function enviar(idi){
	
	seccio(0);

	document.frm1.desti.value = parent.iframe1.document.frm2.desti.value;
	if (document.frm1.origen.value==0) {
		alert ("select origen");
		return false;
	}
	else if (document.frm1.desti.value==0){
		alert ("desti")
		return false;
	}
	//url="buscar.php?origen="+document.frm1.origen.value+"&desti="+document.frm1.desti.value+"&idioma="+idi;	
	//document.getElementById("centre").src=url;
	
	url="mostrar_pdf.php?origen="+document.frm1.origen.value+"&desti="+document.frm1.desti.value+"&idioma="+idi;	
	eval("window.open('"+ url +"','_blank','width=580,height=590,resizable=yes')");
}


function fechaCorrecta(obj){
	var formatoFecha = /\d\d\/\d\d\/\d\d\d\d/;	
	if( !formatoFecha.test(obj.value) )	return false;

	var d = parseInt(obj.value.substr(0,2));
	var m = parseInt(obj.value.substr(3,2));
	var a = parseInt(obj.value.substr(6,4));

	if (m > 12) return false;

	if ( (d  > 30)  && ((m==4) || (m==6) || (m==9) || (m==11)) )  return false;

	if ( (d  > 31)  && ((m==1) || (m==3) || (m==5) || (m==7) || (m==8) || (m==10) || (m=12)) )  return false;
	
	if ( ((a % 4 == 0) && (a % 100 != 0)) || (a % 400 == 0) ){
		//año bisiesto
		if ( (d  > 29)  && (m==2) )	return false;
	}else{
		if ( (d  > 28)  && (m==2) )	return false;
	}

	return true;
}

function horaOk(hora){
	var formatHora = /\d\d\:\d\d/;	
	if( !formatHora.test(hora.value) )	return false;
	
	var h = parseInt(hora.value.substr(0,2));
	var m = parseInt(hora.value.substr(3,2));
	
	if (h>23) return false;
	if (m>59) return false;
	
	return true;
}
/********************************************
   FUNCIONES DE COMPROBACIÓN DE FORMATOS
********************************************/

var digits = "0123456789";

//función para comprobar si una cadena contiene sólo dígitos (es numérica)
function esNumerico(pCadena){
	for(i=0;i<pCadena.length;i++){
		if(digits.indexOf(pCadena.charAt(i)) == -1){
			return false;
		}
	}
	return true;
}

function emailCheck (emailStr) {
/* The following variable tells the rest of the function whether or not
to verify that the address ends in a two-letter country or well-known
TLD.  1 means check it, 0 means don't. */
var checkTLD=1;
/* The following is the list of known TLDs that an e-mail address must end with. */
var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
var emailPat=/^(.+)@(.+)$/;
var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
var validChars="\[^\\s" + specialChars + "\]";
var quotedUser="(\"[^\"]*\")";
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
var atom=validChars + '+';
var word="(" + atom + "|" + quotedUser + ")";
var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
var matchArray=emailStr.match(emailPat);

if (matchArray==null) {
//alert("La dirección de correo no es válida (revisa el uso de @ (arroba) y puntos)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];
for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
//alert("La dirección de correo contiene caracteres no válidos.");
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
//alert("La dirección de correo contiene caracteres no válidos.");
return false;
   }
}

if (user.match(userPat)==null) {
//alert("La direción de correo no es válida.");
return false;
}

var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {
for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
//alert("La IP especificada en la dirección de correo no es válida");
return false;
   }
}
return true;
}

var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
//alert("La dirección de correo no es válida.");
return false;
   }
}

if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
//alert("La dirección de correo debe acabar con un dominio existente.");
return false;
}

if (len<2) {
//alert("La dirección de correo no es válida");
return false;
}

return true;
}
//-->
