	var popUpWin=0;	
	function popUpWindowNE(URLStr){
		if(popUpWin){
			if(!popUpWin.closed) popUpWin.close();
		}
		popUpWin = open(URLStr,'popUpWin','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=yes,width=800,height=550,left=100, top=100,screenX=250,screenY=250');
	}

	ahora          = new Date();
	ahoraDay    = ahora.getDate();
	ahoraMonth = ahora.getMonth();
	ahoraYear   = ahora.getYear();

	if (ahoraYear < 2000) 
        ahoraYear += 1900;
        
    function cuantosDias(mes, anyo)
    { 
        var cuantosDias = 31;
        if (mes == "Abril" || mes == "Junio" || mes == "Septiembre" || mes == "Noviembre")
      cuantosDias = 30;
        if (mes == "Febrero" && (anyo/4) != Math.floor(anyo/4))
      cuantosDias = 28;
        if (mes == "Febrero" && (anyo/4) == Math.floor(anyo/4))
      cuantosDias = 29;
        return cuantosDias;
    }
    function asignaDias()
    {
        comboDias = document.formFecha.seleccionaDia;
        comboMeses = document.formFecha.seleccionaMes;
        comboAnyos = document.formFecha.seleccionaAnyo;

        Month = comboMeses[comboMeses.selectedIndex].text;
        Year = comboAnyos[comboAnyos.selectedIndex].text;

        diasEnMes = cuantosDias(Month, Year);
        diasAhora = comboDias.length;

        if (diasAhora > diasEnMes)
        {
            for (i=0; i<(diasAhora-diasEnMes)-1; i++)
            {
                comboDias.options[comboDias.options.length -1] = null
            }
        }
        if (diasEnMes > diasAhora)
        {
            for (i=0; i<(diasEnMes-diasAhora)+1; i++)
            {
                sumaOpcion = new Option(comboDias.options.length );
                comboDias.options[comboDias.options.length]=sumaOpcion;
            }
        }
        if (comboDias.selectedIndex < 0) 
          comboDias.selectedIndex = 0;
     }

function fcheck(v){
		if (v==true){
			var o = document.getElementById("chkLunes")
			o.disabled=false;
			o = document.getElementById("chkMartes")
			o.disabled=false;
			o = document.getElementById("chkMiercoles")
			o.disabled=false;
			o = document.getElementById("chkJueves")
			o.disabled=false;
			o = document.getElementById("chkViernes")
			o.disabled=false;
			o = document.getElementById("chkSabado")
			o.disabled=false;
			o = document.getElementById("chkDomingo")
			o.disabled=false;
		}
		else{
		var o = document.getElementById("chkLunes")
			o.disabled=true;
			o = document.getElementById("chkMartes")
			o.disabled=true;
			o = document.getElementById("chkMiercoles")
			o.disabled=true;
			o = document.getElementById("chkJueves")
			o.disabled=true;
			o = document.getElementById("chkViernes")
			o.disabled=true;
			o = document.getElementById("chkSabado")
			o.disabled=true;
			o = document.getElementById("chkDomingo")
			o.disabled=true;
			}
	}
	
function limpiar(cbo) {	
	cbo.selectedIndex = -1;
	cbo.length = 0;
}

function llenarCiudades(ed) {
	var i;
	var edoNuevo = ed;
	var cboCdad = document.formFecha.cbociudad;
	cboCdad.disabled = false;			
	limpiar(cboCdad);				
	if (edoNuevo == "0" ){
		cboCdad.options[0] = new Option("seleccione un estado","0");
		return;}
	cboCdad.options[0] = new Option("seleccione una ciudad","0");
	var d = 1;			
	for (var i=0;i<arrCdad.length;i++){				
		if (arrCdad[i][2]==edoNuevo){
			cboCdad.options[d++] = new Option(arrCdad[i][0],arrCdad[i][1]);
		}
	}
	llenarColegios(ed);
}

function llenarColegios(ed){
	var i;
	var clgNuevo = ed;
	var cboColg = document.formFecha.cbocolegio;	
	if (typeof(cboColg) != 'object'){
		return}
	limpiar(cboColg);
	if (clgNuevo == "0"){
		cboColg.options[0] = new Option("seleccione un estado","0");
		return;}
	cboColg.options[0] = new Option("seleccione un colegio","0");
	var d = 1;
	for (var i=0;i<arrColg.length;i++){
		if (arrColg[i][2]==clgNuevo){
			cboColg.options[d++] = new Option(arrColg[i][0],arrColg[i][1]);
		}
	}
}

function validarProm(obj){	
		if (navigator.appName == "Netscape")
		{
			var c = String.fromCharCode(obj.which);
			var x = obj.which;
		}
		else {
			var c = String.fromCharCode(obj.keyCode);
			var x = obj.keyCode;
			}
		if (x != 8) {
			var mask = "0123456789";
			if (mask.indexOf(c) == -1){
				return false	
			}
			else
			{
				if (document.formFecha.txtpromedio.value.length == 1) {
					document.formFecha.txtpromedio.value = document.formFecha.txtpromedio.value + c + ".00";
					return false
				}
				if (document.formFecha.txtpromedio.value.length == 2){
					document.formFecha.txtpromedio.value = document.formFecha.txtpromedio.value  + "." + c + "0";
					return false
				}
				if (document.formFecha.txtpromedio.value.length == 3){
					document.formFecha.txtpromedio.value = document.formFecha.txtpromedio.value  + c + "0";
					return false
				}
			}
		}
}

