// JavaScript Document
$(function(){
/*
            $('#slide_img ul li a img').show();
			$('#slide_img ul').anythingSlider({
				autoPlay       : true,
				startText           : '',
				stopText            : '',
				easing              : 'swing'
			});
			
*/
			
				$('#promociones_wrapper ul').carouFredSel({
					scroll: 1,
					pagination: ".promociones_form_pag",
					auto: true
				});				
				$('#novedades ul').carouFredSel({
					scroll: 2,
					pagination: ".novedades_pag",
					auto: false
				});	
				$('#promociones ul').carouFredSel({
					scroll: 2,
					pagination: ".promociones_pag",
					auto: false
				});					
		$("#tab_pestana li a:first").addClass('current');	
		$(".tabs:first").fadeIn();
				
	$("#tab_pestana li a").click(function(){
		$("#tab_pestana li a").removeClass('current');	
		$(this).addClass('current');
		$(".tabs").hide();
		var id = $(this).attr('id');
		$("#contenedor_tab #tab_"+id).fadeIn();
	});
				
					
	$("#icon_menu ul li a img").hover(function(){
	
		$(this).animate({marginTop: '-5'}, 200);
		var sombra = $(this).parent().parent();
		$(sombra).find('span').animate({opacity: 0.4}, 200);
	}, function(){

  		$(this).animate({marginTop: '0'});
		var sombra = $(this).parent().parent();
		$(sombra).find('span').animate({opacity: 1.0}, 200);  
	});

	$("#menu-logos-slide ul li a:last").css({border: '0px'});

	$("#menu-logos-slide .menuprincipal li .menu").hover(function() {
		$(this).animate({ backgroundColor: '#CCCCCC' }, 200);
	
	}, function() {
		$(this).animate({ backgroundColor: '#fff' }, 'fast');
	
	});

    $("#menu-logos-slide .menuprincipal li").hover(function(){
		var id = $("a",this).attr('id');
	$("#menu-logos-slide ul#sub"+id).find('.sub').slideDown();
	},function(){
		var id = $("a",this).attr('id');
		$("#menu-logos-slide ul#sub"+id).find('.sub').slideUp();
	});
	//$("#contenido img").rotate({angle:-2});
	/*
      $("#contenido img").each(function (i) {
         alert(i);
      }); */
	
			$("#contenido ul.galerias li a").fancybox({
				'overlayShow'	: true,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic'
			});	
			$("#listado a").fancybox({
				'overlayShow'	: true,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic'
			});					
	var rotation = function (){
   		$("#iphone").rotate({
     	 angle:0, 
     	 animateTo:360, 
    	 callback: rotation
   		}, 2000);
	}
	rotation();	
	
});
