   function popvalidation(thisform)
	{ 
	with (thisform)
	{
		 	if (emptyvalidation(pname,"Please fill in your Name.")==false) 
			{
				pname.select();
				pname.focus();
				return false;
			}
			
			if (emptyvalidation(pphone,"Please fill in your Phone.")==false) 
			{
				pphone.select();
				pphone.focus();
				return false;
			}

			if (emptyvalidation(pemail,"Please fill in your Email Address.")==false) 
			{
				pemail.select();
				pemail.focus();
				return false;
			}
			 if(emailvalidation(pemail)==false)
			{
				alert("Sorry, You have entered an invalid Email Address.");
				pemail.select();
				pemail.focus();
				return false;			
			}
			
		   if (emptyvalidation(pcomments,"Please fill in your Comments.")==false) 
			{
				pcomments.focus();
				return false;
			}
			
			if($('#userdigit_pop').val()=='Enter Verification Code')
			{
			   alert("Please enter the Verification Code.");
			   $('#userdigit_pop').focus();$('#userdigit_pop').select(); 
			   $('#submit_btn1').show();$('#wait1').hide();
			   return false;
			}   		
		      validateCaptcha_pop('process_pop.php',thisform.userdigit_pop.value,thisform);
		      return false;
			
		  $("#submit_btn").hide();
		  $('#wait').show();
		  $('#wait').html('<img  src="images/send.gif" alt=""  /><font color=#633e0a> Please Wait...</font>'); 
		  var pasurlq='email-validate.php';
		  quick_checkemaildomain('quick_check_email',document.popcontact.pemail.value,pasurlq);				
		
	}
}

function validateCaptcha_pop(filename,code,thisform)
{
   $.post(filename,{userdigit:$.trim(code)},
              function(data)
			  {
			       data=$.trim(data);
				   if(data=='yes')
				   {
				       thisform.submit();
				    }
				   else
				  {
				       alert("Verification Code Mismatch.");
				       $('#userdigit_pop').focus();
					   $('#userdigit_pop').select();
					   $('#submit_btn1').show();$('#wait1').hide();
					   captcha_refresh_pop();
				       return false;
				  } 
			 });
		return false;		 		
}
function captcha_refresh_pop()
{
 	$("#button_div_pop").attr('src','popup-button.php?'+Math.random());
    return false;
	
}




function quick_checkemaildomain(field,argVal,argurl)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
} 

var url=argurl 
url=url+"?pemail="+argVal
url=url+"&sid="+Math.random()
if(field=='quick_check_email')
xmlHttp.onreadystatechange=quick_check_email;
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function quick_check_email() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
			if(xmlHttp.responseText==0) 
			{
			 $("#submit_btn1").show();
			 $('#wait1').hide();
			 alert("Sorry, you have entered an invalid Email Address.");
			 document.popcontact.pemail.focus();
			 document.popcontact.pemail.select();
			 return false;
			}
			else
			{
	       	 document.popcontact.submit();  
			}		 
	} 
	return false;
}
function GetXmlHttpObject()
{ 
	var objXMLHttp=null
if (window.XMLHttpRequest)
{
	objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
	objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
	return objXMLHttp
}
function emailvalidation(thisform) {

   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = thisform.value;
   var email = address.split(',');
   
   for (var i = 0; i < email.length; i++) {
   if(reg.test(email[i]) == false) {
     // alert('Invalid Email Address');
      return false;
   }
   }
}
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;
	}
}

