// JavaScript Document
// JavaScript Document

function validar(){
	if(document.frm.nombre.value==""){
		alert("CUIDADO: Por favor introduzca su nombre");
		document.frm.nombre.focus();
		return false;
	}else if(document.frm.apellido.value==""){
		alert("CUIDADO:Por favor introduzca su apellido");
		document.frm.apellido.focus();
		return false;
	}else if(document.frm.telefono.value==""){
		alert("CUIDADO: Por favor escriba al menos un telefono");
		document.frm.telefono.focus();
		return false;
	}else if(document.frm.email.value==""){
		alert("CUIDADO: Por favor escriba su e-mail");
		document.frm.email.focus();
		return false;
	}else if(document.frm.mensaje.value==""){
		alert("CUIDADO: Por favor escriba el mensaje");
		document.frm.mensaje.focus();
		return false;
	}else{
		return true;	
	}
}


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 buscar(url,texto){
	document.f2.action=url+'&q='+texto.value;
	document.f2.submit();
	
	}
function procesa_admin(){
	if(document.f1.usuario.value==""){
		alert("ERROR: Por favor ingrese Usuario");
		document.f1.usuario.focus();
		return false
	}else if(document.f1.password.value==""){
		alert("ERROR: Por favor ingrese Password");
		document.f1.password.focus();
		return false;
	}
	document.f1.action="admin/validacion.php";
	document.f1.submit();
	
	} 	
	
function showPic (whichpic) {
 if (document.getElementById) {
  document.getElementById('placeholder').src = whichpic.href;
  if (whichpic.title) {
   document.getElementById('desc').childNodes[0].nodeValue = whichpic.title;
  } else {
   document.getElementById('desc').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
  }
  return false;
 } else {
  return true;
 }
}	
function hidelayers(lay){
	if(document.getElementById([lay]).style.display == "none"){
		document.getElementById([lay]).style.display = "block";
	}else{
		document.getElementById([lay]).style.display = "none";
	}		
}