
function  ValidateLoginForm(thisForm)
{	
	if  (!hasValue(thisForm.username, "TEXT" ))
	{
		if  (!onError(thisForm.username, "Please enter your user name!"))
		{
			return false;
		}
	}	
	
	if  (!hasValue(thisForm.password, "PASSWORD" ))
	{
		if  (!onError(thisForm.password, "Please enter your password!"))
		{
			return false;
		}
	}

	return true;
}

function  ValidateClientLoginForm(thisForm)
{	
	if  (!hasValue(thisForm.user_name, "TEXT" ))
	{
		if  (!onError(thisForm.user_name, "Please enter your user name!"))
		{
			return false;
		}
	}	
	
	if  (!hasValue(thisForm.password, "PASSWORD" ))
	{
		if  (!onError(thisForm.password, "Please enter your password!"))
		{
			return false;
		}
	}

	return true;
}

function  ValidateAddEditAdminForm(thisForm)
{	
	if  (!hasValue(thisForm.username, "TEXT" ))
	{
		if  (!onError(thisForm.username, "Please enter user name!"))
		{
			return false;
		}
	}	
	
	if  (!hasValue(thisForm.password, "TEXT" ))
	{
		if  (!onError(thisForm.password, "Please enter password!"))
		{
			return false;
		}
	}	
	
	if  (!hasValue(thisForm.repassword, "TEXT" ))
	{
		if  (!onError(thisForm.repassword, "Please re-enter password for verification!"))
		{
			return false;
		}
	}	
	
	if  (thisForm.password.value != thisForm.repassword.value)
	{
		if  (!onError(thisForm.password, "Passwords don't match!"))
		{
			return false;
		}
	}

	return true;
}



function  ValidateFormGeneric(thisForm)
{	
	if  (!hasValue(thisForm.firstname, "TEXT" ))
	{
		if  (!onError(thisForm.firstname, "Please enter your first name."))
		{
			return false;
		}
	}	
	
	if  (!hasValue(thisForm.lastname, "TEXT" ))
	{
		if  (!onError(thisForm.lastname, "Please enter your last name."))
		{
			return false;
		}
	}
	
	if  (!hasValue(thisForm.address, "TEXT" ))
	{
		if  (!onError(thisForm.address, "Please enter your address."))
		{
			return false;
		}
	}
		
	if  (!hasValue(thisForm.city, "TEXT" ))
	{
		if  (!onError(thisForm.city, "Please enter your city."))
		{
			return false;
		}
	}
	
	if  (!hasValue(thisForm.zip, "TEXT" ))
	{
		if  (!onError(thisForm.zip, "Please enter your ZIP code."))
		{
			return false;
		}	
		else return true;        
	}
	
	if  (!checkzip(thisForm.zip.value))
	{
		if  (!onError(thisForm.zip, "Please enter a valid ZIP code."))
		{
			return false;
		}
	}	
	
	if  (!hasValue(thisForm.phone, "TEXT" ))
	{
		if  (!onError(thisForm.phone, "Please enter your phone number."))
		{
			return false;
		}
	}
	
	if  (!checkphone(thisForm.phone.value))
	{
		if  (!onError(thisForm.phone, "Please enter a valid phone number."))
		{
			return false;
		}
	}
	
	if  (!hasValue(thisForm.email, "TEXT" ))
	{
		if  (!onError(thisForm.email, "Please enter your email address."))
		{
			return false;
		}
	}
	
	if  (!checkemail(thisForm.email.value))
	{
			return false;
	}
	
	if  (!hasValue(thisForm.date, "TEXT" ))
	{
		if  (!onError(thisForm.date, "Please enter purchase date."))
		{
			return false;
		}
	}
	
	if  (!checkdate(thisForm.date.value))
	{
		if  (!onError(thisForm.email, "Please enter a valid purchase date."))
		{
			return false;
		}
	}
	
	if  ((!hasValue(thisForm.search_zip, "TEXT" )) && (!hasValue(thisForm.search_city, "TEXT" )))
	{
		if  (!onError(thisForm.email, "Please enter a search zip or city."))
		{
			return false;
		}
	}
	
	if  (hasValue(thisForm.search_zip, "TEXT" ))
	{
		if  (!checkzip(thisForm.search_zip.value))
		{
			if  (!onError(thisForm.search_zip, "Please enter a valid ZIP code."))
			{
				return false;
			}
		}
		else return true;
	}
	
	return true;
}
