// JavaScript Document
<!--
function OpenHelp(url){
	
	open(url, "_blank", "width=400,height=400,toolbar=no,directories=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no")
}
function OpenStealth(url){
	open(url, "_blank", "width=800,height=600,toolbar=no,directories=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes")
}

function OpenImage(url,w,h){
	open(url, "_blank", "width=" + w + ",height=" + h + ",toolbar=no,directories=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no")
}

<!-- Begin script for signup.cfm

function click(e) { 
	if (document.all) { 
		if (event.button == 2) { 
			alert(sorry); 
			return false; 
		} 
	} 
	if (document.layers) { 
		if (e.which == 3) { 
			return false; 
		} 
	} 
} 

function cancelClick(){ 
	if (document.layers) { 
		document.captureEvents(Event.MOUSEDOWN); 
	} 
	if (!window.print){
		document.onmousedown=click; 
	}
} 

function checkPasswords(){

	var validchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-";
	var temp;
	var pw = document.forms[1].password.value;
	
	if ( pw != document.forms[1].repassword.value){
		alert("the password you re-typed does not match the original password");
		document.forms[1].password.value = "";
		document.forms[1].repassword.value = "";
		return;
	}
	
	for (var i=0; i<pw.length; i++){
		temp = "" + pw.substring(i, i+1);
		if (validchars.indexOf(temp) == "-1"){
		 	alert( "The password you chose contains illegal characters.\n" );
			document.forms[1].password.value = "";
			document.forms[1].repassword.value = "";
			return;
		}
	}
		
	if ((pw.length < 4 ) || (pw.length > 24)){ 
		alert("Your password needs to be between 4 and 24 characters long.\n");
		document.forms[1].password.value = "";
		document.forms[1].repassword.value = "";
		return;
	}
	
}

function CheckUserName() {
	var myUserName = document.forms[1].username.value;
	
	if ( checkUseNameforBadChars( myUserName ) == false ){
		document.forms[1].username.value = "";
		document.forms[1].username.style.backgroundColor='ffff00';
		return;
	}
	
	var DateSeed = new Date();
    DateSeed = DateSeed.valueOf();
	var myURL = "checkUserName.cfm?uname=" +myUserName+ "&DateSeed=" +DateSeed;
	document.images.invisible.src = myURL;
    CheckCookie(DateSeed, 1);
	
}

 
function UserNameExists( myAtt ) {
   
   var DocCookies = document.cookie;
   var Pos = DocCookies.indexOf("SERVERMESSAGE=");
   if (Pos != -1) {
      var StartPos = Pos + 14;
      var EndPos = DocCookies.indexOf(";", StartPos);
      if (EndPos == -1) EndPos = DocCookies.length;
      var CookieVal = DocCookies.substring(StartPos, StartPos+3);
      CookieVal = CookieVal.replace(/\+/g, "%20");
      CookieVal = unescape(CookieVal);
   }
   if ( CookieVal == "yes" ){
   		alert(" The username you selected is already in use, please enter another one"); 
		document.forms[1].username.value = "";
		document.forms[1].username.style.backgroundColor='ffff00';
		
   }
   
}

function CheckCookie(DateSeed, CurCount) {

   if (typeof(TimeOutID) == "number") {
      clearTimeout(TimeOutID);
   }
   if (CurCount > 500) {
   		// do something else here if server times out
   		//alert("timed out");
      return false;
   }
   var DocCookies = document.cookie;
   var Pos = DocCookies.indexOf("DateSeed" + DateSeed);
   if (Pos == -1) {
      TimeOutID = setTimeout("CheckCookie('" + DateSeed + "', " + (CurCount + 1) + ")", 50);
	  
   }else {
   	    UserNameExists();
   }
}

function checkABA(s) {

	var i, n, t;
	t = "";
	for (i = 0; i < s.length; i++) {
	    c = parseInt(s.charAt(i), 10);
	    if (c >= 0 && c <= 9)
	    t = t + c;
	}
	
	if (t.length != 9){
	    alert("the bank routing number you entered is invalid, please try again");
		document.forms[1].route.value = "";
		document.forms[1].route.style.backgroundColor='ffff00';
		return false;
	}
	
	n = 0;
	for (i = 0; i < t.length; i += 3) {
	    n += parseInt(t.charAt(i),     10) * 3
	      +  parseInt(t.charAt(i + 1), 10) * 7
	      +  parseInt(t.charAt(i + 2), 10);
	}
	
	 if (n != 0 && n % 10 == 0){
	    return true;
	 }else{
	    alert("the bank routing number you entered is invalid, please try again");
		document.forms[1].route.style.backgroundColor='ffff00';
		document.forms[1].route.value = "";
		return false;
	 }

}

function checkUseNameforBadChars( uname ){
	var validchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-";
	
	if ( ( uname == "backend" ) || ( uname == "images" ) || ( uname == "include" ) || ( uname == "admin" ) || ( uname == "reports" ) ) {
		alert( "You have chosen a username that is already in use, please choose again" );
		return false;
	}
	
	var temp;
	
	for (var i=0; i<uname.length; i++){
		temp = "" + uname.substring(i, i+1);
		if (validchars.indexOf(temp) == "-1"){
		 	alert( "The username you chose contains illegal characters.\n" );
			return false;
		}
	}
		
	if ((uname.length < 4 ) || (uname.length > 24)){ 
		alert("Your username needs to be between 4 and 24 characters long.\n");
		return false;
	}
	
	return true;
}

// -->