// JavaScript Document

// Top Link Plugin.
jQuery.fn.returnHome = function(settings) {
	settings = jQuery.extend({
		min: 1,
		fadeSpeed: 200
	}, settings);
	return this.each(function() {
		//listen for scroll
		var el = $(this);
		el.hide(); //in case the user forgot
		$(window).scroll(function() {
			if($(window).scrollTop() >= settings.min)
			{
				el.fadeIn(settings.fadeSpeed);
			}
			else
			{
				el.fadeOut(settings.fadeSpeed);
			}
		});
	});
};	


$(document).ready(function(){

		seccion("expo_intro");
		
		/* cargamos nuestro video */
		$("#video").flash({
			swf: 'swf/estofue.swf',
			width: 350,
			height: 220,
			params: {wmode: 'transparent', menu : "false"}
		});		
				
		/* Agregamos el div con el return al inicio */		  
		//$("#contenido_body").before('<div class="go_to_home"><a href="index.php"><img src="imagenes/go-to-menu.png" alt="Regresar al menu principal" /></a></div>');						  
		
		//$(".go_to_home").fadeTo("fast", 0.40);
		
		// Set the link
		//$('.go_to_home').returnHome({min: 90, fadeSpeed: 500});
		
		/*$(".go_to_home").hover(function () {
			$(this).fadeTo("fast", 1);
		  }, function () {
			$(this).fadeTo("fast", 0.40);

		 });*/
		
		/* activamos el lightbox para los logos */
		$("a[rel=fancybox]").fancybox({
			'titleShow'		: false,
			'transitionIn'	: 'elastic',
			'transitionOut'	: 'elastic'
		});
		
		/* activamos el lightbox para el video-manual */
		$("a[rel=thickboxVideo]").fancybox({
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'titlePosition' 	: 'over',
			'titleShow'			: false,
			'width'				: 500,
			'height'			: 302,
			'autoScale'			: false,
			'type'				: 'iframe'
		});
		
		
		/* activamos el lightbox para el contacto */		
		$("a[rel=fancyboxContacto]").fancybox({
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'titlePosition' 	: 'over',
			'titleShow'			: false,
			'width'				: 600,
			'height'			: 510,
			'autoScale'			: false,
			'type'				: 'iframe'
		});
		
		/* activamos el lightbox para el contacto */		
		$("a[rel=fancyboxStands]").fancybox({
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'titlePosition' 	: 'over',
			'titleShow'			: false,
			'width'				: 600,
			'height'			: 510,
			'autoScale'			: false,
			'type'				: 'iframe'
		});		
		
		/* activamos el lightbox para los horarios */		
		$("a[rel=fancyboxHorarios]").fancybox({
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'titlePosition' 	: 'over',
			'titleShow'			: false,
			'width'				: 600,
			'height'			: 290,
			'autoScale'			: false,
			'type'				: 'iframe'
		});
		
		/* activamos el lightbox para los ganadores */		
		$("a[rel=fancyboxGanadores]").fancybox({
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'titlePosition' 	: 'over',
			'titleShow'			: false,
			'width'				: 520,
			'height'			: 520,
			'autoScale'			: false,
			'type'				: 'iframe'
		});
		

});

/* funcion para el menu */
function seccion(div){

		$(".texto").each(function() {
			var id = $(this).attr("id");
			$("	#" + id).css("display", "none");			
		});	
		
		$("#"+ div).animate({"opacity":"hide"},500);
		$("#" + div).slideToggle(750,function(){
			$(this).animate({"opacity":"show"},1000);
			
			/* si la capa llamada es la del contacto */
			if(div == 'expo_contacto'){
			
				$('#map_google').googleMaps({
					depth: 17,
					geocode: "Morelos 1708, Colonia Moderna, Guadalajara, Jalisco",
					scroll: false
				});
			}
			
		});
};


