// JavaScript Document
	


function busqueda(url,texto){
	document.fbuscar.action = url+'&q=' + texto.value;
	document.fbuscar.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ínea de patron que se necesite y borrar el resto 
    //patron =/[A-Za-z]/; // Solo acepta letras 
    patron = /\d/; // Solo acepta números
    //patron = /\w/; // Acepta números y letras 
    //patron = /\D/; // No acepta números 
    // patron = /[\d.-]/; numeros el punto y el signo -
    te = String.fromCharCode(tecla); 
    return patron.test(te);  
	// uso  onKeyPress="return validnum(event)"
}


function ver_compromiso(){
  $('#nosotros').hide('slow');
  $('#compromiso').show('slow');
}
function ver_nosotros(){
  $('#compromiso').hide('slow');
  $('#nosotros').show('slow');
}

$(document).ready( function(){						   
	$('#menu li').each(function(index){ 
		$(this).click(function(){			                
			$("#subcat"+index).toggle("fast"); 			   
		}); 	  
	});	
	$("#images a").click( function(){
		var title = $(this).attr("title");
		$("#imgp").hide();
		$("#imgp").attr("src", title).fadeIn('slow'); 
	});	
}); 


function validar(){
	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.email.value==""){
		alert("ERROR: Por favor ingrese su Email");
		document.f1.email.focus();
		return false;
	}else{
		document.f1.action="enviar.php";
		document.f1.submit();
		
	}
	
}

