var pageId=$('counter').value;

Event.observe(window,'load',function(){
	setInterval('userLogoutCounter()',1000);
	setInterval('updateLoginCurrentTime()',10000);
	deleteCookie(pageId);
	
	if($('openCategoryContainer')!=undefined)
	{
		categorySpecific = new fx.Height('categorySpecificContainer');
		categorySpecific.hide();
		$('openCategoryContainer').onclick = function() {
			$('openCategoryContainer').setStyle({display:'none'});
			$('closeCategoryContainer').setStyle({display:'inline'});
			categorySpecific.toggle();
			};

		$('closeCategoryContainer').onclick = function() {
			$('closeCategoryContainer').setStyle({display:'none'});
			$('openCategoryContainer').setStyle({display:'inline'});
			categorySpecific.toggle();
			};
	}

	if($('openSearchZoneContainer')!=undefined)
	{
		searchZoneSpecific = new fx.Height('searchZoneSpecificContainer');
		searchZoneSpecific.hide();
		$('openSearchZoneContainer').onclick = function() {
			$('openSearchZoneContainer').setStyle({display:'none'});
			$('closeSearchZoneContainer').setStyle({display:'inline'});
			searchZoneSpecific.toggle();
			};
	
		$('closeSearchZoneContainer').onclick = function() {
			$('closeSearchZoneContainer').setStyle({display:'none'});
			$('openSearchZoneContainer').setStyle({display:'inline'});
			searchZoneSpecific.toggle();
			};
	}
	
	if($('openTUserDetailsContainer')!=undefined)
	{
		userDetailsSpecific = new fx.Height('userDetailsSpecificContainer');
		userDetailsSpecific.hide();
		
		$('openTUserDetailsContainer').onclick = function() {
			$('openTUserDetailsContainer').setStyle({display:'none'});
			$('closeTUserDetailsContainer').setStyle({display:'inline'});
			userDetailsSpecific.toggle();
			};

		$('closeTUserDetailsContainer').onclick = function() {
			$('closeTUserDetailsContainer').setStyle({display:'none'});
			$('openTUserDetailsContainer').setStyle({display:'inline'});
			userDetailsSpecific.toggle();
			};
	}
	
	/*if($('openContactDetailsContainer')!=undefined)
	{
		contactDetailsSpecific = new fx.Height('contactDetailsSpecificContainer');
		contactDetailsSpecific.hide();
		$('openContactDetailsContainer').onclick = function() {
			$('openContactDetailsContainer').setStyle({display:'none'});
			$('closeContactDetailsContainer').setStyle({display:'inline'});
			contactDetailsSpecific.toggle();
			};

		$('closeContactDetailsContainer').onclick = function() {
			$('closeContactDetailsContainer').setStyle({display:'none'});
			$('openContactDetailsContainer').setStyle({display:'inline'});
			contactDetailsSpecific.toggle();
			};
	}*/
});



