var arg1='';
var arg2='';
var arg3='';
function showErrorPopup(heading,subheading,bodyCopy){

	if(typeof($('error_msg_overlay_container'))!='undefined')
	{	
		$('error_msg_overlay_container').remove();
	}
	this.popupContainer();

	$('error_msg_heading').update('');
	$('error_msg_sub_heading').update('');
	$('error_msg_body_copy').update('');
	
	$('error_msg_heading').update(heading);
	$('error_msg_sub_heading').update(subheading);
	$('error_msg_body_copy').update(bodyCopy);
	
	/*if(subheading=='')
	{$('error_msg_sub_heading').setStyle({display:'none'});}*/
	if(subheading=='')
	{$('error_msg_sub_heading').setStyle({visiblity:'hidden'});}
	
	$('error_msg_overlay_container').setStyle({
		display:'block'
	});
	/*$('error_msg_container').setStyle({
		display:'block',
		visibility:'hidden'
	});*/
	
	/*********************CONFIRMATION CONTROLLER*****************************************/
	if(arguments.length>3)
	{
		if(arguments.length==6 && arguments[5]=='story_confirm')
		{
			$('error_msg_btn_container').appendChild(Builder.node('input',{id:'error_msg_btn_homepage',className:'error_msg_btn',type:'button',name:'error_homepage',value:arguments[3],onClick:'goTo(\'\')'}));	
			$('error_msg_btn_container').appendChild(Builder.node('input',{id:'error_msg_btn_refer_a_tradie',className:'error_msg_btn',type:'button',name:'error_refer_a_tradie',value:arguments[4],onClick:'goTo(\'introduce-tradie\')'}));	
			$('error_msg_btn_back').setStyle({display:'none'});
			
		}
		else if(arguments.length==8 && arguments[7]=='story_confirm')
		{
			$('error_msg_btn_container').appendChild(Builder.node('input',{id:'error_msg_btn_homepage',className:'error_msg_btn',type:'button',name:'error_homepage',value:arguments[3],onClick:'goTo(\'\')'}));	
			$('error_msg_btn_container').appendChild(Builder.node('input',{id:'error_msg_btn_myprofile',className:'error_msg_btn',type:'button',name:'error_myprofile',value:arguments[4],onClick:'goTo(\'my-profile\')'}));		
			$('error_msg_btn_container').appendChild(Builder.node('input',{id:'error_msg_btn_myjobs',className:'error_msg_btn',type:'button',name:'error_myjobs',value:arguments[5],onClick:'goTo(\'my-jobs\')'}));	
			$('error_msg_btn_container').appendChild(Builder.node('input',{id:'error_msg_btn_refer_a_tradie',className:'error_msg_btn',type:'button',name:'error_refer_a_tradie',value:arguments[6],onClick:'goTo(\'introduce-tradie\')'}));	
			$('error_msg_btn_back').setStyle({display:'none'});
			
		}
		else if(arguments.length==4 && arguments[3]=='loader')
		{
			$('error_msg_btn_container').setStyle({display:'none'});
			$('error_msg_body_copy').setStyle({textAlign:'center'});
			$('error_msg_body_copy').update('<img src="'+view_url+'/images/loader.gif"/>');
		}
		//This condition will manage user's account activation re-send email screen
		else if(arguments.length==6 && arguments[5]=='tuser_account_activation_email')
		{
				
			string=DIVPOPUPWINDOW.LOGIN_ERROR[3].MSG;
			msg=string.replace('{email_id}',arguments[3]);
					
			$('error_msg_heading').update(DIVPOPUPWINDOW.LOGIN_ERROR[6].MSG);
			$('error_msg_sub_heading').update(DIVPOPUPWINDOW.LOGIN_ERROR[5].MSG);
			$('error_msg_body_copy').update(msg);
							
							//$('error_msg_btn_container').appendChild(Builder.node('input',{id:'error_msg_btn_resendemail',className:'error_msg_btn',type:'button',name:'error_resendemail',value:DIVPOPUPWINDOW.LOGIN_ERROR[4].MSG, onClick:'sendAccountActivationEmail(\''+arguments[3]+'\', \''+arguments[4]+'\')'}));	
		}
		//This condition will manage user's account activation re-send email screen
		else if(arguments.length==7 && arguments[6]=='loginerror')
		{
			$('error_msg_btn_container').appendChild(Builder.node('input',{id:'error_msg_btn_resendemail',className:'error_msg_btn',type:'button',name:'error_resendemail',value:arguments[3], onClick:'sendAccountActivationEmail(\''+$F(arguments[4])+'\', \''+arguments[5]+'\')'}));	
		}
		//This condition will manage user's account activation welcome screen
		else if(arguments.length==7 && arguments[6]=='welcome')
		{
			
			$('error_msg_btn_container').appendChild(Builder.node('input',{id:'error_msg_btn_myjobs',className:'error_msg_btn',type:'button',name:'error_myjobs',value:arguments[3],onClick:'goTo(\'my-jobs\')'}));	
			$('error_msg_btn_container').appendChild(Builder.node('input',{id:'error_msg_btn_myprofile',className:'error_msg_btn',type:'button',name:'error_myprofile',value:arguments[4],onClick:'goTo(\'my-profile\')'}));			
			$('error_msg_btn_back').value=arguments[5];
		}
		else if(arguments.length==7 && arguments[6]=='welcometuser')
		{
			
			$('error_msg_btn_container').appendChild(Builder.node('input',{id:'error_msg_btn_findJob',className:'error_msg_btn',type:'button',name:'error_findJob',value:arguments[3],onClick:'goTo(\'myjobs/find-a-job\')'}));	
			$('error_msg_btn_container').appendChild(Builder.node('input',{id:'error_msg_btn_myprofile',className:'error_msg_btn',type:'button',name:'error_myprofile',value:arguments[4],onClick:'goTo(\'my-profile\')'}));			
			$('error_msg_btn_back').setStyle({display:'none'});
			$('error_msg_btn_container').appendChild(Builder.node('input',{id:'error_msg_btn_postajob',className:'error_msg_btn',type:'button',name:'error_postajo',value:arguments[5],onClick:'hideErrorPopup()'}));		
		}
		else if(arguments.length==7 && arguments[6]=='upgradeaccount')
		{
			$('error_msg_btn_container').appendChild(Builder.node('input',{id:'error_msg_btn_myjobs',className:'error_msg_btn',type:'button',name:'error_myjobs',value:arguments[3],onClick:'goTo(\'my-jobs\')'}));	

$('error_msg_btn_container').appendChild(Builder.node('input',{id:'error_msg_btn_myprofile',className:'error_msg_btn',type:'button',name:'error_myprofile',value:arguments[4],onClick:'goTo(\'my-profile\')'}));			

				$('error_msg_btn_back').setStyle({display:'none'});
			$('error_msg_btn_container').appendChild(Builder.node('input',{id:'error_msg_btn_postajob',className:'error_msg_btn',type:'button',name:'error_postajo',value:arguments[5],onClick:'goTo(\'\')'}));	
		}
		else if(arguments.length==6 && arguments[5]=='tellAFavouriteTradie')
		{
			$('error_msg_body_copy').innerHTML=$('error_msg_body_copy').innerHTML+"<br/>"+$('tellafav').innerHTML;
			$('error_msg_btn_yes').show();
			$('error_msg_btn_yes').value="SEND NOTIFICATION";
			arg1=arguments[3];arg2=arguments[4];arg3=arguments[5];
			$('error_msg_btn_container').appendChild(Builder.node('input',{id:'tellAFavTradieHiddenBtn',type:'hidden',name:'tellAFavTradieHiddenBtn',value:"0"}));
			$('error_msg_btn_container').appendChild(Builder.node('input',{id:'error_msg_btn_xclose',className:'error_msg_btn',type:'button',name:'error_msg_btn_xclose',value:"X Close",onClick:'hideErrorPopup()'}));
			$('error_msg_btn_back').setStyle({display:'none'});
		}
		else if(arguments.length==6 && arguments[3]=='send_material' && arguments[4]=='zero_limit')
		{
			$('error_msg_btn_back').setStyle({display:'none'});
			$('error_msg_sub_heading').setStyle({display:'none'});
			$('mobilContainerspan').appendChild(Builder.node('div',{id:'mobilContainer'}));
			$('mobilContainer').appendChild(Builder.node('div',{id:'mobileContentContianer'}));
			$('mobileContentContianer').appendChild(Builder.node('div',{id:'mobileText'}));
			$('mobileContentContianer').appendChild(Builder.node('div',{id:'mobileTextBoxDiv'}));
			$('mobileTextBoxDiv').appendChild(Builder.node('input',{id:'mobileTextBox',name:'mobileTextBox',type:'text',value:'0',className:'disabled_textarea',readOnly:'true',maxLength:'11'}));
			$('mobilContainerspan').appendChild(Builder.node('div',{id:'mobilButtonContainer'}));
			$('mobileText').update(DIVPOPUPWINDOW.SEND_MATERIALS[7].MSG);
			
			$('error_msg_btn_container').appendChild(Builder.node('input',{id:'mobilePurchaseSMSLimit',className:'error_msg_btn',type:'button',name:'mobilePurchaseSMSLimit',value:DIVPOPUPWINDOW.SEND_MATERIALS[8].MSG}));
			$('error_msg_btn_container').appendChild(Builder.node('input',{id:'error_msg_btn_xclose',className:'error_msg_btn',type:'button',name:'error_msg_btn_xclose',value:"X Close",onClick:'hideErrorPopup()'}));
			$('mobileTextBox').value=arguments[5];
		}
		else if(arguments.length==6 && arguments[3]=='send_material' && arguments[4]=='enough_limit')
		{
			$('error_msg_btn_back').setStyle({display:'none'});
			$('error_msg_sub_heading').setStyle({display:'none'});
			$('mobilContainerspan').appendChild(Builder.node('div',{id:'mobilContainer'}));
			$('mobilContainer').appendChild(Builder.node('div',{id:'mobileContentContianer'}));
			$('mobileContentContianer').appendChild(Builder.node('div',{id:'mobileText'}));
			$('mobileContentContianer').appendChild(Builder.node('div',{id:'mobileTextBoxDiv'}));
			$('mobileTextBoxDiv').appendChild(Builder.node('input',{id:'mobileTextBox',name:'mobileTextBox',type:'text',value:'0',maxLength:'11'}));
			$('mobilContainerspan').appendChild(Builder.node('div',{id:'mobilButtonContainer'}));
			$('mobileText').update(DIVPOPUPWINDOW.SEND_MATERIALS[7].MSG);
			
			$('error_msg_btn_container').appendChild(Builder.node('input',{id:'mobileSendSMS',className:'error_msg_btn',type:'button',name:'mobileSendSMS',value:DIVPOPUPWINDOW.SEND_MATERIALS[9].MSG,onClick:'validMobileNumber()'}));
			$('error_msg_btn_container').appendChild(Builder.node('input',{id:'error_msg_btn_xclose',className:'error_msg_btn',type:'button',name:'error_msg_btn_xclose',value:"X Close",onClick:'hideErrorPopup()'}));
			$('mobileTextBox').value=arguments[5];
		}
		else if(arguments.length==4 && arguments[3]=="forgotPassword")
		{
			
			$('error_msg_btn_back').setStyle({display:'none'});
			$('error_msg_sub_heading').setStyle({display:'none'});
			
			$('mobilContainerspan').appendChild(Builder.node('div',{id:'forgotPWDEmailContainer',className:'forgotPWDEmailContainer'}));
			$('forgotPWDEmailContainer').appendChild(Builder.node('div',{id:'forgotPWDEmailControlContainer',className:'forgotPWDEmailControlContainer'}));
			$('forgotPWDEmailControlContainer').appendChild(Builder.node('div',{id:'forgotPWDEmailText',className:'forgotPWDEmailText'}));
			$('forgotPWDEmailControlContainer').appendChild(Builder.node('div',{id:'forgotPWDEmailcontrolDiv',className:'forgotPWDEmailcontrolDiv'}));
			$('forgotPWDEmailcontrolDiv').appendChild(Builder.node('input',{id:'emailid',name:'emailid',type:'text',size:"30",className:"pwdEmailID"}));
			
			$('forgotPWDEmailcontrolDiv').appendChild(Builder.node('input',{id:'submitEmailID',name:'submitEmailID',type:'button',value:"submit",className:"buttons",onclick:"forgotPassword()"}));
			
			$('forgotPWDEmailText').update("Email:");
			$("emailid").focus();
			
			$('mobilContainerspan').appendChild(Builder.node('div',{id:'forgotPWDErrorText'}));
			$('error_msg_btn_container').appendChild(Builder.node('input',{id:'error_msg_btn_xclose',className:'buttons',type:'button',name:'error_msg_btn_xclose',value:"X Close",onClick:'hideErrorPopup()'}));
			$("error_msg_btn_container").setStyle({textAlign:"right",marginTop:"0px"});
			
			$("forgotPWDErrorText").update("Sorry, we don't recognise that email address, please try again.");
		}
		else if(arguments.length==6 && arguments[3]=="resetPassword")
		{
			$('error_msg_btn_back').setStyle({display:'none'});
			$('error_msg_sub_heading').setStyle({display:'none'});
			
			$('mobilContainerspan').appendChild(Builder.node('div',{id:'forgotPWDEmailContainer',className:'resetPWDEmailContainer',style:"margin-top:20px;"}));
			$('forgotPWDEmailContainer').appendChild(Builder.node('div',{id:'forgotPWDEmailControlContainer',className:'forgotPWDEmailControlContainer'}));
			$('forgotPWDEmailControlContainer').appendChild(Builder.node('div',{id:'forgotPWDEmailText',className:'resetPWDEmailText',style:"padding:0px 2px 0px 0px;"}));
			$('forgotPWDEmailControlContainer').appendChild(Builder.node('div',{id:'forgotPWDEmailcontrolDiv',className:'forgotPWDEmailcontrolDiv',style:"font-weight:bold"}));
			$('forgotPWDEmailcontrolDiv').update(arguments[4]);
			
			$('mobilContainerspan').appendChild(Builder.node('div',{id:'forgotPWDEmailContainer1',className:'resetPWDEmailContainer'}));
			$('forgotPWDEmailContainer1').appendChild(Builder.node('div',{id:'forgotPWDEmailControlContainer1',className:'forgotPWDEmailControlContainer'}));
			$('forgotPWDEmailControlContainer1').appendChild(Builder.node('div',{id:'forgotPWDEmailText1',className:'resetPWDEmailText'}));
			$('forgotPWDEmailControlContainer1').appendChild(Builder.node('div',{id:'forgotPWDEmailcontrolDiv1',className:'forgotPWDEmailcontrolDiv'}));
			$('forgotPWDEmailcontrolDiv1').appendChild(Builder.node('input',{id:'newpassword',name:'newpassword',type:'password',size:"30",maxLength:"15",className:"pwdEmailID"}));
			
			$('mobilContainerspan').appendChild(Builder.node('div',{id:'forgotPWDEmailContainer2',className:'resetPWDEmailContainer'}));
			$('forgotPWDEmailContainer2').appendChild(Builder.node('div',{id:'forgotPWDEmailControlContainer2',className:'forgotPWDEmailControlContainer'}));
			$('forgotPWDEmailControlContainer2').appendChild(Builder.node('div',{id:'forgotPWDEmailText2',className:'resetPWDEmailText'}));
			$('forgotPWDEmailControlContainer2').appendChild(Builder.node('div',{id:'forgotPWDEmailcontrolDiv2',className:'forgotPWDEmailcontrolDiv'}));
			$('forgotPWDEmailcontrolDiv2').appendChild(Builder.node('input',{id:'renewpassword',name:'renewpassword',type:'password',size:"30",maxLength:"15",className:"pwdEmailID"}));
			$('forgotPWDEmailcontrolDiv2').appendChild(Builder.node('input',{id:'resetpasswordcode',name:'resetpasswordcode',type:'hidden'}));
			
			$('forgotPWDEmailText').update("Your email:");
			$('forgotPWDEmailText1').update("New password:");
			$('forgotPWDEmailText2').update("Re-enter new password:");
			$("resetpasswordcode").value=arguments[5];
			$("newpassword").focus();
			
			$('mobilContainerspan').appendChild(Builder.node('div',{id:'forgotPWDErrorText'}));
		
			$('error_msg_btn_container').appendChild(Builder.node('input',{id:'changePassword',className:'buttons',type:'button',name:'changePassword',value:"CHANGE PASSWORD",onClick:'resetPassword()'}));
		
			$('error_msg_btn_container').appendChild(Builder.node('input',{id:'error_msg_btn_xclose',className:'buttons',type:'button',name:'error_msg_btn_xclose',value:"X Close",onClick:'hideErrorPopup()',style:"display:none"}));
			$("error_msg_btn_container").setStyle({textAlign:"center",marginTop:"0px"});

			$("forgotPWDErrorText").update("");
			$("forgotPWDErrorText").setStyle({visibility:"visible",marginBottom:"10px"});
		}
		else
		{
			$('error_msg_btn_yes').show();
			arg1=arguments[3];arg2=arguments[4];arg3=arguments[5];
		}
	}
	/**************************************************************/	

	var dimensions=$('error_msg_container').getDimensions();

	var Width=getWidth();
	var Height=getHeight();
	var centerWidth = ((Width-480) / 2)+getScrollLeft();
    var centerHeight = ((Height-dimensions['height']) / 2)+getScrollTop();
	

	$('error_msg_overlay').setStyle({
		height:''+getScrollHeight()+'px',
		width:''+getScrollWidth()+'px'
		});

	$('error_msg_container').setStyle({
			left:''+centerWidth+'px',
			top:''+centerHeight+'px'
		});
	var containerCopyDimension=$('error_msg_container_copy').getDimensions();
	
	$('error_msg_iframe').setStyle({
			height:''+(containerCopyDimension['height']-2)+'px',
			width:''+(containerCopyDimension['width']-2)+'px',
			display:'inline'
		});
	
	
	if(containerCopyDimension['height']<175)
	{
		$('error_msg_container_copy').setStyle({
				height:'145px'
			});	
	}
	
	$('error_msg_container').setStyle({
		visibility:'visible'
	});
	

//	Effect.toggle('error_msg_container','appear');
	buttonFocus=setInterval('getFocus()','2000');
	return false;
}	
function getFocus()
{
	if(typeof($('error_msg_btn_back'))!='undefined')
	{
		if($('error_msg_btn_container').getStyle('display')!='none' && $('error_msg_btn_back').getStyle('display')!='none')
		{
			$('error_msg_btn_back').focus();
		}
	}
}
function hideErrorPopup()
{
	clearInterval(buttonFocus);
	$('error_msg_overlay_container').remove();
}

