function checkEmailNoOblig(myForm) {

if(myForm.email.value.length){

   if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.email.value))
      {
         return (true)
      }

      alert("Dirección de E-mail inválida.")
      return (false)
}else return true
}


function checkEmail(myForm) {
if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.email.value))
{
return (true)
}

alert("Dirección de E-mail inválida.")
return (false)
}



function borra() {
return confirm("¿Confirma el borrado del formulario?");
}

function Validar(carac){

/* Funcion que valida los datos ingresados al formulario previo a su envio   */

var ok=true;
var foco=0; //indica que si hay error, luego del mensaje mande el foco a la password

if (window.document.form1.usuario.value.length == 0)
{
	ok=false;
 var mensaje="Ingrese usuario (o E-mail)";
	foco=1; //para que mande el foco al nombre
}

if (window.document.form1.clave.value.length == 0)
{
	if(ok) //se ingreso usuario pero no contraseña
		{
			ok=false;
			mensaje="Ingrese su contraseña";
		}
	else // no ingreso ni usuario ni clave
		{
			mensaje = mensaje + ' y contraseña';

		}
} // fin if ... == 0


else // ingreso una clave
	{


		if(window.document.form1.clave.value.length < carac) // clave mas corta que lo requerido
		{
			if(ok) //se ingreso usuario y contraseña corta
			{
				ok=false;
				mensaje="La clave debe tener " + carac + " caracteres";

			}
			else // no ingreso usuario e ingreso clave corta
				mensaje = mensaje + ' y la clave debe tener ' + carac + ' caracteres';
		}
		else // la clave esta bien
		{
			if(ok) //se ingreso usuario y contraseña correcta
				window.document.form1.submit();
		}
	} // fin else ingreso una clave

if(!ok) //disparamos el mensaje de error si en algun momento se cambio el ok a false
	{
		alert(mensaje);
		if(foco==1) // el nombre esta mal
			window.document.form1.usuario.focus();
		else // lo que esta mal es solo la clave
			window.document.form1.clave.focus();
	}

}	// fin funcion Validar



//******

function VerificaCheck(fm)
// verifica si hay al menos algun checkbox tildado. En tal caso envia el formulario

{

	var numelements= fm.elements.length

	almenosuno=false
	for (i=0;i<numelements;i++)
	{
		if (fm.elements[i].checked)
			{
				almenosuno=true;
				break;
			}

	}
 	if (almenosuno)
	{
		if (confirm('¿Confirma el borrado?'))
				fm.submit()
	}
	else
		alert('Seleccione al menos una IP')

} // fin VerificaCheck

////////



function ValidarBusq(carac){

if (window.document.buscador.termino.value.length < carac)
{
	alert('Ingrese al menos '+ carac +' caracteres');
	window.document.buscador.termino.focus();
}
else
	if(window.document.buscador.termino.value == "Ingrese palabra a buscar" )
		{
			alert(window.document.buscador.termino.value) ;
			window.document.buscador.termino.focus();
		}
		else
		window.document.buscador.submit();
}

///
function cargaCat(op){ // recarga la pagina con la opcion de la categoria seleccionada

	cat = document.form1.categ.value ;
	location.href = "index.php?op="+op+"&cat="+cat;

}



////

function confirmPlantilla(formobj){

	//1) Enter name of mandatory fields
	var fieldRequired = Array("nombre");
	//2) Enter field description to appear in the dialog box
	var fieldDescription = Array("Nombre");
	//3) Enter dialog message
	var alertMsg = "Por favor, complete el nombre de la plantilla";

	var listo=false;

	var falta = false;
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
				if (obj.value == "" || obj.value == null){
               falta = true
               alert(alertMsg)
				}
//				else
//				  alert(obj.value)

			}

	}
if (!falta){
     		 mensaje = '¿Confirma la carga de los datos de la plantilla?';

  	  listo=confirm(mensaje );
	  if (listo)
			 return true;
     else return false

      }else{

      	 return false;
      }


} // fin confirmPlantilla



////