function step1_validation(varFormType)
{
////////////////////////////////BASIC DATAILS VALIDATION//////////////////////////////
resetFormErrorBorderStyle('tuserRegistrationProcess');
if(varFormType=="add")
{
	businessName=$('businessName').value;
	fname=$('fname').value;
	lname=$('lname').value;
	regEmail=$('reg_email').value;
	regReeEmail=$('reenter_reg_email').value;
	regPassword=$('reg_password').value;
	regReePassword=$('reenter_reg_password').value;
}
	regQualification1=$('reg_qualification1').value;
	regInstitution1=$('reg_institution1').value;
	regYear1=$('reg_year1').value;
	regQualification2=$('reg_qualification2').value;
	regInstitution2=$('reg_institution2').value;
	regYear2=$('reg_year2').value;
	regTradeLicenceType1=$('reg_trade_licence_type1').value;
	regTradeLicenceNumber1=$('reg_trade_licence_number1').value;
	regTradeLicenceType2=$('reg_trade_licence_type2').value;
	regTradeLicenceNumber2=$('reg_trade_licence_number2').value;
	regInsuranceType=$('reg_insurance_type').value;
	regInsuranceNumber=$('reg_insurance_number').value;
	regInsuranceAmount=$('reg_insurance_amount').value;
	regInsuranceExpiry=$('DPC_reg_insurance_expiry').value;
	
//////////////////////////////Variable for check validate date	
	var dtCh= "/";
	var minYear=1900;
	var maxYear=2100;	
////////////////////////////////////////////////////////////////

	str="";
if(varFormType=="add")
{
	if(businessName=="")
	{str+=TUSER.BASIC_STEP1[9].ERROR;setErrorBoxBorder('businessName');}
	
	if(fname=="")
	{str+=TUSER.BASIC_STEP1[10].ERROR;setErrorBoxBorder('fname');}
	
	if(lname=="")
	{str+=TUSER.BASIC_STEP1[11].ERROR;setErrorBoxBorder('lname');}
	
	if(regEmail=="")
	{str+=TUSER.BASIC_STEP1[0].ERROR;setErrorBoxBorder('reg_email');}
	else
	{
		if(validEmailAddress(regEmail))
		{str+=TUSER.BASIC_STEP1[2].ERROR;setErrorBoxBorder('reg_email');}
	}
	
	if(regEmail!="")
	{
		if(!validEmailAddress(regEmail))
		{
			if(regReeEmail=="")
			{str+=TUSER.BASIC_STEP1[1].ERROR;setErrorBoxBorder('reenter_reg_email');}
			else
			{
				if(validEmailAddress(regReeEmail))
				{str+=TUSER.BASIC_STEP1[2].ERROR;setErrorBoxBorder('reenter_reg_email');}
				else if(regEmail!=regReeEmail)
				{str+=TUSER.BASIC_STEP1[3].ERROR;setErrorBoxBorder('reenter_reg_email');setErrorBoxBorder('reg_email');}
			}
		}
	}
		
	if(regPassword=="")
	{str+=TUSER.BASIC_STEP1[4].ERROR;setErrorBoxBorder('reg_password');}
	else if(regPassword.length<6)
	{
		str+=TUSER.BASIC_STEP1[6].ERROR;setErrorBoxBorder('reg_password');
	}
	
	if(regPassword!="" && regPassword.length>6 && regPassword.length<15)
	{
		if(regReePassword=="")
		{str+=TUSER.BASIC_STEP1[5].ERROR;setErrorBoxBorder('reenter_reg_password');}
		else if(regReePassword.length<6)
		{str+=TUSER.BASIC_STEP1[6].ERROR;setErrorBoxBorder('reenter_reg_password');}
		else if(regPassword!=regReePassword)
		{str+=TUSER.BASIC_STEP1[7].ERROR;setErrorBoxBorder('reenter_reg_password');setErrorBoxBorder('reg_password');}
	}
}
	if(regQualification1!="" && regInstitution1=="" && regYear1=="")
	{str+=TUSER.DETAILS_STEP1[1].ERROR;setErrorBoxBorder('reg_institution1');
	 str+=TUSER.DETAILS_STEP1[2].ERROR;setErrorBoxBorder('reg_year1');}
	
	if(regQualification1=="" && regInstitution1!="" && regYear1=="")
	{str+=TUSER.DETAILS_STEP1[0].ERROR;setErrorBoxBorder('reg_qualification1');
	 str+=TUSER.DETAILS_STEP1[2].ERROR;setErrorBoxBorder('reg_year1');} 
	
	if(regQualification1=="" && regInstitution1=="" && regYear1!="")
	{str+=TUSER.DETAILS_STEP1[0].ERROR;setErrorBoxBorder('reg_qualification1');
	 str+=TUSER.DETAILS_STEP1[1].ERROR;setErrorBoxBorder('reg_institution1');}
	 
	if(regQualification1=="" && regInstitution1!="" && regYear1!="")
	{str+=TUSER.DETAILS_STEP1[0].ERROR;setErrorBoxBorder('reg_qualification1');} 
	
	if(regQualification1!="" && regInstitution1=="" && regYear1!="")
	{str+=TUSER.DETAILS_STEP1[1].ERROR;setErrorBoxBorder('reg_institution1');} 
	
	if(regQualification1!="" && regInstitution1!="" && regYear1=="")
	{str+=TUSER.DETAILS_STEP1[2].ERROR;setErrorBoxBorder('reg_year1');}
	
	if(regYear1!="")
	{
		if(isNaN(regYear1))	
		{str+=TUSER.DETAILS_STEP1[17].ERROR;setErrorBoxBorder('reg_year1');}
		else
		{
			if(regYear1<minYear || regYear1>maxYear)
			{str+="- Please year between "+minYear+" and "+maxYear+"<br>";setErrorBoxBorder('reg_year1');}
		}
	}
	 
	if(regQualification2!="" && regInstitution2=="" && regYear2=="")
	{str+=TUSER.DETAILS_STEP1[4].ERROR;setErrorBoxBorder('reg_institution2');
	 str+=TUSER.DETAILS_STEP1[5].ERROR;setErrorBoxBorder('reg_year2');}
	
	if(regQualification2=="" && regInstitution2!="" && regYear2=="")
	{str+=TUSER.DETAILS_STEP1[3].ERROR;setErrorBoxBorder('reg_qualification2');
	 str+=TUSER.DETAILS_STEP1[5].ERROR;setErrorBoxBorder('reg_year2');} 
	
	if(regQualification2=="" && regInstitution2=="" && regYear2!="")
	{str+=TUSER.DETAILS_STEP1[3].ERROR;setErrorBoxBorder('reg_qualification2');
	 str+=TUSER.DETAILS_STEP1[4].ERROR;setErrorBoxBorder('reg_institution2');}
	 
	if(regQualification2=="" && regInstitution2!="" && regYear2!="")
	{str+=TUSER.DETAILS_STEP1[3].ERROR;setErrorBoxBorder('reg_qualification2');} 
	
	if(regQualification2!="" && regInstitution2=="" && regYear2!="")
	{str+=TUSER.DETAILS_STEP1[4].ERROR;setErrorBoxBorder('reg_institution2');} 
	
	if(regQualification2!="" && regInstitution2!="" && regYear2=="")
	{str+=TUSER.DETAILS_STEP1[5].ERROR;setErrorBoxBorder('reg_year2');}
	
	if(regYear2!="")
	{
		if(isNaN(regYear2))	
		{str+=TUSER.DETAILS_STEP1[17].ERROR;setErrorBoxBorder('reg_year2');}
		else
		{
			if(regYear2<minYear || regYear2>maxYear)
			{str+="- Please year between "+minYear+" and "+maxYear+"<br>";setErrorBoxBorder('reg_year2');}
		}
	}
	 
	if(regTradeLicenceType1!="" && regTradeLicenceNumber1=="")
	{str+=TUSER.DETAILS_STEP1[7].ERROR;setErrorBoxBorder('reg_trade_licence_number1');} 
	if(regTradeLicenceType1=="" && regTradeLicenceNumber1!="")
	{str+=TUSER.DETAILS_STEP1[6].ERROR;setErrorBoxBorder('reg_trade_licence_type1');} 
	
	if(regTradeLicenceType2!="" && regTradeLicenceNumber2=="")
	{str+=TUSER.DETAILS_STEP1[9].ERROR;setErrorBoxBorder('reg_trade_licence_number2');} 
	if(regTradeLicenceType2=="" && regTradeLicenceNumber2!="")
	{str+=TUSER.DETAILS_STEP1[8].ERROR;setErrorBoxBorder('reg_trade_licence_type2');}
	
	if(regInsuranceType!="" && regInsuranceNumber=="" && regInsuranceAmount=="" && regInsuranceExpiry=="dd/mm/yyyy")
	{str+=TUSER.DETAILS_STEP1[11].ERROR;setErrorBoxBorder('reg_insurance_number');
	 str+=TUSER.DETAILS_STEP1[12].ERROR;setErrorBoxBorder('reg_insurance_amount');
	 str+=TUSER.DETAILS_STEP1[13].ERROR;setErrorBoxBorder('DPC_reg_insurance_expiry');}
	
	if(regInsuranceType=="" && regInsuranceNumber!="" && regInsuranceAmount=="" && regInsuranceExpiry=="dd/mm/yyyy")
	{str+=TUSER.DETAILS_STEP1[10].ERROR;setErrorBoxBorder('reg_insurance_type');
	 str+=TUSER.DETAILS_STEP1[12].ERROR;setErrorBoxBorder('reg_insurance_amount');
	 str+=TUSER.DETAILS_STEP1[13].ERROR;setErrorBoxBorder('DPC_reg_insurance_expiry');}
	
	if(regInsuranceType=="" && regInsuranceNumber=="" && regInsuranceAmount!="" && regInsuranceExpiry=="dd/mm/yyyy")
	{str+=TUSER.DETAILS_STEP1[10].ERROR;setErrorBoxBorder('reg_insurance_type');
	 str+=TUSER.DETAILS_STEP1[11].ERROR;setErrorBoxBorder('reg_insurance_number');
	 str+=TUSER.DETAILS_STEP1[13].ERROR;setErrorBoxBorder('DPC_reg_insurance_expiry');}
	
	if(regInsuranceType=="" && regInsuranceNumber=="" && regInsuranceAmount=="" && regInsuranceExpiry!="dd/mm/yyyy")
	{str+=TUSER.DETAILS_STEP1[10].ERROR;setErrorBoxBorder('reg_insurance_type');
	 str+=TUSER.DETAILS_STEP1[11].ERROR;setErrorBoxBorder('reg_insurance_number');
	 str+=TUSER.DETAILS_STEP1[12].ERROR;setErrorBoxBorder('reg_insurance_amount');}
	 
	if(regInsuranceType!="" && regInsuranceNumber!="" && regInsuranceAmount=="" && regInsuranceExpiry=="dd/mm/yyyy")
	{str+=TUSER.DETAILS_STEP1[12].ERROR;setErrorBoxBorder('reg_insurance_amount');
	 str+=TUSER.DETAILS_STEP1[13].ERROR;setErrorBoxBorder('DPC_reg_insurance_expiry');}
	
	if(regInsuranceType!="" && regInsuranceNumber=="" && regInsuranceAmount!="" && regInsuranceExpiry=="dd/mm/yyyy")
	{str+=TUSER.DETAILS_STEP1[11].ERROR;setErrorBoxBorder('reg_insurance_number');
	 str+=TUSER.DETAILS_STEP1[13].ERROR;setErrorBoxBorder('DPC_reg_insurance_expiry');}
	
	if(regInsuranceType!="" && regInsuranceNumber=="" && regInsuranceAmount=="" && regInsuranceExpiry!="dd/mm/yyyy")
	{str+=TUSER.DETAILS_STEP1[11].ERROR;setErrorBoxBorder('reg_insurance_number');
	 str+=TUSER.DETAILS_STEP1[12].ERROR;setErrorBoxBorder('reg_insurance_amount');}
	
	if(regInsuranceType=="" && regInsuranceNumber!="" && regInsuranceAmount!="" && regInsuranceExpiry=="dd/mm/yyyy")
	{str+=TUSER.DETAILS_STEP1[10].ERROR;setErrorBoxBorder('reg_insurance_type');
	 str+=TUSER.DETAILS_STEP1[13].ERROR;setErrorBoxBorder('DPC_reg_insurance_expiry');}
	
	if(regInsuranceType=="" && regInsuranceNumber!="" && regInsuranceAmount=="" && regInsuranceExpiry!="dd/mm/yyyy")
	{str+=TUSER.DETAILS_STEP1[10].ERROR;setErrorBoxBorder('reg_insurance_type');
	 str+=TUSER.DETAILS_STEP1[12].ERROR;setErrorBoxBorder('reg_insurance_amount');}
	 
	if(regInsuranceType=="" && regInsuranceNumber=="" && regInsuranceAmount!="" && regInsuranceExpiry!="dd-mm-YYYY")
	{str+=TUSER.DETAILS_STEP1[10].ERROR;setErrorBoxBorder('reg_insurance_type');
	 str+=TUSER.DETAILS_STEP1[11].ERROR;setErrorBoxBorder('reg_insurance_number');}
	 
	if(regInsuranceType!="" && regInsuranceNumber!="" && regInsuranceAmount!="" && regInsuranceExpiry=="dd/mm/yyyy")
	{str+=TUSER.DETAILS_STEP1[13].ERROR;setErrorBoxBorder('DPC_reg_insurance_expiry');}
	
	if(regInsuranceType!="" && regInsuranceNumber!="" && regInsuranceAmount=="" && regInsuranceExpiry!="dd/mm/yyyy")
	{str+=TUSER.DETAILS_STEP1[12].ERROR;setErrorBoxBorder('reg_insurance_amount');}
	
	if(regInsuranceType!="" && regInsuranceNumber=="" && regInsuranceAmount!="" && regInsuranceExpiry!="dd/mm/yyyy")
	{str+=TUSER.DETAILS_STEP1[11].ERROR;setErrorBoxBorder('reg_insurance_number');}
	
	if(regInsuranceType=="" && regInsuranceNumber!="" && regInsuranceAmount!="" && regInsuranceExpiry!="dd/mm/yyyy")
	{str+=TUSER.DETAILS_STEP1[10].ERROR;setErrorBoxBorder('reg_insurance_type');}
	
	if(regInsuranceExpiry!="dd/mm/yyyy" && regInsuranceExpiry!="")
	{
		str1="";
		var validformat=/^\d{2}\/\d{2}\/\d{4}$/ //Basic check for format validity
		if (!validformat.test(regInsuranceExpiry))
		{str1="1";}
	
		var daysInMonth = DaysArray(12)
		var pos1=regInsuranceExpiry.indexOf(dtCh);
		var pos2=regInsuranceExpiry.indexOf(dtCh,pos1+1);
		var strDay=regInsuranceExpiry.substring(0,pos1);
		var strMonth=regInsuranceExpiry.substring(pos1+1,pos2)
		var strYear=regInsuranceExpiry.substring(pos2+1)
		strYr=strYear
		if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
		if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
		for (var i = 1; i <= 3; i++) {
			if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
		}
		month=parseInt(strMonth)
		day=parseInt(strDay)
		year=parseInt(strYr)

		if (regInsuranceExpiry.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(regInsuranceExpiry, dtCh))==false)
		{str1="1";}
		else if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month])
		{str1="1";}
		else if (strMonth.length<1 || month<1 || month>12)
		{str1="1";}
		else if (strYear.length != 4 || year==0)
		{str1="1";}
	
	
		var currentDate= new Date();
		var currentDay=(currentDate.getDate()).toString();
		var currentMonth=(currentDate.getMonth()+1).toString();
		var currentyear=(currentDate.getFullYear()).toString();
		
		if(strMonth.length==1){strMonth='0'+strMonth;}
		if(strDay.length==1){strDay='0'+strDay;}
		
		if(currentMonth.length==1){currentMonth='0'+currentMonth;}
		if(currentDay.length==1){currentDay='0'+currentDay;}
		
		var userEnteredDate = parseInt(strYear+''+strMonth+''+strDay);
		var currentCmpDate= parseInt(currentyear+''+currentMonth+''+currentDay);
	
		if(userEnteredDate<currentCmpDate)
		{str+=TUSER.DETAILS_STEP1[23].ERROR;setErrorBoxBorder('DPC_reg_insurance_expiry');}

	
		
		if(str1=="1")
		{str+=TUSER.DETAILS_STEP1[15].ERROR;setErrorBoxBorder('DPC_reg_insurance_expiry');}
		else if(year<minYear || year>maxYear)
		{str+="- Please year between "+minYear+" and "+maxYear+"<br>";setErrorBoxBorder('DPC_reg_insurance_expiry');}
		
		
	}
	if(typeof($('agreement'))!='undefined')
	{
		var agreement=$('agreement').checked
		//if(agreement==false && str=="")
		if(agreement==false)
		{
				str+=TUSER.DETAILS_STEP1[22].ERROR;;
		}
	}


	if(str!="")
	{	
		showErrorPopup(DIVPOPUPWINDOW.TEXT[0].MSG,DIVPOPUPWINDOW.TEXT[1].MSG,str)
		return false;
	}
	else if(varFormType=="add")
	{	
		processur142=base_url+'registration/validTUser/'+varHexString('reg_email');
		var myAjax = new Ajax.Request(processur142, {method: 'post', 
				onComplete: function showResponse(response)
				{
					if(response.responseText!=0)
					{str+=TUSER.BASIC_STEP1[8].ERROR;setErrorBoxBorder('reg_email');
					showErrorPopup(DIVPOPUPWINDOW.TEXT[0].MSG,DIVPOPUPWINDOW.TEXT[1].MSG,str)
					return false;
					}
					else{
						$('tuserRegistrationProcess').submit();
						return true;}
				}
		});
		return false;
	}
	else if(varFormType=="edit")
	{
		$('tuserRegistrationProcess').submit();
	}
}

