$(document).ready(function() {


		$('#flotante').addFloating(  
            {  
                targetRight: 0,  
                targetTop: 170,  
                snap: true  
            });  

	
	$('.item01').hover(
		function(){
			$(this).find('img').attr('src', function(){return 'images/items-01-over.jpg'});
		},
		function(){
			$(this).find('img').attr('src',function(){return 'images/items-01.jpg'});
		}
	);
	$('.item02').hover(
		function(){
			$(this).find('img').attr('src', function(){return 'images/items-02-over.jpg'});
		},
		function(){
			$(this).find('img').attr('src',function(){return 'images/items-02.jpg'});
		}
	);
	$('.item03').hover(
		function(){
			$(this).find('img').attr('src', function(){return 'images/items-03-over.jpg'});
		},
		function(){
			$(this).find('img').attr('src',function(){return 'images/items-03.jpg'});
		}
	);
	$('.item04').hover(
		function(){
			$(this).find('img').attr('src', function(){return 'images/items-04-over.jpg'});
		},
		function(){
			$(this).find('img').attr('src',function(){return 'images/items-04.jpg'});
		}
	);
	$('.menu a').hover(
		function(){
			$(this).stop().animate({backgroundPosition:'0px -30px'},200);
		},
		function(){
			$(this).stop().animate({backgroundPosition:'0px 0px'},200);
		}
	);
	
	
	$('.left ul li a').hover(function(){
		$(this).css('background-image','url(images/marca.jpg)');
		$(this).css('color','white');
		$(this).stop().animate({backgroundPosition:'5px 0px'});
		
	},function(){
		$(this).css('background-image','none');
		$(this).css('color','#004C99');
		$(this).stop().animate({backgroundPosition:'0px 0px'});
		
	});
	$('.left ul li a').click(function(){
		$('.left ul li a').removeClass('marca-press');
		$(this).addClass('marca-press');
		
	});
	
	$('.left ul.verde li a').hover(function(){
		$(this).css('background-image','url(images/marca_verde.jpg)');
		$(this).css('color','white');
		$(this).stop().animate({backgroundPosition:'5px 0px'});
		
	},function(){
		$(this).css('background-image','none');
		$(this).css('color','#004C99');
		$(this).stop().animate({backgroundPosition:'0px 0px'});
		
	});
	$('.left ul.verde li a').click(function(){
		$('.left ul.verde li a').removeClass('marca-verde-press');
		$(this).addClass('marca-verde-press');
		
	});
	
	ocultarPreguntas();
	
	$('.preg-ocultables div h3').click(function()
	{
		ocultarPreguntas();
		$(this).parent().find('p').slideDown(200);
		//alert("ASD");
	});
	
	$('#box1 img').attr('src','images/ciencia_btn_01-over.jpg');
	
	
	$('.sistema-btns .btn1').addClass('press');
	$('#info-btn1').slideDown(300);
	$('.sistema-btns a').click(function(){
		var cual = $(this).attr('class');
		//ocultarTextosSistema();
		$(this).addClass('press');
		
		if($('#info-'+cual).css('display')==='none'){
			ocultarTextosSistema();
			$('#info-'+cual).slideDown(300);
		}else{
		}
	});
	
	
	$('.preguntas a').hover(function(){
		$(this).stop().animate({marginTop:'-5px',height:'38px'},200);
		
	},function(){
		
		$(this).stop().animate({marginTop:'0px',height:'33px'},200);
		
	});
});
function ocultarTextosSistema(){
	$('.cont-sistema-box').css('display','none');
	$('.sistema-btns a').removeClass('press');
}
function cargarSeccion(id){
	ocultarSecciones();
	$('#'+id).fadeIn(400);
	if(id=='frutilla0' || id=='multifruta0' || id=='frutos-del-bosque0')
	{
		$('#'+id+'-click').addClass('marca-verde-press');
	}else{
		$('#'+id+'-click').addClass('marca-press');
	}
}

function ocultarSecciones(){
$('.ocultables').hide(1);
}

