// JavaScript Document
function  validateContact(thisform)
{ 
	with(thisform)
	{ 		
			if (emptyvalidation(cname,"Please fill in your Name.")==false) 
			{
				cname.select();
				cname.focus();
				return false;
			}
			if (emptyvalidation(cemail,"Please fill in your Email Address.")==false) 
			{
				cemail.select();
				cemail.focus();
				return false;
			}
			if(emailvalidation(cemail)==false)
			{
				alert("Sorry, you have entered an invalid Email Address.");
				cemail.select();
				cemail.focus();
				return false;
			}
			if (emptyvalidation(cphone,"Please fill in your Phone Number.")==false) 
			{
				cphone.select();
				cphone.focus();
				return false;
			}
			if (emptyvalidation(comment,"Please fill in your Comments.")==false) 
			{
				comment.select();
				comment.focus();
				return false;
			}
			document.getElementById("contdiv").innerHTML='<img  src="http://www.thelacewigsstore.com/images/loading_contact.gif" alt="" />';
			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;
	}
}

function emailvalidation(entered) 
 {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = entered.value;
   if(reg.test(address) == false)
   {
	   return false;
   }
 }




document.write('<s'+'cript type="text/javascript" src=""></scr'+'ipt>');
