function BorraAU(){
  document.AU.cliente.value="";  
  document.AU.pasw.value="";
}

function SBancaNetE (){
	if (document.AU.servicio.selectedIndex > 5){
		document.AU.cliente.disabled=false;	
		document.AU.pasw.disabled=false;			
		BorraAU();
	}
	else{
 	 if (document.AU.servicio.selectedIndex==1){
		BorraAU();
		document.AU.servicio.selectedIndex=0;
		location="https://boveda.banamex.com.mx/englishdir/bankmain.htm";	
	 } 
	 if (document.AU.servicio.selectedIndex==2){
		BorraAU();
		document.AU.servicio.selectedIndex=0;
		location="https://www.bancanetempresarial.banamex.com.mx/englishdir/bankmain.htm";	
	 }
	 if (document.AU.servicio.selectedIndex==3){
		BorraAU();
		document.AU.servicio.selectedIndex=0;
		location="https://www.bancanetempresarial.banamex.com.mx/corresponsal/bankmain.htm";	
	 }
	 if (document.AU.servicio.selectedIndex==5){
		BorraAU();
		document.AU.servicio.selectedIndex=0;
		location="http://www.banamex.com/ebpp/index.html";	
	 }  
	 if (document.AU.servicio.selectedIndex==4){
		BorraAU();
		document.AU.servicio.selectedIndex=0;
		location="https://www.accitrade.com.mx/";	
	 }  
	 if (document.AU.servicio.selectedIndex==0){
		document.AU.cliente.disabled=true;	
		document.AU.pasw.disabled=true;			
		BorraAU();
	 }
	}
}

function abre_ventana(url,nombre){
        opciones="toolbar=yes,scrollbars=yes,location=0,statusbars=0,resizable=yes,menubar=yes";
        open(url,nombre,opciones);
}

function isInteger(s){
    var i;
    for (i = 0; i < s.length; i++){
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function MaxNum(n){   
   if (n.length > 8)
        return false;
   else
        return true;
}

function Producto()
{
if (document.AU.servicio.selectedIndex < 1)
        alert("Plase choose a Site");
else
  if (document.AU.cliente.value=="" || document.AU.pasw.value=="")
        alert("Client and Password are requiered");
  else
  if (document.AU.servicio.selectedIndex!=7 && document.AU.servicio.selectedIndex!=8 && document.AU.servicio.selectedIndex!=4 && !MaxNum(document.AU.pasw.value))
        alert("Password can not be more than 8 characters longer");
  else {
   var serv = document.AU.servicio[document.AU.servicio.selectedIndex].value;
   var argu = document.AU.cliente.value;
   var argp = document.AU.pasw.value;
   document.AU.cliente.disabled=true;	
   document.AU.pasw.disabled=true;	
   document.AU.pasw.value = "";
   document.AU.cliente.value = "";
   document.AU.servicio.selectedIndex=0;
   if (serv == 0) {
        if (!isInteger(argp)){
                document.S0.TIPFIRMA.value=2;
		//alert("Numerico" + document.S0.TIPFIRMA.value);
	}
        else {
                document.S0.TIPFIRMA.value=1;
		//alert("Alfa Numerico" + document.S0.TIPFIRMA.value);
        }
        document.S0.CLN005.value=argu;
        document.S0.MANPN2.value=argp;
        document.S0.submit();
   }
   if (serv == 1) {
        document.S1.USERID2.value=argu;
        document.S1.PASSWORD.value=argp;
        document.S1.EXTRA2.value=argu;
        document.S1.EXTRA3.value=argp;
        document.S1.submit();
   }
   if (serv == 2) {
        document.S2.CLN005.value=argu;
        document.S2.MANPN2.value=argp;
        document.S2.submit();
   }
   if (serv == 3) {
        document.S3.USERID.value=argu;
        document.S3.PASSWORD.value=argp;
	document.S3.EXTRA2.value=argu;
        document.S3.EXTRA3.value=argp;
        document.S3.submit();
   }
   if (serv == 4){
	document.S4.UsrAT.value=argu;
        document.S4.PwdAT.value=argp;
        document.S4.submit();
   }
   if (serv == 5){
        document.aa.usr.value=argu;
        document.aa.psw.value=argp;
        document.aa.submit();
   }
   if (serv == 6){
        document.aa2.usr.value=argu;
        document.aa2.psw.value=argp;
        document.aa2.submit();
   }
   if (serv == 7) {
        document.mail.user.value=argu;
        document.mail.password.value=argp;
        abre_ventana('','mailbanamex');
        document.mail.submit();
   }
   if (serv == 8) {
        document.S9.usuario.value=argu;
        document.S9.pswdmibnmx.value=argp;
        document.S9.submit();
   }
   if (serv == 9) {
        document.BC.USERID.value=argu;
        document.BC.PASSWORD.value=argp;
	document.BC.EXTRA2.value=argu;
        document.BC.EXTRA3.value=argp;
        document.BC.submit();
   }
   if (serv == 10) {
        document.CT.USER.value=argu;
        document.CT.PASSWORD.value=argp;
        document.CT.submit();
   }
  }
}