	var alphabetics ="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var numbers="0123456789";
	var ImgElement = Object;
	var ImgDivElement = Object;
	var userNameAllow = true;
	var usArr = new Array();
	var ipFields = new Array("strusername","strpassword","con_password",
									"strcompanyname","strname","stroccupation","intmonthlyfamilyincome","strdesignation",
									"intcountry","intstate","intcity","intstdcode","strphone","strmobile","stremail",
									"strcompanylogofname","stragentphoto","strcompanyurl",
									"strareaofbusiness","strlanguages","strprimaryoperationcity",
									"intturnover","intyearsofoperation","intpropertiessold",
									"strcompanyprofile","stragentprofile","strbuilderprofile","strreferences","TERMS");
	var strusername = {
		blank:"Please enter a username",
		focus:"Please enter a Username of min 6 characters.",
		min6:"Min 6 characters. Spaces and Special Characters not allowed",
		special:"Username should not have any Spaces or Special Characters not allowed",
		useravailability:"username not available",
		useravailability_yes:"username available"
	};
	var strpassword = {
		blank:"Please enter a password",
		focus:"Please enter a Password of min. 6 characters.",
		min6:"Password should be of min 6 characters",
		special:"Min 6 characters. Spaces and Special Characters not allowed"
	};
	var con_password = {
		blank:"Re-enter the password",
		focus:"Please enter a Password of min. 6 characters.",
		min6:"Password should be of min 6 characters",
		special:"Min 6 characters. Spaces and Special Characters not allowed",
		notmatch:"Passwords do not match",
		usernamematch:"Username and password should not be the same"
	};
	var strcompanyname = {
		focus : {
			corporate : "Please enter the name of your company",
			agent : "Please enter the name of your company",
			builder : "Please enter a Builder Name"
		},
		invalid:"Please avoid use of Special characters"
	};
	var strname = {
		blank:"Please enter your name",
		focus	:"Please enter Contact person's name",
		agentfocus	:"Please enter agent name",
		min3:"Min 3 characters. Numbers and Special Characters not allowed",
		invalid:"Invalid format. Numbers and Special Characters not allowed"
	};
	var stroccupation= {
		focus : 	"Please enter your current occupation",
		invalid: "Invalid format. Special Characters not allowed"
	};
	var intmonthlyfamilyincome = {
		focus : 	"Please enter your monthly income",
		min4:"Min. 4 characters. Please use only numerals",
		invalid:"Invalid format"
	};
	var strdesignation = {
		focus:"Please enter contact person's designation",
		blank : 	"Please enter your designation",
		invalid:"Invalid format. Please use only alphabets"
	};
	var intcountry = {
		blank:"Please select the country you reside in",
		focus:"Please select the country you reside in"
	};
	var intstate = {
		blank:"Please select the state you reside in",
		focus:"Please select the state you reside in"
	};
	var intcity= {
		blank:"Please select the city you reside in",
		focus:"Please select the city you reside in"
	};
	var intcountrycode = {
		invalid:"Please enter valid Country code",
		blank:"Provide Country code",
		focus:"Provide Country code"
	};
	var intstdcode = {
		invalid:"Please enter a valid Area code. Code should be of min 2 characters",
		blank:"Please enter your Area code",
		focus:"Please enter your Area code"
	};
	var strphone = {
		stdAvail:"Please provide landline no",
		invalid:"Please enter a valid phone number",
		focus:"Please enter a valid phone number",
		min6:"Landline should be of min 6 characters",
		blank:"Mandatory to enter either a landline or mobile no."
	};
	var strmobile = {
		invalid:"Your mobile no should be numeric of min 10 digits.",
		blank:"Mandatory to enter either a landline or mobile no.",
		focus:"Please enter your Mobile Number. Do not prefix +"
	};
	var stremail = {
		blank:"Please enter a valid email id",
		focus:"Please enter a valid email id",
		invalid:"Invalid format",
		special:"Enter valid email id to receive email enquiries"
	};
	var strcompanylogofname = {
		focus:"Please upload your logo",
		invalid:"Please make sure the image type should be JPG/GIF"
	};
	var stragentphoto = {
		focus:"Please upload your logo",
		invalid:"Please make sure the image type should be JPG/GIF"
	};
	var strlanguages = {};
	var strprimaryoperationcity= {
		focus:"Please type cities of operation",
		invalid:"Invalid format. Special characters not allowed"
	};
	var strcompanyurl = {
		focus:"Please mention your website url",
		blank:"Please mention your website url",
		invalid:"Invalid format. Special characters not allowed",
		special:"Invalid format. Special characters not allowed"
	};
	var strareaofbusiness= {
		blank:"Please mention the areas of business",
		focus:"Please mention the areas of business",
		invalid:"Invalid format. Special characters not allowed"
	};
	var strcompanyprofile= {
		focus:"Please type your profile",
		invalid:"Invalid format. Special characters not allowed",
		max1000:"Maximum 1000 characters only"
	};
	var intturnover = {
		focus:"Please enter your annual turnover",
		invalid:"Invalid format."
	};
	var intyearsofoperation = {
		blank:"Please select no of years of operation"
	};
	var intpropertiessold = {
		blank:"Please select no. of transactions completed"
	};
	var stragentprofile= {
		focus:"Please type your profile",
		invalid:"Invalid format. Special characters not allowed",
		max1000:"Maximum 1000 characters only"
	};
	var strreferences={
		focus:"Please mention references if any",
		invalid:"Invalid format. Special characters not allowed"
	};
	var strbuilderprofile={
		focus:"Please type your profile",
		invalid:"Invalid format. Special characters not allowed",
		max5000:"Maximum 5000 characters only"
	};
	var TERMS={
		blank:"Please accept the terms and condition"
	};
	
	
	function navigate_usertype(Obj)
	{
		d.getElementById('usertype_hint').style.display="none";
		d.getElementById('username_hint').style.display="none";
		if(Obj.value=="A")
		{
			d.getElementById('usertype_hint').style.display="";
			d.getElementById('username_hint').style.display="";
		}
		d.getElementById('Div_user_type').style.display = "none";
		ShowHideuserDetails(Obj.value,1);
		ShowProfileDetails(Obj.value,1);
		var e = d.getElementById("func");
		if(Obj.value=="A"){e.value="memberagent";}
		else if(Obj.value=="B"){e.value="memberbuilder";}
		else{e.value="memberindividual";}
	}
	function SendRequest4UserName(e){
		try{
			var xmlHTTP = new getHTTPObject;
			d.getElementById("Div_strusername_availability").innerHTML = ip.loading("Checking username availability... Please wait...");
			d.getElementById("Div_strusername_availability").style.display ="";
			url="ajax.php?q=checkusername~"+e.value;
			xmlHTTP.open("GET", url, true);
			xmlHTTP.onreadystatechange = function(){
				if (xmlHTTP.readyState == 4) {
					var res =xmlHTTP.responseText;
					res=parseInt(res);
					userNameAllow = (res==1) ? false : true;
					/*usArr[usArr.length-1][1] = userNameAllow;*/
					d.getElementById("Div_strusername_availability").innerHTML = (res==1) ? strusername.useravailability : strusername.useravailability_yes;
					d.getElementById("Div_strusername_availability").style.display = (res==1) ? "" : "none";
					try{if(res==1) d.frmnew.strusername.focus();}catch(e){ip.traceErr(e,"usernameValidate_Focus","quickreg");}
				}
			};
			xmlHTTP.send(null);
		}catch(e){ip.traceErr(e,"SendReq4UserName","quickreg");}
	}
	
	function ShowHideuserDetails(usertype,Option)
	{
		Obj = (d.getElementById("userDetails")) ? d.getElementById("userDetails") : "undefined";
		if(Obj=="undefined") return;
		Obj.innerHTML = '<div style="padding:0px 10px;">'+ ip.loadingStr +'<div>';
		d.getElementById("registration").disabled=true;
		if(Option==1)
		{
			var url="ajax.php?q=userdetails~"+usertype;
			try
			{
				var xmlHTTP4userDetails = new getHTTPObject;
				xmlHTTP4userDetails.open("POST", url, true);
				xmlHTTP4userDetails.onreadystatechange = function(){
					Obj = (d.getElementById("userDetails")) ? d.getElementById("userDetails") : "undefined";
					if(Obj=="undefined") return;
					if (xmlHTTP4userDetails.readyState == 4) {
						Obj.innerHTML = xmlHTTP4userDetails.responseText;
						Obj.style.display="";
						d.getElementById("registration").disabled=false;
//						window.setTimeout("toolTip.createAttributes()",500);
					}
				};
				xmlHTTP4userDetails.send(null);
			}catch(e){ip.traceErr(e,"","quickreg");}
			Obj.style.display="";
		}
	}

	function ShowProfileDetails(usertype, Option){
		Obj = (d.getElementById("profileDetails")) ? d.getElementById("profileDetails") : "undefined";
		if(Obj=="undefined") return;
		Obj.innerHTML = '<div style="padding:0px 10px;">'+ip.loadingStr+'<div>';
		d.getElementById("registration").disabled=true;
		if(Option==1){
			var url="ajax.php?q=profiledetails~"+usertype;
			try
			{
				var xmlHTTP4profileDetails = new getHTTPObject;
				xmlHTTP4profileDetails.open("GET", url, true);
				xmlHTTP4profileDetails.onreadystatechange = function handleReq4profileDetails(){
					Obj = (d.getElementById("profileDetails")) ? d.getElementById("profileDetails") : "undefined";
					if(Obj=="undefined") return;
					if (xmlHTTP4profileDetails.readyState == 4) {
						Obj.innerHTML = xmlHTTP4profileDetails.responseText;
						Obj.style.display="";
						d.getElementById("registration").disabled=false;
//						window.setTimeout("toolTip.createAttributes()",500);
					}
				};
				xmlHTTP4profileDetails.send(null);
			}catch(e){ip.traceErr(e,"showProfile","quickreg");}
			Obj.style.display="";
		}
	}
	
	
	
	function SendRequest4fileSize(url){
		try{
			var xmlHTTP4fileSize = new getHTTPObject;
			ImgDivElement.innerHTML = ip.loadingStr;
			ImgDivElement.style.display ="";
			xmlHTTP4fileSize.open("GET", url, true);
			xmlHTTP4fileSize.onreadystatechange = function(){
				if (xmlHTTP4fileSize.readyState == 4) {
					var res = parseInt(xmlHTTP4fileSize.responseText);
					ImgDivElement.innerHTML = (res>1) ? "" : strcompanylogofname.invalid;
					ImgDivElement.style.display= (res>1) ? "none" : "";
					ImgElement.focus();
				}
			};
			xmlHTTP4fileSize.send(null);
		}catch(e){ip.traceErr(e,"fileSize","quickreg");}
	}
	function tipShowError_OnSubmit(e){
		if(!e || e=="undefined") return false;
		toolTip.obj = e;
		toolTip.DivObj = d.getElementById("Div_"+e.name);
		var scrX = Number(toolTip.xCord);
		var scrY = Number(toolTip.yCord);
		var tp = parseInt(scrY+15);
		var lt = parseInt(scrX+10);
		var status = tipStatus(toolTip.obj,"message");
		if(status!=0){
			toolTip.DivObj.innerHTML = status;
			toolTip.DivObj.style.display="";
			toolTip.DivObj.style.opacity = '.1';
			toolTip.DivFade(10);
			return false;
		}else {
			toolTip.DivObj.innerHTML = "";
			toolTip.DivObj.style.display="none";
			d.getElementById("registration").disabled=false;
			return true;
		}
	}
	function tipStatus(e,Statustype){
		var StrObj = e.name;
		if(!Statustype) Statustype="tooltip";
		if(StrObj=="strusername"){
			if(IsEmpty(e,"text")) return (Statustype=="tooltip") ? strusername.focus : strusername.blank;
			if(IsMin(e.value,6))  return strusername.min6;
			if(!IsValidCharacters(e.value, alphabetics + numbers + "'_'",alphabetics)) return strusername.special;
			/*var findUName=false;
			for (var i=0; i<usArr.length; i++) {
				if(usArr[i][0] == e.value){
					findUName=true;
					break;
				}
			}
			if(!findUName){
				usArr[usArr.length] = new Array(e.value,true);
			}*/
			if(d.getElementById("func").value=="memberagent"){
				if(d.getElementById("strcompanyurl")) d.getElementById("strcompanyurl").value = "http://www.indiaproperty.com/agent/" + e.value;
			}
			/*if(!userNameAllow) return strusername.useravailability;*/
			return 0;
		}else if(StrObj=="strpassword"){
			if(IsEmpty(e,"text")) return (Statustype=="tooltip") ? strpassword.focus : strpassword.blank;
			if(IsMin(e.value,6))  return strpassword.min6;
			if(!IsValidCharacters(e.value, alphabetics + numbers + "-'_'.",numbers+alphabetics)) return strpassword.special;
			return 0;
		}else if(StrObj=="con_password"){
			if(IsEmpty(e,"text")) return (Statustype=="tooltip") ? con_password.focus : con_password.blank;
			if(!IsMatch(d.getElementById("strpassword").value,e.value)){return con_password.notmatch;}
			if(IsMatch(d.getElementById("strusername").value,e.value)){return con_password.usernamematch;}
			if(!IsValidCharacters(e.value, alphabetics + numbers + "-'_'.",numbers+alphabetics)) return con_password.special;
			return 0;
		}else if(StrObj=="strcompanyname"){
			if(IsEmpty(e,"text")){
				if(frm.user_type[2].checked && Statustype=="message") return 0;
				var usertype = d.frmnew.user_type;
				for(i=0;i<usertype.length;i++){
					if(usertype[i].checked){
						if(usertype[i].value==2) return strcompanyname.focus.corporate;
						if(usertype[i].value==3) return strcompanyname.focus.agent;
						if(usertype[i].value==4) return strcompanyname.focus.builder;
					}
				}
			}
			if(!IsEmpty(e,"text")){
				if(!IsValidCharacters(e.value, alphabetics + numbers + "-'_' ",alphabetics)) return strcompanyname.invalid;
			}
			e.value = ip.toTitleCase(e.value);
			return 0;
		}else if(StrObj=="strname"){
			if(IsEmpty(e,"text")) return  (Statustype=="tooltip") ? ( ( d.frmnew.user_type[2].checked) ? strname.agentfocus : strname.focus) : strname.blank;
			if(IsMin(e.value,3))  return strname.min3;
			if(!IsValidCharacters(e.value, alphabetics + ".-'_' ",alphabetics)) return strname.invalid;
			e.value = ip.toTitleCase(e.value);
			return 0;
		}else if(StrObj=="stroccupation"){
			if(IsEmpty(e,"text") && Statustype!="message") return stroccupation.focus;
			if(!IsEmpty(e,"text")){
				if(!IsValidCharacters(e.value, alphabetics + numbers + " .,&",alphabetics)) return stroccupation.invalid;
			}
			return 0;
		}else if(StrObj=="intmonthlyfamilyincome"){
			if(IsEmpty(e,"text") && Statustype!="message") return intmonthlyfamilyincome.focus;
			if(!IsEmpty(e,"text")){
				if(IsMin(e.value,4))  return intmonthlyfamilyincome.min4;
				if(!IsValidCharacters(e.value, numbers + ".-",numbers)) return intmonthlyfamilyincome.invalid;
			}
			return 0;
		}else if(StrObj=="strdesignation"){
			if(IsEmpty(e,"text")) return (Statustype=="tooltip") ? strdesignation.focus : strdesignation.blank;
			if(!IsValidCharacters(e.value, alphabetics + numbers + " .-,'_ ",alphabetics)) return strdesignation.invalid;
			return 0;
		}else if(StrObj=="intcountry"){
			if(IsEmpty(e,"select")) return intcountry.blank;
			return 0;
		}else if(StrObj=="intstate"){
			if(d.getElementById("intcountry").options[d.getElementById("intcountry").selectedIndex].value!=1) return 0;
			if(IsEmpty(e,"select")) return intstate.blank;
			return 0;
		}else if(StrObj=="intcity"){
			if(d.getElementById("intcountry").options[d.getElementById("intcountry").selectedIndex].value!=1) return 0;
			if(IsEmpty(e,"select")){if(e.options[e.selectedIndex].text!="Other Cities") return intcity.blank;}
			return 0;
		}else if(StrObj=="intcountrycode"){
			if(d.getElementById("strmobile").value!="" && e.value=="" && d.getElementById("strphone").value=="") return 0;
			if(IsEmpty(e,"text")) return intcountrycode.blank;
			if(!IsValidCharacters(e.value, numbers + " ,-/",numbers))  return intcountrycode.invalid;
			return 0;
		}else if(StrObj=="intstdcode"){
			if(d.getElementById("strmobile").value!="" && e.value=="" && d.getElementById("strphone").value=="") return 0;
			if(IsEmpty(e,"text")) return (Statustype=="tooltip") ? intstdcode.focus : intstdcode.blank;
			if(!IsValidCharacters(e.value, numbers + " ,-/",numbers))  return intstdcode.invalid;
			return 0;
		}else if(StrObj=="strphone"){
			if(d.getElementById("strmobile").value!="" && e.value=="" && d.getElementById("intstdcode").value=="") return 0;
			if(IsEmpty(e,"text")) if(d.getElementById("strmobile").value=="")  return  (Statustype=="tooltip") ? strphone.focus : strphone.blank; else return strphone.stdAvail;
			if(IsMin(e.value,6))  return strphone.min6;
			if(!IsValidCharacters(e.value, numbers + " ,-/",numbers))  return strphone.invalid;
			if(e.value.substr(0,2)=="91" || e.value.substr(0,1)=="+")  return strphone.invalid;
			return 0;
		}else if(StrObj=="strmobile"){
			if(d.getElementById("intstdcode").value!="" && d.getElementById("strphone").value!="" && d.getElementById("strmobile").value=="") return 0;
			if(IsEmpty(e,"text")) return  (Statustype=="tooltip") ? strmobile.focus : strmobile.blank;
			if(!IsValidCharacters(e.value, numbers,numbers))  return strmobile.invalid;
			if(e.value.length<10)  return strmobile.invalid;
			/*if(e.value.substr(0,1)!="9" || e.value.substr(0,2)=="91" || e.value.length<10)  return strmobile.invalid;*/
			d.getElementById("Div_intstdcode").style.display="none";
			d.getElementById("Div_strphone").style.display="none";
			d.getElementById("Div_strmobile").style.display="none";
			return 0;
		}else if(StrObj=="stremail"){
			if(IsEmpty(e,"text")) return  (Statustype=="tooltip") ? stremail.focus : stremail.blank;
			if(!ip.IsValidEmail(e.value)) return stremail.invalid;
			return 0;
		}else if(StrObj=="strcompanylogofname"){
			if(IsEmpty(e,"file") && Statustype!="message") return strcompanylogofname.focus;
			if(!IsEmpty(e,"file")){
				if(!ip.IsValidFile(e,"gif|jpg|jpeg")) return strcompanylogofname.invalid;
			}
			return 0;
		}else if(StrObj=="stragentphoto"){
			if(IsEmpty(e,"file") && Statustype!="message") return stragentphoto.focus;
			if(!IsEmpty(e,"file")){
				if(!ip.IsValidFile(e,"gif|jpg|jpeg")) return stragentphoto.invalid;
			}
			return 0;
		}else if(StrObj=="strcompanyurl"){
			if(IsEmpty(e,"text") && Statustype!="message") return strcompanyurl.focus;
			if(!IsEmpty(e,"text")){
				if(!IsValidCharacters(e.value, alphabetics + numbers + "-'_',.://",alphabetics+numbers)) return strcompanyurl.special;
				if(!ip.IsValidURL(e))  return strcompanyurl.invalid;
			}
			return 0;
		}else if(StrObj=="strareaofbusiness"){
			if(IsEmpty(e,"text")) return (Statustype=="tooltip") ? strareaofbusiness.focus : strareaofbusiness.blank;
			if(!IsValidCharacters(e.value, alphabetics + ".-'_' ,",alphabetics)) return strareaofbusiness.invalid;
			return 0;
		}else if(StrObj=="strprimaryoperationcity"){
			if(IsEmpty(e,"text") && Statustype!="message") return strprimaryoperationcity.focus;
			if(!IsEmpty(e,"text")){
				if(!IsValidCharacters(e.value, alphabetics + numbers + ".-'_' ,",alphabetics)) return strprimaryoperationcity.invalid;
			}
			return 0;
		}else if(StrObj=="intturnover"){
			if(IsEmpty(e,"text") && Statustype!="message") return intturnover.focus;
			if(!IsEmpty(e,"text")){
				if(!IsValidCharacters(e.value, alphabetics + numbers + ".-'_' ,",numbers)) return intturnover.invalid;
			}
			return 0;
		}else if(StrObj=="intyearsofoperation"){
			if(IsEmpty(e,"select")) return intyearsofoperation.blank;
			return 0;
		}else if(StrObj=="intpropertiessold"){
			if(IsEmpty(e,"select")) return intpropertiessold.blank;
			return 0;
		}else if(StrObj=="strcompanyprofile"){
			if(IsEmpty(e,"text") && Statustype!="message") return strcompanyprofile.focus;
			if(!IsEmpty(e,"text")){
				if(!IsValidCharacters(e.value, alphabetics + numbers + ".-'_' ,",alphabetics)) return strcompanyprofile.invalid;
				if(IsMax(e.value,1000)) return strcompanyprofile.max1000;
			}
			return 0;
		}else if(StrObj=="stragentprofile"){
			if(IsEmpty(e,"text") && Statustype!="message") return stragentprofile.focus;
			if(!IsEmpty(e,"text")){
				if(!IsValidCharacters(e.value, alphabetics + numbers + ".-'_' ,",alphabetics)) return stragentprofile.invalid;
				if(IsMax(e.value,1000)) return stragentprofile.max1000;
			}
			return 0;
		}else if(StrObj=="strbuilderprofile"){
			if(IsEmpty(e,"text") && Statustype!="message") return strbuilderprofile.focus;
			if(!IsEmpty(e,"text")){
				if(!IsValidCharacters(e.value, alphabetics + numbers + ".-'_' ,",alphabetics)) return strbuilderprofile.invalid;
				if(IsMax(e.value,1000)) return strbuilderprofile.max5000;
			}
			return 0;
		}else if(StrObj=="strreferences"){
			if(IsEmpty(e,"text") && Statustype!="message") return strreferences.focus;
			if(!IsEmpty(e,"text")){
				if(!IsValidCharacters(e.value, alphabetics + numbers + ".-'_' ,",alphabetics)) return strreferences.invalid;
			}
			return 0;
		}else if(StrObj=="TERMS"){
			if(IsEmpty(e,"checkbox")) return TERMS.blank;
			return 0;
		}
		if(d.getElementById("Div_strusername_availability").innerHTML == strusername.useravailability){
			d.getElementById("strusername").focus();
			return 0;
		}
		return 0;
	}
	function ValidateForm(frm){
		if(!frm) return false;
		var ArrObjs  = ipFields;
		if(!IsMandatory(frm.user_type, "radio",	"Please select a user type",	1,	"Div_user_type")) return false;
		d.getElementById("registration").disabled=true;
		for(var i=0; i<ArrObjs.length; i++) {
			if(frm.elements[ArrObjs[i]]){
				if(!tipShowError_OnSubmit(frm.elements[ArrObjs[i]])){
					try{frm.elements[ArrObjs[i]].focus();}catch(e){ip.traceErr(e,"OnSubmitForm","quickreg");}
					d.getElementById("registration").disabled=false;
					return false;
				}
			}
		}
		d.getElementById("registration").disabled=false;
		/*window.setTimeout("",200);*/
		if(userNameAllow){
			frm.action = "input_property.php";
			return true;
		}else{
			d.getElementById("strusername").focus();
			return false;
		}
	}