function step3_validation(varFormType)
{
	$('stateChangeStatus1').value="0";
	resetFormErrorBorderStyle('tuserRegistrationProcess3z1');
	resetFormErrorBorderStyleForSelectControl();
	zoneName=$('zoneName').value;
	postcode=$('postCode').value;
	radius=$('radius').value;
	zoneStatus=$('zoneStatus').value;
	zoneState=$('state').value;

	str="";
	if(zoneName=="")
	{str+=TUSER.STEP3[0].ERROR;setErrorBoxBorder('zoneName');}

	if(zoneState=="" || zoneState==0)
	{str+=TUSER.STEP3[4].ERROR;Position.clone('state', 'zoneState1');setErrorBoxBorder('zoneState1');}
	
	if(postcode=="")
	{str+=TUSER.STEP3[1].ERROR;setErrorBoxBorder('postCode');}
	
	if(radius=="")
	{str+=TUSER.STEP3[5].ERROR;Position.clone('radius', 'radius31');setErrorBoxBorder('radius31');}
	
	if(str!="")
	{showErrorPopup(DIVPOPUPWINDOW.TEXT[0].MSG,DIVPOPUPWINDOW.TEXT[1].MSG,str)}
	else
	{
		if(postcode=="")
			postcode="null";
		submitZone1URL=base_url+'registration/tuserSearchZone/'+varHexString('postCode')+'/'+varHexString('radius')+'/'+varHexString('zoneStatus')+'/'+varHexString('state')+'/'+varFormType;
		
	//submitZone1URL=base_url+'registration/tuserSearchZone/'+postcode+'/'+radius+'/'+zoneStatus+'/'+zoneState+'/'+varFormType;
		$("submitZone1").className="disabled_button";
		$("submitZone1").disabled="disabled";
		$('seeOnMap1').className="disabled_button";
		var myAjax = new Ajax.Request(submitZone1URL, {method: 'post', 
				onComplete: function showResponse(response)
				{	
					var htmlString=(response.responseText).split('latlongarrayseparator');
					$('showSearchZone').innerHTML="";
					$('showSearchZone').innerHTML=htmlString[0];
					$('zoneOneLatitude').value=htmlString[1];
					$('zoneOneLongitude').value=htmlString[2];
					$('savedZone1').value="show";
					
					if(typeof($("zoneSavedMSG1"))!='undefined')
					{$('seeOnMap1').className="buttons";}
					
					$("submitZone1").className="buttons"
					$("submitZone1").disabled="";
				}
		});
	}	
}

function searchZoneOnRefresh(varFormType)
{
	resetFormErrorBorderStyle('tuserRegistrationProcess3z1');
	var zoneName2=$('zoneName1').value;
	var zoneName=$('zoneName').value;
	var postcode=$('postCode').value;
	var radius=$('radius').value;
	var zoneState=$('state').value;
	var zoneStatus='zone1';
	
	if(zoneName!='')
	{
		if(postcode=="")
			postcode="null";
		
		submitZone1URL=base_url+'registration/tuserSearchZone/'+varHexString('postCode')+'/'+varHexString('radius')+'/'+zoneStatus+'/'+varHexString('state')+'/'+varFormType;
		//submitZone1URL=base_url+'registration/tuserSearchZone/'+postcode+'/'+radius+'/'+zoneStatus+'/'+zoneState+'/'+varFormType;
		
		var myAjax = new Ajax.Request(submitZone1URL, {method: 'post', 
				onComplete: function showResponse(response)
				{	
					var htmlString=(response.responseText).split('latlongarrayseparator');
				
					$('showSearchZone').innerHTML="";
					$('showSearchZone').style.display='none';
					$('showSearchZone').innerHTML=htmlString[0];
					
					$('zoneName').className="disabled_textarea zone__name_text_field";	
					$('zoneName').readOnly=true;
					$('state').className="disabled_textarea zone_midpoint_txtfield";	
					$('state').disabled=true;
					$('postCode').className="disabled_textarea zone_midpoint_txtfield";	
					$('postCode').readOnly=true;
					$('radius').className="disabled_textarea radius_in_km";	
					$('radius').disabled=true;
					$('submitZone1').className="disabled_button";	
					$('submitZone1').readOnly=true;
					$('submitZone1').onclick='';
					$('submitStep3').className="disabled_button";
					$('submitStep3').readOnly=true;
					$('submitStep3').onclick='';
					
					Effect.toggle('showSearchZone','appear');
					//Remove this comment when zone two needed. getZone2ValueOnReferesh(varFormType);
				}
		});
	}
	else if(zoneName2!='')
	{
		getZone2ValueOnReferesh(varFormType);
	}
}

function getZone2ValueOnReferesh(varFormType)
{
	var zoneName2=$('zoneName1').value;
	var postcode2=$('postCode1').value;
	var radius2=$('radius1').value;
	var zoneState2=$('state1').value;
	var zoneStatus2='zone2';
	if(zoneName2!='')
	{
		if(postcode2=="")
			postcode2="null";
		
			submitZone1URL=base_url+'registration/tuserSearchZone/'+varHexString('postCode1')+'/'+varHexString('radius1')+'/'+zoneStatus2+'/'+varHexString('state1')+'/'+varFormType;
		//submitZone1URL=base_url+'registration/tuserSearchZone/'+postcode2+'/'+radius2+'/'+zoneStatus2+'/'+zoneState2+'/'+varFormType;
		var myAjax = new Ajax.Request(submitZone1URL, {method: 'post', 
				onComplete: function showResponse(response)
				{	
					var htmlString=(response.responseText).split('latlongarrayseparator');
					$('showSearchZone1').innerHTML="";
					$('showSearchZone1').style.display='none';
					$('showSearchZone1').innerHTML=htmlString[0];
										
					Effect.toggle('showSearchZone1','appear');
					$('seeOnMap2').onclick='';
				}
				
		});
	}
}

