function abre(cual,width,height){
	w2=width/2;
	h2=height/2;
	parametros="width="+width+",height="+height+",menubar=no";
	hija = open(cual,'temp',parametros)
	x = (screen.width/ 2)- w2;
	y = (screen.height/2) - h2; 
	hija.moveTo(x, y); 
}
function abrir(url){
	cual="http://directorioveracruz.com/"+url;	
	open(cual,'_self','');
}


function validar(miforma) {
	var deta1=document.forms(miforma);
	if ((deta1.correo.value.indexOf("@") == -1)||(deta1.correo.value.indexOf(".") == -1)){
 		alert('Debes escribir un Correo Electronico válido');
		deta1.correo.focus();
	     return false;
		}
	if (deta1.nombre.value==""){
 		alert('Debes escribir tu nombre');
		deta1.nombre.focus();
	     return false;
		}
	 if (deta1.correo.value!=deta1.correo2.value){
	 	alert ('La confirmacion del Correo-E no coincide');
		deta1.correo2.focus();
		return false;
		}
	deta1.submit();
}


function validar2() {
	if(deta1.titulo.value.length<5){
	alert("Escribe un nombre de Negocio o Empresa valido.");
     deta1.titulo.focus();
     return (false);
	}
	if ((deta1.correo.value.indexOf("@") == -1)||(deta1.correo.value.indexOf(".") == -1)){
 		alert('Debes escribir un Correo Electronico válido');
		deta1.correo.focus();
	     return (false);
		}
	deta1.submit();
}

function poncoordenadas(y,x){
	if(y!=""){
		document.getElementById("mapa").value=y+","+x;
		document.getElementById("btn_vermapa").style.visibility="visible";
	}
	hija.close();
}
function validamapa(){
	if(document.getElementById("mapa").value!=""){
		var coords=document.getElementById("mapa").value;
		var titulo=deta1.titulo.value;
		var dir=deta1.dir.value;
		var info=titulo+"|"+dir;
		abre("mapaver.php?coords="+coords+"&info="+info,'600','630')
	}
}

function habilitar(){
	if(deta1.aceptar.checked==true){
		deta1.envia.disabled=false;
	}else{
		deta1.envia.disabled=true;
	}
}

function quitaexeso(cual,limite){
//	cual.value=cual.length;  
}


function limita(obj,elEvento, maxi){   
  var elem = obj;   
  var evento = elEvento || window.event;   
  var cod = evento.charCode || evento.keyCode;   


    // 37 izquierda   
    // 38 arriba   
    // 39 derecha   
    // 40 abajo   
    // 8  backspace   
    // 46 suprimir   
  
  if(cod == 37 || cod == 38 || cod == 39   
  || cod == 40 || cod == 8 || cod == 46)   
  {   
    return true;   
  }   
  
  if(elem.value.length < maxi )   
  {   
    return true;   
  }   
  
  return false;   
}   
  
function cuenta(obj,evento,maxi,div)   
{   
    var elem = obj.value;   
    var info = document.getElementById(div);   
  
    info.innerHTML = maxi-elem.length;   
}  
