	var requiredFields = new Array("txtUserId", "txtPassword", "txtEmail", "txtZip", "txtFirstName", "txtLastName");
    	var fieldNames = new Array("User ID", "Password", "Email Address", "Zip / Postal Code", "First Name", "Last Name");   
	var FormOK = UserIdOK = PasswordOK = EmailOK = ZipOK = FNameOK = LNameOK = true;

function checkFields(input) {
	
	if (document.theForm.optTitle.value==null){
		if (document.theForm.optTitle[0].checked==false){
			if (document.theForm.optTitle[1].checked==false){
				if (document.theForm.optTitle[2].checked==false){
					if (document.theForm.optTitle[3].checked==false){
						alert("The Title field requires valid input"); return false;
					}
				}		
			}	
		}	
	}
	
	if (!(checkRequiredFields2(input))) {return false;}	
	if (!(UserIdOK)) { alert("The User ID field requires valid input"); return false; }
	if (!(PasswordOK)) { alert("The Password field requires valid input"); return false; }
	//if (!(Password2OK)) { alert("The Password Again field requires valid input"); return false; }		
	if (!(EmailOK)) { alert("The Email field requires valid input"); return false; }
	if (!(ZipOK)) { alert("The Zip / Postal Code field requires valid input"); return false; }			
	if (!(FNameOK)) { alert("The First Name field requires valid input"); return false; }
	if (!(LNameOK)) { alert("The Last Name field requires valid input"); return false; }	
	else {
	return true; 
	}	
}	
		
function checkRequiredFields2(input)
{             
   
    var fieldCheck   = true;
    var fieldsNeeded = "\nA value must be entered in the following field(s):\n\n\t";

    for(var fieldNum=0; fieldNum < requiredFields.length; fieldNum++) {
        if ((input.elements[requiredFields[fieldNum]].value == "") ||
            (input.elements[requiredFields[fieldNum]].value == " ")) {

            fieldsNeeded += fieldNames[fieldNum] + "\n\t";
            fieldCheck = false;
        }
    }
  
    if (fieldCheck == true)
    {
		FormOK = true
        return true;
    }

    else
    {
		FormOK = false
        alert(fieldsNeeded);
        return false;
    }
}
	
function ifEmpty(s)
{   
	return ((s == null) || (s.length == 0))
}

function isWhitespace (s)
{   
	var i;
	var whitespace = " \t\n\r";
	
    if (ifEmpty(s)) return true;

    for (i = 0; i < s.length; i++)
    {   

	var c = s.charAt(i);

	if (whitespace.indexOf(c) == -1) return false;
    }

    return true;
}

function isEmail (s)
{   
	if (ifEmpty(s)) 
       if (isEmail.arguments.length == 1) return alert('Please Enter Email Address');
       else return (isEmail.arguments[1] == true);
   
    if (isWhitespace(s)) return alert('invalid email1');
    
    var i = 1;
    var sLength = s.length;

    while ((i < sLength) && (s.charAt(i) != "@"))
    { i++
    }

    if ((i >= sLength) || (s.charAt(i) != "@")) return alert('Invalid Email Address without  "@" ');
    else i += 2;

    while ((i < sLength) && (s.charAt(i) != "."))
    { i++
    }

    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return alert('Invalid Email Address without  "." ');
    else return true;
}		

function checkPassword(checkString) 
{
	if ((checkString.length >= 4) && (checkString.length <=16)) 
		{ return checkString; }
	else
		{ 
		 alert('Invalid Password, Password must be 4 - 16 characters in length');
		return (''); 
		}
}

function ForceStrings3(fieldvalue,fieldname){
	var tot=0
		for (i = 0; i < fieldvalue.length ; i++) 
		{
    		ch = fieldvalue.substring(i, i+1);
        
		if (!( (ch >= "a" && ch <= "z") || (ch >= "A" && ch <= "Z" )  || (ch >="0"  && ch <= "9") )  )
			{
		   tot=tot+1;
			}
		}
	if (tot>=1)
	{
		alert('Please Enter Only AlphaNumeric Characters in ' + fieldname + ' field'); 
		document.theForm.elements[fieldname].value = "" ;
	}
} 

function Focus()
{
    document.theForm.txtUserId.focus(); 
}