function doneZoneSavingProcess()
{
	var str="";
	
	if($('zoneName').value=="")
	{str=TUSER.STEP3[0].ERROR;}
	else if($('state').value=="" || $('state').value=="0")
	{str=TUSER.STEP3[4].ERROR;}
	else if($('postCode').value=="")
	{str=TUSER.STEP3[1].ERROR;}
	else if($('radius').value=="" || $('radius').value=="0")
	{str=TUSER.STEP3[5].ERROR;}
	else if($('savedZone1').value=="")
	{str=TUSER.STEP3[8].ERROR;}	
	else if($('savedZone1').value=="show")
	{str=TUSER.STEP3[7].ERROR;}	
	else if($('zoneName1').value!='' && $('savedZone2').value=="")
	{str=TUSER.STEP3[8].ERROR;}	
	else if($('savedZone2').value=="show")
	{str=TUSER.STEP3[9].ERROR;}	

	
	if($('stateChangeStatus1').value!='0' || $('stateChangeStatus2').value!='0')
	{str+=TUSER.STEP3[8].ERROR;}
	
	if(str!="")
	{showErrorPopup(DIVPOPUPWINDOW.TEXT[0].MSG,DIVPOPUPWINDOW.TEXT[1].MSG,str);return false;}
	else
	{window.location.reload(true);}
}
function saveZone1(zone,varFormType)
{
	var formAction="";
	var zoneNumber=(zone=='')?'1':'2';
	var savedZone=(zoneNumber=='1')?'savedZone1':'savedZone2';

	zoneNameValue=$('zoneName'+zone).value;
	postcodeValue=$('postCode'+zone).value;
	radiusValue=$('radius'+zone).value;
	stateValue=$('state'+zone).value;
	
	str='';
	if(zoneNameValue=="")
	{str+=TUSER.STEP3[0].ERROR;setErrorBoxBorder('zoneName');}

	if(stateValue=="" || stateValue==0)
	{str+=TUSER.STEP3[4].ERROR;Position.clone('state', 'zoneState1');setErrorBoxBorder('zoneState1');}
	
	if(postcodeValue=="")
	{str+=TUSER.STEP3[1].ERROR;setErrorBoxBorder('postCode');}
	
	if(radiusValue=="")
	{str+=TUSER.STEP3[5].ERROR;Position.clone('radius', 'radius31');setErrorBoxBorder('radius31');}
	
	if($('stateChangeStatus'+zoneNumber).value!='0' && str=='')
	{str+=TUSER.STEP3[8].ERROR;}

	
	if(str!="")
	{showErrorPopup(DIVPOPUPWINDOW.TEXT[0].MSG,DIVPOPUPWINDOW.TEXT[1].MSG,str);return false;}
	
	
	if(postcodeValue=="")
		postcodeValue="null";
	
	if(varFormType=="add")
	{
		formAction=	"registrationProcessesByAjax";
	}
	else if(varFormType=="edit")
	{
		formAction=	"registrationEditProcessesByAjax";
	}
	
	submitZoneURL=base_url+'registration/'+formAction+'/'+Base64.encode(zoneNameValue)+'/'+Base64.encode(postcodeValue)+'/'+Base64.encode(radiusValue)+'/'+zoneNumber+'/'+stateValue;
	//submitZoneURL=base_url+'registration/'+formAction+'/'+zoneNameValue+'/'+postcodeValue+'/'+radiusValue+'/'+zoneNumber+'/'+stateValue;
	$('zoneSavedMSG'+zoneNumber).innerHTML=("zone saving").toUpperCase();
	var myAjax = new Ajax.Request(submitZoneURL, {method: 'post', 
			onComplete: function showResponse(response)
			{	
				if(response.responseText=='Yes')
				{
					if(zoneNumber==1)
					{
						$('zoneName').className="disabled_textarea zone__name_text_field";	
						$('zoneName').readOnly=true;
						$('state').className="disabled_textarea zone_midpoint_txtfield";	
						$('state').disabled=true;
						$('postCode').className="disabled_textarea zone_midpoint_txtfield";	
						$('postCode').readOnly=true;
						$('radius').className="disabled_textarea radius_in_km";	
						$('radius').disabled=true;
						$('submitZone1').className="disabled_button";	
						$('submitZone1').readOnly=true;
						$('submitZone1').onclick='';
						$('submitStep3').className="disabled_button";
						$('submitStep3').readOnly=true;
						$('submitStep3').onclick='';
						
						$('seeOnMap'+zoneNumber).className="disabled_button";
						$('seeOnMap'+zoneNumber).readOnly=true;
						$('seeOnMap'+zoneNumber).onclick='';
					}
					//$('submitZone2').className="buttons";
					$('zoneSavedMSG'+zoneNumber).innerHTML=("zone saved").toUpperCase();
					$(savedZone).value=response.responseText;
				}
			}
	});
}

function step3Zone2_validation(varFormType)
{

	if($('submitZone2').className=='buttons')
	{
		$('stateChangeStatus2').value="0";
		resetFormErrorBorderStyle('tuserRegistrationProcess3z2');
		resetFormErrorBorderStyleForSelectControl();
		
		var zoneName1=$('zoneName1').value;
		var postCode1=$('postCode1').value;
		var radius1=$('radius1').value;
		var zoneStatus1=$('zoneStatus1').value;
		var zoneState1=$('state1').value;
		
		str="";
		if(zoneName1=="")
		{str=1;setErrorBoxBorder('zoneName1');}
	
		if(zoneState1=="" || zoneState1=="0")
		{str=1;Position.clone('state1', 'zoneState2');setErrorBoxBorder('zoneState2');}
		
		if(postCode1=="")
		{str=1;setErrorBoxBorder('postCode1');}
		
		if(radius1=="" || radius1==0)
		{str=1;Position.clone('radius1', 'radius32');setErrorBoxBorder('radius32');}
				
		if(str==1){str=TUSER.STEP3[6].ERROR;}
			
		if(str!="")
		{showErrorPopup(DIVPOPUPWINDOW.TEXT[0].MSG,DIVPOPUPWINDOW.TEXT[1].MSG,str)}
		else
		{
			if(postCode1=="")
				postCode1="null";
			
			submitZone1URL=base_url+'registration/tuserSearchZone/'+varHexString('postCode1')+'/'+varHexString('radius1')+'/'+varHexString('zoneStatus1')+'/'+varHexString('state1')+'/'+varFormType;
			//submitZone1URL=base_url+'registration/tuserSearchZone/'+postCode1+'/'+radius1+'/'+zoneStatus1+'/'+zoneState1+'/'+varFormType;
			var myAjax = new Ajax.Request(submitZone1URL, {method: 'post', 
					onComplete: function showResponse(response)
					{	
						var htmlString=(response.responseText).split('latlongarrayseparator');
						$('showSearchZone1').innerHTML="";
						$('showSearchZone1').style.display='none';
						Effect.toggle('showSearchZone1','appear');
						$('showSearchZone1').innerHTML=htmlString[0];
						$('zoneTwoLatitude').value=htmlString[1];
						$('zoneTwoLongitude').value=htmlString[2];
						$('savedZone2').value="show";
						$('seeOnMap2').className="buttons";
					}
					
			});
			/*$('tuserRegistrationProcess3z1').submit();*/
		}	
	}
	/*else
	{showErrorPopup(DIVPOPUPWINDOW.TEXT[0].MSG,DIVPOPUPWINDOW.TEXT[1].MSG,'- Please select zone 1 before selecting zone 2')}*/
}

function resetSMSSelectBoxBorderColor()
{
	var tag=document.getElementsByTagName('div');
	for(i=0;i<tag.length;i++)
	{
		if(tag[i].className=="smstime")
		{
				if(tag[i].id=='clonetimeTo1' || tag[i].id=='clonetimeTo2' || tag[i].id=='clonetimeFrom1' || tag[i].id=='clonetimeFrom2')
				{
					$(tag[i].id).setStyle({border:'0px solid #fff'});
				}
		}
	}
}


function step4_validation()
{
	resetFormErrorBorderStyle('tuserRegistrationProcess4');
	resetSMSSelectBoxBorderColor();
	resetFormErrorBorderStyleForSelectControl();

	timeTo1=parseInt($('timeTo1').value);
	timeTo2=$('timeTo2').value;
	timeFrom1=parseInt($('timeFrom1').value);
	timeFrom2=$('timeFrom2').value;
	
	email=$('email').value;
	mobile2=$('mobile2').value;

	str="";

	if($('checkMobile2').checked && mobile2=="")
	{str+=TUSER.STEP4[26].ERROR;setErrorBoxBorder('mobile2');}
	else if($('checkMobile2').checked &&  mobile2!="" && $('checkMobile2').disabled==false)
	{
		var filter_number=/^([0-9]{1,10})$/;
		var filter_valid_number=/^([0-9]{10})$/;
		if (!filter_number.test(mobile2))
		{str+=TUSER.STEP4[27].ERROR;setErrorBoxBorder('mobile2');}
		else if (!filter_valid_number.test(mobile2))
		{str+=TUSER.STEP4[27].ERROR;setErrorBoxBorder('mobile2');}	
	}
	
	var startTime=0;
	var fromTime=0;
	if(timeTo2=='AM' && timeTo1==12)
	{
		startTime=0;
	}
	else if(timeTo2=='PM' && timeTo1<12)
	{
		startTime=(parseInt(timeTo1)+parseInt(12));
	}
	else
	{
		startTime=timeTo1;
	}
	
	
	if(timeFrom2=='AM' && timeFrom1==12)
	{
		fromTime=(parseInt(timeFrom1)+parseInt(12));
	}
	else if(timeFrom2=='PM' && timeFrom1<12)
	{
		fromTime=(parseInt(timeFrom1)+parseInt(12));
	}
	else
	{
		fromTime=timeFrom1;
	}
	
	if($('checkMobile1').checked && $('checkSms2').checked)
	{
		if(startTime>=fromTime)
		{
			str+=TUSER.STEP4[37].ERROR;Position.clone('timeTo1', 'clonetimeTo1');setErrorBoxBorder('clonetimeTo1');Position.clone('timeTo2', 'clonetimeTo2');setErrorBoxBorder('clonetimeTo2');Position.clone('timeFrom1', 'clonetimeFrom1');setErrorBoxBorder('clonetimeFrom1');Position.clone('timeFrom2', 'clonetimeFrom2');setErrorBoxBorder('clonetimeFrom2');
		}
	
	}

	if(str!="")
	{showErrorPopup(DIVPOPUPWINDOW.TEXT[0].MSG,DIVPOPUPWINDOW.TEXT[1].MSG,str)}
	else
	{$('tuserRegistrationProcess4').submit();}	
}

