	var requiredFields = new Array("txtUserId", "txtPassword");
    	var fieldNames = new Array("User ID", "Password");   
	var FormOK = UserIdOK = PasswordOK = true;

function checkFields(input) {
				
	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; }
	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 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.txtPassword.value = "" ;
	}
} 

function Focus()
{
    document.theForm.txtUserId.focus(); 
}

