// JavaScript Document

$(document).ready(function()
{
  
    $('.product-service-element')
    .cycle({
        fx:     'scrollRight',
        speed:  'fast',
        timeout: 5000,
        pager: '#product_pager',
        activePagerClass: 'product-selected',
        nowrap:  0
    });
  
    var flashvars = {};
                    var params = {
                      menu: "false",
                      wmode: "transparent",
                      allowScriptAccess: "always"
                    };
                    var attributes = {
                      wmode: "transparent"
                    };
                    swfobject.embedSWF("main.swf", "promociones", "553", "244", "10.0.0", "", flashvars, params, attributes,
                    function(){

                                $.ajax({
                type: "GET",
                url: "banners-destacados.xml",
                dataType: "xml",
                success: function(xml) {
                    $(xml).find('ban').each(function(){
                        var id = $(this).attr('id');
                        var img = $(this).find('img').text();
                        var url = $(this).find('url').text();
                        var ventana = $(this).find('ventana').text();
                        $('<div id="'+id+'" class="slide"></div>').html('<a href="'+url+'" target="_'+ventana+'"><img src="'+img+'"/></a>').appendTo('#group1');
                     });
                         $('.promo-pack-element4')
                        .cycle({
                        fx:     'scrollRight',
                        speed:  'fast',
                        timeout: 5000,
                        pager: '#promo_pager4',
                        next: '#promo_next4',
                        prev: '#promo_prev4',
                        activePagerClass: 'promo-selected'
                              });
                }
              
            });
           
                        $.ajax({
                type: "GET",
                url: "banners-postpago.xml",


                dataType: "xml",
                success: function(xml) {
                    $(xml).find('ban').each(function(){
                        var id = $(this).attr('id');
                        var img = $(this).find('img').text();
                        var url = $(this).find('url').text();
                        var ventana = $(this).find('ventana').text();
                        $('<div id="'+id+'" class="slide"></div>').html('<a href="'+url+'" target="_'+ventana+'"><img src="'+img+'"/></a>').appendTo('#group2');
                       });
                        $('.promo-pack-element')

                       .cycle({
                        fx:     'scrollRight',
                        speed:  'fast',
                        timeout: 5000,
                        pager: '#promo_pager',
                        next: '#promo_next',
                        prev: '#promo_prev',
                        activePagerClass: 'promo-selected'
                              });
                }
            });

            $.ajax({
                type: "GET",
                url: "banners-negocios.xml",


                dataType: "xml",
                success: function(xml) {
                    $(xml).find('ban').each(function(){
                        var id = $(this).attr('id');
                        var img = $(this).find('img').text();
                        var url = $(this).find('url').text();
                        var ventana = $(this).find('ventana').text();
                        $('<div id="'+id+'" class="slide"></div>').html('<a href="'+url+'" target="_'+ventana+'"><img src="'+img+'"/></a>').appendTo('#group4');
                    });
                    $('.promo-pack-element3')

                    .cycle({
                        fx:     'scrollRight',
                        speed:  'fast',
                        timeout: 5000,
                        pager: '#promo_pager3',
                        next: '#promo_next3',
                        prev: '#promo_prev3',
                        activePagerClass: 'promo-selected'
                    });
                }
				
			}); 
			
			

            $.ajax({
                type: "GET",
                url: "banners-prepago.xml",


                dataType: "xml",
                success: function(xml) {
                    $(xml).find('ban').each(function(){
                        var id = $(this).attr('id');
                        var img = $(this).find('img').text();
                        var url = $(this).find('url').text();
                        var ventana = $(this).find('ventana').text();
                        $('<div id="'+id+'" class="slide"></div>').html('<a href="'+url+'" target="_'+ventana+'"><img src="'+img+'"/></a>').appendTo('#group3');
                    });
                        $('.promo-pack-element2')

                    .cycle({
                        fx:     'scrollRight',
                        speed:  'fast',
                        timeout: 5000,
						pager: '#promo_pager2',
                        next: '#promo_next2',
                        prev: '#promo_prev2',
                        activePagerClass: 'promo-selected'
                          });
                }
              });
			
			   <!-- -->
				$.ajax({
                type: "GET",
                url: "banners-imovil.xml",
                dataType: "xml",
                success: function(xml) {
                    $(xml).find('ban').each(function(){
                        var id = $(this).attr('id');
                        var img = $(this).find('img').text();
                        var url = $(this).find('url').text();
                        var ventana = $(this).find('ventana').text();
                        $('<div id="'+id+'" class="slide"></div>').html('<a href="'+url+'" target="_'+ventana+'"><img src="'+img+'"/></a>').appendTo('#group5');
                    });
                        $('.promo-pack-element5')

                    .cycle({
                        fx:     'scrollRight',
                        speed:  'fast',
                        timeout: 5000,
						pager: '#promo_pager5',
                        next: '#promo_next5',
                        prev: '#promo_prev5',
                        activePagerClass: 'promo-selected'
					});
				}
              });
				
				$.ajax({
                type: "GET",
                url: "banners-servicios.xml",
                dataType: "xml",
                success: function(xml) {
                    $(xml).find('ban').each(function(){
                        var id = $(this).attr('id');
                        var img = $(this).find('img').text();
                        var url = $(this).find('url').text();
                        var ventana = $(this).find('ventana').text();
                        $('<div id="'+id+'" class="slide"></div>').html('<a href="'+url+'" target="_'+ventana+'"><img src="'+img+'"/></a>').appendTo('#group6');
                    });
                        $('.promo-pack-element6')

                    .cycle({
                        fx:     'scrollRight',
                        speed:  'fast',
                        timeout: 5000,
						pager: '#promo_pager6',
                        next: '#promo_next6',
                        prev: '#promo_prev6',
                        activePagerClass: 'promo-selected'
					});
				}
              });
				<!-- -->
                              }
                                      );

                   
                   
       
                  
                  
                  
  
    $('#mostrar').click(function(e)
        {
                $('#v1').show();
                $('#v3').hide();
                $('#v2').hide();
                $('#v4').hide();
                $('.tabs-box a.tab01').removeClass('tab01').addClass('tab01-on');
                $('.tabs-box a.tab03-on').removeClass('tab03-on').addClass('tab03');
                $('.tabs-box a.tab02-on').removeClass('tab02-on').addClass('tab02');
                $('.tabs-box a.tab04-on').removeClass('tab04-on').addClass('tab04');
                e.preventDefault();

              
        });
  
    $('#mostrar1').click(function(e)
        {
                $('#v1').hide();
                $('#v3').hide();
                $('#v2').show();
                $('#v4').hide();
                $('.tabs-box a.tab01-on').removeClass('tab01-on').addClass('tab01');
                $('.tabs-box a.tab03-on').removeClass('tab03-on').addClass('tab03');
                $('.tabs-box a.tab02').removeClass('tab02').addClass('tab02-on');
                $('.tabs-box a.tab04-on').removeClass('tab04-on').addClass('tab04');
                e.preventDefault();
        });
    $('#mostrar2').click(function(e)
        {
                $('#v1').hide();
                $('#v2').hide();
                $('#v3').show();
                $('#v4').hide();
                $('.tabs-box a.tab01-on').removeClass('tab01-on').addClass('tab01');
                $('.tabs-box a.tab02-on').removeClass('tab02-on').addClass('tab02');
                $('.tabs-box a.tab03').removeClass('tab03').addClass('tab03-on');
                $('.tabs-box a.tab04-on').removeClass('tab04-on').addClass('tab04');
                e.preventDefault();
        });
  
    $('#mostrar3').click(function(e)
        {
                $('#v1').hide();
                $('#v2').hide();
                $('#v3').hide();
                $('#v4').show();
                $('.tabs-box a.tab01-on').removeClass('tab01-on').addClass('tab01');
                $('.tabs-box a.tab02-on').removeClass('tab02-on').addClass('tab02');
                $('.tabs-box a.tab03-on').removeClass('tab03-on').addClass('tab03');
                $('.tabs-box a.tab04').removeClass('tab04').addClass('tab04-on');
                e.preventDefault();
        });
	$('#mostrar4').click(function(e)
        {
                $('#v1').hide();
                $('#v2').hide();
                $('#v3').hide();
                $('#v4').hide();
				$('#v5').show();
				$('#v6').hide();
                $('.tabs-box a.tab01-on').removeClass('tab01-on').addClass('tab01');
                $('.tabs-box a.tab02-on').removeClass('tab02-on').addClass('tab02');
                $('.tabs-box a.tab03-on').removeClass('tab03-on').addClass('tab03');
				$('.tabs-box a.tab04-on').removeClass('tab04-on').addClass('tab04');
				$('.tabs-box a.tab05').removeClass('tab05').addClass('tab05-on');
				$('.tabs-box a.tab06-on').removeClass('tab06-on').addClass('tab06');
                e.preventDefault();
        });
	$('#mostrar5').click(function(e)
        {
                $('#v1').hide();
                $('#v2').hide();
                $('#v3').hide();
                $('#v4').hide();
				$('#v5').hide();
				$('#v6').show();
                $('.tabs-box a.tab01-on').removeClass('tab01-on').addClass('tab01');
                $('.tabs-box a.tab02-on').removeClass('tab02-on').addClass('tab02');
                $('.tabs-box a.tab03-on').removeClass('tab03-on').addClass('tab03');
				$('.tabs-box a.tab04-on').removeClass('tab04-on').addClass('tab04');
				$('.tabs-box a.tab05-on').removeClass('tab05-on').addClass('tab05');
				$('.tabs-box a.tab06').removeClass('tab06').addClass('tab06-on');
                e.preventDefault();
        });
                  

});

google.load("feeds", "1");
 
    function initialize() {
      var feed = new google.feeds.Feed("http://www.conectadospodemosmas.com.pe/feed/");
      feed.load(function(result) {
          if (!result.error) {
            var strHtml = "";
            for (var i = 0; i < 2; i++) {
              var entry = result.feed.entries[i];
              var attributes = ["title", "link", "publishedDate", "contentSnippet"];

              strHtml += "<h3><a href=\"" + entry[attributes[1]] + "\" target=\"_blank\">" + entry[attributes[0]] +"</a></h3>";
              strHtml += "<small>" + entry[attributes[2]] + "</small>";
              strHtml += "<p>" + entry[attributes[3]] + "</p>";
            }
            strHtml += "<a href=\"http://www.conectadospodemosmas.com.pe/\" target=\"_blank\">ver m&aacute;s entradas</a>";
          
            $("#feed").html(strHtml);
          
          }
          else
          {
          }
        });
    }
    google.setOnLoadCallback(initialize);