function ActionPanelConfirmation()
{
	if(typeof($('tellAFavTradieHiddenBtn'))!='undefined')
	{
		if($('tradie').value==0)
		{alert('- Please select a favourite tradie form the list');return false;}
	}
		
	if(arg1=='function')
	{
		var fun=arg3;
		hideErrorPopup();
		return eval(fun)(arg2);
	}
	else if(arg1=='form')
	{$(arg2).submit();}
	hideErrorPopup();
	
	
}

function popupContainer()
{
		var objBody= $$('body')[0];
		objBody.appendChild(Builder.node('div',{id:'error_msg_overlay_container'}));

		$('error_msg_overlay_container').appendChild(Builder.node('div',{id:'error_msg_overlay'}));
		$('error_msg_overlay_container').appendChild(Builder.node('div',{id:'error_msg_container'}));
		
		$('error_msg_container').appendChild(Builder.node('div',{id:'error_msg_top'}));	
		$('error_msg_top').appendChild(Builder.node('img',{src:view_url+'error_popup/images/spacer.gif'}));

		$('error_msg_container').appendChild(Builder.node('div',{id:'error_msg_container_copy'}));	
		$('error_msg_container_copy').appendChild(Builder.node('iframe',{id:'error_msg_iframe',frameBorder:'0',width:'200',height:'200'}));
		
		$('error_msg_container_copy').appendChild(Builder.node('div',{id:'error_msg_heading'}));
		$('error_msg_container_copy').appendChild(Builder.node('div',{id:'error_msg_sub_heading'}));
		$('error_msg_container_copy').appendChild(Builder.node('div',{id:'error_msg_body_copy'}));
		
		$('error_msg_container_copy').appendChild(Builder.node('span',{id:'mobilContainerspan'}));
		
		$('error_msg_container_copy').appendChild(Builder.node('div',{id:'error_msg_btn_container'}));
		$('error_msg_btn_container').appendChild(Builder.node('input',{id:'error_msg_btn_yes',className:'error_msg_btn',type:'button',name:'error_btn_yes',value:'Yes',style:'display:none',onClick:'ActionPanelConfirmation()'}));		

		$('error_msg_btn_container').appendChild(Builder.node('input',{id:'error_msg_btn_back',className:'error_msg_btn',type:'button',name:'error_back',value:'X Close',onClick:'hideErrorPopup()'}));		
		$('error_msg_container').appendChild(Builder.node('div',{id:'error_msg_bottom_left'}));
		$('error_msg_bottom_left').appendChild(Builder.node('img',{src:view_url+'error_popup/images/spacer.gif'}));
		
		$('error_msg_container').appendChild(Builder.node('div',{id:'error_msg_bottom_center'}));
		$('error_msg_bottom_center').appendChild(Builder.node('img',{src:view_url+'error_popup/images/spacer.gif'}));
		
		$('error_msg_container').appendChild(Builder.node('div',{id:'error_msg_bottom_right'}));
		$('error_msg_bottom_right').appendChild(Builder.node('img',{src:view_url+'error_popup/images/spacer.gif'}));
		
		//PNG image opacity is not working on ie-6 so this hacker made, range from 0 to 1, higher number means darker
		Element.setOpacity('error_msg_overlay',.5);
}

