// JavaScript Document
$(document).ready(function(){
	$("#texto_tours_absolute").hide();
	$("#content").hide();
	$(".img_tours a").each(function(i){
		$(this).click(function(){
			$("#texto_tours_absolute").show("slow");
			$("#content").hide();
			var n = Math.random();
			$("#content").ajaxStart(function(){
		$("#content").html('<br><br><br><center><br><br><span style="color:#B13838"> Cargando Resultados...</span> </center>');		
		}).fadeIn('slow').load("load.php?link="+i+"&n="+n).show("slow");
			   
		});
	});
	$("#close").click(function(){
		$("#texto_tours_absolute").hide("slow");					   
	});
	
	
	$(".carros a").each(function(i){
		 var x = Math.random();
		 if(i==0){
		 	$("#flotas").load("load_buss.php?x="+x+"&flota=8").show("slow");
		 }
		$(this).click(function(){
			$("#flotas").hide();
			var n = Math.random();
			$("#flotas").ajaxStart(function(){
		$("#flotas").html('<br><br><br><center><img src="aplication/webroot/imgs/ajax-loader.gif"><br><br><span style="color:#B13838"> Cargando Resultados...</span> </center>');		
		}).fadeIn('slow').load("load_buss.php?flota="+i+"&n="+n).show("slow");
		});
	});
	
	var clicked = 1;
	var valeft = 0;
	
	$("#left").click(function(){
		if(clicked <= 2){
			if(clicked==2){
				valeft += 2;	
			}
			valeft += 127;
			$(".jcarrucel").animate({left:-valeft},1500);
			clicked++;
		}
	});
	
	$("#right").click(function(){
		var xy;
		if(clicked==3){ xy = "-127"; valeft=127;}
		if(clicked==2){ xy = "2"; valeft=0;}
		clicked--; 
		$(".jcarrucel").animate({left: xy},1500);
	});
	
});

/*function recuperar_acceso(){
		location.replace('index.php?action=recuperar');
}
function eliminar_sesion(){
	location.replace('salir.php');
}

function mantenimiento_categoria(url,opcion,id1,id){
	
	if(opcion!="deletep" && opcion!="deletec"){ 
			location.replace(url+'?id='+id+'&action='+opcion+'&id1='+id1);
	}else if(opcion=="delete"){
		if(!confirm("Esta Seguro que desea Eliminar el Registro")){
			return false;	
		}else{
			location.replace(url+'?id='+id+'&action='+opcion+'&id1='+id1);			
		}		
	}
}*/

function validar(){
	if(document.f1.nombre.value==""){
		alert("ERROR: Por favor ingrese su Nombre");
		document.f1.nombre.focus();
		return false;
	}else if(document.f1.telefono.value==""){
		alert("ERROR: Por favor ingrese sus telefono");
		document.f1.apellidos.focus();
		return false;
	}else if(document.f1.correo.value==""){
		alert("ERROR: Por favor ingrese su Email");
		document.f1.email.focus();
		return false;
	}else{
		document.f1.action='enviar.php';
		document.f1.submit();
	}
	
	}
	
	

/*
function validas(){
	if(document.f1.nombre.value==""){
		alert("ERROR: Por favor ingrese su Nombre");
		document.f1.nombre.focus();
		return false;
	}else if(document.f1.apellidos.value==""){
		alert("ERROR: Por favor ingrese sus Apellidos");
		document.f1.apellidos.focus();
		return false;
	}else if(document.f1.telefonos.value==""){
		alert("ERROR: Por favor ingrese sus telefonos");
		document.f1.telefonos.focus();
		return false;
	}else if(document.f1.deposito.value==""){
		alert("ERROR: Por favor ingrese sus deposito");
		document.f1.deposito.focus();
		return false;
	}else if(document.f1.efectivo.value==""){
		alert("ERROR: Por favor ingrese sus efectivo");
		document.f1.efectivo.focus();
		return false;
	}else if(document.f1.efectivo.value==""){
		alert("ERROR: Por favor ingrese sus efectivo");
		document.f1.efectivo.focus();
		return false;
	}else if(document.f1.descuento.value==""){
		alert("ERROR: Por favor ingrese su descuento");
		document.f1.descuento.focus();
		return false;
	}else{
		return true;	
	}
	
	}


*/


