/*-----------------------------------------------------------------------
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 Q = ""; // this block determines lifespan of Q
	{
	
	if (isWhitespace(theForm.old_password.value))
		{
			Q += "  Old Password\n";
		}	

//Check for password
	if (theForm.old_password.value.length < 6 || theForm.old_password.value.length > 12)
		{
		errMesg += "Old Password must be 6-12 characters.\n";
		}	
		
	if(isWhitespace(theForm.new_password.value))
	{
			Q += "  New Password\n";
	}	
//Check for password
		if(theForm.new_password.value.length < 6 || theForm.new_password.value.length > 12)
	{
		errMesg += "New Password must be 6-12 characters.\n";
	}	
		
	
		if(isWhitespace(theForm.confirm_password.value))
	{
			Q += "  Confirm Password\n";
	}	
//Check for password
	if(theForm.new_password.value!=theForm.confirm_password.value)
	{
		errMesg += "New Password and Confirm Password should be same.\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;
			}	
	}
}

