function validate_user(thisform)

{  

	with(thisform)

	{

		

		if(emptyvalidation(name,"Please enter Name.")==false)

		{

			name.focus();

			return false;

		}	

		if(emptyvalidation(companyname,"Please enter Company name.")==false)

		{		

			companyname.focus();

			return false;

		}

		if(emptyvalidation(email,"Please enter Email / Username.")==false)

		{		

			email.focus();

			return false;

		}

		 if(email_validate(email)==false)

		{

			alert("You have entered an invalid Email.");

			email.select();

			email.focus();

			return false;

		}

		/*if(emptyvalidation(address,"Please enter Address.")==false)

		{		

			address.focus();

			return false;

		}

		if(emptyvalidation(country,"Please select a Country.")==false)

		{		

			country.focus();

			return false;

		}

		if(emptyvalidation(state,"Please enter State.")==false)

		{		

			state.focus();

			return false;

		}

		if(emptyvalidation(city,"Please enter City.")==false)

		{		

			city.focus();

			return false;

		}

		if(emptyvalidation(zip,"Please enter Zip.")==false)

		{		

			zip.focus();

			return false;

		}*/

		

		/*if(emptyvalidation(username,"Please enter Username.")==false)

		{		

			username.focus();

			return false;

		}*/

		if(emptyvalidation(password,"Please enter Password.")==false)

		{		

			password.focus();

			return false;

		}

		if(emptyvalidation(c_password,"Please enter Confirm Password.")==false)

		{		

			c_password.focus();

			return false;

		}

		if(password.value!=c_password.value)

		{

		  alert("Password mis-match error!");

		  c_password.focus();

		  c_password.select();

		  return false;

		}

		

		if(emptyvalidation(package,"Please select a Package.")==false)

		{		

			package.focus();

			return false;

		}

		if(thisform.tos.checked==false)

		{

		 alert("Please read the terms of use and agree before proceeding to submit.");

		 return false;

		}

		

	

		var values=new Array(thisform.name.value,thisform.email.value,thisform.companyname.value,thisform.password.value,thisform.package.value,thisform.newsletter.value);

		 document.getElementById('premium-sub').style.display='none';

		document.getElementById("loader-div").innerHTML='<div style="margin-top:200px; margin-left:190px;"><img src="images/ajax-loader.gif"></div></style>';

 

 

doregistration(values);

}



	//thisform.submit();

}

xmlHttp=GetXmlHttpObject();

function doregistration(values)

{

   

   var url='http://www.gpablo.com/doregistration.php';

   url=url+"?name="+values[0]+"&email="+values[1]+"&companyname="+values[2]+"&package="+values[4]+"&username="+values[1]+"&password="+values[3]+"&newsletter="+values[5];



   url=url+"&sid="+Math.random();



  xmlHttp.onreadystatechange=register;



  xmlHttp.open("GET",url,true);



xmlHttp.send(null);



} 

function register() 

	{ 

	  if (xmlHttp.readyState==4 || xmlHttp.readyState=='complete' )

	                {

					    var result=xmlHttp.responseText;

						

						if(result!='No')

						{						  

						  

						  result+='<span style="align:left"><br><br><a href="login.php"><strong>Click here</strong></a> to login to your administrative area. You can add sites for scanning.</span>';

						  document.getElementById('inner-content-left').style.display='none';

						  document.getElementById('inner-content-left-thanks').style.display='Block';

						}

						else

						{

						  result+='<span style="align:left"><br><br>Registration failed.Username already exists.</span>';

						  document.getElementById('loader-div').style.display='none';

						  document.getElementById("premium-sub").style.display='Block';

						  document.getElementById('emailid').innerHTML='<font color="#cc0000">&nbsp;Email address already exists</font>';

						  //document.getElementById('inner-content-left-error').style.display='Block';

						}

						

						

						

					}						    

	}	





function reset_adduser(arg)

{

  arg.name.value='';

  arg.email.value='';

  arg.address.value='';

  arg.country.value='';

  arg.state.value='';

  arg.city.value='';

  arg.zip.value='';

  arg.package.value='';

  //arg.username.value='';

  arg.password.value='';

}

/*common files*/

function email_validate(objForm) 

 {

	

   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;

   var address = objForm.value;

   if(reg.test(address) == 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;

	}

}

 function GetXmlHttpObject()

{

	var xmlHttp=null;

	try

		{ 

		// Firefox, Opera 8.0+, Safari

		xmlHttp=new XMLHttpRequest();

		}

	catch (e)

		{

		// Internet Explorer

				try

				{

					xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");

				}

		catch (e)

				 {

					 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");

			

				}

		}

  

     return xmlHttp;

}

/*########################################*/

function GetXmlHttpObject()

{

	var xmlHttp=null;

	try

		{ 

		// Firefox, Opera 8.0+, Safari

		xmlHttp=new XMLHttpRequest();

		}

	catch (e)

		{

		// Internet Explorer

				try

				{

					xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");

				}

		catch (e)

				 {

					 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");

			

				}

		}

  

     return xmlHttp;

}