function step4Add_validation()
{
	resetFormErrorBorderStyle('tuserRegistrationProcess4');
	resetSMSSelectBoxBorderColor();
	resetFormErrorBorderStyleForSelectControl();
	streetNumber1=$('streetNumber1').value;
	streetName1=$('streetName1').value;
	streetType1=$('streetType1').value;
	suburb1=$('suburb1').value;
	postcode1=$('postcode1').value;
	state1=$('state41').value;
	streetNumber2=$('streetNumber2').value;
	streetName2=$('streetName2').value;
	streetType2=$('streetType2').value;
	suburb2=$('suburb2').value;
	postcode2=$('postcode2').value;
	state2=$('state42').value;
	mobile=$('mobile').value;
	stdCode1=$('stdCode1').value;
	landLine1=$('landLine1').value;
	stdCode2=$('stdCode2').value;
	landLine2=$('landLine2').value;
	stdfax=$('stdfax').value;
	fax=$('fax').value;
	/*fax2=$('fax2').value;
	stdfax2=$('stdfax2').value;*/
	
	timeTo1=parseInt($('timeTo1').value);
	timeTo2=$('timeTo2').value;
	timeFrom1=parseInt($('timeFrom1').value);
	timeFrom2=$('timeFrom2').value;
	
	othersNumber=$('othersNumber').value;
	email=$('email').value;
	mobile2=$('mobile2').value;
	addressType1=$('addressType1').checked;
	addressType2=$('addressType2').checked;
	postBoxNumber=$('postBoxNumber').value;
	
	str="";
	if(streetNumber1=="")
	{str+=TUSER.STEP4[0].ERROR;setErrorBoxBorder('streetNumber1');}
	
	if(streetName1=="")
	{str+=TUSER.STEP4[1].ERROR;setErrorBoxBorder('streetName1');}
	
	if(streetType1=="" || streetType1=="0")
	{str+=TUSER.STEP4[2].ERROR;Position.clone('streetType1', 'cloneStreetType1');setErrorBoxBorder('cloneStreetType1');}
	
	if(suburb1=="")
	{str+=TUSER.STEP4[4].ERROR;setErrorBoxBorder('suburb1');}
	
	if(postcode1=="")
	{str+=TUSER.STEP4[5].ERROR;setErrorBoxBorder('postcode1');}
	else 
	{
		var filter_number=/^([0-9]{1,4})$/;
		var filter_valid_number=/^([0-9]{4})$/;
		if (!filter_number.test(postcode1))
			{str+=TUSER.STEP4[5].ERROR;setErrorBoxBorder('postcode1');}
		else if (!filter_valid_number.test(postcode1))
			{str+=TUSER.STEP4[5].ERROR;setErrorBoxBorder('postcode1');}
	}
	
	if(state1=="" || state1==0)
	{str+=TUSER.STEP4[6].ERROR;Position.clone('state41', 'businessState');setErrorBoxBorder('businessState');}
	
	if(addressType1==true)
	{
		if(streetNumber2=="")
		{str+=TUSER.STEP4[7].ERROR;setErrorBoxBorder('streetNumber2');}
		
		if(streetName2=="")
		{str+=TUSER.STEP4[8].ERROR;setErrorBoxBorder('streetName2');}
		
		if(streetType2=="" || streetType2=="0")
		{str+=TUSER.STEP4[9].ERROR;Position.clone('streetType2', 'cloneStreetType2');setErrorBoxBorder('cloneStreetType2');}
	}
	else if(addressType2==true)
	{
		if(postBoxNumber=="")
		{str+=TUSER.STEP4[38].ERROR;setErrorBoxBorder('postBoxNumber');}	
	}
	
	if(suburb2=="")
	{str+=TUSER.STEP4[11].ERROR;setErrorBoxBorder('suburb2');}
	
	if(postcode2=="")
		{str+=TUSER.STEP4[12].ERROR;setErrorBoxBorder('postcode2');}
	else 
	{
		var filter_number=/^([0-9]{1,4})$/;
		var filter_valid_number=/^([0-9]{4})$/;
		if (!filter_number.test(postcode2))
			{str+=TUSER.STEP4[12].ERROR;setErrorBoxBorder('postcode2');}
		else if (!filter_valid_number.test(postcode2))
			{str+=TUSER.STEP4[12].ERROR;setErrorBoxBorder('postcode2');}
	}

	if(state2=="" || state2==0)
	{str+=TUSER.STEP4[13].ERROR;;Position.clone('state42', 'postalState');setErrorBoxBorder('postalState');}
	
	
	if(mobile=="")
	{str+=TUSER.STEP4[14].ERROR;setErrorBoxBorder('mobile');}
	else 
	{
		var filter_number=/^([0-9]{1,10})$/;
		var filter_valid_number=/^([0-9]{10})$/;
		if (!filter_number.test(mobile))
		{str+=TUSER.STEP4[14].ERROR;setErrorBoxBorder('mobile');}
		else if (!filter_valid_number.test(mobile))
		{str+=TUSER.STEP4[14].ERROR;setErrorBoxBorder('mobile');}
	}
	
	if(stdCode1=="" && landLine1=="")
	{str+=TUSER.STEP4[15].ERROR;setErrorBoxBorder('stdCode1');
	 str+=TUSER.STEP4[16].ERROR;setErrorBoxBorder('landLine1');}
	
	if(stdCode1=="" && landLine1!="")
	{str+=TUSER.STEP4[15].ERROR;setErrorBoxBorder('stdCode1');}
	else if(stdCode1!="" && landLine1=="")
	{str+=TUSER.STEP4[16].ERROR;setErrorBoxBorder('landLine1');}
	
	if(stdCode1!="") 
	{
		var filter_number=/^([0-9]{1,2})$/;
		var filter_valid_number=/^([0-9]{2})$/;
		if (!filter_number.test(stdCode1))
		{str+=TUSER.STEP4[15].ERROR;setErrorBoxBorder('stdCode1');}
		else if (!filter_valid_number.test(stdCode1))
		{str+=TUSER.STEP4[15].ERROR;setErrorBoxBorder('stdCode1');}
	}
	if(landLine1!="")
	{
		var filter_number=/^([0-9]{1,8})$/;
		var filter_valid_number=/^([0-9]{8})$/;
		if (!filter_number.test(landLine1))
		{str+=TUSER.STEP4[16].ERROR;setErrorBoxBorder('landLine1');}
		else if (!filter_valid_number.test(landLine1))
		{str+=TUSER.STEP4[16].ERROR;setErrorBoxBorder('landLine1');}
	}
	
	if(stdCode2=="" && landLine2!="")
	{str+=TUSER.STEP4[20].ERROR;setErrorBoxBorder('stdCode2');}
	else if(stdCode2!="" && landLine2=="")
	{str+=TUSER.STEP4[21].ERROR;setErrorBoxBorder('landLine2');}

	
	if(stdCode2!="")
	{	var filter_number=/^([0-9]{1,2})$/;
		var filter_valid_number=/^([0-9]{2})$/;
		if (!filter_number.test(stdCode2))
		{str+=TUSER.STEP4[20].ERROR;setErrorBoxBorder('stdCode2');}
		else if (!filter_valid_number.test(stdCode2))
		{str+=TUSER.STEP4[20].ERROR;setErrorBoxBorder('stdCode2');}
	}
	if(landLine2!="")
	{
		var filter_number=/^([0-9]{1,8})$/;
		var filter_valid_number=/^([0-9]{8})$/;
		if (!filter_number.test(landLine2))
		{str+=TUSER.STEP4[21].ERROR;setErrorBoxBorder('landLine2');}
		else if (!filter_valid_number.test(landLine2))
		{str+=TUSER.STEP4[21].ERROR;setErrorBoxBorder('landLine2');}
	}

	if(stdfax=="" && fax!="")
	{str+=TUSER.STEP4[18].ERROR;setErrorBoxBorder('stdfax');}
	else if(stdfax!="" && fax=="")
	{str+=TUSER.STEP4[19].ERROR;setErrorBoxBorder('fax');}

	if(stdfax!="")
	{	var filter_number=/^([0-9]{1,2})$/;
		var filter_valid_number=/^([0-9]{2})$/;
		if (!filter_number.test(stdfax))
		{str+=TUSER.STEP4[18].ERROR;setErrorBoxBorder('stdfax');}
		else if (!filter_valid_number.test(stdfax))
		{str+=TUSER.STEP4[18].ERROR;setErrorBoxBorder('stdfax');}
	}

	if(fax!="")
	{	var filter_number=/^([0-9]{1,8})$/;
		var filter_valid_number=/^([0-9]{8})$/;
		if (!filter_number.test(fax))
		{str+=TUSER.STEP4[19].ERROR;setErrorBoxBorder('fax');}
		else if (!filter_valid_number.test(fax))
		{str+=TUSER.STEP4[19].ERROR;setErrorBoxBorder('fax');}
	}
	
	
	if($('checkEmail2').checked && email=="")
	{str+=TUSER.STEP4[24].ERROR;setErrorBoxBorder('email');}
	else if($('checkEmail2').checked && email!="" && $('checkEmail2').disabled==false)
	{
		if(validEmailAddress(email))
		{str+=TUSER.STEP4[25].ERROR;setErrorBoxBorder('email');}
	}
	
	if($('checkMobile2').checked && mobile2=="")
	{str+=TUSER.STEP4[26].ERROR;setErrorBoxBorder('mobile2');}
	else if($('checkMobile2').checked &&  mobile2!="" && $('checkMobile2').disabled==false)
	{
		var filter_number=/^([0-9]{1,10})$/;
		var filter_valid_number=/^([0-9]{10})$/;
		if (!filter_number.test(mobile2))
		{str+=TUSER.STEP4[27].ERROR;setErrorBoxBorder('mobile2');}
		else if (!filter_valid_number.test(mobile2))
		{str+=TUSER.STEP4[27].ERROR;setErrorBoxBorder('mobile2');}	
	}
	
	var startTime=0;
	var fromTime=0;
	if(timeTo2=='AM' && timeTo1==12)
	{
		startTime=0;
	}
	else if(timeTo2=='PM' && timeTo1<12)
	{
		startTime=(parseInt(timeTo1)+parseInt(12));
	}
	else
	{
		startTime=timeTo1;
	}
	
	
	if(timeFrom2=='AM' && timeFrom1==12)
	{
		fromTime=(parseInt(timeFrom1)+parseInt(12));
	}
	else if(timeFrom2=='PM' && timeFrom1<12)
	{
		fromTime=(parseInt(timeFrom1)+parseInt(12));
	}
	else
	{
		fromTime=timeFrom1;
	}
	
	if($('checkMobile1').checked && $('checkSms2').checked)
	{
		if(startTime>=fromTime)
		{
			str+=TUSER.STEP4[37].ERROR;Position.clone('timeTo1', 'clonetimeTo1');setErrorBoxBorder('clonetimeTo1');Position.clone('timeTo2', 'clonetimeTo2');setErrorBoxBorder('clonetimeTo2');Position.clone('timeFrom1', 'clonetimeFrom1');setErrorBoxBorder('clonetimeFrom1');Position.clone('timeFrom2', 'clonetimeFrom2');setErrorBoxBorder('clonetimeFrom2');
		}
	
	}
	/*if($('checkFax2').checked && stdfax2=="")
	{str+=TUSER.STEP4[22].ERROR;setErrorBoxBorder('stdfax2');}
	else if($('checkFax2').checked && stdfax2!="")
	{	
		var filter_number=/^([0-9]{1,2})$/;
		var filter_valid_number=/^([0-9]{2})$/;
		if (!filter_number.test(stdfax2))
		{str+=TUSER.STEP4[22].ERROR;setErrorBoxBorder('stdfax2');}
		else if (!filter_valid_number.test(stdfax2))
		{str+=TUSER.STEP4[22].ERROR;setErrorBoxBorder('stdfax2');}
	}
	
	if($('checkFax2').checked && fax2=="")
	{str+=TUSER.STEP4[23].ERROR;setErrorBoxBorder('fax2');}
	else if($('checkFax2').checked &&  fax2!="" && $('checkFax2').disabled==false)
	{
		var filter_number=/^([0-9]{1,8})$/;
		var filter_valid_number=/^([0-9]{8})$/;
		if (!filter_number.test(fax2))
		{str+=TUSER.STEP4[23].ERROR;setErrorBoxBorder('fax2');}
		else if (!filter_valid_number.test(fax2))
		{str+=TUSER.STEP4[23].ERROR;setErrorBoxBorder('fax2');}	
	}*/
	
	
		
	
	
	if(str!="")
	{showErrorPopup(DIVPOPUPWINDOW.TEXT[0].MSG,DIVPOPUPWINDOW.TEXT[1].MSG,str)}
	else
	{$('tuserRegistrationProcess4').submit();}	
}


