$(document).ready(function() {


	/* Proceso fabricaci—n */
	/*jQuery('.proceso-item').stop().mouseenter(function animar(){
		jQuery("img",this).animate({
					 	'width': "+=50px",
					 	'height': "+=50px",
					 	'marginTop': "-=25px",
					 	'marginLeft': "-=25px"
					  });
		
	});
	jQuery('.proceso-item').stop().mouseleave(function animar2(){
		jQuery("img",this).animate({
					 	'width': "-=50px",
					 	'height': "-=50px",
					 	'marginTop': "+=25px",
					 	'marginLeft': "+=25px"
					  });
		
	});*/
	
	/* Imprimir pantalla */
	
	jQuery('#btn-print').click(function(){
		window.print();
		return false;
	});

	/* solicitar informacion */

	jQuery('#info-producto').click(function(){
		jQuery('#contenedor-ficha').css('display' , 'block');
		return false;
	});
	jQuery('#cerrar-form').click(function(){
		jQuery('#contenedor-ficha').css('display' , 'none');
		return false;
	});
	
	
	/* overlay formulario solicitar informacion*/
	$('#info-producto').click(function(e) {
        e.preventDefault();
        $("body").append("<div id='overlay'></div>");
        $("#overlay").height($(document).height());
        	 $('#overlay').click(function() {
       			 $('#overlay').remove();
        			jQuery('#contenedor-ficha').css('display' , 'none');
    			});
    });
    
    $('#cerrar-form').click(function() {
            $('#overlay').remove();
    });
    $('#overlay').click(function() {
        $('#overlay').remove();
        jQuery('#contenedor-ficha').css('display' , 'none');
    });

	
	
	
	
	/*Typsy*/
	$('#hS-button').tipsy({gravity: 'nw'});
	$('#btn-print').tipsy({gravity: 'e'});

	/*Cycle*/ 
    $('#cicle').cycle({
    		fx:      'scrollHorz', 
 				speed:  'fast',
				timeout: 0,
        prev:   '#slide-left',
        next:   '#slide-right'
    });
    
    
		$('#cicle2').cycle({
				fx:      'scrollHorz', 
 				speed:  'slow',
				timeout: 10000,
        pager:      '#nav',
        pagerEvent: 'click',
				pauseOnPagerHover: true

    });


	/*Volver Arriba*/
	if($(document).height() > 2000){
	jQuery("#Go-Top").css("display", "block")
	}
	//alert($(document).height());
	function goToByScroll(posicion){
		$('html,body').stop().animate({scrollTop: $(posicion).offset().top},1000);
	}


	jQuery('#Go-Top').stop().click(function(){		
			goToByScroll('#top');
			return false;				
		});



	/* Cerrar Alerta */
	
	jQuery('#cerrar-alerta').click(function(){
		jQuery('.alerta-envio').css('display' , 'none');
	});


	/* jQuery("#wind-energy p").css("opacity", 0.0) */
	jQuery("#industrial p").css("opacity", 0.0)
	jQuery("#wind-energy p").css("opacity", 0.0)
	jQuery("#industrial p").css("display", 'none')
	jQuery("#wind-energy p").css("display", 'none')
	
	


	jQuery('.boton-tabla-1').click(function(){
		jQuery('.boton-tabla-0').removeClass('activo');
		jQuery('.boton-tabla-1').addClass('activo');
		jQuery(".tabla-0").css("display", "none")
		jQuery(".tabla-1").css("display", "block")	
	});
	
	jQuery('.boton-tabla-0').click(function(){
		jQuery('.boton-tabla-1').removeClass('activo');
		jQuery('.boton-tabla-0').addClass('activo');
		jQuery(".tabla-1").css("display", "none")
		jQuery(".tabla-0").css("display", "block")	
	});



jQuery('#wind-energy').click(function(){
location.href = $("a",this).attr("href");
});
jQuery('#industrial').click(function(){
location.href = $("a",this).attr("href");
});
jQuery('#sun-energy').click(function(){
location.href = $("a",this).attr("href");
});

jQuery('#wind-energy').hover(function(){
		jQuery('#wind-energy').stop().animate({
					 	'width': "440px"
					  },300,function(){
					  	jQuery('#wind-energy p').stop().css('display' , 'block');
					  	jQuery('#wind-energy p').stop().fadeTo(400, 0.9);
					  	});		
		jQuery('#industrial').stop().animate({
					 	'width': "240px"
					  },300);	
		jQuery('#industrial p').stop().fadeTo(100, 0.0);
		jQuery('#industrial p').stop().css('display' , 'none');
		
		jQuery('#sun-energy').stop().animate({
					 	'width': "240px"
					  },300);		
		jQuery('#sun-energy p').stop().fadeTo(100, 0.0);
		jQuery('#sun-energy p').stop().css('display' , 'none');
		
		jQuery('#banner-imagen img').stop().fadeTo(400, 0.0);
		jQuery('#img-wind').stop().fadeTo(400, 1.0);
					
	});
		
jQuery('#industrial').hover(function(){
		jQuery('#industrial').stop().animate({
					 	'width': "440px"
					  },300,function(){
					    jQuery('#industrial p').stop().css('display' , 'block');
					  	jQuery('#industrial p').stop().fadeTo(400, 0.9);
					  	});		
		jQuery('#sun-energy').stop().animate({
					 	'width': "240px"
					  },300);		
		jQuery('#sun-energy p').stop().fadeTo(100, 0.0);
		jQuery('#sun-energy p').stop().css('display' , 'none');
		
		jQuery('#wind-energy').stop().animate({
					 	'width': "240px"
					  },300);		
		jQuery('#wind-energy p').stop().fadeTo(100, 0.0);
		jQuery('#wind-energy p').stop().css('display' , 'none');		
		
		jQuery('#banner-imagen img').stop().fadeTo(400, 0.0);
		jQuery('#img-industrial').stop().fadeTo(400, 1.0);	
	});
			
jQuery('#sun-energy').hover(function(){
		jQuery('#sun-energy').stop().animate({
					 	'width': "440px"
					  },300,function(){
					    jQuery('#sun-energy p').stop().css('display' , 'block');
					  	jQuery('#sun-energy p').stop().fadeTo(400, 0.9);
					  	});				  	
		jQuery('#industrial').stop().animate({
					 	'width': "240px"
					  },300);		
		jQuery('#industrial p').stop().fadeTo(100, 0.0);
		jQuery('#industrial p').stop().css('display' , 'none');
		
		jQuery('#wind-energy').stop().animate({
					 	'width': "240px"
					  },300);		
		jQuery('#wind-energy p').stop().fadeTo(100, 0.0);
		jQuery('#wind-energy p').stop().css('display' , 'none');		
		
		jQuery('#banner-imagen img').stop().fadeTo(400, 0.0);
		jQuery('#img-sun').stop().fadeTo(400, 1.0);	
	});

	/*PARA EL MENU*/
	$("#menu-niveles li").mouseenter(function () {
	$(this).find('ul:first').css("display", "block");
	jQuery(this).addClass('activo2');
	});
	
	$("#menu-niveles li").mouseleave(function () {
	$(this).find('ul:first').css("display", "none");
	jQuery(this).removeClass('activo2');
	});
	
	$("#menu-niveles li ul li").mouseenter(function () {
	jQuery(this).find('a:first').addClass('activo3');
	});
	
	$("#menu-niveles li ul li").mouseleave(function () {
	jQuery(this).find('a:first').addClass('activo3');
	});
	
	
	/*Menu idiomas*/
	
	$("#menu-idiomas li").mouseenter(function () {
	$(this).find('ul:first').css("display", "block");
	jQuery("#idioma-activo").addClass('activo2');
	});
	
	$("#menu-idiomas li").mouseleave(function () {
	$(this).find('ul:first').css("display", "none");
	jQuery("#idioma-activo").removeClass('activo2');
	});


	/*Descargas*/
	
	$(".descargas").click(function () {	
	$('.docs-content').css("display", "none");
	$(this).parent().parent().find('.docs-content').toggle();
	
	return false;
	});
	
	$('body').click(function () {	
	$('.docs-content').css("display", "none");
	//return false;
	});

	/*CONTACTO*/
	$("#contactanos").mouseenter(function () {
	$("#contacto-form").slideToggle(100);	
	return false;
	});
	
	$("#contactanos").mouseleave(function () {
	$("#contacto-form").css("display", "none");	
	return false;
	});
	
	

	
	
	$(".map-point").mouseenter(function () {
	$(this).find('.tip').css("display", "block");
	$(this).find('.img-tip').css("display", "block");
	return false;
	});
	
	$(".map-point").mouseleave(function () {
	$(this).find('.tip').css("display", "none");
	$(this).find('.img-tip').css("display", "none");
	return false;
	});
	

	
	/*Filtrar mapa*/
	$("#filtro-wind").click(function () {
	$(".map-wind").toggle();
	return false;
	});
	$("#filtro-industrial").click(function () {
	$(".map-industrial").toggle();
	return false;
	});
	$("#filtro-sun").click(function () {
	$(".map-sun").toggle();
	return false;
	});
	
	
	
	
	// FORMULARIOS
	
	$('input:not(:checkbox)').focus(function() {
		$(this).siblings('span').fadeTo(200,0.2);
		$(this).siblings('span').css("color","#ffffff");
		$(this).closest('.inputBg, .buscador').addClass('active');
	});
	$('input:not(:checkbox)').blur(function() {
		if ($(this).val() == '') {
			$(this).siblings('span').fadeTo(200,1);
			$(this).siblings('span').css("color","#888888");
			$(this).closest('.inputBg, .buscador').removeClass('active');
		}
	});
	
	$('textarea').focus(function() {
		$(this).siblings('span').fadeTo(200,0.2);
		$(this).siblings('span').css("color","#ffffff");
		$(this).closest('.inputBg').addClass('active');
	});
	$('textarea').blur(function() {
		if ($(this).val() == '') {
			$(this).siblings('span').fadeTo(200,1);
			$(this).siblings('span').css("color","#888888");
			$(this).closest('.inputBg').removeClass('active');
		}
	});


	$('#hS-button').click(function(e) {
		e.stopPropagation();
		if ($(this).hasClass('close')) {
			$('.buscador').animate({ width: '225px' }, 300);
			$(this).removeClass('close').addClass('open').siblings('.buscaInput').stop().animate({ right: 0 }, 300, function(){
				$('input:first',this).focus();
			});
			return false;
		}
	});
	
	$('.buscaInput').click(function(e) {
		e.stopPropagation();
	});
	
	$('body').click(function() {
		$('.buscador').animate({ width: '25px' }, 300);
		$('#hS-button').removeClass('open').addClass('close').siblings('.buscaInput').stop().animate({ right: -180 }, 300);
	});

	
	

	
	
				
});

