/*
------------------------------
Created by: Ketan
Created date: 8th Aug 2007
File description: can't find - validation 
Special instructions-notes: Javascript Validation
Tables used: none
Stored procedures: none
Triggers used: none
--------------------------------
*/

function validatewholesale(theForm)
{	
	if (isWhitespace(theForm.name.value))
	{
		alert("Please enter your name.");
		theForm.name.focus();
		return false;
	}
	else if(!isCharsInBag(theForm.name.value, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' "))
	{
		alert("Your name contains invalid characters.");
		theForm.name.focus();
		return false;
	}

	var email_1 = trimAll(theForm.email.value);
	if (isWhitespace(email_1))
	{		
		alert("Please enter your e-mail address.");
		theForm.email.focus();
		return false;
	}		
	else if(!isEmail(email_1))
	{
	   alert("Please enter your e-mail address in the correct format.");
	   theForm.email.focus();
	   return false;	   
	}	
	else if(!isCharsInBag( email_1, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@._-"))
	{
		alert("Your e-mail address contains invalid characters.");
	    theForm.email.focus();
		return false;
	}	

	if (isWhitespace(theForm.contact.value))
	{
		alert("Please enter your contact number");
		theForm.contact.focus();
		return false;
	}			
	else if(!isCharsInBag(theForm.contact.value, "0123456789-+ "))
	{
		alert("Your contact number contains invalid characters.");
		theForm.contact.focus();
		return false;
	}

	if (isWhitespace(theForm.enquiry.value))
	{
	   alert("Please enter details of your enquiry.");
	   theForm.email.focus();
	   return false;
	}
	
	return true;
}