$().ready(function(){
  var paginaActual = $("div#Contenido").attr("rel")
      if(paginaActual){
        $("ul#Menu li.main_li").each(function(){
          if($(this).text() == paginaActual){
            $(this).attr("class","active")
          }
        })

      } else {
      $("ul#Menu li.main_li:eq(0)").attr("class","active")
      }
     
 })

$(window).load(function(){

  var speed = 5000;
  var run = setInterval('rotate()', speed);  
  
  var item_height = $('#slides li').outerHeight(); 
  var top_value = item_height * (-1); 
        
   $('#slides li:first').before($('#slides li:last'));
  
  $('#slides ul').css({'top' : top_value});


 
   
  $('#next').click(function() {
    
    var left_indent = parseInt($('#slides ul').css('top')) - item_height;
    
    $('#slides ul:not(:animated)').animate({'top' : left_indent}, {duration:1000, easing:"easeInSine", complete:function(){
    
    
     $('#slides li:last').after($('#slides li:first'));                   
      
      $('#slides ul').css({'top' : top_value});
    
    
    
    }}
  );
            
       
             
    return false;
    
  });        
  $('#slides').hover(
    
    function() {
      clearInterval(run);
    }, 
    function() {
      run = setInterval('rotate()', speed);  
    }
  ); 
        
});
function rotate() {
  $('#next').click();
}

$(document).ready(function() {
  
  var contadorLi = 0;
    var colores;
    var array_colores = new Array("#6CCFF6", "#128CB3", "#C7EAFD", "#76712D")
  
    $('#main_banner div.images ul').cycle({
    fx: 'scrollLeft' ,
    speed:    1500, 
    timeout:  7000 ,
    easing:"easeOutSine",
    pager:"#main_banner .list_item ul"
  });
  
     
  //Botones
   $("#main_banner .list_item ul li").each(function () {
        contadorLi++;
        colores = array_colores[contadorLi];

        if (contadorLi == array_colores.length) {
            contadorLi = 0
        }

        $(this).find("a").css("background", colores)
    })
  
  
});

