
var isIE=document.all?true:false;
var isDOM=document.getElementById?true:false;
var isNS4=document.layers?true:false;
var pulsado=false;

/* _w : which ID (1) or (2) */
/* _h : (h)ide or (s)how */
function toggleT(_w,_h) {
  if (isDOM)
  {
    if (_h=='s') document.getElementById(_w).style.visibility='visible';
    if (_h=='h') document.getElementById(_w).style.visibility='hidden';
  }
  else if (isIE) {
    if (_h=='s') eval("document.all."+_w+".style.visibility='visible';");
    if (_h=='h') eval("document.all."+_w+".style.visibility='hidden';");
  }
  else if(isNS4)
  {
    if (_h=='s') eval("document.layers['"+_w+"'].visibility='show';");
    if (_h=='h') eval("document.layers['"+_w+"'].visibility='hide';");
  }
}

function esCaracterEspecial(campo)
{
  var chr;

  for (var i=0;i<campo.value.length;i++)
  {
     chr=campo.value.substring(i,i+1);
     if ( (chr<"0") || (chr.toUpperCase()>"Z") || (chr==" ") || (chr=="?") || (chr=="@") || (chr=="=") || (chr==":") || (chr==";") || (chr=="<") || ( chr==">") )
     {
        if ((chr!="_") && (chr!=".") )
        {
           campo.focus();
           return true;
        }
     }
  }
  return false;
}

function validarMail(campo)
{
var chr;
var arrobas=0;
var puntos=0;
var blancos=0;
if (campo.value.length==0)
{
   alert( "Debe ingresar una dirección de correo válida.");
   campo.focus();
   return false;
}

if (campo.value.length!=0)
{
        for (var i=0;i<campo.value.length;i++)
        {
                chr=campo.value.substring(i,i+1);
                if ( (chr=="@") )
                        arrobas=arrobas+1;
                if ( (chr==".") )
                        puntos=puntos+1;
                if ( (chr==" ") )
                        blancos=blancos+1;
        }

        if ( (blancos!=0) || (arrobas!=1) || (puntos<1) )
        {
                alert("AVISO IMPORTANTE: La dirección de correo que ha ingresado no es correcta. Recuerde que no se admiten espacios en blanco y que debe contener el carácter arroba (@) y el carácter punto (.)");
                campo.focus();
                return false;
        }
}

return true;
}

function validarNulo(campo,dato,texto,tipo){
        if (tipo=="T"){
                if (campo.value.length==0){
                        alert("IMPORTANT: The Field "+texto+" is required.");
                        campo.focus();
                        return false;

                }
		}
        if (tipo=="S") {
                if (campo.selectedIndex==0){alert("IMPORTANT: The Field "+texto+" is required.");
                        campo.focus();
                        return false;
                }
        }
        if (tipo=="C"){
                var chequeado=0;
                for (var i=0;i<document.form1.elements.length;i++){
                        if (document.form1.elements[i].name==dato){
                                if (document.form1.elements[i].checked==true)
                                        chequeado=1;
                        }
                }
 		if (chequeado==0){
                        alert("IMPORTANT: The Field "+texto+" is required.");
                        return false;
        }
}
return true;
}

function esNumero(pTextBox, pErrorMessage){
    if (isNaN(pTextBox.value)){
        pTextBox.focus();
        alert('el campo '+pErrorMessage+' debe ser numérico');
		pTextBox.value="";
		pTextBox.focus();
        return false;
    } 
    else{
        return true;
    }
}

function validarPassword(campo1,campo2){
	
	//if (campo1.value!=campo2.value){
	//alert("IMPORTANTE: Los password suministrados no coinciden.");
	//campo1.focus();
  //  return false;
	//}
return true;	
	} //cierra funcion

function validarFecha(campo,dato,texto,tipo){
        if (tipo=="T"){
                if (campo==0){
                        alert("IMPORTANTE: El campo "+texto+" no debe dejarse en blanco.");
						alert(campo);
                       // campo.focus();
                        return false;

                }
				else {
				alert(campo);
				return campo;
				}
		}
		return true;
}

function enviar(formulario)
{
	formulario.submit();
}
//-->