/*function mantenimiento(url,id,opcion){
	if(opcion!="delete"){ 
		location.replace(url+'?id='+id+'&action='+opcion);
	}else if(opcion=="delete"){
		if(!confirm("Esta Seguro que desea Eliminar el Registro")){
			return false;	
		}else{
			location.replace(url+'?id='+id+'&action='+opcion);			
		}		
	}
}*/

/*function validar_delete(url){	
	if(!confirm("Esta Seguro que desea Eliminar el Registro")){
		return false;	
	}
}*/
/*function validar_categorias(opcion, id1, id){
	var name=document.f1.elements['nombre[]']
	for(i=0; i < name.length; i++){
		if(name[i].value==""){
			alert(" ERROR: Por favor ingrese el nombre de Categoria ");
			name[i].focus();
			return false
		}
	}
	
	if(document.f1.imagen.value=="" && opcion == "addc"){
		alert(" ERROR: Por favor ingrese la imagen de categoria ");
		document.f1.imagen.focus();
		return false	
	}else{
		document.f1.action='productos.php?action='+opcion+'&id1='+id1+'&id='+id
		document.f1.submit();
	}
}

function validar_productos(opcion, id1, id){
	
	var name=document.f1.elements['nombre[]']	
	var desc=document.f1.elements['descripcion[]']	
	
	if(name.value==""){
		alert(" ERROR: Por favor ingrese el nombre del producto ");
		name.focus();
		return false
	}else if(desc.value==""){
		alert(" ERROR: Por favor ingrese la descripcion del producto ");
		desc.focus();
		return false
	}else if(document.f1.imagen.value=="" && opcion == "addp"){
		alert(" ERROR: Por favor ingrese la imagen del producto ");
		document.f1.imagen.focus();
		return false	
	
	}else{
		document.f1.action='productos.php?action='+opcion+'&id1='+id1+'&id='+id
		document.f1.submit();
	}
}
*/
/*function validar_delete(){
	if(!confirm("Esta Seguro que desea Eliminar el Registro")){
		return false;	
	}else{
		return true;	
	}	
}

function pasa_precio(Obj, receptor, oferta){
	if(Obj.value!=""){
		var indice= Obj.selectedIndex;
		var texto=Obj.options[indice].text;
		var precio=texto.split("€");
		receptor.value=precio[1];
		oferta.readOnly="";
		oferta.focus();
	}else{
		receptor.value="";
		oferta.readOnly="true";
	}
}
	
function compara_monto(precio, oferta){
	if(precio.value!=""){
		if(parseFloat(oferta.value)>=parseFloat(precio.value)){
			alert("El precio de la oferta tiene que ser menor al precio del producto: "+precio.value )		
		}	
	}		
}	
function mantenimiento_det(url, id1){	
			location.replace(url+'?id1='+id1);			
}

function buscar(url,texto){
	document.f2.action=url+'&q='+ texto.value;
	document.f2.submit();
}*/

/*function checkTheKey(keyCode){
	if(event.keyCode==13){	
		valida();
		return true ;
	}
	return false ;
}
function validnum(e) { 
	tecla = (document.all) ? e.keyCode : e.which; 
	//alert(tecla)
    if (tecla==8 || tecla==46) return true; //Tecla de retroceso (para poder borrar) 
    // dejar la l&iacute;nea de patron que se necesite y borrar el resto 
    //patron =/[A-Za-z]/; // Solo acepta letras 
    patron = /\d/; // Solo acepta n&uacute;meros
    //patron = /\w/; // Acepta n&uacute;meros y letras 
    //patron = /\D/; // No acepta n&uacute;meros 
    // patron = /[\d.-]/; numeros el punto y el signo -
    te = String.fromCharCode(tecla); 
    return patron.test(te);  
	// uso  onKeyPress="return validnum(event)"
}*/



function links(id){
	if(id == 1){
		$("#img1").attr("src","aplication/webroot/imgs/home1.jpg");	
	}
	if(id == 2){
		$("#img2").attr("src","aplication/webroot/imgs/nosotros1.jpg");	
	}	
	if(id == 3){
		$("#img3").attr("src","aplication/webroot/imgs/productos1.jpg");	
	}	
	
	if(id == 4){
		$("#img4").attr("src","aplication/webroot/imgs/contactenos1.jpg");	
	}	
	
	
}