function goTo(url)
{
		window.location.href=base_url+url;
}

function sendAccountActivationEmail(emailid,password)
{
	
	var varString=trim(emailid)==''?' ':trim(emailid);
	var emailID=varString.toCharCode();
	
	resendEmailer=base_url+'resendemail/sender/'+emailID+'/'+password;
	$('error_msg_body_copy').setStyle({textAlign:'center'});
	$('error_msg_body_copy').update('<img src="'+view_url+'/images/loader.gif"/>');
	$('error_msg_iframe').setStyle({height:'auto'});
	var myAjax = new Ajax.Request(resendEmailer, {method: 'post', 
			onComplete: function showResponse(response)
			{	
				if(response.responseText=="successfully send")
				{
					$('error_msg_body_copy').setStyle({textAlign:'left'});
					string=DIVPOPUPWINDOW.LOGIN_ERROR[3].MSG;
					msg=string.replace('{email_id}',emailid);
					$('error_msg_body_copy').update(msg);	
					$('error_msg_sub_heading').update(DIVPOPUPWINDOW.LOGIN_ERROR[5].MSG);
				}
			}
		});
}

function sendAccountActivationEmailTuser(emailid,password)
{
	var varString=trim(emailid)==''?' ':trim(emailid);
	var emailID=varString.toCharCode();
	
	resendEmailer=base_url+'resendemail/sender/'+emailID+'/'+password;
	var myAjax = new Ajax.Request(resendEmailer, {method: 'post', 
			onComplete: function showResponse(response)
			{}
		});
}

