var tmpDiv,px="unused_",$=jQuery;function displayPanel(d,b){if(document.getElementById(d)===null){return false}var e=document.getElementById(d).parentNode;var c=tmpDiv;if(c===null){return true}removePanel(d);if(c.style&&navigator.product=="Gecko"){removePrefix(c,px);c.style.display=""}else{var a=document.getElementById("attributeSearchBottom");e.insertBefore(c,a)}switch(d){case"housesForSaleSearchForm":case"rentalsSearchForm":setControlState("136","133");break;default:break}var h=document.getElementById("SiteHeader_SideBar_AttributeSearch_SearchTabOne");var f=document.getElementById("SiteHeader_SideBar_AttributeSearch_SearchTabTwo");var j=document.getElementById("SiteHeader_SideBar_AttributeSearch_SearchTabs").getElementsByTagName("ul")[0];switch(d){case"housesForSaleSearchForm":case"commercialForSaleSearchForm":h.className="Widget";f.className="Widget search-tab-selected";j.className="search-tabs search-tabs-right";break;case"rentalsSearchForm":case"commercialForLeaseSearchForm":h.className="Widget search-tab-selected";f.className="Widget";j.className="search-tabs search-tabs-left";break;default:break}if(d=="housesForSaleSearchForm"){$("#rentalsSearchForm").show();$("#AdvancedSearchSidebarLink").attr("href","/link.aspx?i=38055")}if(d=="rentalsSearchForm"){$("#housesForSaleSearchForm").show();$("#AdvancedSearchSidebarLink").attr("href","/link.aspx?i=38054")}setupOtherSearchSuggest();return false}function removePanel(a){tmpDiv=document.getElementById(a);var b=tmpDiv.parentNode;if(tmpDiv.style&&navigator.product=="Gecko"){appendPrefix(tmpDiv,px);tmpDiv.style.display="none"}else{b.removeChild(tmpDiv)}}function appendPrefix(b,c){if(b.childNodes.length>0){for(var a=0;a<b.childNodes.length;a++){appendPrefix(b.childNodes[a],c)}}if(b.id){b.id=c+b.id}return}function removePrefix(b,c){if(b.childNodes.length>0){for(var a=0;a<b.childNodes.length;a++){removePrefix(b.childNodes[a],c)}}if(b.id){if(b.id.length>c.length&&b.id.substr(0,c.length)==c){b.id=b.id.substr(c.length,b.id.length-c.length)}}return}function setDdlState(d,b){var c=document.getElementById(d);var a=document.getElementById(b);if(c.disabled||c.value===""){a.value="";a.disabled=true}else{a.disabled=false}}function setControlState(d,b){var a=document.getElementById(b);var c=document.getElementById(d);if(c.disabled||c.value===""){document.getElementById("span_"+b).style.color="#aac992";a.checked=false;a.disabled=true}else{document.getElementById("span_"+b).style.color="#fff";a.disabled=false}}function setControlStateForFlatmates(d,b){var a=document.getElementById(b);var c=document.getElementById(d);if(c.disabled||c.value===""){document.getElementById("span_"+b).style.color="#999";a.checked=false;a.disabled=true}else{document.getElementById("span_"+b).style.color="#333";a.disabled=false}}function setOptionState(){var a;if(document.sidebar){a=document.getElementById("enableBedroomOptions");if(a.value=="1"){toggleControl(document.sidebar,"27",false)}else{toggleControl(document.sidebar,"27",true)}}else{if(document.rentals_main){a=document.getElementById("enableBedroomOptions");if(a.value=="1"){toggleControl(document.rentals_main,"27",false)}else{toggleControl(document.rentals_main,"27",true)}}}}function toggleControl(e,d,a){for(var c=0;c<e.elements.length;c++){if(d==e.elements[c].name){var b=e.elements[c];if(b.disabled!=a){if(b.type=="select-one"){b.selectedIndex=0}b.disabled=a}}}}function toggleControl2(e,d,a){for(var c=0;c<e.elements.length;c++){if(d==e.elements[c].name){var b=e.elements[c];if(b.disabled!=a){if(b.type=="select-one"){b.selectedIndex=0}b.disabled=a}}}}function setAdjacentAsChecked(){var a=document.getElementById(133);var b=document.getElementById(136);if(!b.disabled||b.value!==""){a.disabled=false;a.checked=true}}TradeMe.namespace("TradeMe.Flat");TradeMe.Flat.getElementByIdViaTag=function(b,d){var c=document.getElementsByTagName(d);for(var a=0;a<c.length;a++){if(c[a].id==b){return c[a]}}return null};function cascadeLocationsByAttributeId2(arrParentChildLink,arrParentOptions,arrChildOptions,strParentNoun,strChildNoun,strMode,parentControlId,childControlId,countsArrayName){var strActionText="";var iCurrSource=0;var aOptions;var sortIndex;var arrChildOptionsOutput;var intItemToSelect=0;var optionKey="";var optionValue="";var hasCounts=false;var topOptionText;if(strMode=="search"){if(strChildNoun=="sub category"){strActionText="Any sub category"}else{strActionText="All "+strChildNoun+"s"}}else{strActionText="Choose a "+strParentNoun+" first"}var ctlParent=$("#"+parentControlId)[0];var ctlChild=$("#"+childControlId)[0];var ctlSelectedChild=$("#selected"+childControlId)[0];if(ctlParent.value===""||ctlParent.text===""){if(!ctlChild.disabled){ctlChild.disabled=true}ctlChild.options.length=0;ctlChild.options[0]=new Option(strActionText,"",false,false)}else{iCurrSource=ctlParent.options[ctlParent.selectedIndex].value;if(arrParentChildLink[iCurrSource]===null||arrParentChildLink[iCurrSource].length===0){var strNoChildrenMsg="";if(strChildNoun=="sub category"){strNoChildrenMsg="No sub categories"}else{strNoChildrenMsg="No "+strChildNoun+"s"}if(ctlChild.options[0].text!=strNoChildrenMsg){ctlChild.options.length=0;ctlChild.options[0]=new Option(strNoChildrenMsg,"",false,false);if(!ctlChild.disabled){ctlChild.disabled=true}}}else{if(ctlChild.disabled){ctlChild.disabled=false}aOptions=new Array();var index=0;for(i=0;i<arrParentChildLink[iCurrSource].length;i++){if(arrParentChildLink[iCurrSource][i]==1){aOptions[index]=i;index++}}arrChildOptionsOutput=new Array(aOptions);for(i=0;i<aOptions.length;i++){arrChildOptionsOutput[i]=new Array(1);arrChildOptionsOutput[i]=[aOptions[i],arrChildOptions[aOptions[i]]]}arrChildOptionsOutput.sort(function(a,b){if(a[1]=="Other"){return 1}else{if(b[1]=="Other"){return -1}else{if(a[1].indexOf("Other ")>-1){return 1}else{if(b[1].indexOf("Other ")>-1){return -1}else{if(a[1]==b[1]){return 0}else{return a[1]>b[1]?1:-1}}}}}});ctlChild.options.length=0;topOptionText="";if(strMode=="search"){if(strChildNoun=="sub category"){topOptionText="Any sub category"}else{topOptionText="All "+strChildNoun+"s"}}else{topOptionText="Choose..."}ctlChild.options[0]=new Option(topOptionText,"",false,false);ctlChild.options[1]=new Option("","",false,false);if(countsArrayName!==null&&countsArrayName!==undefined){hasCounts=true}for(i=0;i<arrChildOptionsOutput.length;i++){if(ctlSelectedChild&&ctlSelectedChild.value!==""&&arrChildOptionsOutput[i][0]==ctlSelectedChild.value){intItemToSelect=i+2}optionKey=arrChildOptionsOutput[i][0];optionValue=arrChildOptionsOutput[i][1];if(hasCounts){optionValue=optionValue+" ("+eval(countsArrayName)[optionKey]+")"}ctlChild.options[i+2]=new Option(optionValue,optionKey,false,false)}ctlChild.options[intItemToSelect].selected=true}}var districtDropDown="135";var $suburbDropDown=$("select#136");if(ctlParent.id===districtDropDown){var $propertyTypeDropDown=$("#29");if($propertyTypeDropDown.val()==="Retirement villages"){$suburbDropDown.attr("selectedIndex",0);$suburbDropDown.attr("disabled","disabled")}}if(ctlChild.onchange){ctlChild.onchange()}}function validateMulti(d,c){var b;var a;if(d.options.length===0){b=false;a=false}else{b=false;a=true;for(iLoop=0;iLoop<d.options.length;iLoop++){if(d.options[iLoop].selected){b=true}else{a=false}}}if(a&&!c.checked){c.checked=true}else{if(!a&&c.checked){c.checked=false}}}function getBitArray(a){return g(a)}function g(a){var b=new Array();for(iLoop=0;iLoop<a.length;iLoop++){b[a[iLoop]]=1}return(b)}function numberorder(c,d){return c-d};
