function regform_onsubmit() 
{

	if(document.regform.du.checked){}
	else
	{
	alert("Please agree with Privacy Policy!");
	return false;
	}

	if(checkspace(document.regform.user_name.value)) {
	document.regform.user_name.focus();
    	alert("Please enter correct username!");
	return false;}

	if(checkspace(document.regform.user_name.value) || document.regform.user_name.value.length < 3 || document.regform.user_name.value.length > 15) {
	document.regform.user_name.focus();
    	alert("Please enter correct username!");
	return false;}

	if(checkspace(document.regform.user_pass.value) || document.regform.user_pass.value.length < 6) {
	document.regform.user_pass.focus();
    	alert("Please enter correct password!");
	return false;}

	if(document.regform.user_pass.value != document.regform.user_pass2.value) {
	document.regform.user_pass.focus();
	document.regform.user_pass.value = '';
	document.regform.user_pass2.value = '';
    	alert("Please enter correct password!");
	return false;}

if(document.regform.user_mail.value.length!=0)
  {
    if (document.regform.user_mail.value.charAt(0)=="." ||        
         document.regform.user_mail.value.charAt(0)=="@"||       
         document.regform.user_mail.value.indexOf('@', 0) == -1 || 
         document.regform.user_mail.value.indexOf('.', 0) == -1 || 
         document.regform.user_mail.value.lastIndexOf("@")==document.regform.user_mail.value.length-1 || 
         document.regform.user_mail.value.lastIndexOf(".")==document.regform.user_mail.value.length-1)
     {
      alert("Please enter correct Email!");
      document.regform.user_mail.focus();
      return false;
      }
   }
 else
  {
   alert("Please enter Email!");
   document.regform.user_mail.focus();
   return false;
   }	 	 
}

function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}