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 chkfirst_name(){
	if(document.registration.first_name.value == ""){
		document.getElementById("chkfirst_name").innerHTML = "Please Enter First Name!.";
	}
	else{
		document.getElementById("chkfirst_name").innerHTML = "";
	}
}

function chklast_name(){
	if(document.registration.last_name.value == ""){
		document.getElementById("chklast_name").innerHTML = "Please Enter Last Name!.";
	}
	else{
		document.getElementById("chklast_name").innerHTML = "";
	}
}


function chkdisplay_name(){
	if(document.registration.display_name.value == ""){
		document.getElementById("chkdisplay_name").innerHTML = "Please Enter Display Name!.";
	}
	else{
		document.getElementById("chkdisplay_name").innerHTML = "";
	}
}


function chkgender(){
	if(document.registration.gender.value == ""){
		document.getElementById("cgender").innerHTML = "Please Choose Gender!.";
	}
	else{
		document.getElementById("cgender").innerHTML = "";
	}
}


function chkuname_owner1(){
	if(document.registration.user_name.value == ""){
		document.getElementById("chkuname").innerHTML = "Please Enter User Name!.";
	}
	if(document.registration.user_name.value != ""){
		xmlhttp = GetXmlHttpObject()
		var user_name = document.registration.user_name.value;
		var query = "user_name="+user_name;
		document.getElementById("chkuname").innerHTML = "<span class='smallred'>Checking...</span><img src=images/icon_loading.gif />";
		xmlhttp.onreadystatechange=function(){
		if (xmlhttp.readyState==4)
		  { 
			document.getElementById("chkuname").innerHTML=xmlhttp.responseText;
		  }
		}
		xmlhttp.open("GET","pass.php?block=main&go=registerview_owner&"+query,true)
		xmlhttp.send(null)
	}
}
function check_password(){
	//alert(document.registration.password1.value);
	if(document.registration.password1.value == ""){
		document.getElementById("password_chk").innerHTML = "Please Specify a Password.";
	}
	if(document.registration.password1.value != ""){
		if(document.registration.password1.value.length<6){
			document.getElementById("password_chk").innerHTML = "Password Chosen Must be Minimum 6 Characters Long.";
			document.registration.password1.value = "";
			document.registration.password1.focus();
		}else{
			document.getElementById("password_chk").innerHTML = "";
		}
	}
}

function check_conpassword(){
	if(document.registration.conpassword.value == ""){
		document.getElementById("conpassword_chk").innerHTML = "Please Specify Confirm Password.";
	}
	if(document.registration.conpassword.value != ""){
		if(document.registration.conpassword.value != document.registration.password1.value){
		document.getElementById("conpassword_chk").innerHTML = "Your Passwords Entries Do Not Match.";
		document.registration.conpassword.value = "";
		var i=1;
		}else{
		document.getElementById("conpassword_chk").innerHTML = "";
		}
	}
}
function check_email1(){
	if(document.registration.email.value == ""){
		document.getElementById("email_chk").innerHTML = "Please Specify Your Email Id!.";
	}
	if(document.registration.email.value != ""){
		var str=document.registration.email.value;
	  	var filter=/^.+@.+\..{2,3}$/;
		if(!filter.test(str)){
			document.getElementById("email_chk").innerHTML = "Please Enter a Valid Email Id!!.";
		}else{
			xmlhttp = GetXmlHttpObject()
			var email = document.registration.email.value;
			var query = "email="+email;
			
			document.getElementById("email_chk").innerHTML = "<span class='ajaxmsg'>Checking...</span><img src=images/icon_loading.gif />";
			xmlhttp.onreadystatechange=function(){
			if (xmlhttp.readyState==4)
			  { 
				document.getElementById("email_chk").innerHTML=xmlhttp.responseText;
			  }
			}
			xmlhttp.open("GET","pass.php?block=main&go=checkemail_owner&"+query,true)
			xmlhttp.send(null)
		}
	}
}
function chkuname1(id){
	if(document.registration.varification.value == ""){
		document.getElementById("chkuname1").innerHTML = "Please Enter Verification Code.";
		pass=1;
	}
	if(document.registration.varification.value != ""){
		xmlhttp = GetXmlHttpObject()
		var uname = id.value;
		var query = "uname="+uname;
		document.getElementById("chkuname1").innerHTML = "<span class='ajaxmsg'>Checking...</span><img src=images/icon_loading.gif />";
		xmlhttp.onreadystatechange=function(){
		if (xmlhttp.readyState==4)
		  { 
			chck = xmlhttp.responseText;
			document.getElementById("chkuname1").innerHTML=xmlhttp.responseText;
			return false;
		  }
		}
		xmlhttp.open("GET","pass.php?block=main&go=checkcode&"+query,true)
		xmlhttp.send(null)
	}
}	

