// JavaScript Document
function validate_quickcontact(thisform)
{
	with (thisform)
	{
	//	if(fname.value=="Name")fname.value="";	
	if (emptyvalidation(CName,"Woops! You forgot to fill in your Name")==false) 
		{
		CName.focus();
		return false;	
		}
	if (emptyvalidation(phone,"Woops! You forgot to fill in your Phone Number")==false) 
		{
		phone.focus();
		return false;	
		}
	/*if(email.value=="Email")email.value=""; */	
	if (emptyvalidation(mail_id,"Woops! You forgot to fill in your Email Address")==false) 
		{
		mail_id.focus();
		return false;	
		}	
  var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = thisform.mail_id.value;
  
	if(reg.test(address) == false) 
	{ 
      alert('Woops! You have entered an invalid Email Address');
	  mail_id.focus();
	  mail_id.select();
      return false;
   }
		
	
	if (emptyvalidation(comments,"Woops! You forgot to fill in your Comments")==false) 
		{
		comments.focus();
		return false;	
		}
		
		
	}
	thisform.submit();
}	
function emptyvalidation(entered, alertbox)
{
	with (entered)
	{
		while (value.charAt(0) == ' ')
			value = value.substring(1);
		while (value.charAt(value.length - 1) == ' ')
			value = value.substring(0, value.length - 1);
		if (value==null || value=="")
		{
			if (alertbox!="") alert(alertbox);
			return false;
		}
		else return true;
	}
}