function formCheck_altaUser(formobj){

	//1) Enter name of mandatory fields
	var fieldRequired = Array("nombre", "usuario", "clave", "clave2");
	//2) Enter field description to appear in the dialog box
	var fieldDescription = Array("Nombre","Usuario", "Clave", "Reingreso de Clave");
	//3) Enter dialog message
	var alertMsg = "Por favor, complete los siguientes campos:\n";

	var listo=false;

	var l_Msg = alertMsg.length;

	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == 0 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
	}

if (alertMsg.length == l_Msg){
	//if(2+2 == 5){
      if(verificaClaves(formobj)){
         if(formobj.name=='alta')
     		 mensaje = '¿Confirma el alta del usuario?';
         else
      		mensaje = '¿Confirma la modificacion de los datos del usuario?'

  	  listo=confirm(mensaje );
	  if (listo)
			 return true;
     else return false

      }else{

      	 return false;
      }
 }else{
  alert(alertMsg);
  return false;
 }



}// fin formCheckaltaUser

////

function formCheck_datosCli(formobj, tipo){

	//1) Enter name of mandatory fields
	var fieldRequired = Array("nombre");
	//2) Enter field description to appear in the dialog box
	var fieldDescription = Array("Nombre");
	//3) Enter dialog message
	var alertMsg = "Por favor, complete los siguientes campos:\n";

	var listo=false;

	var l_Msg = alertMsg.length;

	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == 0 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
	}
if(checkEmailNoOblig(formobj)){

   if (alertMsg.length == l_Msg){
         if(tipo=='alta')
     		 mensaje = '¿Confirma el alta del cliente?';
         else
      		mensaje = '¿Confirma la modificacion de los datos del cliente?'

  	  listo=confirm(mensaje );
	  if (listo)
			 return true;
     else return false


 }else{
  alert(alertMsg);
  return false;
 }
}else
   return false;


}// fin formCheckDatosCli



////

function formCheck_datosComp(formobj, tipo){

	//1) Enter name of mandatory fields
	var fieldRequired = Array("nombre" , "descripcion");
	//2) Enter field description to appear in the dialog box
	var fieldDescription = Array("Nombre" , "Descripción");
	//3) Enter dialog message
	var alertMsg = "Por favor, complete los siguientes campos:\n";

	var listo=false;

	var l_Msg = alertMsg.length;

	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == 0 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
	}
   if (alertMsg.length == l_Msg){
         if(tipo=='alta')
     		 mensaje = '¿Confirma el alta de la competencia?';
         else
      		mensaje = '¿Confirma la modificacion de los datos de la competencia?'

  	  listo=confirm(mensaje );
	  if (listo)
			 return true;
     else return false


 }else{
  alert(alertMsg);
  return false;
 }

}// fin formCheckDatosComp
///////////

function formCheck_datosPerf(formobj, tipo){

	//1) Enter name of mandatory fields
	var fieldRequired = Array("nombre" , "descripcion");
	//2) Enter field description to appear in the dialog box
	var fieldDescription = Array("Nombre" , "Descripción");
	//3) Enter dialog message
	var alertMsg = "Por favor, complete los siguientes campos:\n";

	var listo=false;

	var l_Msg = alertMsg.length;

	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == 0 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
	}
   if (alertMsg.length == l_Msg){
         if(tipo=='alta')
     		 mensaje = '¿Confirma el alta del Perfil';
         else
      		mensaje = '¿Confirma la modificacion de los datos del perfil?'

  	  listo=confirm(mensaje );
	  if (listo)
			 return true;
     else return false


 }else{
  alert(alertMsg);
  return false;
 }

}// fin formCheckDatosPerf





///////

function handleEnter (field, event) {
		var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		if (keyCode == 13) {
			var i;
			for (i = 0; i < field.form.elements.length; i++)
				if (field == field.form.elements[i])
					break;
			i = (i + 1) % field.form.elements.length;
			field.form.elements[i].focus();
			return false;
		}
		else
		return true;
}  // fin handleEnter

function verificaClaves(formobj){//
  if(formobj.clave.value != formobj.clave2.value){
    alert('Las contraseñas ingresadas no coinciden');
    return false;
  }else{
      if(formobj.clave.value.length < 4 || formobj.clave.value.length > 12){
        alert('La contraseña debe tener entre 4 y 12 caracteres');
        return false;
      }else
          return true
   }
}// fin verificaClaves