function forgotPassword()
{	
	var emailid=$F("emailid");
	var validation=$F("utoolValidation");
	var varString=trim(emailid)==''?' ':trim(emailid);
	var valString=trim(validation)==''?' ':trim(validation);
	var emailID=varString.toCharCode();
	var validation=valString.toCharCode();
	
	str="";
	if($F("emailid")=="")
	{str+=POSTAJOB.PROCESS142_LOGIN[0].ERROR;setErrorBoxBorder('emailid');}
	else
	{
		if(validEmailAddress($F("emailid")))
		{str+=POSTAJOB.PROCESS142_LOGIN[1].ERROR;setErrorBoxBorder('emailid');}
	}
	
	if(str!="")
	{
		$("forgotPWDErrorText").setStyle({visibility:"visible"});
		$("forgotPWDErrorText").update(str);return false;
	}
	else
	{
		$("submitEmailID").className="disabled_button";
		$("submitEmailID").onclick="";
		$("forgotPWDErrorText").setStyle({visibility:"visible"});
		$('forgotPWDErrorText').update('<img src="'+view_url+'/images/ajax-loader.gif"/>');
	}
	var forgotpwd=base_url+'utool-user/forgot-password/'+emailID+'/'+validation;
	var myAjax = new Ajax.Request(forgotpwd, {method: 'post', 
			onComplete: function showResponse(response)
			{
				if(response.responseText=="valid email id")
				{
					$("forgotPWDErrorText").setStyle({visibility:"visible"});
					$('forgotPWDErrorText').update('Password reset request sent successfully, please check your email');
				}
				else if(response.responseText=="invalid email id")
				{
					$("forgotPWDErrorText").setStyle({visibility:"visible"});
					$('forgotPWDErrorText').update("Sorry, we don't recognise that email address, please try again.");
					$("submitEmailID").className="buttons";
					$("submitEmailID").onclick=forgotPassword;
				}
			}
		});
}