function cargarVideo(id,wi,he){
	$('#bg').slideDown(200);
	$('#video-home').slideDown(300);
	$('#video-home').append('<div id="flowplayer"></div>');
	var ro = new SWFObject("reproductor.swf", "flowplayer", wi, he, "8", "#fff");
	ro.addParam("scale", "noscale");
	ro.addParam("wmode", "transparent");
	ro.addParam("flashVars", 'videoURL=video/'+id+'.flv');
	ro.write("flowplayer");
	
}
/*function cargarVideo(id){
	$('#bg').slideDown(200);
		$('#video-home').css('width','680px');
	$('#video-home').css('left','30%');
	$('#video-home').slideDown(300);
	$('#video-home').append('<iframe width="640" height="360" src="http://www.youtube.com/embed/'+id+'" frameborder="0" allowfullscreen></iframe>');
}*/
function cerrarVideo(){
	$('#bg').css('display','none');
	$('#video-home').css('display','none');
	$('#video-home #flowplayer').remove();
	$('#video-home').find('iframe').remove();
}

function ocultarPreguntas(){
$('#preguntas-frecuentes .preguntas .cont .preg-ocultables p').css('display','none');
}

function tabPreguntas(id){
	desmarcarTabs();
	
	if(id==1){
		$('#preg-producto').fadeIn(300);
		$('.preguntas a.producto').addClass('ocultables-press');
		$('.preguntas .img-preg').fadeIn(300);
		$('.preguntas .img-preg img').attr('src','images/preg_clip_producto.png');
		}else if(id==2){
			$('#preg-zinc').fadeIn(300);
			$('.preguntas a.zinc').addClass('ocultables-press');
			$('.preguntas .img-preg').fadeIn(300);
			$('.preguntas .img-preg img').attr('src','images/preg_clip_zinc.png');
			}else if(id==3){
				$('#preg-fermentos').fadeIn(300);
				$('.preguntas a.fermentos').addClass('ocultables-press');
				$('.preguntas .img-preg').fadeIn(300);
				$('.preguntas .img-preg img').attr('src','images/preg_clip_fermentos.png');
				}else{
					$('#preg-consumo').fadeIn(300);
					$('.preguntas a.consumo').addClass('ocultables-press');
					$('.preguntas .img-preg').fadeIn(300);
					$('.preguntas .img-preg img').attr('src','images/preg_clip_consumo.png');
					}
}

function desmarcarTabs(){
	$('.preg-ocultables').hide(1);
	$('.preguntas .img-preg').fadeOut(10);
	$('.preguntas a').removeClass('ocultables-press');
}


function cambiarBox(id){
//$('#box-mask div').animate({top:'-200px'},300);
if(id==1){
		$('#box1 img').attr('src','images/ciencia_btn_01-over.jpg');
		$('#box2 img').attr('src','images/ciencia_btn_02.jpg');
		$('#box3 img').attr('src','images/ciencia_btn_03.jpg');
		$('#box4 img').attr('src','images/ciencia_btn_04.jpg');
		}else if(id==2){
			$('#box1 img').attr('src','images/ciencia_btn_01.jpg');
			$('#box2 img').attr('src','images/ciencia_btn_02-over.jpg');
			$('#box3 img').attr('src','images/ciencia_btn_03.jpg');
			$('#box4 img').attr('src','images/ciencia_btn_04.jpg');
			}else if(id==3){
				$('#box1 img').attr('src','images/ciencia_btn_01.jpg');
				$('#box2 img').attr('src','images/ciencia_btn_02.jpg');
				$('#box3 img').attr('src','images/ciencia_btn_03-over.jpg');
				$('#box4 img').attr('src','images/ciencia_btn_04.jpg');
				}else{
					$('#box1 img').attr('src','images/ciencia_btn_01.jpg');
					$('#box2 img').attr('src','images/ciencia_btn_02.jpg');
					$('#box3 img').attr('src','images/ciencia_btn_03.jpg');
					$('#box4 img').attr('src','images/ciencia_btn_04-over.jpg');
					}
$('#box-mask div').css('display','none');
$('#box-mask #box-'+id).fadeIn(300);
}