function toggleFaxMobileInput(type,element,updateCHK,updateLabel,anotherCHK,anotherInput,textMessage,stdFax)
{
	if(trim($(element).value)!='')
	{
		$(updateCHK).disabled=false;
		if(type=='fax')
	 	{
			$(updateLabel).innerHTML=$(stdFax).value+$(element).value;
		}
		else
		{
			$(updateLabel).innerHTML=$(element).value;
		}
	}
	else
	{	
		$(updateCHK).checked=false;
		$(updateCHK).disabled=true;
		$(updateLabel).innerHTML=textMessage;
		
		$(anotherCHK).checked=false;
		$(anotherCHK).disabled=true;
		$(anotherInput).value="";
		$(anotherInput).disabled=true;
		
	if(type=='mobile')
	 {
		$('checkSms1').disabled = true;
		$('checkSms2').disabled = true;
		$('timeTo1').disabled = true;
		$('timeTo2').disabled = true;
		$('timeFrom1').disabled = true;
		$('timeFrom2').disabled = true;
	 }

	if(type=='fax')
	 {$('stdfax2').disabled=true;$('stdfax2').value='';}

	}
}


function toggleAnotherOption(element,update,anotherUpdater)
{
	if($(element).checked)
	{	$(update).disabled=false;
			if($(update).checked)
			{$(anotherUpdater).disabled=false;}

	}
	else
	{	if($(update).checked)
		{$(anotherUpdater).disabled=true;}
		$(update).disabled=true;
	}
	
	/*if($('checkFax1').checked==true && $('checkFax2').checked==true)
	{$('stdfax2').disabled=false;}
	else
	{
		$('stdfax2').disabled=true;
		$('checkFax2').checked=false;
		$('stdfax2').value="";
		$('fax2').value="";
	}*/
		

}

function enableCheckBox1(element,update,updaterInput,str3,str4,str5,str6,str7,str8)
{
	if($(element).checked)
	{	$(update).disabled=false;
			if($(update).checked)
			{$(updaterInput).disabled=false;}
			if($(str4).checked)
			{
				$(str5).disabled=false;
				$(str6).disabled=false;
				$(str7).disabled=false;
				$(str8).disabled=false;
			}
			
		$(str3).disabled = false;
		$(str4).disabled = false;

	}
	else
	{
		if($(update).checked)
		{$(updaterInput).disabled=true;}
		$(update).disabled=true;

		$(str3).checked = true;
		$(str3).disabled = true;
		$(str4).checked = false;
		$(str4).disabled = true;
		$(str5).disabled = true;
		$(str6).disabled = true;
		$(str7).disabled = true;
		$(str8).disabled = true;
	}
}

function enableDropDown()
{
	if($('checkSms2').checked==true)
	{
		$('timeTo1').disabled=false;
		$('timeTo2').disabled=false;
		$('timeFrom1').disabled=false;
		$('timeFrom2').disabled=false;
	}
	else
	{
		if($('checkSms1').checked==true)
		{
			$('timeTo1').disabled=true;
			$('timeTo2').disabled=true;
			$('timeFrom1').disabled=true;
			$('timeFrom2').disabled=true;	
		}
	}
}

/*function submitRegistrationStep3(error)
{
	if($('submitZone2').className=='buttons')
	{$('tuserRegistrationStep3').submit();}
	else
	{
		if($('radius').value=="" && $('radius1').value=="")
		{str="- You must name and define at least one zone before you progress";}
		else
		{
			if($('savedZone1').value=="")
			{str='- You need to save Zone 1 before you can progress';}
			else
			{
				if($('radius1').value!=""){ 
					if($('savedZone2').value=="")
					{str+='- You must view your covered suburbs and save them before you progress'}
				}
			}
		}
		showErrorPopup(DIVPOPUPWINDOW.TEXT[0].MSG,DIVPOPUPWINDOW.TEXT[1].MSG,str)		
	}
}
*/

function submitRegistrationStep3(error)
{
	str="";
		
	/*if($('savedZone1').value=="")
	{str=TUSER.STEP3[7].ERROR;}
	
	if($('zoneName1').value!="" || $('state1').value!="" || $('state1').value!="0" || $('postCode1').value!="" || $('suburb1').value!="" || $('radius1').value!="")
	{str=TUSER.STEP3[6].ERROR;}
	
	if($('savedZone2').value=="")
	{str=TUSER.STEP3[8].ERROR;}*/
	if($('zoneName').value=="")
	{str=TUSER.STEP3[0].ERROR;}
	else if($('state').value=="" || $('state').value=="0")
	{str=TUSER.STEP3[4].ERROR;}
	else if($('postCode').value=="")
	{str=TUSER.STEP3[1].ERROR;}
	else if($('radius').value=="" || $('radius').value=="0")
	{str=TUSER.STEP3[5].ERROR;}
	else if($('savedZone1').value=="")
	{str=TUSER.STEP3[8].ERROR;}	
	else if($('savedZone1').value=="show")
	{str=TUSER.STEP3[7].ERROR;}	
	else if($('zoneName1').value!='' && $('savedZone2').value=="")
	{str=TUSER.STEP3[8].ERROR;}	
	else if($('savedZone2').value=="show")
	{str=TUSER.STEP3[9].ERROR;}	
							
	if(str=="")
	{$('tuserRegistrationStep3').submit();}
	else
	{showErrorPopup(DIVPOPUPWINDOW.TEXT[0].MSG,DIVPOPUPWINDOW.TEXT[1].MSG,str)
	 return false;}		
}


function moveTabIndex(element,update)
{
	var elementLength=$(element).value.length;
	if(elementLength==2)
	$(update).focus();
}

function defaultBlank(inputFieldId)
{
	if($(inputFieldId).value=="dd/mm/yyyy")
	{
		$(inputFieldId).value="";
	}
}

function defaultVal(inputFieldId)
{
	if($(inputFieldId).value=="")
	{
		$(inputFieldId).value="dd/mm/yyyy";
	}
}
/**********************Functions for validate date start*********************************************/

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

/***************************************End functions to validate date*********************************/