function validaReg(formobj){
 //1) Enter name of mandatory fields
 var fieldRequired = Array("nombre", "apellido", "email", "telefono", "calle_y_num", "localidad", "clave", "clave2");
 //2) Enter field description to appear in the dialog box
 var fieldDescription = Array("Nombre", "Apellido", "E-mail","Teléfono/s", "Calle y Número", "Localidad", "Clave", "Confirmación de Clave");
 //3) Enter dialog message
 var alertMsg = "Por favor, complete los siguientes campos:\n";

 var listo=false;

 var l_Msg = alertMsg.length;
 for (var i = 0; i < fieldRequired.length; i++){
  var obj = formobj.elements[fieldRequired[i]];
  if (obj){
   switch(obj.type){
   case "select-one":
    if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
     alertMsg += " - " + fieldDescription[i] + "\n";
    }
    break;
   case "select-multiple":
    if (obj.selectedIndex == -1){
     alertMsg += " - " + fieldDescription[i] + "\n";
    }
    break;
   case "text":
   case "textarea":
    if (obj.value == "" || obj.value == null){
     alertMsg += " - " + fieldDescription[i] + "\n";
    }
    break;
   default:
    if (obj.value == "" || obj.value == null){
     alertMsg += " - " + fieldDescription[i] + "\n";
    }
   }
  }
 }

 if (alertMsg.length == l_Msg){
 	if(checkEmail(formobj)){

 			if(verificaClaves(formobj)){

      	listo=confirm('¿Confirma el envío del formulario?' );

	   if (listo)
		  	 formobj.submit();
 			}

 }


}else
    alert(alertMsg);

}// fin validaReg();


// **** ///
function borrarPostulante(id, nombre, act){
	confirma=confirm("¿Confirma el borrado del postulante \n"+ nombre +"?")
    if(confirma){
      location.href = 'index.php?op=prod&act='+act+'&borra='+id
    }

 }// fin borrarPostulante()


function cancelaCita(id, fecha){
	confirma=confirm("¿Confirma el borrado de la cita?")
    if(confirma){
      location.href = 'index.php?op=agenda&dataArea0='+fecha+'&borra='+id
    }

 }// fin borra()


// **** ///
function borrarEstado(id, postu){
	confirma=confirm("¿Confirma el borrado del cambio de estado?")
    if(confirma){
      location.href = 'etapas.php?postu='+postu+'&borra='+id
    }

 }// fin borra()



// **** ///
function borrarCliente(id, nombre){
	confirma=confirm("¿Confirma el borrado del cliente \n"+ nombre +"?")
    if(confirma){
      location.href = 'index.php?op=cli&accion=borrar&id='+id
    }

 }// fin borra()

// **** ///
function borrarCompetencia(id, nombre){
	confirma=confirm("¿Confirma el borrado de la competencia \n"+ nombre +"?")
    if(confirma){
      location.href = 'index.php?op=comp&accion=borrar&id='+id
    }

 }// fin borra()


// **** ///
function borrarPlantilla(id, nombre){
	confirma=confirm("¿Confirma el borrado de la plantilla \n\""+ nombre +"\"?")
    if(confirma){
      location.href = 'index.php?op=forms&accion=borrar&confirm=1&id='+id
    }

 }// fin borra()



function borrarPerfil(id, nombre){
	confirma=confirm("¿Confirma el borrado del perfil \n"+ nombre +"?")
    if(confirma){
      location.href = 'index.php?op=perfil&accion=borrar&id='+id
    }

 }// fin borra()

// **** ///
function preActivarProd(id, nombre,act){

     window.open("preActivaProd.php?idProd="+id, 'form', 'menubar=no, scrollbars=no, width=428, height=205, top=49 , left=133');

 }// fin


//configure status message to show
function muestraStatus(statusmsg){
window.status=statusmsg
return true
}
///////////
function borrar(id, titulo, seccion) {
    confirma=confirm('¿Confirmas el borrado de la nota "'+ titulo +'"?')
    if(confirma){
      location.href = 'index.php?op=cont&sec='+ seccion +'&borra='+id
    }
  }// fin borrar


///////////


