function registervalidate()
{

	var firstname = document.registration_popupform.firstname.value ;
	var username =  document.registration_popupform.usrname.value ;
	var password =  document.registration_popupform.usrpass.value ;
	var repassword = document.registration_popupform.usrpass.value.value;
	var email =  document.registration_popupform.email.value ;
	var mothername =  document.registration_popupform.mothername.value ;
	var motheremail =  document.registration_popupform.motheremail.value ;

	
		if (document.registration_popupform.firstname.value == '') 
			{
			alert('Please fill in your firstname');
			return false;
			}		
		
		if (document.registration_popupform.usrname.value == '') 
			{
			alert('Please fill in your username');
			return false;
			}		
			if (document.registration_popupform.usrpass.value == '') 
			{
			alert('Please fill in your desired password!');
			return false;
			}
		if (document.registration_popupform.repassword.value == '') 
			{
			alert('Please fill in your password again for confirmation!');
			return false;
			} 
		if (document.registration_popupform.usrpass.value != document.registration_popupform.repassword.value) 
			{
			alert("The two passwords are not identical! "+
			"Please enter the same password again for confirmation");
			return false;
			}
		if (document.registration_popupform.email.value == '') 
			{
			alert('Please fill in your email');
			return false;
			}	
			
		if (document.registration_popupform.mothername.value == '') 
			{
			alert("Please fill in your mother's name");
			return false;
			}		
		if (document.registration_popupform.motheremail.value == '') 
			{
			alert("Please fill in your mother's email");
			return false;
			}	
			
			document.getElementById("txtHint2").innerHTML="Processing Form......";
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {

		  if (xmlhttp.readyState==4 && xmlhttp.status==200)
			{
							var rs = xmlhttp.responseText;
							rs=rs.trim();
							//alert('*'+rs+'*');
							if(rs=='UserName Already exist')

							{
								//alert(rs);
								document.getElementById("txtHint2").innerHTML="UserName Already exist";
								return false;
							}
							else if(rs=='E-Mail Already exist')

							{
								document.getElementById("txtHint2").innerHTML="E-Mail Already exist";
								return false;
							}
							if(Number(rs)>0)
							{
							document.location='setinfo.php?UserID='+rs;
							}
			}
  }
  var url ="setcookie_register.php?f="+firstname+"&u="+username+"&p="+password+"&e="+email+"&mn="+mothername+"&me="+motheremail;
//  alert(url);
xmlhttp.open("GET",url,true);
xmlhttp.send();
}