function check(){
	var pass = 0;
	// First Name
	if(document.registration.first_name.value != ""){
			if(document.getElementById("chkfirst_name").value == "No"){
				document.registration.user_name.value = ""
				document.registration.user_name.focus();
				document.getElementById("chkfirst_name").innerHTML = "Please! Enter first name";
				pass=1;
			}
	}else{
		document.getElementById("chkfirst_name").innerHTML = "Please! Enter first name";
		pass=1;
	}

	if(document.registration.last_name.value != ""){
			if(document.getElementById("chklast_name").value == "No"){
				document.registration.user_name.value = ""
				document.registration.user_name.focus();
				document.getElementById("chklast_name").innerHTML = "Please! Enter last name";
				pass=1;
			}
	}else{
		document.getElementById("chklast_name").innerHTML = "Please! Enter last name";
		pass=1;
	}
	
	if(document.registration.display_name.value != ""){
			if(document.getElementById("chkdisplay_name").value == "No"){
				document.registration.user_name.value = ""
				document.registration.user_name.focus();
				document.getElementById("chkdisplay_name").innerHTML = "Please! Enter display name";
				pass=1;
			}
	}else{
		document.getElementById("chkdisplay_name").innerHTML = "Please! Enter display name";
		pass=1;
	}
	
	
	if(document.registration.gender.value != ""){
			if(document.getElementById("chkdisplay_name").value == "No"){
				document.registration.gender.value = ""
				document.registration.gender.focus();
				document.getElementById("gender").innerHTML = "Please Choose Gender!.";
				pass=1;
			}
	}else{
		document.getElementById("gender").innerHTML = "Please Choose Gender!.";
		pass=1;
	}

	
	
	if(document.registration.user_name.value != ""){
			if(document.getElementById("chkusername").value == "No"){
				document.registration.user_name.value = ""
				document.registration.user_name.focus();
				document.getElementById("chkuname").innerHTML = "Please! Enter user name";
				pass=1;
			}
	}else{
		document.getElementById("chkuname").innerHTML = "Please! Enter user name";
		pass=1;
	}
	
	if(document.registration.password1.value == ""){
		document.getElementById("password_chk").innerHTML = "Please Specify a Password.";
		pass=1;
	}
	if(document.registration.password1.value != ""){
		if(document.registration.password1.value.length<6){
			document.getElementById("password_chk").innerHTML = "Password Chosen Must be Minimum 6 Characters Long.";
			pass=1;
			document.registration.password1.value = "";
			document.registration.password1.focus();
		}else{
			document.getElementById("password_chk").innerHTML = "";
		}
	}
	if(document.registration.conpassword.value == ""){
		document.getElementById("conpassword_chk").innerHTML = "Please Specify Confirm Password.";
		pass=1;
	}
	if(document.registration.conpassword.value != ""){
		if(document.registration.conpassword.value != document.registration.password1.value){
		document.getElementById("conpassword_chk").innerHTML = "Your Passwords Do Not Match.";
		pass=1;
		document.registration.conpassword.value = "";
		}else{
		document.getElementById("conpassword_chk").innerHTML = "";
		}
	}
	if(document.registration.email.value != ""){
			if(document.getElementById("email_chk").value == "No"){
				document.registration.email.value = "";
				document.registration.email.focus();
				document.getElementById("email_chk").innerHTML = "Please! Enter Email Address";
				pass=1;
			}
	}else{
		document.getElementById("email_chk").innerHTML = "Please! Enter Email Address";
		pass=1;
	}

	if(document.registration.varification.value  != ""){
			if(document.registration.chkcode.value == "No"){
				document.registration.varification.value = "";
				document.registration.varification.focus();
				document.getElementById("chkuname1").innerHTML = "Please Enter Right Code";
				pass=1;		
			}
	}else{
		document.getElementById("chkuname1").innerHTML = "Please Enter  Code";
		pass=1;		
	}
	
	if(pass == 1){
		return false;
	}
}




