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


/* Eventos de la pagina de inicio */
function Eventos_inicio()
{
	$('#botonera > ul').tabs();
	
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	// Chequear_Requisitos
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	function Chequear_Requisitos()
	{
		// PARA EL CASO DE INTERNET EXPLORER 
		if ( $.browser.msie)
		{	
			if ( $.browser.version> 5)
			{
				// bien, todo se ve
			}
			else
			{
				Mostrar("requisitos");
				return; 
			};
		}
		// PARA OTROS NAVEGADOR O CASOS
		Mostrar("empresa");
	}
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	// funcion que sirve para mostrar la pagina
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	function Mostrar(pagina)
	{
		$.ajax({
				url: pagina + ".inc",
				cache: false,
				success: function(html)
				{
					$("#inclusion").hide();
					$("#inclusion").empty();																						
					$("#inclusion").append(html);											
					$("#inclusion").show(1500);
					if (pagina=="empresa")
					{
						// Carrusel
						Carrusel();
					}
					
					// servicios
					if (pagina=="servicios")
					{
						Refrescar_Servicios();
					}
					// partners
					if (pagina=="partners")
					{
						Partners();
					}
					// contacto
					if (pagina=="contacto")
					{
						Calidad();
					}
					
				
					
					// SIEMPRE REFRESCAR EL LOGO
					Logotipo();
				}
			});
	}
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	
	// carga inicial chequear requisitos
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	Chequear_Requisitos();


	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	
	// eventos
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	$("#empresa_link").click(
				function()       
				{
					Mostrar("empresa");
				}				
			)							

	$("#servicios_link").click(
				function()       
				{
					Mostrar("servicios");
				}				
			)
				
	$("#partners_link").click(
				function()       
				{
					Mostrar("partners");
				}				
			)
				
	$("#contacto_link").click(
				function()       
				{
					Mostrar("contacto");
				}				
			)
				
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
}

/* 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 la pestana de Partners */
function Partners()
{
	$("a").click(
		function()
		{
			this.target ="_blank";
		}
	)
}
/* Para la pestana contacto */
function Conctacto()
{
	$('#carrusel').cycle({ fx: 'fade', speed: '1000'}); 
}

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