function ValidateForm(frm){
		if(frm.x_UserName.value	== ''){
			alert("Username is empty")
			frm.x_UserName.focus()
			return false			
		}
		em	=	frm.x_UserEmail.value;
		if(em==''){
			alert("Empty Email Address")
			frm.x_UserEmail.focus()
			return false			
		}else{
			if(echeck(em)==false){
				alert("Improper Email Address")
				frm.x_UserEmail.focus()
				return false
			}else{
				if(frm.ueexist.value == 1){
				alert("Email Address already registered.")
				frm.x_UserEmail.focus()
				return false					
				}
			}
		}
		if(frm.x_UserPassword.value	== ''){
			alert("Password is empty")
			frm.x_UserPassword.focus()
			return false
		}else{
			if(frm.x_UserPassword.value.length < 6){
			alert("Minimum pasword length should be 6 characters")
			frm.x_UserPassword.focus()
			return false				
			}
		}
		if(frm.Cx_UserPassword.value	== ''){
			alert("Confirm Password is empty")
			frm.Cx_UserPassword.focus()
			return false			
		}
		if(frm.Cx_UserPassword.value != frm.x_UserPassword.value){
			alert("Password does not match")
			frm.x_UserPassword.focus()
			return false			
		}
		if(frm.x_FirstName.value	== ''){
			alert("First Name is empty")
			frm.x_FirstName.focus()
			return false			
		}
		if(frm.x_LastName.value	== ''){
			alert("Last Name is empty")
			frm.x_LastName.focus()
			return false			
		}
		if(frm.x_Gender.value	== ''){
			alert("Gender not selected")
			frm.x_Gender.focus()
			return false			
		}
		if(frm.x_Addrerss.value	== ''){
			alert("Address is empty")
			frm.x_Addrerss.focus()
			return false
		}
	//location
	loct	=	frm.LocType.value;
	if(loct=='IN'){
		if(frm.x_Country.value	== ''){
			alert("Country is empty")
			//frm.x_Country.focus()
			return false			
		}			
		if(frm.x_State.value	== ''){
			alert("State is empty")
			//frm.x_State.focus()
			return false			
		}			
		if(frm.x_City.value	== ''){
			alert("City is empty")
			//SSSSfrm.x_City.focus()
			return false			
		}
			
	
	}else{
	//other country	
		if(frm.OtherCountry.value!=''){
			frm.x_Country.value	=	frm.OtherCountry.value		
		}else{
			alert("Country name is empty")
			frm.OtherCountry.focus()
			return false;
		}
		if(frm.OtherState.value!=''){
			frm.x_State.value	=	frm.OtherState.value		
		}else{
			alert("State name is empty")
			frm.OtherState.focus()
			return false;			
		}
		if(frm.OtherCity.value!=''){
			frm.x_City.value	=	frm.OtherCity.value
		}else{
			alert("City name is empty")
			frm.OtherCity.focus()
			return false;				
		}
	}
/*	if(frm.OtherCountry.value!='' && frm.OtherState.value!='' && frm.OtherCity.value!=''){
		frm.x_City.value	=	frm.OtherCity.value
		frm.x_State.value	=	frm.OtherState.value		
		frm.x_Country.value	=	frm.OtherCountry.value		
	}else{
		if(frm.x_City.value	== ''){
			alert("City is empty")
			frm.x_City.focus()
			return false			
		}
		if(frm.x_State.value	== ''){
			alert("State is empty")
			frm.x_State.focus()
			return false			
		}				
		if(frm.x_Country.value	== ''){
			alert("Country is empty")
			frm.x_Country.focus()
			return false			
		}
	}*/
	
	///location
		if(frm.x_PhoneNumber.value	== ''){
			alert("Phone Number is empty")
			frm.x_PhoneNumber.focus()
			return false
		}else if(isNaN(frm.x_PhoneNumber.value)){
			alert("Only Numeric Values allowed in Phone Number");
			frm.x_PhoneNumber.focus();
			return false;
		}
		
		if(frm.x_MobileNumber.value	== ''){
		/// do nothing
		}else if(isNaN(frm.x_MobileNumber.value)){
			alert("Only Numeric Values allowed in Mobile Number");
			frm.x_MobileNumber.focus();
			return false;
		}
	}
	
	var uchk = getXmlHttpRequestObject();
	var uem	 = 	getXmlHttpRequestObject();
	function UsernameCheck(username){
		if(username	== ''){
			//alert("Username is Empty");
			return false
		}
		str	= username;
		URL	=	window.location.protocol + '//' + window.location.hostname+pth+'uc.php?un=' + str
		uchk.open("GET", URL, true);
		uchk.onreadystatechange = uch; 
		uchk.send(null);
	}
	
	function uch(){
		if (uchk.readyState == 4) {	
			result		=	uchk.responseText;
			if(result	==	'Yes'){
				document.getElementById("uchres").innerHTML="<div align'center'><b><font color='red'>Username is Unavailable</font></b></div>"
			}else{
				document.getElementById("uchres").innerHTML="<div align'center'><b><font color='green'>Username is Available</font></b></div>"
			}
		}
	}


	function UseremailCheck(username,frm){
		if(username	== ''){
//			alert("Email is Empty");
//			frm.x_UserEmail.focus()
			return false
		}
		em	=	username;
			if(echeck(em)==false){
				//alert("Improper Email Address")
				//frm.x_UserEmail.focus()
				return false
			}	
		
			str	= username;
			URL	=	window.location.protocol + '//' + window.location.hostname+pth+'ue.php?un=' + str
			uchk.open("GET", URL, true);
			uchk.onreadystatechange = ueh; 
			uchk.send(null);
	}	


function UseremailCheck_refer(username,frm, srcElementName, resElementName){
	if(username	== ''){
		alert("Email is Empty");
			if(frm.x_UserEmail!=null){
				frm.x_UserEmail.focus()
			}
		return false
	}
	em	=	username;
	if(!echeck(em)){
		alert("Improper Email Address")
		document.getElementById(srcElementName).focus()
		return false
	}	
	str	= username;
	URL	=	window.location.protocol + '//' + window.location.hostname+pth+'ue.php?un=' + str+'&refer=t'
	uchk.open("GET", URL, true);
	uchk.onreadystatechange = function(){
		result		=	uchk.responseText;
		if(result	==	'Yes'){
			document.getElementById(resElementName).innerHTML="<b><font color='red'>Invalid Email. Already registered/refered with us.</font></b>"
		}else{
			document.getElementById(resElementName).innerHTML="<b><font color='green'>Valid Email. </font></b>"
		}
	} 
	uchk.send(null);
}	
function ueh(){

	if (uchk.readyState == 4) {	
		result		=	uchk.responseText;
		if(result	==	'Yes'){
			document.getElementById("ueres").innerHTML="<b><font color='red'>Invalid Email.Already registered with us.</font><input type='hidden' name='ueexist' value='1'></b>"
		}else{
			document.getElementById("ueres").innerHTML="<b><font color='green'>Valid Email. <input type='hidden' name='ueexist' value='0'></font></b>"
		}
	}
}


function echeck(str){
var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if(str.match(emailRegEx)){
		return true;
	}else{
		return false;
	}
}
function echeck_123(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   //alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   //alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    //alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    //alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    //alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    //alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    //alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}