﻿/* Iniciar */	
$(function() 
{
	Eventos_inicio(); 
});	


/* Eventos de la pagina de inicio */
function Eventos_inicio()
{
	$('#botonera').tabs();
	
	// funcion que sirve para mostrar la pagina
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	function Mostrar(pagina)
	{
		$.ajax({
				url: "inc/" + pagina + "-" + lenguaje + ".inc",
				cache: false,
				success: function(html)
				{
					$("#inclusion").hide();
					$("#inclusion").empty();																						
					$("#inclusion").append(html);											
					$("#inclusion").fadeIn(750);
					//$("#inclusion").slideDown(1000);
					
					if (pagina=="empresa")
					{
						// Carrusel
						Carrusel();
						//document.title='www.multiplanos.com';
					}
					
					// productos
					if (pagina=="productos")
					{
						Refrescar_Servicios();
					}
					// partners
					if (pagina=="partners")
					{
						//Partners();
					}
					// contacto
					if (pagina=="contacto")
					{
						Calidad();
					}
					
				
					
					// SIEMPRE REFRESCAR EL LOGO
					Logotipo();
				}
			});
	}
	
	
	function Invocar()
	{
		$.ajax({
				url: "count/counter.php",
				cache: false,
				success: function(html)
				{				
					// recuperar datos
				}
			});
	}
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	
	// carga inicial
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	Mostrar("empresa");
	//Invocar();
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	
	// eventos
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	$("#empresa_link").click(
				function()       
				{
					Mostrar("empresa");
				}				
			)							

	$("#productos_link").click(
				function()       
				{
					Mostrar("productos");
				}				
			)
				
	$("#portadas_link").click(
				function()       
				{
					Mostrar("portadas");
				}				
			)
			
	$("#callejero_link").click(
				function()       
				{
					Mostrar("callejero");
				}				
			)
			
	$("#enlaces_link").click(
				function()       
				{
					Mostrar("enlaces");
				}				
			)
			
	$("#contacto_link").click(
				function()       
				{
					Mostrar("contacto");
				}				
			)
						
			
	// spanish		
	$("#img_es").click(
				function()
				{
					lenguaje="es";
					Cambiar_Idioma();
					// refrescar la pagina 
					Mostrar("empresa");
				}
			)
			
	// english
	$("#img_en").click(
				function()
				{
					lenguaje="en";	
					Cambiar_Idioma();
					// refrescar la pagina 
					Mostrar("empresa");
				}
			)	
	
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
}



/* Carrusel */
function Carrusel()
{
	$('#carrusel').cycle({ 
		fx:      'custom', 
		cssBefore: {  
			left: 115,  
			top:  115,  
			width: 0,  
			height: 0,  
			opacity: 1, 
			zIndex: 1 
		}, 
		animOut: {  
			opacity: 0  
		}, 
		animIn: {  
			left: 0,  
			top: 0,  
			width: 330,  
			height: 225  
		}, 
		cssAfter: {  
			zIndex: 0 
		}, 
		delay: -3000 
	});
}



/* Para los iconos de calidad */
function Calidad()
{
	$('#carrusel').cycle({ fx: 'fade', speed: '1000'}); 
}

/* Para el logotipo */
function Logotipo()
{
	$('#div_logotipo').cycle({ fx: 'fade', speed: '1000'}); 
}
	