/*****
Fuction editInfo()
created by chandra
purpose for redirection page onclick edit from tuser profile page
*****/
function editInfo(editTypeInfo)
{
	document.editDetails.action=base_url+"registration/";
	if(document.editDetails.editType.value=="")
	{
		document.editDetails.editType.value=editTypeInfo;
	}
	document.getElementById('editDetails').submit();
}


/*****
Fuction editInfo()
created by chandra
purpose for redirection page onclick edit from tuser profile page
*****/
function cancelAction()
{
	document.editDetails.action=base_url+MY_PROFILE+"/";
	document.getElementById('editDetails').submit();
}

function editUserProfileInfo(editTypeInfo,editTypeInfoMethod)
{	
	if($('openEditTag').value=='No')
	{
		showEditUserProfileHtml=base_url+'tuser_profile/'+editTypeInfoMethod;
		var myAjax = new Ajax.Request(showEditUserProfileHtml, {method: 'post',
					onComplete: function showResponse(response)
					{	
						$(editTypeInfo).update('');
						$(editTypeInfo).setStyle({textAlign:'left'});
						$(editTypeInfo).update(response.responseText);
						$('openEditTag').value=editTypeInfo;
					}
			});	
	}
	else
	{
		var alertValue;
		if($('openEditTag').value == 'editStepContactInfo')
		alertValue ='Contact Information';
		else if($('openEditTag').value == 'editStepId1')
		alertValue ='Qualifications, licences and insurance';
		else if($('openEditTag').value == 'editStepId2')
		alertValue ='trade categories';
		else if($('openEditTag').value == 'editStepId3')
		alertValue ='work zones';
		else if($('openEditTag').value == 'editStepId4')
		alertValue ='contact & job notifications preferences';
		
		var ERRORMSG = 'You must save '+alertValue+' section first before opening another edit section.';
		showErrorPopup(DIVPOPUPWINDOW.TEXT[0].MSG,DIVPOPUPWINDOW.TEXT[1].MSG,ERRORMSG);
		return false;	
	}
}
/*
function showDearUtool()
{
	$('txtID').show();
	$('submitID').show();
	$('buttonID').hide();
}
*/function validateDearUtool()
{
	resetFormErrorBorderStyle('dearutool');
	resetFormErrorBorderStyleForSelectControl();
	
	textArea=$('textareadUTOOL').value;
	str="";
	var congTitle = "THANK YOU";
	var confDesc = "We really appreciate your feedback. While we can't promise a reply to every message, we do read all of them. Please complete the security challange below and tell us your name and email if you like";
	if(textArea=='')
	{str+="Please enter some text.<br>";setErrorBoxBorder('textareadUTOOL');}
	
	if(str!="")
	{showErrorPopup(DIVPOPUPWINDOW.TEXT[0].MSG,DIVPOPUPWINDOW.TEXT[1].MSG,str);return false;}
	else
	{
		showConfirmationPopup(congTitle,confDesc,'','');
	}	
}

function enableFieldFunction(clickEventVar,effectVar1,effectVar2,effectVar3,effectCssVar1,effectCssVar2,effectCssVar3)
{
	if($(clickEventVar).value.length>0)
	{
		if(effectVar1!='')
		{
			$(effectVar1).disabled=false;
			$(effectVar1).className=effectCssVar1;
		}
		if(effectVar2!='')
		{
			$(effectVar2).disabled=false;
			$(effectVar2).className=effectCssVar2;
		}
		if(effectVar3!='')
		{
			$(effectVar3).disabled=false;
			$(effectVar3).className=effectCssVar3;
		}
	}
	else
	{
		if(effectVar1!='')
		{
			$(effectVar1).value='';
			$(effectVar1).className=effectCssVar1+' disabled_textarea';
			$(effectVar1).disabled=true;
		}
		if(effectVar2!='')
		{
			$(effectVar2).value='';
			$(effectVar2).className=effectCssVar2+' disabled_textarea';
			$(effectVar2).disabled=true;
		}
		if(effectVar3!='')
		{
			$(effectVar3).value='';
			$(effectVar3).className=effectCssVar3+' disabled_textarea';
			$(effectVar3).disabled=true;
		}
	}
}

function divDisplay(onClickVal, defaultDisplayDivID, changeDisplayDivID)
{

	if(onClickVal=="PO Box")
	{
		if(typeof($('sameAsBusiness'))!='undefined')
		{
			$('sameAsBusiness').checked=false;
			$('business_to_postal').hide();
		}
		$(changeDisplayDivID).hide();
		$(defaultDisplayDivID).show();
	}
	else
	{

		if(typeof($('business_to_postal'))!='undefined')
		{
			$('business_to_postal').show();
		}
		$(changeDisplayDivID).show();
		$(defaultDisplayDivID).hide();
	}
}

function updateBusinessToPostal(check)
{
	if(check)
	{
		var unitNo=$F('unitNumber1');
		var streeNo=$F('streetNumber1');
		var streeName=$F('streetName1');
		var streetType=$('streetType1').selectedIndex;
		var addressLine1=$F('addressLine1');
		var suburb=$F('suburb1');
		var postCode=$F('postcode1');
		var state=$('state41').selectedIndex;
		
		$('unitNumber2').value=unitNo;
		$('streetNumber2').value=streeNo;
		$('streetName2').value=streeName;
		$('streetType2').selectedIndex=streetType;
		$('addressLine2').value=addressLine1;
		$('suburb2').value=suburb;
		$('postcode2').value=postCode;
		$('state42').selectedIndex=state;
	}
	else
	{
		$('unitNumber2').value='';
		$('streetNumber2').value='';
		$('streetName2').value='';
		$('streetType2').selectedIndex=0;
		$('addressLine2').value='';
		$('suburb2').value='';
		$('postcode2').value='';
		$('state42').selectedIndex=0;
		
	}
	
		
}

function clearBusinessToPostal()
{
	$('unitNumber2').value='';
	$('streetNumber2').value='';
	$('streetName2').value='';
	$('streetType2').selectedIndex=0;
	$('addressLine2').value='';
	$('suburb2').value='';
	$('postcode2').value='';
	$('state42').selectedIndex=0;
}

function showGM(zoneName,lng,rad,zoneBtn)
{
	if(typeof($(zoneBtn))!='undefined' && $F('stateChangeStatus1')==0)
	{
		var validGoogleMap = base_url+"registration/validateGoogleMapRequest/"+$("state").value+"/"+$("postCode").value;
		var myAjax = new Ajax.Request(validGoogleMap, {method: 'post', 
			onComplete: function showResponse(response)
			{	
				if(parseInt(response.responseText)>0)
				{
					var windowWidth=800;
					var windowHeight=600;
					var centerWidth = (window.screen.width - windowWidth) / 2;
					var centerHeight = (window.screen.height - windowHeight) / 2;
					var mapURL=base_url+'google-map/'+zoneName;
					window.open(mapURL,'test','location=no,menubar=no,toolbar=no,width=' + windowWidth + ',height=' + windowHeight + ',top=' + centerHeight + ',left=' + centerWidth);	
				}
				else
				{
					alert(" No record found, to view google map.");
				}
			}
		  });
	}
}


