/*
------------------------------
Created by: Ravi Kachariya
Created date: 07 Oct 2008
File description: Supply Us - validation 
Special instructions-notes: Javascript Validation
Tables used: none
Stored procedures: none
Triggers used: none
--------------------------------
*/

function validatesupplyus(theForm)
{	
	/*alert('Hi');
	return false;*/
	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;
	}
	
	/*if (isWhitespace(theForm.company_name.value))
	{
		alert("Please enter your company name.");
		theForm.company_name.focus();
		return false;
	}
	else if(!isCharsInBag(theForm.company_name.value, " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.&' "))
	{
		alert("Your company name contains invalid characters.");
		theForm.company_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.phone.value))
	{
		alert("Please enter your phone number");
		theForm.phone.focus();
		return false;
	}			
	else if(!isCharsInBag(theForm.phone.value, "0123456789-+ "))
	{
		alert("Your phone number contains invalid characters.");
		theForm.phone.focus();
		return false;
	}
	if (isWhitespace(theForm.subject.value))
	{
		alert("Please subject name.");
		theForm.subject.focus();
		return false;
	}
		
	if (isWhitespace(theForm.details.value))
	{
		alert("Please enter detail of your requirements.");
		theForm.details.focus();
		return false;
	}
	
	if (isWhitespace(theForm.qty.value))
	{
		alert("Please enter quantity of product required.");
		theForm.qty.focus();
		return false;
	}
	else if(!isCharsInBag(theForm.qty.value, "0123456789"))
	{
		alert("Please enter only numbers for quantity.");
		theForm.qty.focus();
		return false;
	}*/
	
	return true;
}