function validarCed(obj){
		if (navigator.appName == "Netscape")
		{
			var c = String.fromCharCode(obj.which);
			var x = obj.which;
		}
		else {
			var c = String.fromCharCode(obj.keyCode);
			var x = obj.keyCode;
			}
		if (x != 8) {
			var mask = "0123456789";
			if (mask.indexOf(c) == -1){
				return false	
			}
		}
}
function validarTef(obj){
		if (navigator.appName == "Netscape")
		{
			var c = String.fromCharCode(obj.which);
			var x = obj.which;
		}
		else {
			var c = String.fromCharCode(obj.keyCode);
			var x = obj.keyCode;
			}
		if ((x != 8)||(x != 32)){
			var mask = "0123456789,-() ";
			if (mask.indexOf(c) == -1){
				return false	
			}
		}
}
function pass(){
	var v1 = document.formFecha.bClave1.value;
	var v2 = document.formFecha.bClave2.value;
	if (v1 != ""){
		document.formFecha.txtpassword.value=v1;
	}
	if (v2 != ""){
		document.formFecha.txtpassword2.value=v2;
	}
}

function ValidatorIncribir(){	
	var bError = false;
	var form;
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		form = document.formFecha;	}
	else {
		form = document.forms["formFecha"];}
	/// validamos la cedula
	if (form.txtcedula.value==""){
		document.getElementById('lblerrorcedula').innerHTML = 'este campo es obligatorio';
		bError = true;}
	else{
		document.getElementById('lblerrorcedula').innerHTML = '';
	}
	/// validamos la fecha de nacimiento
	if (form.seleccionaMes.selectedIndex==0 || form.seleccionaDia.selectedIndex==0 || form.seleccionaAnyo.selectedIndex==0){
		document.getElementById('lblerrorfecha').innerHTML = 'este campo es obligatorio';
		bError = true;}
	else {
		document.getElementById('lblerrorfecha').innerHTML = '';
	}		
	/// validamos la dirección 
	if (form.txtdireccion.value==""){
		document.getElementById('lblerrordireccion').innerHTML = 'este campo es obligatorio';
		bError = true;}
	else {
		document.getElementById('lblerrordireccion').innerHTML = '';
	}
	/// validamos el estado
	if (form.cboestado.selectedIndex==0){
		document.getElementById('lblerrorestado').innerHTML = 'este campo es obligatorio';
		bError = true;}	
	else{
		document.getElementById('lblerrorestado').innerHTML = '';
	}
	/// validamos la Ciudad
	if (form.cbociudad.selectedIndex==0){
		document.getElementById('lblerrorciudad').innerHTML = 'este campo es obligatorio';
		bError = true;}
	else{
		document.getElementById('lblerrorciudad').innerHTML = '';
	}
	/// validamos el colegio
	if (form.cbocolegio.selectedIndex==0){
		document.getElementById('lblerrorcolegio').innerHTML = 'este campo es obligatorio';
		bError = true;}
	else {
		document.getElementById('lblerrorcolegio').innerHTML = '';
	}
	/// validamos el nivel educativo
	if (form.cbonivel.selectedIndex==0){
		document.getElementById('lblerrornivel').innerHTML = 'este campo es obligatorio';
		bError = true;}
	else {
		document.getElementById('lblerrornivel').innerHTML = '';
	}
		
	/// validamos el promedio academico
	if (form.txtpromedio.value==""){
		document.getElementById('lblerrorpromedio').innerHTML = 'este campo es obligatorio';
		bError = true;	}
	else {
		var txtp = form.txtpromedio.value		
		if (Math.floor(txtp) < 10 || Math.floor(txtp) > 20){
			document.getElementById('lblerrorpromedio').innerHTML = 'nota no valida';
			bError = true; }
		else {
			document.getElementById('lblerrorpromedio').innerHTML = '';
		}		
	}
	/// validamos la contraseña si es menos de 5 caracteres
	if (form.txtpassword.value.length < 5){	
		document.getElementById('lblerrorpassword').innerHTML = 'la contrase&ntilde;a debe tener m&atilde;s de 5 caracteres';
	    bError = true;	}
	else{
		document.getElementById('lblerrorpassword').innerHTML = '';
	}
	
	//// validamos si las contraseños son diferentes
	if (form.txtpassword.value != form.txtpassword2.value){
		document.getElementById('lblerrorpassword').innerHTML = 'la contrase&ntilde;a no coincide';
	    bError = true;
	}
	
	/// validamos la conexion
	if (form.cboconexion.selectedIndex==0){
		document.getElementById('lblerrorconexion').innerHTML = 'este campo es obligatorio';
		bError = true;}	
	else {
		document.getElementById('lblerrorconexion').innerHTML = '';
	}
	
	if (form.txtApellidoAux.value=="" && bError == false){
		alert("Escriba su apellido como muestra que acepto el contrato");
		form.txtApellidoAux.focus();
		bError = true;
	}
	
	if (form.txtApellidoAux.value != form.txtapellido.value && bError == false){
		alert("El apellido debe ser igual al que indico")
		form.txtApellidoAux.focus();
		bError = true;
	}
	
	if (form.txtPromotor.value.length > 0 && form.txtPromotor.value.length < 3){
		document.getElementById('lblerrorPromotor').innerHTML = 'debe indicar las 3 letras del promotor';
		bError = true;	
	}
	else{
		document.getElementById('lblerrorPromotor').innerHTML = '';
	}
	
	return !bError; 	
}