function getContactInfoHTML(val)
{
	if($('openEditTag').value=='No' || $('openEditTag').value=='editStepContactInfo')
	{
		if(val=='edit')
		{	$('openEditTag').value='editStepContactInfo';
			$('huser_contact_info_edit_button').setStyle({visibility:'hidden'});
		}
		else
		{	$('openEditTag').value='No';
			$('huser_contact_info_edit_button').setStyle({visibility:'visible'});
		}
		var pagevalue=varHexString($('codeValue'))
		$('loaderImage').setStyle({display:'block'});
		getHTMLURL=base_url+'update-tuser-profile-html/'+pagevalue+'/'+val;
		var myAjax = new Ajax.Request(getHTMLURL, {method: 'post', 
		onComplete: function showResponse(response)
		{
			$('loaderImage').setStyle({display:'none'});
			$('editTuserContactInformation').update('');
			$('editTuserContactInformation').update(response.responseText);
		}
		});
	}else
	{
		var alertValue;
		if($('openEditTag').value == 'editStepContactInfo')
		alertValue ='Contact Information';
		else if($('openEditTag').value == 'editStepId1')
		alertValue ='Qualifications, licences and insurance';
		else if($('openEditTag').value == 'editStepId2')
		alertValue ='trade categories';
		else if($('openEditTag').value == 'editStepId3')
		alertValue ='work zones';
		else if($('openEditTag').value == 'editStepId4')
		alertValue ='contact & job notifications preferences';
		
		var ERRORMSG = 'You must save '+alertValue+' section first before opening another edit section.';
		showErrorPopup(DIVPOPUPWINDOW.TEXT[0].MSG,DIVPOPUPWINDOW.TEXT[1].MSG,ERRORMSG);
		return false;	
	}
}
function submitTuserContactInfo()
{
	resetFormErrorBorderStyle('tuserRegistrationProcess4');
	resetSMSSelectBoxBorderColor();
	resetFormErrorBorderStyleForSelectControl();
	streetNumber1=$('streetNumber1').value;
	streetName1=$('streetName1').value;
	streetType1=$('streetType1').value;
	suburb1=$('suburb1').value;
	postcode1=$('postcode1').value;
	state1=$('state41').value;
	streetNumber2=$('streetNumber2').value;
	streetName2=$('streetName2').value;
	streetType2=$('streetType2').value;
	suburb2=$('suburb2').value;
	postcode2=$('postcode2').value;
	state2=$('state42').value;
	mobile=$('mobile').value;
	stdCode1=$('stdCode1').value;
	landLine1=$('landLine1').value;
	stdCode2=$('stdCode2').value;
	landLine2=$('landLine2').value;
	stdfax=$('stdfax').value;
	fax=$('fax').value;
	
	othersNumber=$('othersNumber').value;

	addressType1=$('addressType1').checked;
	addressType2=$('addressType2').checked;
	postBoxNumber=$('postBoxNumber').value;
	
	str="";
	if(streetNumber1=="")
	{str+=TUSER.STEP4[0].ERROR;setErrorBoxBorder('streetNumber1');}
	
	if(streetName1=="")
	{str+=TUSER.STEP4[1].ERROR;setErrorBoxBorder('streetName1');}
	
	if(streetType1=="" || streetType1=="0")
	{str+=TUSER.STEP4[2].ERROR;Position.clone('streetType1', 'cloneStreetType1');setErrorBoxBorder('cloneStreetType1');}
	
	if(suburb1=="")
	{str+=TUSER.STEP4[4].ERROR;setErrorBoxBorder('suburb1');}
	
	if(postcode1=="")
	{str+=TUSER.STEP4[5].ERROR;setErrorBoxBorder('postcode1');}
	else 
	{
		var filter_number=/^([0-9]{1,4})$/;
		var filter_valid_number=/^([0-9]{4})$/;
		if (!filter_number.test(postcode1))
			{str+=TUSER.STEP4[5].ERROR;setErrorBoxBorder('postcode1');}
		else if (!filter_valid_number.test(postcode1))
			{str+=TUSER.STEP4[5].ERROR;setErrorBoxBorder('postcode1');}
	}
	
	if(state1=="" || state1==0)
	{str+=TUSER.STEP4[6].ERROR;Position.clone('state41', 'businessState');setErrorBoxBorder('businessState');}
	
	if(addressType1==true)
	{
		if(streetNumber2=="")
		{str+=TUSER.STEP4[7].ERROR;setErrorBoxBorder('streetNumber2');}
		
		if(streetName2=="")
		{str+=TUSER.STEP4[8].ERROR;setErrorBoxBorder('streetName2');}
		
		if(streetType2=="" || streetType2=="0")
		{str+=TUSER.STEP4[9].ERROR;Position.clone('streetType2', 'cloneStreetType2');setErrorBoxBorder('cloneStreetType2');}
	}
	else if(addressType2==true)
	{
		if(postBoxNumber=="")
		{str+=TUSER.STEP4[38].ERROR;setErrorBoxBorder('postBoxNumber');}	
	}
	
	if(suburb2=="")
	{str+=TUSER.STEP4[11].ERROR;setErrorBoxBorder('suburb2');}
	
	if(postcode2=="")
		{str+=TUSER.STEP4[12].ERROR;setErrorBoxBorder('postcode2');}
	else 
	{
		var filter_number=/^([0-9]{1,4})$/;
		var filter_valid_number=/^([0-9]{4})$/;
		if (!filter_number.test(postcode2))
			{str+=TUSER.STEP4[12].ERROR;setErrorBoxBorder('postcode2');}
		else if (!filter_valid_number.test(postcode2))
			{str+=TUSER.STEP4[12].ERROR;setErrorBoxBorder('postcode2');}
	}

	if(state2=="" || state2==0)
	{str+=TUSER.STEP4[13].ERROR;;Position.clone('state42', 'postalState');setErrorBoxBorder('postalState');}
	
	
	if(mobile=="")
	{str+=TUSER.STEP4[14].ERROR;setErrorBoxBorder('mobile');}
	else 
	{
		var filter_number=/^([0-9]{1,10})$/;
		var filter_valid_number=/^([0-9]{10})$/;
		if (!filter_number.test(mobile))
		{str+=TUSER.STEP4[14].ERROR;setErrorBoxBorder('mobile');}
		else if (!filter_valid_number.test(mobile))
		{str+=TUSER.STEP4[14].ERROR;setErrorBoxBorder('mobile');}
	}
	
	if(stdCode1=="" && landLine1=="")
	{str+=TUSER.STEP4[15].ERROR;setErrorBoxBorder('stdCode1');
	 str+=TUSER.STEP4[16].ERROR;setErrorBoxBorder('landLine1');}
	
	if(stdCode1=="" && landLine1!="")
	{str+=TUSER.STEP4[15].ERROR;setErrorBoxBorder('stdCode1');}
	else if(stdCode1!="" && landLine1=="")
	{str+=TUSER.STEP4[16].ERROR;setErrorBoxBorder('landLine1');}
	
	if(stdCode1!="") 
	{
		var filter_number=/^([0-9]{1,2})$/;
		var filter_valid_number=/^([0-9]{2})$/;
		if (!filter_number.test(stdCode1))
		{str+=TUSER.STEP4[15].ERROR;setErrorBoxBorder('stdCode1');}
		else if (!filter_valid_number.test(stdCode1))
		{str+=TUSER.STEP4[15].ERROR;setErrorBoxBorder('stdCode1');}
	}
	if(landLine1!="")
	{
		var filter_number=/^([0-9]{1,8})$/;
		var filter_valid_number=/^([0-9]{8})$/;
		if (!filter_number.test(landLine1))
		{str+=TUSER.STEP4[16].ERROR;setErrorBoxBorder('landLine1');}
		else if (!filter_valid_number.test(landLine1))
		{str+=TUSER.STEP4[16].ERROR;setErrorBoxBorder('landLine1');}
	}
	
	if(stdCode2=="" && landLine2!="")
	{str+=TUSER.STEP4[20].ERROR;setErrorBoxBorder('stdCode2');}
	else if(stdCode2!="" && landLine2=="")
	{str+=TUSER.STEP4[21].ERROR;setErrorBoxBorder('landLine2');}

	
	if(stdCode2!="")
	{	var filter_number=/^([0-9]{1,2})$/;
		var filter_valid_number=/^([0-9]{2})$/;
		if (!filter_number.test(stdCode2))
		{str+=TUSER.STEP4[20].ERROR;setErrorBoxBorder('stdCode2');}
		else if (!filter_valid_number.test(stdCode2))
		{str+=TUSER.STEP4[20].ERROR;setErrorBoxBorder('stdCode2');}
	}
	if(landLine2!="")
	{
		var filter_number=/^([0-9]{1,8})$/;
		var filter_valid_number=/^([0-9]{8})$/;
		if (!filter_number.test(landLine2))
		{str+=TUSER.STEP4[21].ERROR;setErrorBoxBorder('landLine2');}
		else if (!filter_valid_number.test(landLine2))
		{str+=TUSER.STEP4[21].ERROR;setErrorBoxBorder('landLine2');}
	}

	if(stdfax=="" && fax!="")
	{str+=TUSER.STEP4[18].ERROR;setErrorBoxBorder('stdfax');}
	else if(stdfax!="" && fax=="")
	{str+=TUSER.STEP4[19].ERROR;setErrorBoxBorder('fax');}

	if(stdfax!="")
	{	var filter_number=/^([0-9]{1,2})$/;
		var filter_valid_number=/^([0-9]{2})$/;
		if (!filter_number.test(stdfax))
		{str+=TUSER.STEP4[18].ERROR;setErrorBoxBorder('stdfax');}
		else if (!filter_valid_number.test(stdfax))
		{str+=TUSER.STEP4[18].ERROR;setErrorBoxBorder('stdfax');}
	}

	if(fax!="")
	{	var filter_number=/^([0-9]{1,8})$/;
		var filter_valid_number=/^([0-9]{8})$/;
		if (!filter_number.test(fax))
		{str+=TUSER.STEP4[19].ERROR;setErrorBoxBorder('fax');}
		else if (!filter_valid_number.test(fax))
		{str+=TUSER.STEP4[19].ERROR;setErrorBoxBorder('fax');}
	}
	

	if(str!="")
	{showErrorPopup(DIVPOPUPWINDOW.TEXT[0].MSG,DIVPOPUPWINDOW.TEXT[1].MSG,str)}
	else
	{$('tuserRegistrationProcess4').submit();}	
}

function tuserBlurb(val)
{
	if(val=="edit")
	{
		$("tuser_blurb_edit_button").setStyle({display:'none'});
		$("tuser_blurb_text").setStyle({display:'none'});
		$("tuser_blurb_button_area").setStyle({display:'inline'});
		$("tuser_blurb_textarea").setStyle({display:'inline'});
	}
	else if(val=="cancel")
	{
		$("tuser_blurb_edit_button").setStyle({display:'inline'});
		$("tuser_blurb_text").setStyle({display:'inline'});
		$("tuser_blurb_button_area").setStyle({display:'none'});
		$("tuser_blurb_textarea").setStyle({display:'none'});
	}
}

function tuserBlurbValidation()
{
	var blurb=$("tuser_blurb_textarea").value;
	var str="";
	if(trim(blurb)=="")
	{str+="- Please enter few text.";}
	else if((trim(blurb)).length>1000)
	{str+="- You can enter up to 1000 characters.";}
	
	if(str!="")
	{showErrorPopup(DIVPOPUPWINDOW.TEXT[0].MSG,DIVPOPUPWINDOW.TEXT[1].MSG,str);}
	else
	{$('form_tuser_blurb').submit();}	
}
