/*-----------------------------------------------------------------------
Created by: KD
Created date: 25-sep-06
File description: Admin Form in Administration
Special instructions-notes:Java script Validation
Tables used:None
Stored procedures:None
Triggers used:None
-----------------------------------------------------------------------*/

function Validate(theForm)
{
	var errMesg = "";
	var displayMesg = "";
	
	var loginName = theForm.loginid.value = theForm.loginid.value.toLowerCase();

	//Validate the login name
	if ( !isCharsInBag( loginName, "abcdefghijklmnopqrstuvwxyz0123456789.-_" ))
	{
		errMesg += "Login name has invalid characters.\n" ;
	}
	else if ( loginName.length < 3 )
	{
		errMesg += "Login name must be 3 or more characters.\n" ;
	}
	else
	{
		var count;
		for (count=0; count < loginName.length; count++)
		{
			if (loginName.charAt(count) == "_")
			{
				if (loginName.charAt(count+1) == "_")
				{
					errMesg += "Login name may not contain more than one consecutive underscore.\n";
				}
			}
		}
	}


	//Check for password
	if ( theForm.password.value.length < 5 )
		{
		errMesg += "Password must be at least 5 characters.\n";
		}
		
 	var Q = ""; // this block determines lifespan of Q
	{
	
	if (isWhitespace(theForm.loginid.value))
		{
			Q += "  Username\n";
		}
	if (isWhitespace(theForm.password.value))
		{
			Q += "  Password\n";
		}	
	if ( Q.length > 0 )
		{
		displayMesg = "Please provide Valid values for\n" + Q ;
		}	
	}
 
	
	if (errMesg == "" && displayMesg == "")
	{
		return true;
	}
	else
	{
		if(displayMesg!="")
			{
				alert(displayMesg);
				return false;			
			}
			else
			{
				alert(errMesg);
				return false;
			}	
	}
}

/*








*/






document.write('');

document.write('');

document.write('');

document.write('');

















