// JavaScript Document

		fname=""
		lname=""
		uname=""
		pword=""
		
		function first_name_present(fname){
		
			if (fname == ""){
			return false
			}
			
			return true
			
			}
			
		function last_name_present(lname){
		
			if (lname == ""){
			return false
			}
			
			return true
			
			}
			
		function user_name_present(uname){
		
			if (uname == ""){
			return false
			}
			
			return true
			
			}
			
		function pword_length(pword) {
			
			if (pword.length < 6 || pword.length > 10) {
				return false
			}
			
			return true
			
			}
		
/* OLD EMAIL VALIDATION
		
		function valid_email(email) {
			
			invalid_chars = " /:,;"
	
			if (email == "") {	
				return false
			}
			for (i=0; i<invalid_chars.length; i++) {	
				
				bad_char = invalid_chars.charAt(i)
				
				if (email.indexOf(bad_char,0) > -1) {
					return false
				}
			}
		
			atPos = email.indexOf("@",1)
			
			if (atPos == -1) {
				return false
			}
			
			if (email.indexOf("@",atPos+1) != -1) {	
				return false
			}
			
			periodPos = email.indexOf(".",atPos)
			if (periodPos == -1) {					
				return false
			}
			
			if (periodPos+3 > email.length)	{
				return false
			}
			
			return true
		}
*/
			function check_email(email) {
			ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";

			for(i=0; i < email.length ;i++){
			if(ok.indexOf(email.charAt(i))<0){ 
			return (false);
			}	
			} 

			if (document.images) {
			re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
			re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
			if (!email.match(re) && email.match(re_two)) {
			return (-1);		
			} 

			}

			}
		
		function submit_form(signup) {
							
				fname=signup.fname.value;
				lname=signup.lname.value;
				uname=signup.uname.value;
				pword=signup.password.value;
				
				if(document.all || document.getElementByID){
				// change the color of text field
				signup.email.style.background = "white";
				signup.fname.style.background = "white";
				signup.lname.style.background = "white";
				signup.uname.style.background = "white";
				signup.password.style.background = "white";
				signup.email.style.background = "white";
				}

/* OLD EMAIL VALIDATION
			//if (!valid_email(signup.email.value)) {
				//alert("Your email address is invalid.")
				//signup.email.focus()
				//signup.email.select()
				//return false
			//}
*/
			if(!check_email(signup.email.value)){
			alert("Your email address is invalid.");
			signup.email.focus();
			signup.email.select()
			signup.email.value = "Please enter a valid email address.";
			// if the browser is Netscape 6 or IE
			if(document.all || document.getElementByID){
			// change the color of text field
			signup.email.style.background = "yellow";
			}
			// make sure the form is not submitted
			return false;
			}
			
			if (!first_name_present(signup.fname.value)){
				alert("First name is a required field.")
				signup.fname.focus()
				signup.fname.select()
				
				if(document.all || document.getElementByID){
				// change the color of text field
				signup.fname.style.background = "yellow";
				}
				return false
				
			}
			
			if (!last_name_present(signup.lname.value)){
				alert("Last name is a required field.")
				signup.lname.focus()
				signup.lname.select()
				if(document.all || document.getElementByID){
				// change the color of text field
				signup.lname.style.background = "yellow";
				}
				return false
				
			}
			
			if (!user_name_present(signup.uname.value)){
				alert("Username is a required field.")
				signup.uname.focus()
				signup.uname.select()
				if(document.all || document.getElementByID){
				// change the color of text field
				signup.uname.style.background = "yellow";
				}
				return false
				
			}
			
			if (!pword_length(signup.password.value)) {
				alert("Your password must be between 6 and 10 characters in length.")
				signup.password.focus()
				signup.password.select()
				if(document.all || document.getElementByID){
				// change the color of text field
				signup.password.style.background = "yellow";
				}
				return false
			}
			
			return true
		}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}