function borrarAviso(id, titulo) {
    confirma=confirm('¿Confirmas el borrado de la búsqueda "'+ titulo +'"?')
    if(confirma){
      location.href = 'index.php?op=avisos&borra='+id
    }
  }// fin borrar


///////////

//////////

function borrarcampo(id, titulo, aviso, preentrevista) {
    confirma=confirm('¿Confirma el borrado del campo "'+ titulo +'"?')
    if(confirma){
      location.href = 'index.php?op=form&aviso='+ aviso +'&en_preentrevista='+preentrevista+'&borraCampo='+id
    }
  }// fin borrarcampo
//////////

function borrarCampoPreentrevista(id, titulo, postu, tipoForm) {
    confirma=confirm('¿Confirma el borrado del campo "'+ titulo +'"?')
    if(confirma){
      location.href = 'fichaPreentrevista.php?idPostulacion='+ postu +'&tipoForm='+tipoForm+'&borraCampo='+id
    }
  }// fin borrarcampo

function borrarCampoPlantilla(id, titulo, plantilla) {
    confirma=confirm('¿Confirma el borrado del campo "'+ titulo +'"?')
    if(confirma){
      location.href = 'index.php?op=camposPlantilla&idPlantilla='+ plantilla +'&borraCampo='+id
    }
  }// fin borrarcampo

//////////

function borraropcion(id, titulo, idAviso, idCampo, tipoCampo, en_preentrevista) {
    confirma=confirm('¿Confirma el borrado de la opción "'+ titulo +'"?')
    if(confirma){
      location.href = 'index.php?op=opciones&idAviso='+ idAviso +'&borraOpcion='+id+'&idCampo='+idCampo+'&tipoCampo='+tipoCampo+'&en_preentrevista='+en_preentrevista
    }
  }// fin borrarOpcion

  //////////

function borraropcionPlantilla(id, idPlantilla, idCampo, tipoCampo) {
    confirma=confirm('¿Confirma el borrado de la opción?')
    if(confirma){
      location.href = 'index.php?op=opcionesPl&idPlantilla='+ idPlantilla +'&borraOpcion='+id+'&idCampo='+idCampo+'&tipoCampo='+tipoCampo    }
  }// fin borrarOpcionPlantilla



//////////

function borrarOpcionPreentrevista(id, titulo,  idPostu, idCampo, tipoCampo, tipoForm) {
    confirma=confirm('¿Confirma el borrado de la opción "'+ titulo +'"?')
    if(confirma){
      location.href = 'fichaPreentrevista.php?op=opciones&idPostulacion='+ idPostu +'&borraOpcion='+id+'&idCampo='+idCampo+'&tipoCampo='+tipoCampo +'&tipoForm='+tipoForm
    }
  }// fin borrarOpcionPreentrevista




//////////////
function borrarSec(id, Nombre) {
    confirma=confirm('¿Confirma el borrado de la Sección "'+ Nombre +'"?\n \nATENCION:\nSe borrarán todas las notas de esa seccion')
    if(confirma){
      location.href = 'index.php?op=sec&borraSec='+id
    }
  }// fin borrarSubSec

//////////////

function borrarNovedad(id) {
    confirma=confirm('¿Confirma el borrado de la Novedad '+ id +'?')
    if(confirma){
      location.href = 'index.php?op=nov&borranovedad='+ id
    }
  }// fin borrarSubSec

//////////////


function borrarCia(id, Nombre, tabla,seccion) {
    confirma=confirm('¿Confirma el borrado de la compañía "'+ Nombre +'"?')
    if(confirma){
      location.href = 'index.php?op=cias&borraCia='+id+'&tabla='+tabla+'&sec='+seccion
    }
  }// fin borrarCia

////////////

function borrarCli(id, Nombre) {
    confirma=confirm('¿Confirma el borrado del cliente "'+ Nombre +'"?')
    if(confirma){
      location.href = 'index.php?op=cli&borraCli='+id
    }
  }// fin borrarCia


//////////////

function borrarMiembro(id, Nombre) {
    confirma=confirm('¿Confirma el borrado de datos de "'+ Nombre +'"?')
    if(confirma){
      location.href = 'index.php?op=staff&borraMiembro='+id
    }
  }// fin borrarCia


