function searchResultHandler(){this.myId;this.myView;this.container;this.isSubView=false;this.propertyHeading;this.myName;this.sortField="property_createddate";this.propertyTypeList=[];this.searchOption=-1;this.searchPriceFrom=0;this.searchPriceTo=0;this.searchKeyWord="";this.searchItemList="";this.searchSubType="";this.searchdirectionTypeList="";this.bedroomBox=0;this.bathroomBox=0;this.builtUpBox=0;this.totalRowsInPage=10;this.currentPage=1;this.totalPageCount=0;this.totalRecordCount=0;this.queryObj=[];this.viewType;this.myView=new searchResultView(this.callbackHandlerFn,this);this.init()}searchResultHandler.prototype.loadDetailData=function(a){if(reapfield.G_ViewMgr.activeModule.myName!=this.myName){return}var c=0;for(var b in a){c++}if(c){var d=a;d.page=this.currentPage;d.rows=this.totalRowsInPage;this.searchOption=d.searchOption||"";this.searchPriceFrom=d.searchPriceFrom||"";this.searchPriceTo=d.searchPriceTo||"";this.searchKeyWord=d.locationKeyword||"";this.searchItemList=d.propertyType||"";this.searchSubType=d.propertySubType||"";this.searchstateId=d.stateId||"";this.searchstatesuburbId=d.statesuburbId||"";reapfield.G_API.getPropertySearchResultListData(d);this.queryObj=d}else{reapfield.G_EventMgr.fireEvent("newModuleLoaded","loadBasicView");reapfield.G_ViewMgr.fixFooterHeight()}};searchResultHandler.prototype.loadView=function(c,a,b){this.myId=c;this.viewContainer=a;this.subViewContainer=b;reapfield.G_API.getAllStateList();if(this.myName=="searchResultView"){this.propertyHeading="Latest Properties";this.viewType="open"}else{if(this.myName=="propertysoldlist"){this.propertyHeading="Sold Properties";this.viewType="sold"}}this.myView.showView(this.callbackHandlerFn,this.viewContainer,this.subViewContainer,this.isSubView,this,this.propertyHeading);if(reapfield.G_ViewMgr.activeModule.myName!=this.myName){return}if(this.propertyTypeList.length){document.getElementById(this.myView.propertyTypeDivList).innerHTML=this.myView.createDropDownList(this.propertyTypeList,"id","name",this.myView.propertyTypeDivId,"Property Type","propertyTypeSearchFieldLength")}else{if(reapfield.G_API.propertyTypeList.length&&reapfield.G_API.propertySubTypeList.length){this.initPropertyTypeValues()}}};searchResultHandler.prototype.init=function(){this.currentPage=1;this.totalRecords;this.totalPages;reapfield.G_EventMgr.registerEvent("allPropertyTypesListArrived",this,"getPropertyTypeListDataListener");reapfield.G_EventMgr.registerEvent("propertySubTypesListArrived",this,"propertySubTypesListArrivedListener");reapfield.G_EventMgr.registerEvent("getPropertySubTypeListDataEvents",this,"allPropertySubTypesListArrivedListener");reapfield.G_EventMgr.registerEvent("getPropertySearchResultListDataArrived",this,"propertyListDataListener");reapfield.G_EventMgr.registerEvent("allStatesListArrived",this,"allStatesListListener");reapfield.G_EventMgr.registerEvent("allSuburbListForpropertyArrived",this,"contactSuburbsListListener")};searchResultHandler.prototype.getPropertyTypeListDataListener=function(b){var a=[];if(reapfield.G_ViewMgr.LayoutMgr.activeLayout!="landing"){return}if(reapfield.G_API.propertyTypeList.length<=0){reapfield.G_API.propertyTypeList=b.data}};searchResultHandler.prototype.propertySubTypesListArrivedListener=function(a){if(reapfield.G_ViewMgr.LayoutMgr.activeLayout!="landing"){return}this.myView.showSubTypes(a.data)};searchResultHandler.prototype.allPropertySubTypesListArrivedListener=function(a){if(reapfield.G_ViewMgr.LayoutMgr.activeLayout!="landing"){return}this.getAllPropertySubType(a)};searchResultHandler.prototype.getAllPropertySubType=function(a){if(reapfield.G_API.propertySubTypeList.length<=0){reapfield.G_API.propertySubTypeList=a.data}this.initPropertyTypeValues()};searchResultHandler.prototype.initPropertyTypeValues=function(){var c=reapfield.G_API.propertyTypeList,g=reapfield.G_API.propertySubTypeList,e=[];for(var b=0;b<c.length;b++){var d=c[b].propertytype_propertytypeid,a="-- All "+c[b].propertytype_propertytype+" --";e.push({id:d,name:a,isSubType:false});for(var f=0;f<g.length;f++){if(g[f].propertytypeid==d){e.push({id:g[f].propertysubtypeid,name:g[f].propertysubtype,isSubType:true})}}}this.propertyTypeList=e;document.getElementById(this.myView.propertyTypeDivList).innerHTML=this.myView.createDropDownList(e,"id","name",this.myView.propertyTypeDivId,"Property Type")};searchResultHandler.prototype.allStatesListListener=function(a){var b=document.getElementById(this.myView.stateTypeDivList);if(b){b.innerHTML=this.myView.createDropDownListforState(a.data,"state_stateid","state_statename","stateTypeDivId","State");this.myView.eventHandler(document.getElementById("stateTypeDivId"),"change",this.callbackFn,this.owner)}};searchResultHandler.prototype.contactSuburbsListListener=function(a){var b=document.getElementById(this.myView.suburbTypeDivList);if(b){b.innerHTML=this.myView.createDropDownListforState(a.data,"suburb_suburbid","suburb_suburbtype","suburbTypeDivId","Area")}};searchResultHandler.prototype.allDirectionTypesListListener=function(b){if(reapfield.G_ViewMgr.activeModule.myName!=this.myName){return}var a=document.getElementById("adddirectiontypeListDiv");a.innerHTML=this.myView.createDropDownList(b.data,"directiontype_directiontypeid","directiontype_directiontype","property_directiontypeid","-- Select --")};searchResultHandler.prototype.propertyListDataListener=function(b){if(reapfield.G_ViewMgr.activeModule.myName!=this.myName){return}var a=b.data;if(a.properties.length<=0){this.myView.createNoData();return}this.currentPage=a.page;this.totalRecords=a.records;this.totalPages=a.total;this.myView.displayMainViewData(a);if(this.currentPage==1){this.myView.createOptions();this.myView.addSortDropDown();this.myView.addPagerDropDown(this.getPagerData(this.totalPages),this.currentPage,this.totalPages)}else{this.myView.updatePagerDropDown(this.currentPage,this.totalPages)}reapfield.G_ViewMgr.fixFooterHeight()};searchResultHandler.prototype.getPagerData=function(c){var d=[];for(var b=0;b<c;b++){var a=(b+1);d.push({id:a,text:"Page "+a+" of "+c})}return d};searchResultHandler.prototype.callbackHandlerFn=function(e,d,a,c){if(e=="advanceSearchResultSubmit"){reapfield.G_API.getPropertySearchResultListData(d)}else{if(e=="searchResultPageSearchSubmit"){var b={moduleId:"43",detailId:d};reapfield.G_EventMgr.fireEvent("loadModuleEvent",b)}else{if(e=="moreInfoClick"){reapfield.G_API.nRecord=c;var b={moduleId:"42",detailId:d};reapfield.G_EventMgr.fireEvent("loadModuleEvent",b)}else{if(e=="pageChangeEvent"){a.currentPage=d;var b=a.setAdvSerchData(false);reapfield.G_API.getPropertySearchResultListData(b)}else{if(e=="sortChangeEvent"){if(d==0){a.sortField=""}else{a.sortField=d}var b=a.setAdvSerchData(false);reapfield.G_API.getPropertySearchResultListData(b)}else{if(e=="pageNavigateEvent"){if(d=="prev"){a.currentPage--}else{if(d=="next"){a.currentPage++}}var b=a.setAdvSerchData(false);reapfield.G_API.getPropertySearchResultListData(b)}}}}}}};searchResultHandler.prototype.setAdvSerchData=function(e){if(e){var a="";if(document.getElementById("advSearchOptionBuy").checked){this.searchOption=document.getElementById("advSearchOptionBuy").value||""}else{if(document.getElementById("advSearchOptionRent").checked){this.searchOption=document.getElementById("advSearchOptionRent").value||""}}this.searchKeyWord=document.getElementById("locationKeywordId").value||"";this.searchItemList=document.getElementById("property_propertytypeid").selectedIndex||"";this.searchPriceFrom=document.getElementById("priceBegin").value||"";this.searchPriceTo=document.getElementById("priceEnd").value||"";this.currentPage=parseInt(this.currentPage);this.totalPageCount=parseInt(this.totalPageCount);this.itmObj.sidx=this.sortField||"";this.itmObj.sord="ASC"}if(document.getElementById("bedroomBox")){this.bedroomBox=document.getElementById("bedroomBox").value||""}if(document.getElementById("bathroomBox")){this.bathroomBox=document.getElementById("bathroomBox").value||""}if(document.getElementById("builtupArea")){this.builtUpBox=document.getElementById("builtupArea").value||""}if(document.getElementById("directionType")){this.searchdirectionTypeList=document.getElementById("directionType").selectedIndex||""}var b=new Object();if(parseInt(this.searchOption)>0){b.searchOption=this.searchOption}if(this.searchKeyWord&&this.searchKeyWord.toLowerCase()!="Location Keyword".toLowerCase()){b.locationKeyword=this.searchKeyWord}if(parseInt(this.searchItemList)>0){b.propertyType=this.searchItemList}if(parseInt(this.searchItemList)>0){b.propertyType=this.searchItemList}if(parseInt(this.searchSubType)>0){b.propertySubType=this.searchSubType}if(parseInt(this.bedroomBox)>0){b.noOfBed=this.bedroomBox}if(parseInt(this.bathroomBox)>0){b.noOfBath=this.bathroomBox}if(parseInt(this.builtUpBox)>0){b.builtUpArea=this.builtUpBox}if(parseInt(this.searchPriceFrom)>0){b.searchPriceFrom=this.searchPriceFrom}if(parseInt(this.searchPriceTo)>0){b.searchPriceTo=this.searchPriceTo}if(parseInt(this.totalRowsInPage)>0){b.rows=this.totalRowsInPage}if(parseInt(this.currentPage)>0){b.page=this.currentPage}b.sidx=this.sortField;b.sord="ASC";var d=document.getElementById("stateTypeDivId");var c=this.queryObj;if(c.stateId>0){b.stateId=c.stateId}if(c.statesuburbId>0){b.statesuburbId=c.statesuburbId}return b||{}};function searchResultView(){}searchResultView.prototype.showView=function(c,f,b,d,a,e){this.viewParentObj=f||document.body;this.subViewParentObj=b||document.body;this.owner=a;this.isSubView=d;this.callbackFn=c;this.titlePrefix="propertySearchTitle";this.searchResultView="searchResultView";this.bathNumberId="bathNum";this.bedNumberId="bedNum";this.headingText=e;this.moreInfo="moreInfo";this.carNumberId="carNum";this.propertyDescritptionId="propertyDescription";this.propertyAddressId="propertyAddress";this.propertyPriceId="propertyPrice";this.contactAddress="contactAddress";this.topPagerId="pageListSpanTop";this.topPagerListId="pageSelectListTop";this.bottomPagerId="pageListSpanBottom";this.bottomPagerListId="pageSelectListBottom";this.topPrevBtnId="topPrevNavButton";this.topNextBtnId="topNextNavButton";this.botPrevBtnId="bottomPrevNavButton";this.botNextBtnId="bottomNextNavButton";this.topSortList="topSortList";this.bottomSortList="bottomSortList";this.topSortListId="topSortListId";this.bottomSortListId="bottomSortListId";this.advSearchBtn="advSearchBtn";this.propertyImageId="propertySearchImage";this.reapFieldAgentPhotoImageId="reapFieldAgentPhotoImageId";this.quickSearchDivId="quickSearchDivId1";this.quickSearchPriceFrom="quickSearchPriceFrom1";this.quickSearchPriceto="quickSearchPriceto1";this.quickSearchkeyword="quickSearchkeyword1";this.stateTypeDivList="stateTypeDivList1";this.suburbTypeDivList="suburbTypeDivList1";this.propertyTypeDivList="propertyTypeDivList1";this.propertyTypeDivId="propertytypeid1";this.searchtypeOptionBuy="searchtypeOptionBuy1";this.searchtypeOptionRent="searchtypeOptionRent1";this.propertySubTypeDivId="propertySubTypeContainer1";this.createMainView();if(this.isSubView){this.createSubMainView()}else{this.clearSubMainView()}};searchResultView.prototype.setDataForTheSearch=function(b){var a=b;this.selectDropDownList(document.getElementById("stateTypeDivId"),(a.stateId||""));this.selectDropDownList(document.getElementById("propertytypeid1"),(a.propertySubType||""));document.getElementById(this.quickSearchPriceFrom).value=(a.searchPriceFrom||"");document.getElementById(this.quickSearchPriceto).value=(a.searchPriceTo||"");document.getElementById(this.quickSearchkeyword).value=(a.locationKeyword||"")};searchResultView.prototype.createMainView=function(){var d='<form name="'+this.quickSearchDivId+'" id="'+this.quickSearchDivId+'">					<div class="contentTitle">You are looking to...</div>					<table cellspacing=0 cellpadding=0 style="width:650px">					<div class="reapFieldInnerFooter" style="margin-top:6px;">							<input type="radio" id="'+this.searchtypeOptionBuy+'" name="searchtypeOption"  value="1" /><span class="searchTypeLabel">Buy</span>							<input type="radio" id="'+this.searchtypeOptionRent+'" name="searchtypeOption"  value="2" /><span class="searchTypeLabel">Rent</span>					</div>					<span id="'+this.propertyTypeDivList+'" style="margin-left:16px;"><select class="propertyTypeSearchFieldLength" name="propertyTypeDivId" id="propertyTypeDivId"><option value="">Property Type</option></select></span>					<span id="'+this.stateTypeDivList+'" ><select class="propertyTypeSearchResultLength" name="stateTypeDivId" id="stateTypeDivId"><option value="">State</option></select></span>					<span id="'+this.suburbTypeDivList+'" ><select class="propertyTypeSearchResultLength" name="suburbTypeDivId" id="suburbTypeDivId"><option value="">Area</option></select></span>					</div>					<div style="margin-left:16px;"><input type="text" id="'+this.quickSearchkeyword+'" name="'+this.quickSearchkeyword+'"  value="Location Keyword" class="quickSearchwaterMarkFieldsw"/>					<span><input type="text" id="'+this.quickSearchPriceFrom+'" class="quickSearchwaterMarkFieldsw" value="Price From"></span><span>						<input type="text" id="'+this.quickSearchPriceto+'" class="quickSearchwaterMarkFieldsw" value="Price To"></span>					<input type="submit" name="keyword" value="Search" class="quickSearchBtn reapFieldCommonBtn"  /></div>					</td></tr>					</table>				</div></form>';d+='<div class="contentTitle">Search Result</div>';d+='<div class="reapPropertySearch" id="topNavSection"></div>			<div id="'+this.searchResultView+'" class="reapFieldAgentProfile"></div>			<div class="reapPropetyLowerlist" id="botNavSection"></div>';this.viewParentObj.innerHTML=d;var c=document.getElementById(this.quickSearchPriceFrom);var b=c.value;this.watermarkEventHandler(c,b);var a=document.getElementById(this.quickSearchPriceto);var b=a.value;this.watermarkEventHandler(a,b);var a=document.getElementById(this.quickSearchkeyword);var b=a.value;this.watermarkEventHandler(a,b);this.eventHandler(document.getElementById(this.quickSearchDivId),"submit",false,this.callbackFn,this.owner)};searchResultView.prototype.createSubMainView=function(){};searchResultView.prototype.createNoData=function(){document.getElementById(this.searchResultView).innerHTML="<span>There is no result in this category.</span>"};searchResultView.prototype.createOptions=function(){document.getElementById("topNavSection").innerHTML='<span id="'+this.topSortList+'" style="float:left"></span>						<input type="button" id="'+this.topPrevBtnId+'" value="<<" disabled="true" />						<span id="'+this.topPagerId+'"></span>						<input type="button" id="'+this.topNextBtnId+'" value=">>" disabled="true" />';document.getElementById("botNavSection").innerHTML='<span id="'+this.bottomSortList+'" style="float:left"></span>						<input type="button" id="'+this.botPrevBtnId+'" value="<<" disabled="true" />						<span id="'+this.bottomPagerId+'"></span>						<input type="button" id="'+this.botNextBtnId+'" value=">>" disabled="true" />';this.topPrevBtn=document.getElementById(this.topPrevBtnId);this.topNextBtn=document.getElementById(this.topNextBtnId);this.botPrevBtn=document.getElementById(this.botPrevBtnId);this.botNextBtn=document.getElementById(this.botNextBtnId);this.eventHandler(this.topPrevBtn,"click","prev",this.callbackFn,this.owner);this.eventHandler(this.topNextBtn,"click","next",this.callbackFn,this.owner);this.eventHandler(this.botPrevBtn,"click","prev",this.callbackFn,this.owner);this.eventHandler(this.botNextBtn,"click","next",this.callbackFn,this.owner)};searchResultView.prototype.watermarkEventHandler=function(d,b){var e=this;function a(h){var f=b;var g=d;g.style.color="#222";g.value=(d.value==f)?"":d.value}function c(f){e.blurAssignText(d,b)}reapfield.AttachEvent(d,"focus",a,false);reapfield.AttachEvent(d,"blur",c,false)};searchResultView.prototype.selectOptionList=function(b,a){for(var c=0;c<b.length;c++){if(b[c].value==a){b.selectedIndex=c;break}}};searchResultView.prototype.blurAssignText=function(c,b){var a=b;if(c.value==""){c.value=a;c.style.color="#999"}else{if(c.value==a){c.style.color="#999"}else{c.style.color="#222"}}};searchResultView.prototype.clearSubMainView=function(){var a="";this.subViewParentObj.innerHTML=a};searchResultView.prototype.displayMainViewData=function(p){var a="",l=p.properties;for(var f=0;f<l.length;f++){var g=l[f],j=parseInt(g.property_saleorrenttypeid),o=g.property_salepricetype||"",s=g.property_rentpricetype||"",d="";if(g.property_showprice==1){if(j==1){d="Sale: "+o+" "+(g.property_saleprice||"")}else{if(j==2){d="Rent: "+s+" "+(g.property_rentprice||"")}else{if(j==3){d="Sale: "+o+" "+(g.property_saleprice||"")+" Rent: "+s+" "+(g.property_rentprice||"")}}}}var r="",c=(g.property_propertysubtype||""),e="",q=(g.property_inclusiontype||""),n=this.createDateFormat(g.property_createddate||"");if(g.property_builtupareasize&&g.property_builtupareasize!=0){e="Built Up:"+g.property_builtupareasize+" sqft"}if(n){n="Posted Date: "+n}if(g.property_development){r+=g.property_development+", "}if(g.property_suburbtype){r+=g.property_suburbtype+", "}if(g.property_town){r+=g.property_town+", "}if(g.property_statename){r+=g.property_statename}if(f%2){a+='<div class="reapPropertyRow">'}else{a+='<div class="reapPropertyRowColor">'}a+='<div id="'+this.propertyImageId+f+'" class="reapFieldAgentPhoto linkItem" style="height:135px;"><img src="" id="'+this.reapFieldAgentPhotoImageId+f+'"></div>						<div id="agentDescription" class="reapFiledProfileDesscription" style="width:440px;">							<div class="reapFieldAgentName">								<div class="reapPropertyLeftRow">									<span id="'+this.titlePrefix+f+'" class="spanPaddingWithBold linkItem">'+r+'</span>								</div>								<div class="reapPropertyRightRow">';if(g.property_noofbedroom>0){a+='<span  class="reapPropertyFeature">BED '+g.property_noofbedroom+"</span>"}if(g.property_noofbathroom>0){a+='<span  class="reapPropertyFeature">BATH '+g.property_noofbathroom+"</span>"}if(g.property_noofcarparking>0){a+="<span>CAR "+g.property_noofcarparking+"</span>"}a+='</div></div>							<div  class="reapPropertyLeftRow listPrice">								<span class="spanPadding">'+reapfield.addCommas(d)+'</span></div>							<div class="reapFieldAgentDescription">								<span class="spanPadding">Type: '+c+"</span></div>";if(g.property_builtupareasize&&g.property_builtupareasize!=0){a+='<div class="reapFieldAgentDescription">								<span class="spanPadding">'+e+"</span></div>"}a+='<div class="reapFieldAgentDescription">								<span class="spanPadding">Finishing: '+q+'</span><span class="spanPadding">'+(g.property_statename||"")+'</span><span class="spanPadding">'+(g.property_postcode||"")+'</span></div>							<div class="reapFieldAgentDescription">								<span class="spanPadding">'+n+'</span></div>						</div>						<div  class="reapPropertyRightRow">							<span><input type="button" value="More Info" class="moreInfoBtn reapFieldCommonBtn" id="'+this.moreInfo+f+'" /></span>						</div>					</div>'}var h=document.getElementById(this.searchResultView);h.innerHTML=a;for(var f=0;f<l.length;f++){var k="";var b=p.properties[f].images;for(var m=0;m<b.length;m++){if(b[m].pictureurl){k=b[m].pictureurl;break}else{k="data/property/NoImage.jpg"}}this.ChangePhoto(k,this.reapFieldAgentPhotoImageId+f,155,135)}for(var f=0;f<l.length;f++){var g=l[f];this.eventHandler(document.getElementById(this.moreInfo+f),"click",g.property_propertyid,this.callbackFn,this.owner);this.eventHandler(document.getElementById(this.propertyImageId+f),"click",g.property_propertyid,this.callbackFn,this.owner,f);this.eventHandler(document.getElementById(this.titlePrefix+f),"click",g.property_propertyid,this.callbackFn,this.owner)}};searchResultView.prototype.createDateFormat=function(c){if(c){var a=new DateTimeHandler(),b=c.split(" ")[0];return a.createDate(b,"dMy")}else{return""}};searchResultView.prototype.displaySubViewData=function(a){};searchResultView.prototype.selectDropDownList=function(a,c){if(a){for(var b=0;b<a.options.length;b++){if(a.options[b].value==c){a.selectedIndex=b}}}};searchResultView.prototype.createDropDownList=function(b,k,e,c,h,d){var f;if(d){f='<select name="'+c+'" id="'+c+'" class="'+d+'"><option value="" >'+h+"</option>"}else{f='<select name="'+c+'" id="'+c+'" class="quickSearchFields"><option value="" >'+h+"</option>"}for(var j=0;j<b.length;j++){var a=b[j],i=a[k],g=(a[e]||"");f+='<option  value="'+i+'"';if(i==h){f+="selected"}f+=">"+g+"</option>"}f+="</select> ";return f};searchResultView.prototype.createDropDownListforState=function(b,j,d,c,g){var e;e='<select name="'+c+'" id="'+c+'" class="propertyTypeSearchResultLength">					<option value="" >'+g+"</option>";for(var i=0;i<b.length;i++){var a=b[i],h=a[j],f=(a[d]||"");e+='<option  value="'+h+'"';if(h==g){e+=" selected"}e+=">"+f+"</option>"}e+="</select> ";return e};searchResultView.prototype.updatePagerDropDown=function(a,b){this.selectDropDownList(document.getElementById(this.topPagerListId),a);this.selectDropDownList(document.getElementById(this.bottomPagerListId),a);if(a==b){this.disableNextButtons(true)}else{this.disableNextButtons(false)}this.disablePrevButtons(false)};searchResultView.prototype.addSortDropDown=function(){var b=[];b.push({id:"property_saleprice",sortname:"Price"});b.push({id:"property_createddate",sortname:"Latest Entry"});b.push({id:"property_builtupareasize",sortname:"Land/builtUp Area"});var c=document.getElementById(this.topSortList);c.innerHTML=this.createDropDownList(b,"id","sortname",this.topSortListId,"Sort By");var a=document.getElementById(this.bottomSortList);a.innerHTML=this.createDropDownList(b,"id","sortname",this.bottomSortListId,"Sort By");this.eventHandler(document.getElementById(this.topSortListId),"change","",this.callbackFn,this.owner);this.eventHandler(document.getElementById(this.bottomSortListId),"change","",this.callbackFn,this.owner)};searchResultView.prototype.addPagerDropDown=function(c,b,d){var e=document.getElementById(this.topPagerId);e.innerHTML=this.createDropDownList(c,"id","text",this.topPagerListId,b);var a=document.getElementById(this.bottomPagerId);a.innerHTML=this.createDropDownList(c,"id","text",this.bottomPagerListId,b);this.eventHandler(document.getElementById(this.topPagerListId),"change","",this.callbackFn,this.owner);this.eventHandler(document.getElementById(this.bottomPagerListId),"change","",this.callbackFn,this.owner);if(b!=d){this.disableNextButtons(false)}this.disablePrevButtons(true)};searchResultView.prototype.disableNextButtons=function(a){this.topNextBtn.disabled=a;this.botNextBtn.disabled=a};searchResultView.prototype.disablePrevButtons=function(a){this.topPrevBtn.disabled=a;this.botPrevBtn.disabled=a};searchResultView.prototype.eventHandler=function(f,d,e,h,a,c){var g=this;function b(q){if(!q){q=window.event}if(f.id==g.advSearchBtn){var k=a.setAdvSerchData(true);h("advanceSearchResultSubmit",k,a)}else{if(f.id=="stateTypeDivId"){var s=document.getElementById("stateTypeDivId");if(s.selectedIndex>0){reapfield.G_API.getAllCallByPropertySuburbList(s.value)}}else{if(f.id==g.quickSearchDivId){try{var t=0,i=0;if(document.getElementById(g.searchtypeOptionBuy).checked){t=document.getElementById(g.searchtypeOptionBuy).value}else{if(document.getElementById(g.searchtypeOptionRent).checked){t=document.getElementById(g.searchtypeOptionRent).value}}var r=document.getElementById(g.quickSearchkeyword),n=document.getElementById(g.quickSearchPriceFrom).value,l=document.getElementById(g.quickSearchPriceto).value,o=r.value,k=new Object();if(parseInt(t)>0){k.searchOption=t}if(parseInt(n)>0){k.searchPriceFrom=parseFloat(n)}if(parseInt(l)>0){k.searchPriceTo=parseFloat(l)}if(o.toLowerCase()!="Location Keyword".toLowerCase()){k.locationKeyword=o}var p=document.getElementById(g.propertyTypeDivId);if(p.selectedIndex>0){var j=g.getPropertyType(p.selectedIndex);if(j=="type"){k.propertyType=p.value}else{if(j=="subtype"){k.propertySubType=p.value}}}var s=document.getElementById("stateTypeDivId");if(s.selectedIndex>0){k.stateId=s.value}var u=document.getElementById("suburbTypeDivId");if(u){if(u.selectedIndex>0){k.statesuburbId=u.value}}h("searchResultPageSearchSubmit",k,a)}catch(m){alert(m)}if(q.preventDefault){q.preventDefault()}q.returnValue=false;return false}else{if(f.id.indexOf(g.moreInfo)>=0||f.id.indexOf(g.propertyImageId)>=0||f.id.indexOf(g.titlePrefix)>=0){h("moreInfoClick",e,a,c)}else{if(f.id==g.topPagerListId){h("pageChangeEvent",f.value,a)}else{if(f.id==g.bottomPagerListId){h("pageChangeEvent",f.value,a)}else{if(f.id==g.topSortListId){h("sortChangeEvent",f.value,a)}else{if(f.id==g.bottomSortListId){h("sortChangeEvent",f.value,a)}else{if(f.id==g.topPrevBtnId||f.id==g.topNextBtnId||f.id==g.botPrevBtnId||f.id==g.botNextBtnId){h("pageNavigateEvent",e,a)}}}}}}}}}}if(f){reapfield.AttachEvent(f,d,b,false)}};searchResultView.prototype.getPropertyType=function(a){var b="type";if(this.owner.propertyTypeList[a-1].isSubType){b="subtype"}return b};searchResultView.prototype.advanceSearchStructure=function(){var a='<table width="100%" border="0" cellpadding="1" cellspacing="0"><tbody><tr align="center"><td  style="padding-left: 6px;">Advanced Search - Properties</td></tr><tr><td height="21"> <p align="center"><strong>Enter Information about the property you are searching for</strong></p></td></tr></tbody></table><br><fieldset><legend>Advance Search</legend><table width="100%" align="center" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td valign="middle" align="right">* I want to <span ></span></td><td width="0%" align="center">&nbsp;:</td><td colspan="5"  valign="top" align="left"><table id="listType"><tbody><tr><td><label><input name="listType" id="advSearchOptionBuy" checked="checked" value="1" type="radio">&nbsp;Buy</label></td><td><label><input name="listType" id="advSearchOptionRent" value="2" type="radio">&nbsp;Rent</label></td></tr></tbody></table></td><td  valign="middle" align="center">&nbsp;</td></tr><tr><td valign="middle" align="right"><span >Location Keyword(s)</span></td><td  valign="middle" width="0%" align="center">&nbsp;:</td><td align="left" valign="top"><span><input id="locationKeywordId" name="locationKeywordId" value="" maxlength="50"  type="text"/></span></td><td align="left" colspan="4" valign="top"><span><font color="#000000">[</font><font color="#666666"> Enter specific features you are looking for in the property.</font><font color="#000000">]</font></span></td></tr><tr><td valign="middle" width="20%" align="right"><p>Property Type</p></td><td  width="0%" align="center">&nbsp;:</td><td valign="middle" align="left"><span id="addpropertytypeList" name="addpropertytypeList" ><select id="addpropertytypeListId" name="addpropertytypeListId" size="1"><option value="" selected="selected">---Select All---</option></select></span></td><td  width="0%" align="center">&nbsp;</td><td valign="middle" align="right"><p>Direction Type</p></td><td width="0%" align="center">&nbsp;:</td><td align="left"><span id="adddirectiontypeListDiv" name="adddirectiontypeListDiv"><select id="adddirectiontypeListId" name="adddirectiontypeListId" size="1"><option value="" selected="selected">---Select All---</option></select></span></td></tr><tr><td valign="middle" align="right"><p>No of Bed</p></td><td width="0%" align="center">&nbsp;:</td><td valign="middle" align="left"><input id="noOfBedId" name="noOfBedId" value="" maxlength="50" size="10" type="text"></td><td width="0%" align="center">&nbsp;</td><td valign="middle" align="right"><p>No of Bath</p></td><td width="0%" align="center">&nbsp;:</td><td valign="middle" align="left"><input id="noOfBathId" name="noOfBathId" value="" maxlength="50" size="10" type="text"></td></tr><tr><td valign="middle" align="right"><p>Built Up Area</p></td><td width="0%" align="center">&nbsp;:</td><td colspan="5" valign="middle" align="left"><input id="builtUpAreaid" name="builtUpAreaid" value="" maxlength="50" size="10" type="text">&nbsp; &nbsp;</td></tr><tr><td valign="middle" align="right"><p>Price Range: RM</p></td><td width="0%" align="center">&nbsp;:</td><td valign="middle" align="left"><input value="" name="rmBegin" id="priceBegin" size="12" maxlength="12" type="text"></td><td width="0%" align="center">&nbsp;</td><td valign="middle"  align="right"><p>To RM</p></td><td width="0%" align="center">&nbsp;:</td><td valign="middle" align="left"><input value="" size="12" name="priceEnd" id="priceEnd" maxlength="12" type="text"/></td></tr><tr><td colspan="7" align="center"><span><input type="button" id="'+this.advSearchBtn+'" value="Search"/></span></td></tr></tbody></table></fieldset>';return a||""};searchResultView.prototype.ChangePhoto=function(c,b,e,d){if(!c||c==""){document.getElementById(b).parentNode.innerHTML="";return}var a=new Image();a.onload=function(){var i=a.width,h=a.height;var l=(e?e:100);var k=(d?d:100);if(i>=h){var g=h*l/i;if(g<=k){k=g}else{l=i*k/h}}else{tmpx=i*k/h;if(tmpx<=l){l=tmpx}else{k=h*l/i}}a.id=b;a.style.height=k+"px";a.style.width=l+"px";var j=document.getElementById(b);if(j){var f=j.parentNode;f.innerHTML="";f.appendChild(a);f.style.backgroundColor="transparent"}};if(c.indexOf("http://")>=0){a.src=c}else{a.src=reapfield.G_API.webServiceURL+c}};