function reemplaza(r)
{
	r = r.replace(/Ñ/g,"N");
	r = r.replace(/ñ/g,"n");
	r = r.replace(/Á/g,"A");
	r = r.replace(/á/g,"a");
	r = r.replace(/É/g,"E");
	r = r.replace(/é/g,"e");
	r = r.replace(/Í/g,"I");
	r = r.replace(/í/g,"i");
	r = r.replace(/Ó/g,"O");
	r = r.replace(/ó/g,"o");
	r = r.replace(/Ú/g,"U");
	r = r.replace(/ú/g,"u");
	r = r.replace(/°/g,"o");
	r = r.replace(/ª/g,"a");
	r = r.replace(/'/g," ");
	r = r.replace(/º/g," ");
	return(r)
}

function mayus(f)
{
	nom=window.event.srcElement.name
	eval('cadena=f.'+nom+'.value')
		
eval('f.'+nom+'.value=reemplaza(cadena.toUpperCase())')
} 


function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }

    if (blnResult==false)
     {
         alert("Ingrese sólo números");
     }
   return blnResult;
   }

function Vacio(obj,mensaje)
{
	//alert(obj)
	if (obj.value=="")
	{
		alert(mensaje);
		obj.focus();	
		return false;
	 }
	else
	{return true}
}

function mail(texto){ 

    var mailres = true;             
    var cadena = "abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ1234567890@._-"; 
     
    var arroba = texto.indexOf("@",0); 
    if ((texto.lastIndexOf("@")) != arroba) arroba = -1; 
     
    var punto = texto.lastIndexOf("."); 
                 
     for (var contador = 0 ; contador < texto.length ; contador++){ 
        if (cadena.indexOf(texto.substr(contador, 1),0) == -1){ 
            mailres = false; 
            break; 
     } 
    } 

    if ((arroba > 1) && (arroba + 1 < punto) && (punto + 1 < (texto.length)) && (mailres == true) && (texto.indexOf("..",0) == -1)) 
     mailres = true; 
    else 
	  mailres = false; 
                 
    
    if (mailres==false)
    {
    alert("Email con formato incorrecto");
    }
    
    return mailres; 
} 


// No ingresar números

function KeyIsCharacter(evt)
{
    var isNav = (navigator.appName.indexOf("Netscape") != -1) 
    var isIE = (navigator.appName.indexOf("Microsoft") != -1)

    if (isNav) 
    {
        if ( evt.which == 44 || (evt.which>=48 && evt.which<=57 ) )
            return true;
        return false;
    }
    else 
        if (isIE)
        {
            evt = window.event;
            if ( evt.keyCode == 44 || (evt.keyCode>=48 && evt.keyCode<=57 ) )
                return true;
            return false;
        }
        else 
        {
            alert("Su browser no es soportado por esta aplicación");
        }
    return false
}



  
function onlyLetras(e) { 

tecla = (document.all) ? e.keyCode : e.which; // 2
    if (tecla==8) return true; // 3
    patron =/[A-Za-z\s]/; // 4
    te = String.fromCharCode(tecla); // 5
    return patron.test(te); 
} 