//////////////



function panelUpload(id){// abre la ventana de upload de archivos: pdf o jpg chico

  window.open("subeArchivo.php?id="+id, 'formU', 'menubar=no, location=yes, width=630 , height=500, top=16 , left=165, scrollbars=yes');

} // fin panelUpload()

////////


function panelUploadCia(id){// abre la ventana de upload de archivos para cias: pdf o jpg chico

  window.open("subeArchivoCia.php?id="+id, 'formU', 'menubar=no, location=yes, width=630 , height=440, top=16 , left=165, scrollbars=yes');

} // fin panelUpload()

//////////
function panelUploadIm(id,tipo,ancho,carpeta){// abre la ventana de upload de archivos: pdf o jpg chico

  window.open("subeImagen.php?idArt="+id+"&tipo="+tipo+"&ancho="+ancho+"&carpeta="+carpeta, 'formU', 'menubar=no, location=yes, width=630 , height=599, top=16 , left=165, scrollbars=yes');

} // fin panelUploadIm()

//////////
function panelUploadLogo(id){// abre la ventana de upload de archivos: pdf o jpg chico

  window.open("subeLogo.php?idCia="+id , 'formU', 'menubar=no, location=yes, width=630 , height=599, top=16 , left=165, scrollbars=yes');

} // fin panelUploadLogo()

////////////

function panelUploadLogo2(id){// abre la ventana de upload de archivos: pdf o jpg chico

  window.open("subeLogo2.php?idCli="+id , 'formU', 'menubar=no, location=yes, width=630 , height=599, top=16 , left=165, scrollbars=yes');

} // fin panelUploadLogo()



///////
function posicionar(ancho,margenTop){
x = (screen.width - ancho) / 2;
moveTo(x, margenTop);
}

////////

function salir(){

   if(confirm('Confirma la salida del Panel de Administración')){
            location.href='salir.php'

   }else
      return 0;

} // fin salir();

//////////////
function registro(){// abre la ventana de registro de nuevo usuario

  window.open("admin/nuevo_prod.php", 'form', 'menubar=no, scrollbars=yes, width=568, height=605, top=4 , left=133');

} // fin registro()


////////

function validaFechaSinHora(Dia, Mes, Ano){
// no acepta hora y recibe los tres valores por separado
//alert(Dia)
// Valido el año
if (isNaN(Ano) || Ano.length != 4 || parseFloat(Ano)<1900){
        alert('Año inválido')
return false
}
// Valido el Mes
if (isNaN(Mes) || parseFloat(Mes)>12){
alert('Mes inválido')
return false
}
// Valido el Dia
if (isNaN(Dia) || parseInt(Dia, 10)>31){
alert('Día inválido')
return false
}
if (Mes==4 || Mes==6 || Mes==9 || Mes==11 || Mes==2) {
if (Mes==2 && Dia > 28 || Dia>30) {
   if(Dia == 29 && Ano % 4 == 0) return true;
alert('Día inválido')
return false
}
}
 // validamos que la fecha ingresada no sea posterior a la actual

var mydate=new Date();
var year=mydate.getYear();
if (year < 1000)
year+=1900;
var day=mydate.getDay();
var month=mydate.getMonth()+1;
if (month<10)
   month="0"+month;
var daym=mydate.getDate();
if (daym<10)
   daym="0"+daym;
//alert(year+"-"+month+"-"+daym+" 23:59:00")
hoy = year+"-"+month+"-"+daym+" 23:59:00"
if (Mes<10)
   Mes="0"+Mes;

if (Dia<10)
   Dia="0"+Dia;

         Fecha = Ano+"-"+Mes+"-"+Dia+" 23:59:00"

//alert(Fecha)


if(Fecha > hoy){
//*alert(Fecha)
alert('La fecha no puede ser posterior a la actual')
return false
}

return true;
}