function resetPassword()
{	
	var newpassword=$F("newpassword");
	var renewpassword=$F("renewpassword");
	
	var emailID=($("forgotPWDEmailcontrolDiv").innerHTML).toCharCode();
	var validation=$F("utoolValidation");
	var validation=validation.toCharCode();

	str="";
	
	if(newpassword=="")
	{str+=POSTAJOB.PROCESS142_REGISTER[4].ERROR;this.setErrorBoxBorder('newpassword');}
	else if(newpassword.length<6)
	{
		str+=POSTAJOB.PROCESS142_REGISTER[6].ERROR;this.setErrorBoxBorder('newpassword');
	}
	if(newpassword!="" && newpassword.length>=6)
	{
		
		if(renewpassword=="")
		{str+=POSTAJOB.PROCESS142_REGISTER[5].ERROR;this.setErrorBoxBorder('renewpassword');}
		else if(renewpassword.length<6)
		{str+=POSTAJOB.PROCESS142_REGISTER[6].ERROR;this.setErrorBoxBorder('renewpassword');}
		else if(newpassword!=renewpassword)
		{str+=POSTAJOB.PROCESS142_REGISTER[7].ERROR;this.setErrorBoxBorder('renewpassword');this.setErrorBoxBorder('newpassword');}
	}
	if(str!="")
	{
		$("forgotPWDErrorText").setStyle({visibility:"visible"});
		$("forgotPWDErrorText").update(str);return false;
	}
	else
	{
		$("changePassword").className="disabled_button";
		$("changePassword").onclick="";
		$("forgotPWDErrorText").setStyle({visibility:"visible"});
		$('forgotPWDErrorText').update('<img src="'+view_url+'/images/ajax-loader.gif"/>');
	}
	var resetPwd=base_url+'utool-user/reset-password/'+emailID+'/'+MD5(newpassword)+'/'+$F("resetpasswordcode")+'/'+validation;
	var myAjax = new Ajax.Request(resetPwd, {method: 'post', 
			onComplete: function showResponse(response)
			{
				
				if(response.responseText=="password updated")
				{
					$("forgotPWDErrorText").setStyle({visibility:"hidden"});
					
					$("error_msg_body_copy").update("- Your password has been changed. Please press CLOSE below and login to the site with your new password.")
					$("changePassword").setStyle({display:"none"});
					$("mobilContainerspan").setStyle({display:"none"});
					$("error_msg_btn_container").setStyle({textAlign:"right",marginTop:"100px"});
					$("error_msg_btn_xclose").setStyle({display:"inline"});
				}
				
			}
		});
}

Event.observe(window,'load',function(){
var objBody= $$('body')[0];
objBody.appendChild(Builder.node('div',{id:'utoolErrorPupUpWindow'}));
$("utoolErrorPupUpWindow").appendChild(Builder.node('img',{src:view_url+"tooltips/images/overlay.png",style:"display:none"}));
$("utoolErrorPupUpWindow").appendChild(Builder.node('img',{src:view_url+"tooltips/images/error_right_bg_rptr.gif",style:"display:none"}));
$("utoolErrorPupUpWindow").appendChild(Builder.node('img',{src:view_url+"tooltips/images/error_btm_left.gif",style:"display:none"}));
$("utoolErrorPupUpWindow").appendChild(Builder.node('img',{src:view_url+"tooltips/images/error_btm_bg_rptr.gif",style:"display:none"}));
$("utoolErrorPupUpWindow").appendChild(Builder.node('img',{src:view_url+"tooltips/images/error_btm_right.gif",style:"display:none"}));
$("utoolErrorPupUpWindow").appendChild(Builder.node('img',{src:view_url+"tooltips/images/spacer.gif",style:"display:none"}));
});

window.onerror=function(){return true;}