<!--

function validaFecha(fecha){
  if(fecha!="" && fecha!=":: Fecha de creación del informe ::") {
   fecha = fecha.split("-"); 
   if(fecha.length<3 || fecha.length>3){
     document.getElementById('mensaje_error').display = "";
     return(0);
   }
   else{ 
      val1=validarEntero(fecha[0]);
      val2=validarEntero(fecha[1]);
      val3=validarEntero(fecha[2]);
      if(val1==0 || val2==0 || val3==0){
         return(0);     
      }else{
         document.getElementById('fecha').value=document.getElementById('fecha1').value;
         return(1);
      }
   }
  }else{
    document.getElementById('fecha').value="";
    return(1);
  }
}

function showhide(id)
{
	if (document.getElementById)
	{
		obj = document.getElementById(id);
		if (obj.style.display == "none")
		{
			obj.style.display = "";
		} else {
			obj.style.display = "none";
		}
	}
} 

function validarEntero(valor){
    //intento convertir a entero.
    //si era un entero no le afecta, si no lo era lo intenta convertir
    valor = parseInt(valor)

    //Compruebo si es un valor numérico
    if (isNaN(valor)) {
       //entonces (no es numero) devuelvo el valor cadena vacia
       return(0); 
    }else{
       //En caso contrario (Si era un número) devuelvo el valor
       return(1);
    }
}

function Tooltip1(id){
   
    document.getElementById(id).style.position="absolute";
    document.getElementById(id).style.top="272px";
    document.getElementById(id).style.left="500px";
    document.getElementById(id).style.display = "";
 
}

function Tooltip(id,id1,param1, param2){
   
    document.getElementById(id).style.position="absolute";
    
    var y = document.getElementById('edt').offsetTop;
    longY=y.length;
    var x = document.getElementById('edt').offsetLeft;
    longX=x.length;
    y=y-param1;
    x=x+param2;
    x1=x+'px';
    y1=y+'px';
    
    document.getElementById(id).style.top=y1;
    document.getElementById(id).style.left=x1;
    document.getElementById(id).style.display = "";
}

function ocultar(id)
{
   
	if (document.getElementById)
	{
		obj = document.getElementById(id);
		obj.style.display = "none";
	}
} 

function mostrar(id)
{
   
	if (document.getElementById)
	{
		obj = document.getElementById(id);
		obj.style.display = "";
	}
} 

function seleccionaFoco(id){
    document.getElementById(id).focus();
    
}

/*function validaDatosEmpleo(){
	if(document.getElementById('nombre').value=="" || document.getElementById('email').value=="" || document.getElementById('municipio').value== 0 || document.getElementById('profesion').value== 0 || document.getElementById('perfil').value=="")
	    return 0;
    else
	    return 1;		        
}*/
function esDigito(sChr){
var sCod = sChr.charCodeAt(0);
return ((sCod > 47) && (sCod < 58));
}

function valAno(oTxt){
var bOk = true;
var nAno = oTxt.value.substr(0, 4);
//var nAno = oTxt.value.substr(0);
bOk = bOk && ((nAno.length == 2) || (nAno.length == 4));
if (bOk){
for (var i = 0; i < nAno.length; i++){
bOk = bOk && esDigito(nAno.charAt(i));
}
}
return bOk;
}

function valSep(oTxt){
var bOk = false;
bOk = bOk || ((oTxt.value.charAt(4) == "-") && (oTxt.value.charAt(7) == "-"));
bOk = bOk || ((oTxt.value.charAt(4) == "/") && (oTxt.value.charAt(7) == "/"));
return bOk;
}

function finMes(oTxt){
var nMes = parseInt(oTxt.value.substr(5, 2), 10);
var nRes = 0;
switch (nMes){
case 1: nRes = 31; break;
case 2: nRes = 29; break;
case 3: nRes = 31; break;
case 4: nRes = 30; break;
case 5: nRes = 31; break;
case 6: nRes = 30; break;
case 7: nRes = 31; break;
case 8: nRes = 31; break;
case 9: nRes = 30; break;
case 10: nRes = 31; break;
case 11: nRes = 30; break;
case 12: nRes = 31; break;
}
return nRes;
}

function valDia(oTxt){
var bOk = false;
var nDia = parseInt(oTxt.value.substr(8, 2), 10);
bOk = bOk || ((nDia >= 1) && (nDia <= finMes(oTxt)));
return bOk;
}

function valMes(oTxt){
var bOk = false;
var nMes = parseInt(oTxt.value.substr(5, 2), 10);
bOk = bOk || ((nMes >= 1) && (nMes <= 12));
return bOk;
}

function validaDatosEmpleo(){
	nombre		= document.getElementById('nombre');
	municipio	= document.getElementById('municipio');
	profesion	= document.getElementById('profesion');
	email		= document.getElementById('email');	        
	perfil		= document.getElementById('perfil');
	fecha		= document.getElementById('fecha');
	
		
	
	if( nombre.value == "" )
	{
		window.alert("Ingrese su Nombre");
		nombre.select();
		nombre.focus();
		return;
	}
	if( email.value == "" )
	{
		window.alert("Ingrese el Email");
		email.select();
		email.focus();
		return;
	}
	var filter = new RegExp(/^[a-z][\w|\.]*@[\w]*\.([a-z]{2,4}|[\a-z]{2,4}\.[a-z]{2,3})$/);
	if(!filter.test(email.value))
	{
		window.alert('Ingrese un correo electrónico válido');
		email.select();
		email.focus();
		return;
	}
	
	if( fecha.value == "" )
	{
		window.alert("Ingrese la fecha de nacimiento");
		fecha.select();
		fecha.focus();
		return;
	}
	
	var bOk = true;
	if (fecha.value != ""){
	bOk = bOk && (valAno(fecha));	
	bOk = bOk && (valMes(fecha));	
	bOk = bOk && (valDia(fecha));		
	bOk = bOk && (valSep(fecha));
	if (!bOk){
	alert("Fecha inválida");
	fecha.focus();
	return;
	}
	}

	if( municipio.value == 0 )
	{
		window.alert("Seleccione el Municipio");
		municipio.focus();
		return;
	}
	if( profesion.value == 0 )
	{
		window.alert("Seleccione la Profesión");
		profesion.focus();
		return;
	}
	if( perfil.value == "" )
	{
		window.alert("Introduzca el Perfíl");
		perfil.select();
		perfil.focus();
		return;
	}
	document.form1.submit();
}

function validaDatosOferta(){
    if(document.getElementById('nombre').value=="" || document.getElementById('email').value=="" || document.getElementById('direccion').value=="" || document.getElementById('telefono').value=="" || document.getElementById('resp1').value==" " || document.getElementById('municipio').value== 0 || document.getElementById('profesion').value== 0)
	    return 0;
    else
	    return 1;		        
}

 function Abrir_Ventana(el_url) {
var especificaciones="top=100, left=120, toolbar=no,location=no, status=no,menubar=no,scrollbars=no, resizable=no, width=750,height=550"
var titulo="Titulo"
window.open(el_url,titulo,especificaciones);
}

//-->