////////
function formCheck_altaPost(formobj){
	//1) Enter name of mandatory fields
//	var fieldRequired = Array("nombres", "apellido", "DNI", "direccion", "cod_postal", "telefono", "celular",  "email" );
	var fieldRequired = Array("nombres", "apellido", "DNI", "email" );
	//2) Enter field description to appear in the dialog box
	var fieldDescription = Array("Nombres", "Apellido", "DNI", "E-mail");
	//3) Enter dialog message
	var alertMsg = "Por favor, complete los siguientes campos:\n";

	var dia = formobj.dia_nac.value;
	var mes = formobj.mes_nac.value;
	var anio = formobj.anio_nac.value;

	var listo=false;

	var l_Msg = alertMsg.length;

	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == 0 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
	}

	if (alertMsg.length == l_Msg){
	 if(validaFechaSinHora(dia,mes,anio)){

     if(formobj.name=='alta')
      mensaje = '¿Confirma el alta del postulante?';
     else
      mensaje = '¿Confirma la modificacion de los datos del postulante?'
   	if(checkEmail(formobj)){
  	listo=confirm(mensaje );
	  if (listo)
			 return true;
     else return false
		}else return false;
	 }else{ // fecha erronea
      return false;
	 }
	 }else{
  alert(alertMsg);
  return false;
 }



}// fin formCheckaltaPost


function formCheck_filtraPost(formobj){
var ok = true
   if(isNaN(formobj.edad_min.value)){
      alert('La edad mínima debe ser un número')
      formobj.edad_min.value = '';
      formobj.edad_min.focus();
      ok = false
   }
   if(isNaN(formobj.edad_max.value)){
      alert('La edad máxima debe ser un número')
      formobj.edad_max.value = '';

     if(ok){
      formobj.edad_max.focus();
      ok = false;
     }
   }else if(formobj.edad_max.value > 130){
      alert('La edad máxima no puede ser mayor que 130')
      formobj.edad_max.value = '';

     if(ok){
      formobj.edad_max.focus();
      ok = false;
     }
   }

 if(ok) return true
 else return false

}// fin formCheckFiltraPost


function abreFichaCli(idCli){
   ficha1Cli=window.open('fichaCliente.php?idCliente='+idCli,'cliente','status=no, modal=yes, scrollbars=yes, location=no, width=604, height=635')
   ficha1Cli.focus()
}


function abreFicha(idPostu, visto){
   ficha1=window.open('fichaPostulante.php?idPostulante='+idPostu+'&visto='+visto,'postulante','status=no, modal=yes, scrollbars=yes, location=no, width=690, height=635')
   ficha1.focus()
}

function abrirPreentrevista(idPostu, tipoForm){
var alto = screen.height - 89
 ficha2=window.open('fichaPreentrevista.php?idPostulacion='+idPostu+'&tipoForm='+tipoForm,'preentrevista','status=yes, modal=yes, scrollbars=yes, location=no, width=780, height='+alto)
   ficha2.focus()
}


function abrirNuevaPostulacion(dni){
var alto = 175
 ficha5=window.open('nuevaPostulacion.php?dni='+dni ,'preentrevista','status=yes, modal=yes, scrollbars=yes, location=no, width=675, height='+alto)
   ficha5.focus()
}

var nav4 = window.Event ? true : false;
function acceptNum(evt){
// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57
//alert('ddd')
var key = nav4 ? evt.which : evt.keyCode;
return (key <= 13 || (key >= 48 && key <= 57));
}

///////////

function cargaPlantilla(principal, op){


   plantilla=document.getElementById('listaPlantillas').value
   location.href = principal+".php?"+op+"&idPlantilla="+plantilla

}

/////////

 function abrirCita(idPostulacion , enEmpresa){

//      alert(idPostulacion)
//alert(enEmpresa)

      ventanaCita = window.open('cita.php?postu='+idPostulacion+'&enEmpresa='+enEmpresa, 'cita' , 'width=265, height=462, scrollbars="no",top=35, left=270, status="no"')
      ventanaCita.focus();

   }



 function abrirCitaEdit(idPostulacion, idCita, desdeAgenda){

      var paramAgenda = '';

      if(desdeAgenda == 1){
         paramAgenda = '&enAgenda=1'
      }
      ventanaCita = window.open('cita.php?postu='+idPostulacion+'&idCita='+idCita+paramAgenda, 'cita' , 'width=265, height=462, scrollbars="no",top=35, left=270, status="no"')
      ventanaCita.focus();

   }