function validarCampos(form){			

			if (form == null) 
			{
				if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) 
				{
					form = document.formulario;	
				}
				else 
				{
					form = document.forms["formulario"];
				}
			}

			var no_error = true;
			
			if (form.txtnombre.value==""){
				document.getElementById("lblerrorNombre").innerText="Este campo es obligatorio";
				no_error = false;
			}
			else
				document.getElementById("lblerrorNombre").innerText="";
				
			if (form.txtapellido.value==""){
				document.getElementById("lblerrorApellido").innerText="Este campo es obligatorio";
				no_error = false;
			}
			else
				document.getElementById("lblerrorApellido").innerText="";
				
			if (form.txtemail.value==""){
				document.getElementById("lblerrorEmail").innerText="Este campo es obligatorio";
				no_error = false;
			}
			else
				document.getElementById("lblerrorEmail").innerText="";
				
			if (form.txtcedula.value==""){
				document.getElementById("lblerrorCedula").innerText="Este campo es obligatorio";
				no_error = false;
			}
			else
				document.getElementById("lblerrorCedula").innerText="";
				
			if (form.txttelefono.value==""){
				document.getElementById("lblerrorTelefono").innerText="Este campo es obligatorio";
				no_error = false;
			}
			else
				document.getElementById("lblerrorTelefono").innerText="";
				
			//if (form.txttelefono2.value==""){
			//	document.getElementById("lblerrorTelefono2").innerText="Este campo es obligatorio";
			//	no_error = false;
			//}
			//else
			//	document.getElementById("lblerrorTelefono2").innerText="";
				
			if (form.txtdireccion.value==""){
				document.getElementById("lblerrorDireccion").innerText="Este campo es obligatorio";
				no_error = false;
			}
			else
				document.getElementById("lblerrorDireccion").innerText="";
				
			if (form.cboestado.selectedIndex < 1){
				document.getElementById("lblerrorEstado").innerText="indique un estado";
				no_error = false;
			}
			else
				document.getElementById("lblerrorEstado").innerText="";
			
			if (form.cbociudad.selectedIndex < 1){
				document.getElementById("lblerrorCiudad").innerText="indique una ciudad";
				no_error = false;
			}
			else
				document.getElementById("lblerrorCiudad").innerText="";
				
			return no_error;
}

function ValidadorRegistro(){	
	var bError = false;
	var form;
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		form = document.formFecha;	}
	else {
		form = document.forms["formFecha"];}
	
	// validamos el largo de la contraseña	
	if (form.txtpassword.value.length < 5){
		document.getElementById('lblerrorpassword').innerHTML = 'la contrase&ntilde;a debe tener m&atilde;s de 5 caracteres';
		bError = true;	}
	else{
		document.getElementById('lblerrorpassword').innerHTML = '';
	}
	
	// validamos si las contraseños son iguales
	if (form.txtpassword.value != form.txtpassword2.value){
		document.getElementById('lblerrorpassword').innerHTML = 'las contrase&ntilde;a no coincide';
	    bError = true; }
	
	
	var vFecha = 0
	if (form.seleccionaMes.selectedIndex==0) vFecha++;
	if (form.seleccionaDia.selectedIndex==0) vFecha++;
	if (form.seleccionaAnyo.selectedIndex==0) vFecha++;
	
	if (vFecha != 0 && vFecha != 3){
		document.getElementById('lblerrorfecha').innerHTML = 'debe indicar la fecha completa';
		bError = true;}		
		
	if (form.cboestado.selectedIndex > 0 && form.cbociudad.selectedIndex==0){
		document.getElementById('lblerrorciudad').innerHTML = 'debe especificar la Ciudad';
		bError = true;}	
	
	if (form.txtApellidoAux.value=="" && bError == false){
		alert("Escriba su apellido como muestra que acepto el contrato");
		form.txtApellidoAux.focus();
		bError = true;
	}
	
	if (form.txtApellidoAux.value != form.txtapellido.value && bError == false){
		alert("El apellido debe ser igual al que indico")
		form.txtApellidoAux.focus();
		bError = true;
	}	
	return !bError;
}
