function popup_help_full(n,t,i,r,u){t==0&&(t=50),i==0&&(i=50),r==0&&(r=585),u==0&&(u=520),winOptions="location=no,toolbar=yes,menubar=no,resizable=yes,scrollbars=yes,height="+u+",width="+r,winOptions+=navigator.appName=="Netscape"?",screenX="+t+",screenY="+i:",left="+t+",top="+i,window.open("/Help/PopUp.aspx?help_id="+n,"pop",winOptions)}function autoScrollY(){var t=currentYOffSet(),i,n;t==0&&window.scrollBy&&(i="",n=0,window.location&&window.location.search&&(strQS=window.location.search,n=extractQueryTerm(strQS,"Y")),n>0&&window.scrollBy(0,n))}function extractQueryTerm(n,t){var i,r,o,u,f,e,s;return n+="#",e=t+"=",i=n.indexOf(e)+e.length,o=n.indexOf("#",i),u=n.indexOf("&",i),f=n.indexOf("?",i),r=o,f!=-1&&f<r&&(r=f),u!=-1&&u<r&&(r=u),s=n.substr(i,r-i)}function currentYOffSet(){var n;return n=document.documentElement&&document.documentElement.scrollTop?document.documentElement.scrollTop:window.pageYOffset?window.pageYOffset:document.body?document.body.scrollTop:0}function persistYOffSet(n){var t=currentYOffSet();return n.href+"&Y="+t}function redirectY(n){if(window.location&&this&&n)return window.location=persistYOffSet(this),n.returnValue=!1,n.preventDefault&&n.preventDefault(),!1}function hookUpLinks(n){for(var i=n.split(","),t=0;t<i.length;t++)document.getElementById(i[t])&&jQuery("#"+i[t]).click(redirectY)}function resetSearch(){resetSearch("sidebarSearch")}function resetSearch(n){var r=document.getElementById(n),t,u,i;if(r&&r.reset&&r.elements&&(r.reset(),t=r.elements,t))for(u=!0,i=0;i<t.length;i++){switch(t[i].type.toLowerCase()){case"text":case"password":case"textarea":t[i].value="";break;case"radio":u?(t[i].selected=!0,t[i].checked=!0,u=!1):(t[i].selected=!1,t[i].checked=!1);break;case"checkbox":t[i].selected=!1,t[i].checked=!1;break;default:t[i].selectedIndex=0}$(t[i]).change()}}function FavouriteSaveSuccess(n){if(n.type=="FavouritesSaveInvalidAttempt")jQuery(".saving").removeClass("saving").addClass("favButton"),jQuery(".favButton").blur(),jQuery("#MessageInvalidAttempt").html("&nbsp;&nbsp;"+n.description).show(),isSaved=!1;else{var t=0;if(isSaved)return;requestSentTime&&(t=(new Date).getMilliseconds()-requestSentTime.getMilliseconds()-1e3,t=t<0?t*-1:0),setTimeout(TradeMe.favourites.UpdateButtonToSaved,t)}}function FavoriteSaveFail(){location.href=TradeMe.favourites.GetDegradedUrl()}function AjaxLoadScript(n){jQuery.ajax({type:"GET",url:n,cache:!0,dataType:"script",data:null})}function AjaxErrorHandler(n,t,i){if(n!="Error loading script"){var r={URI:TradeMe.ServerUri,referrer:document.referrer,error:n,line:i};jQuery.get("/API/Ajax/LogJavaScriptError.ashx",r)}}function setActive(n){var t=!1;if(n.hasClass("modal-active")&&(t=!0),$(".activities-buying li").removeClass("modal-active"),$(".sat-nav li").removeClass("modal-active"),$(".header-links li").removeClass("modal-active"),$(".listingCard .titleCol div").removeClass("modal-active"),t)n.removeClass("modal-active");else return n.addClass("modal-active"),$(document).click(function i(t){n.has(t.target).length===0&&(n.removeClass("modal-active"),$(document).unbind("click",i))}),!0;return!1}function watchlistFavouriteToggle(n,t){return getInfoForWatchlistFavouriteToggle(n,"",!1,t),!1}function favouriteMiniToggle(n,t,i){$("#FavouritesToggle .toggle-favourites").removeClass("btn-active"),$("#SiteHeader_SiteTabs_BarOfSearch_"+t+"FavouritesToggle").addClass("btn-active"),getInfoForWatchlistFavouriteToggle(n,"favType="+t,!0,i)}function watchlistCategoryFilter(n,t,i){t!=""&&(t="cId="+t),getInfoForWatchlistFavouriteToggle(n,t,!1,i)}function watchlistMiniToggle(n,t){$("#SiteHeader_SiteTabs_BarOfSearch_watchlistDropdownToggleDiv .toggle-watchlist, #SiteTabs_BarOfSearch_watchlistDropdownToggleDiv .toggle-watchlist").removeClass("btn-active"),t!=""?(t="cId="+t,$("#SiteHeader_SiteTabs_BarOfSearch_WatchlistDropDownCategoryFilter, #SiteTabs_BarOfSearch_WatchlistDropDownCategoryFilter").addClass("btn-active")):$("#SiteHeader_SiteTabs_BarOfSearch_WatchlistDropDownCategoryAllFilter, #SiteTabs_BarOfSearch_WatchlistDropDownCategoryAllFilter").addClass("btn-active"),getInfoForWatchlistFavouriteToggle(n,t,!0,"")}function getInfoForWatchlistFavouriteToggle(n,t,i,r){var u=$("#"+n+"-extension-line"),o="/API/Ajax/WatchlistInfo.aspx",f,e;n.indexOf("Fav")>-1?(o="/API/Ajax/FavouritesInfo.aspx",u.html('<div class="separated-action"><span class="card-counter"><img class="loading-gif" src="/Images/Common/spinner-small.gif" alt="" /><\/span><a href="/MyTradeMe/Favourites.aspx" class="nav-action-link">View Favourites<span class="action-link-arrow"><\/span><\/a><\/div>'),i||($("#FavouritesToggle .toggle-favourites").removeClass("btn-active"),$("#SiteHeader_SiteTabs_BarOfSearch_searchesFavouritesToggle").addClass("btn-active"))):u.html('<div class="separated-action"><span class="card-counter"><img class="loading-gif" src="/Images/Common/spinner-small.gif" alt="" /><\/span><a href="/MyTradeMe/Buy/Watchlist.aspx" class="nav-action-link">View Watchlist<span class="action-link-arrow"><\/span><\/a><\/div>'),t!=""&&(t+="&"),t+="trackingId="+r,f=!1,e=$("#"+n),e.hasClass("modal-active")&&(f=!0),i||setActive(e),(!f||i)&&(t!=""&&(t+="&"),r!=""&&trackNavigateClick(r,!0),$.ajax({type:"GET",url:o,data:t+"overrideReturnUrl="+encodeURIComponent(window.location.href),dataType:"html",cache:!1,success:function(t){u.html(t),$("input",u).placeholder();var i=$("#"+n+"-extension-line .input-large");i.length>0&&i.focus()},error:function(){}}))}function myTradeMeClick(n,t){var i=setActive(n);i&&(trackNavigateClick(t),$.ajax({type:"GET",url:"/API/Ajax/MyTradeMeInfo.aspx",data:"",dataType:"json",cache:!1,success:function(t){if(t!=null)if(t.success)if($("#watchlistCount").html(t.watchlist),$("#wonCount").html(t.won),$("#lostCount").html(t.lost),$("#sellCurrentCount").html(t.current),$("#soldCount").html(t.sold),$("#unsoldCount").html(t.unsold),$("#username").html(t.memberName),$("#balance").html(t.balance),t.advertiseMyProducts?$(".tradevine-promotion").show():$(".tradevine-promotion").hide(),t.hasPayNow&&($("#payNowBalance").html(t.payNowBalance),$("#mytrademe-paynow-wrapper").show()),t.isAgent){$("#agentCurrentCount").html(t.liveListings),$("#agentExpiredCount").html(t.unsold),$("#agentListingsThisMonthCount").html(t.listingsThisMonth),$("#agentJobPlanCount").html(t.monthlyPlan),t.freeListings>0&&$("#agentFreeListingsThisMonthCount").html("<br/>&nbsp;("+t.freeListings+" free listing"+(t.freeListings!=="1"?"s)":")")),t.freeFeatures>0&&$("#agentFreeFeaturesThisMonthCount").html("<br/>&nbsp;("+t.freeFeatures+" free feature"+(t.freeFeatures!=="1"?"s)":")")),$("#agentPropertySubscriptionCount").html=t.currentSubscriptionListings,$("#agentClosingTodayCount").html=t.closingToday;var i=$("#SiteHeader_SiteTabs_mtmCurrentLinkAgent"),r=$("#SiteHeader_SiteTabs_mtmUnsoldLinkAgent");$("#agentListingsThisMonth").show(),t.agentType=="Job"?($("#agent-reporting").show(),$("#agent-listings").show(),$(".job-agent-info").show(),$("#mtm-account-info").show(),i!=null&&i.html("Current Jobs"),r!=null&&r.html("Expired Jobs"),$("#mtm-buying").hide(),$("#mtm-selling").hide(),$(".property-agent-info").hide(),t.prepaidAgent?($(".prepaid-agent-info").show(),$("#prepaidAgentCount").html(t.prepaidListingsRemaining),$("#prepaidBrandingAgentCount").html(t.prepaidBrandingRemaining),$("#prepaidFeaturesAgentCount").html(t.prepaidFeaturesRemaining),$("#agentListingsThisMonth").hide(),$("#currentSubscriptions").hide(),$("#monthlyPlan").hide()):$("#prepaidAgent").hide()):($("#agent-reporting").show(),$("#agent-listings").show(),$(".property-agent-info").show(),$("#mtm-account-info").show(),i!=null&&i.html("Current"),r!=null&&r.html("Expired"),$("#mtm-buying").hide(),$("#mtm-selling").hide(),$(".job-agent-info").hide())}else $("#mtm-account-info").show(),$("#mtm-buying").show(),$("#mtm-selling").show(),$(".job-agent-info").hide(),$("#agent-reporting").hide(),$("#agent-listings").hide(),$(".property-agent-info").hide();else t.login?myTradeMeWipeDataAndShowNotLoggedInState(n):myTradeMeWipeDataAndShowNotLoggedInState(n)},error:function(){myTradeMeWipeDataAndShowNotLoggedInState(n)}}))}function myTradeMeWipeDataAndShowNotLoggedInState(n){n.addClass("logged-out-modal"),$("#watchlistCount").html(""),$("#wonCount").html(""),$("#lostCount").html(""),$("#sellCurrentCount").html(""),$("#soldCount").html(""),$("#unsoldCount").html(""),$("#username").html(""),$("#balance").html(""),$("#agentCurrentCount").html(""),$("#agentExpiredCount").html(""),$("#agentListingsThisMonthCount").html(""),$("#agentJobPlanCount").html(""),$("#agentPropertySubscriptionCount").html(""),$("#agentClosingTodayCount").html(""),$("#mtm-buying").removeClass("size1of3"),$("#mtm-buying").addClass("size1of2"),$("#mtm-selling").removeClass("size1of3"),$("#mtm-selling").addClass("size1of2"),$("#mtm-buying").show(),$("#mtm-selling").show(),$("#mtm-account-info").hide(),$(".job-agent-info").hide(),$("#agent-reporting").hide(),$("#agent-listings").hide(),$(".property-agent-info").hide()}function trackNavigateClick(n,t,i,r){t&&$.ajax({type:"GET",url:"/link.aspx",data:{i:n,currentCid:i,memberId:r,FollowLinkRedirect:!1},success:function(){},error:function(){}})}function checkBoxSliderUpdateClass(n){var t=$.browser.msie&&$.browser.version.substr(0,1)<9?!0:!1;t&&($("#"+n).hasClass("old-ie-checked")?$("#"+n).removeClass("old-ie-checked"):$("#"+n).addClass("old-ie-checked"))}var currentWidth,TradeMeApi,setupOtherSearchSuggest;(function(n){var t=[46,48,49,50,51,52,53,54,55,56,57,8,9,39,37,96,97,98,99,100,101,102,103,104,105];n("input.positive-numbers-only").live("keydown",function(i){var r=i.keyCode?i.keyCode:i.which;n.inArray(r,t)===-1&&i.preventDefault()}),n("input.positive-whole-numbers-only-no-symbols").live("keydown",function(t){n.inArray(t.keyCode,[46,8,9,27,13])!==-1||t.keyCode==65&&t.ctrlKey===!0||t.keyCode>=35&&t.keyCode<=39||(t.shiftKey||t.keyCode<48||t.keyCode>57)&&(t.keyCode<96||t.keyCode>105)&&t.preventDefault()})})(jQuery),Date.prototype.add=function(n){var t=Date.now();return t.setTime(this.getTime()+n),t},Date.prototype.subtract=function(n){var t=Date.now();return t.setTime(this.getTime()-n),t},Date.prototype.startOfDay=function(){return new Date(this.getFullYear(),this.getMonth(),this.getDate())},Date.prototype.endOfDay=function(){var n=this.startOfDay();return n.add((1).day()).subtract(1)},Date.now=function(){return new Date},Date.shortMonthNames=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Date.shortDayNames=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Number.prototype.seconds=function(){return this*1e3},Number.prototype.second=function(){return this.seconds()},Number.prototype.minutes=function(){return this*(60).seconds()},Number.prototype.minute=function(){return this.minutes()},Number.prototype.hours=function(){return this*(60).minutes()},Number.prototype.hour=function(){return this.hours()},Number.prototype.days=function(){return this*(24).hours()},Number.prototype.day=function(){return this.days()},Number.prototype.weeks=function(){return this*(7).days()},Number.prototype.week=function(){return this.weeks()},Number.prototype.fortnights=function(){return this*(2).weeks()},Number.prototype.fortnight=function(){return this.fortnites()},Number.prototype.months=function(){return this*(30).days()},Number.prototype.month=function(){return this.months()},Number.prototype.years=function(){return this*365.25.days()},Number.prototype.year=function(){return this.years()},Number.prototype.from=function(n){return n.add(this)},Number.prototype.fromNow=function(){return this.from(Date.now())},Number.prototype.before=function(n){return n.subtract(this)},Number.prototype.ago=function(){return this.before(Date.now())},currentWidth=0,TradeMe.init=function(){niRegions=new Array(0),siRegions=new Array(0),use_gs_regions=!1;var n=document.getElementById("browseRegionLink");n&&(n.onclick=function(t){return TradeMe.toggleLowerRegionChooser(t,n)}),$("a[name=attRegionLink]").each(function(){$(this).click(function(n){return TradeMe.toggleAttRegionChooser(n,$(this))})}),!document.getElementById||!document.getElementsByName||!document.createElement||!TradeMe.init.apply},TradeMe.initApi=function(n){var t,r,i;document.domain="trademe.co.nz",t=location.host,t=t.indexOf("www.")>-1?t.replace("www.","api."):"api."+t,r="http",i=$("<iframe id='tmApiHookFrame' width='0' height='0' />"),i.appendTo("body"),i.load(function(){n(this)}),i.attr("src",r+"://"+t+"/Hook.aspx"),TradeMeApi=i[0].contentWindow},TradeMe.setSearchFocus=function(){jQuery("#searchString").focus()},TradeMe.regionChooserBuild=function(){var h,i,a,n,t,f,c,l,r,u,e,o,s;return h=$("input[name=rptpath]"),h.length>0&&(i=h[0]),i!=null&&i.value.length>=5&&(i.value.substring(0,5)==="9334-"||i.value.length>=6&&i.value.substring(0,6)==="10-36-")&&(use_gs_regions=!0,a=document.getElementById("browseRegionLink"),a!=null&&(document.getElementById("browseRegionLink").href="javascript:void(0);")),n=document.createElement("div"),n.id="RegionChooser",n.className="region-chooser",use_gs_regions?(n.style.background="transparent url(/Images/3/Common/RegionBox3.png) no-repeat bottom right",n.style.top="237px",n.style.height="249px"):n.style.background="transparent url(/Images/3/Common/RegionBox.png) no-repeat bottom right",t=document.createElement("a"),t.id="RegionChooserCloseButton",t.href="#",t.className="region-chooser-close-button spriteButton",t.innerHTML="Close",jQuery(t).click(function(n){return TradeMe.regionChooserToggle(n)}),f=document.createElement("div"),f.appendChild(t),c=document.createElement("strong"),l="Change my region:",use_gs_regions&&(l="Change region:"),c.appendChild(document.createTextNode(l)),f.appendChild(c),r=document.createElement("div"),r.className="regionInner",r.appendChild(f),TradeMe.buildRegionArrays(),u=jQuery(".search-bar .ChangeRegionLink").attr("href"),u=u.substr(u.indexOf("=")+1),e=document.createElement("ul"),e.id="NorthIslandRegions",TradeMe.createRegions(niRegions,e,u),o=document.createElement("ul"),o.id="SouthIslandRegions",TradeMe.createRegions(siRegions,o,u),r.appendChild(e),r.appendChild(o),n.appendChild(r),document.body.filters&&(s=document.createElement("iframe"),s.id="RegionChooserIFrame",s.src="javascript:'<html><\/html>'",document.body.appendChild(s),use_gs_regions&&(document.getElementById("RegionChooserIFrame").style.height="224px")),document.body.appendChild(n),!0},TradeMe.buildRegionArrays=function(){return use_gs_regions?(niRegions=[9,1,14,2,4,5,12,6,15],siRegions=[8,7,16,3,10,11],!0):(niRegions=[50,1,2,3,4,5,6,7,8,9,11,12],siRegions=[60,13,14,15,16,17,18,19],!0)},TradeMe.createRegions=function(n,t,i){var e="/MyTradeMe/SelectRegionDone.aspx?user_region={0}&url="+i,r,u,f;for(use_gs_regions&&(e="/MyTradeMe/SelectRegionDone.aspx?gsregion={0}&url="+i),r=0;r<n.length;r++)u=document.createElement("a"),u.href=e.replace("{0}",n[r]),u.id="RegionLink"+n[r],u.className="region",use_gs_regions?u.appendChild(document.createTextNode(TradeMe.gsRegionNameById(n[r]))):u.appendChild(document.createTextNode(TradeMe.regionNameById(n[r]))),(n[r]==50||n[r]==60)&&(u.style.fontWeight="bold"),f=document.createElement("li"),f.appendChild(u),t.appendChild(f)},TradeMe.changeSearchRegion=function(n,t,i){var r=n.id.replace("RegionLink","");return $("."+t).each(function(){$(this).val(r).attr("checked",!0)}),$("."+i).each(function(){$(this).html(TradeMe.regionNameById(parseInt(r)))}),TradeMe.regionChooserToggle(),!1},TradeMe.toggleAdvRegionChooser=function(n,t){var r,i;for(n=n||window.event,TradeMe.regionChooserToggle(n,t),r=jQuery("#RegionChooser a.region"),i=0;i<r.length;i++)r[i].onclick=function(){try{return TradeMe.changeSearchRegion(this,"search-region-local","search-region-local-label")}catch(n){}};return this.preventDefault(n),this.stopPropagation(n),!1},TradeMe.changeAttSearchRegionHandler=function(n){n=n||window.event;var t=n.srcElement||n.target;if(t==this)return TradeMe.changeSearchRegion(t,"searchRegionAttLocal","searchRegionAttLocalLabel")},TradeMe.toggleAttRegionChooser=function(n,t){var r,i;for(TradeMe.regionChooserToggle(n,t),r=jQuery("#RegionChooser a.region"),i=0;i<r.length;i++)r[i].onclick=TradeMe.changeAttSearchRegionHandler;return!1},TradeMe.toggleLowerRegionChooser=function(n,t){var r,i;for(t.blur(),TradeMe.regionChooserToggle(n,t),r=jQuery("#RegionChooser a.region"),i=0;i<r.length;i++)r[i].onclick=null;return!1},TradeMe.stopPropagation=function(n){n.stopPropagation?n.stopPropagation():n.cancelBubble=!0},TradeMe.preventDefault=function(n){n.preventDefault?n.preventDefault():n.returnValue=!1},TradeMe.regionChooserToggle=function(n,t){var e,f,r;if(n&&n.type&&(TradeMe.stopPropagation(n),TradeMe.preventDefault(n)),!document.getElementById||!document.createElement)return!0;var o="RegionChooser",s="RegionChooserIFrame",i=document.getElementById(o),u=document.getElementById(s);if(i)jQuery(i).toggle(),u&&jQuery(u).toggle();else{try{if(!TradeMe.regionChooserBuild())return!0;jQuery(document).click(function(n){TradeMe.blurRegionChooserHandler(n)})}catch(n){return!0}i=document.getElementById(o),u=document.getElementById(s)}for(e=jQuery("a.region",i),f=0;f<e.length;f++)e[f].onclick=TradeMe.changeRegionHandler;return typeof t!="undefined"&&(r=jQuery(t).offset(),u?(i.style.left=r.left-10+"px",i.style.top=r.top-10+"px",u.style.left=r.left-10+"px",u.style.top=r.top-10+"px"):(i.style.left=r.left-9+"px",i.style.top=r.top-9+"px")),!1},TradeMe.changeRegionHandler=function(n){n=n||window.event;var t=n.srcElement||n.target;if(t==this)return TradeMe.changeRegion(t)},TradeMe.changeRegion=function(n){var o=document.getElementById("regions"),f,t,e,r,u,i;if(!o||(f=o.getElementsByTagName("input"),!f||f.length<2))return!1;if(t=f[1].value,e=n.id.replace("RegionLink",""),!e||e==0)return TradeMe.regionChooserToggle(),!1;if(t&&t.indexOf||(t=2),t.indexOf("&")!=-1)for(r=t.split("&"),u="Current=",i=0;i<r.length;i++)if(r[i].substr(0,u.length)==u){t=r[i].substr(u.length,r[i].length-u.length);break}return TradeMe.setRegion(e,t),!1},TradeMe.setRegion=function(n,t){var r=document.getElementById("userSearchRegion"),i;r.removeChild(r.childNodes[0]),r.appendChild(document.createTextNode(TradeMe.regionNameById(parseInt(n)))),r.setAttribute("for","searchRegion"+n),i=document.getElementById("searchRegion"+t),i&&(i.value=n,i.checked=!0,i.id="searchRegion"+n),TradeMe.regionChooserToggle()},TradeMe.regionNameById=function(n){switch(n){case 1:return"Northland";case 2:return"Auckland";case 3:return"Waikato";case 4:return"Bay of Plenty";case 5:return"Gisborne";case 6:return"Hawke's Bay";case 7:return"Taranaki";case 8:return"Wanganui";case 9:return"Manawatu";case 11:return"Wairarapa";case 12:return"Wellington";case 13:return"Nelson Bays";case 14:return"Marlborough";case 15:return"West Coast";case 16:return"Canterbury";case 17:return"Timaru/Oamaru";case 18:return"Otago";case 19:return"Southland";case 50:return"North Island";case 60:return"South Island"}return""},TradeMe.gsRegionNameById=function(n){switch(n){case 1:return"Auckland";case 2:return"Bay of Plenty";case 3:return"Canterbury";case 4:return"Gisborne";case 5:return"Hawke's Bay";case 6:return"Manawatu / Wanganui";case 7:return"Marlborough";case 8:return"Nelson / Tasman";case 9:return"Northland";case 10:return"Otago";case 11:return"Southland";case 12:return"Taranaki";case 14:return"Waikato";case 15:return"Wellington";case 16:return"West Coast";case 50:return"North Island";case 60:return"South Island"}return""},TradeMe.blurRegionChooserHandler=function(n){n=n||window.event;var t=n.srcElement||n.target;if(t)return TradeMe.blurRegionChooser(t)},TradeMe.blurRegionChooser=function(n){var i=document.getElementById("RegionChooser"),t;return n&&n.id!="browseRegionLink"&&n.name!="attRegionLink"&&n.id!="changeRegionLink"&&!TradeMe.isParentOf(i,n)&&i.style.display!="none"&&TradeMe.regionChooserToggle(),t=document.getElementById("LocationChooser"),t&&n&&n.id!="locationModalLink"&&!TradeMe.isParentOf(t,n)&&t.style.display!="none"&&(typeof TradeMe.Jobs!="undefined"?TradeMe.Jobs.LocationToggler.locationChooserToggle():typeof TradeMe.MotorsLocationFilter!="undefined"&&TradeMe.MotorsLocationFilter.LocationToggler.locationChooserToggle()),!0},TradeMe.isParentOf=function(n,t){return t.parentNode==n?!0:t.parentNode?TradeMe.isParentOf(n,t.parentNode):!1},TradeMe.searchFormSubmitHandler=function(){var n=document.getElementById("SearchType"),r=document.getElementById("searchString"),t=document.getElementById("topBarRptPath"),i;if(n){if(t.value==""&&(isNaN(n.value)?t.value=n.value:(i=n.options[n.selectedIndex].text.substr(0,1).replace(/\xa0|(\&nbsp;)/g,"")==""?n.options[1].value:n.value,t.value=i+"-")),n.value=="365")return document.forms.generalSearch.action="/Browse/Dvds/Popular.aspx",!0;if(n&&n.value!="")return!0}return!1},TradeMe.sendWatchlistSettagRequestToSas=function(n,t){jQuery.ajax({url:"http://tmda.tmcdn.co.nz/trademe/SETTAG/NAME=WL_Cookie/TTL=2592000/TAGS=WLC%3D"+n+"%2FWLSC%3D"+t,xhrFields:{withCredentials:!0}})},TradeMe.namespace("favourites","photos"),TradeMe.favourites.Initialize=function(){var n=jQuery(".favButton");n.length>0&&n.click(TradeMe.favourites.AjaxButtonClick)},TradeMe.favourites.AjaxButtonClick=function(){return isSaved?!1:(jQuery(".favButton").addClass("saving"),jQuery("#Message1").hide(),TradeMe.favourites.AjaxCall())},TradeMe.favourites.AjaxCall=function(){if(!isSignedIn)return TradeMe.favourites.LogIn(),!1;var n="";return isDefault1&&(n="1"),requestSentTime=new Date,jQuery.ajax({type:"GET",url:"/API/Ajax/Favourites.aspx",data:"ajaxSubmit=true"+queryParameters,success:FavouriteSaveSuccess,error:FavoriteSaveFail,dataType:"json"}),!1},TradeMe.favourites.UpdateButtonToSaved=function(){jQuery(".favButton").removeClass("saving").addClass("saved"),jQuery("#Message1").hide(),jQuery("#Message2").show(),isSaved=!0},TradeMe.favourites.LogIn=function(){location.href="/Members/Login.aspx?url="+escape(TradeMe.favourites.GetDegradedUrl())},TradeMe.favourites.GetDegradedUrl=function(){var n="";return isDefault1&&(n="1"),nonAjaxUrl+queryParameters},TradeMe.namespace("Dom"),TradeMe.Dom={getViewportWidth:function(){return 1024}},function(n){function t(t){var i=0;t||(n("#container button.spriteButton").mouseover(function(){n(this).addClass("ieHover"),i=n(this).css("height").substring(0,2),n(this).css({"background-position":"0px -"+i+"px"})}),n("#container button.spriteButton").mouseout(function(){n(this).removeClass("ieHover"),n(this).removeClass("ieActive"),n(this).css({"background-position":"0px 0"})})),n("#container button.spriteButton").mousedown(function(){n(this).addClass("mouseDown"),i=n(this).css("height").substring(0,2)*2,n(this).css({"background-position":"0px -"+i+"px"})}),n("#container button.spriteButton").mouseup(function(){n(this).removeClass("ieHover"),n(this).removeClass("ieActive"),n(this).css({"background-position":"0px 0"})})}function i(){function i(n,t){var i=n.attr("href");n.click(function(){var r=50,u=50,f=t,e=520,n="location=no,toolbar=yes,menubar=no,resizable=yes,scrollbars=yes,height="+e+",width="+f;return n+=",left="+r+",top="+u,window.open(i,"pop",n),!1})}var t=650;n("#container a.js-help-popup-wide").each(function(){i(n(this),t)}),n("#container a.js-help-popup").each(function(){var t=n(this),i=t.attr("href");t.click(function(){var t=50,r=50,u=585,f=520,n="location=no,toolbar=yes,menubar=no,resizable=yes,scrollbars=yes,height="+f+",width="+u;return n+=",left="+t+",top="+r,window.open(i,"pop",n),!1})}),n("#container a.js-help-popup-small").each(function(){var t=n(this),i=t.attr("href");t.click(function(){var t=380,r=230,n="location=no,toolbar=no,menubar=no,resizeable=no,scrollbars=no,height=230,width=380";return n+=",left="+t+",top="+r,window.open(i,"pop",n),!1})})}function r(){n.each(n(".tracking-link"),function(t,i){var r=n(i).metadata(),f,u;if(r!=null){f="/Link.aspx?";for(u in r)r.hasOwnProperty(u)&&(f+=u+"="+r[u]+"&");n(i).mousedown(function(t){(t.which==1||t.which==2)&&n(this).attr("href",f)})}})}n(document).ready(function(){if(n.browser.msie&&n.browser.version==6){t(!1);try{document.execCommand("BackgroundImageCache",!1,!0)}catch(u){}}else n.browser.msie&&n.browser.version==7&&t(!0);i(),r()})}(jQuery),window.onerror=AjaxErrorHandler,TradeMe.namespace("Supports"),TradeMe.Supports.BoxShadow=function(){var n=document.body.style;return n.WebkitBoxShadow!==undefined||n.MozBoxShadow!==undefined||n.BoxShadow!==undefined},TradeMe.Supports.BorderRadius=function(){var n=document.body.style;return n.WebkitBorderRadius!==undefined||n.MozBorderRadius!==undefined||n.BorderRadius!==undefined},TradeMe.Supports.RgbaColor=function(){if(!("result"in arguments.callee)){var n=document.getElementsByTagName("script")[0],t=n.style.color,i="rgba(0, 0, 0, 0.5)";if(t==i)arguments.callee.result=!0;else{try{n.style.color=i}catch(r){}arguments.callee.result=n.style.color!=t,n.style.color=t}}return arguments.callee.result},$(document).ready(function(){$(".modal-open").click(function(n){n.preventDefault();var t=$(this),i;i=t.data().container?$("#"+t.data().container):$(this).closest("li"),setActive(i)&&t.data().trackingid&&(typeof t.data().currentcid!="undefined"&&typeof t.data().memberid!="undefined"?trackNavigateClick(t.data().trackingid,!0,t.data().currentcid,t.data().memberid):trackNavigateClick(t.data().trackingid,!0))}),$(".mytrademe-open").click(function(n){n.preventDefault();var i=$(this).closest("li"),t="";$(this).data().trackingid&&(t=$(this).data().trackingid),myTradeMeClick(i,t)}),$("#FavouritesToggle a").click(function(n){if(window.TradeMe.MemberID==="0")return!0;n.preventDefault();var t="";$(this).data().trackingid&&(t=$(this).data().trackingid),watchlistFavouriteToggle("FavouritesToggle",t)}),$("#watchlist-toggle a").click(function(n){var t,i;if(window.TradeMe.MemberID==="0")return!0;n.preventDefault(),t=$(this).data().category,t=t||"",i="",$(this).data().trackingid&&(i=$(this).data().trackingid),watchlistCategoryFilter("watchlist-toggle",t,i)})}),function(n){var i='<span class="drop-container"><span class="drop-label">All<\/span><span class="drop-arrow"><\/span><\/span>',t={init:function(){return this.each(function(){var r=this,e,f,o,u;r.initialized||(r.initialized=!0,r.select=n(r),r.container=r.select.closest(".drop-container"),r.container.length===0&&(e=n(i),r.select.before(e),r.select.detach().appendTo(e),r.container=r.select.closest(".drop-container")),r.isSearchSelect=r.select.data().searchBar,r.label=n(".drop-label",r.container),r.arrow=n(".drop-arrow",r.container),f=r.select.data().selectWidth,f&&(r.select.width(f-1),r.container.width(f-22)),o=n(":selected",r.select),u="",u=o.length>0?o.html():n(":first-child",r.select).html(),r.isSearchSelect?u!=undefined&&(u!=""&&u!=" "?u.toLowerCase().indexOf("categories")>=0?r.label.html("in "+u.toLowerCase().replace(/\xa0|(\&nbsp;)/g," ")):r.label.html("in <strong>"+u.toLowerCase().replace(/\xa0|(\&nbsp;)/g," ")+"<\/strong>"):r.label.html(u.toLowerCase())):r.label.html(u),t.bindEvents.call(r))})},reset:function(){var t=this;t.container=t.closest(".drop-container"),t.label=n(".drop-label",t.container),t.arrow=n(".drop-arrow",t.container),t.label.html(n(":first-child",t).html())},bindEvents:function(){var i=this;i.select.change(function(r){r.stopPropagation(),setTimeout(function(){var r=n(":selected",i);t.removeFocus.call(i),i.isSearchSelect?r.html()!=""&&r.html()!=" "?r.html().toLowerCase().indexOf("categories")>=0?i.label.html("in "+r.html().toLowerCase().replace(/\xa0|(\&nbsp;)/g," ")):i.label.html("in <strong>"+r.html().toLowerCase().replace(/\xa0|(\&nbsp;)/g," ")+"<\/strong>"):i.label.html(r.html()):i.label.html(r.html())},20)}),i.select.click(function(n){n.stopPropagation(),t.addFocus.call(i)}),i.select.focus(function(){t.addFocus.call(i)}),i.select.blur(function(){t.removeFocus.call(i)})},addFocus:function(){var i=this;i.container.addClass("focus"),n(document.body).bind("click.dropdown",function(){t.removeFocus.call(i)})},removeFocus:function(){var t=this;t.container.removeClass("focus"),n(document.body).unbind("click.dropdown")},destroy:function(){return this.each(function(){var t=n(this);n(window).unbind(".dropdown"),t.removeData("dropdown")})}};n.fn.dropdown=function(i){if(t[i])return t[i].apply(this,Array.prototype.slice.call(arguments,1));if(typeof i!="object"&&i)n.error("Method "+i+" does not exist on jQuery.dropdown");else return t.init.apply(this,arguments)}}(jQuery),function(n){var i=document.createElement("input"),r="placeholder"in i,u='<span class="placeholder-label"><\/span>',f='<span class="placeholder-wrapper"><\/span>',t={init:function(){return this.each(function(){var e=this,o=n(this).attr("placeholder"),h=n(this).is("[placeholder]"),t,s,i;e.placeholderInitialized||r||!h||(e.placeholderInitialized=!0,t=n(e),t.wrap(f),s=t.parent(),i=n(u).text(o),s.append(i),i.addClass("hide-placeholder"),i.click(function(){t.focus()}),t.val()==""&&(i.removeClass("hide-placeholder"),t.addClass("placeholdered")),setTimeout(function(){t.val()!=""&&(i.addClass("hide-placeholder"),t.removeClass("placeholdered"))},100),t.attr("type")=="password"&&setInterval(function(){t.val()!=""&&(i.addClass("hide-placeholder"),t.removeClass("placeholdered"))},250),t.bind("keydown",function(){t.hasClass("placeholdered")&&(i.addClass("hide-placeholder"),t.removeClass("placeholdered"));t.one("keyup",function(){(t.val()==""||t.val()==o)&&(i.removeClass("hide-placeholder"),t.addClass("placeholdered"))})}),t.bind("focusout blur",function(){t.val()==""&&(i.removeClass("hide-placeholder"),t.addClass("placeholdered"))}))})},destroy:function(){return this.each(function(){var t=n(this);n(window).unbind(".placeholder"),t.removeData("placeholder")})}};n.fn.placeholder=function(i){if(t[i])return t[i].apply(this,Array.prototype.slice.call(arguments,1));if(typeof i!="object"&&i)n.error("Method "+i+" does not exist on jQuery.placeholder");else return t.init.apply(this,arguments)}}(jQuery),function(n){var t={init:function(){return this.each(function(){var t=n(this);t.form=t.closest("form"),t.bind("click",function(n){t.prop("disabled",!0),t.html("Submitting..."),n.preventDefault(),setTimeout(function(){t.form.submit()},200)})})},destroy:function(){return this.each(function(){var t=n(this);n(window).unbind(".safeSubmit"),t.removeData("safeSubmit")})}};n.fn.safeSubmit=function(i){if(t[i])return t[i].apply(this,Array.prototype.slice.call(arguments,1));if(typeof i!="object"&&i)n.error("Method "+i+" does not exist on jQuery.safeSubmit");else return t.init.apply(this,arguments)}}(jQuery),function(n){function u(t,r,u,f,e,o){function tt(){d&&(l=n("<div/>").hide().addClass(t.resultsClass).css("position","absolute").appendTo(document.body),nt=n("<div/>").addClass("search-prompts").appendTo(l),v=n("<div/>").addClass("filter-keyword").appendTo(nt),s=n("<ul/>").appendTo(v).mouseover(function(t){a(t).nodeName&&a(t).nodeName.toUpperCase()=="LI"&&(h=n("li",s).removeClass(i.ACTIVE).index(a(t)),n(a(t)).hasClass("ac_title")||n(a(t)).addClass(i.ACTIVE))}).click(function(f){return(n(a(f)).addClass(i.ACTIVE),u(),n(a(f)).hasClass("ac_category")||n(a(f)).hasClass("ac_title"))?!1:(r.focus(),n("#"+n(r).data("suggestedId")).val(n(r).val().length),t.clickToSubmit&&n(r).closest("form").submit(),!1)}).mousedown(function(){f.mouseDownOnSelect=!0}).mouseup(function(){f.mouseDownOnSelect=!1}),t.width>0?l.css("width",t.width-2):l.css("width",r.outerWidth()-2),d=!1)}function a(n){for(var t=n.target;t&&t.tagName!="LI";)t=t.parentNode;return t?t:[]}function y(u){var f,o,e;if(c.slice(h,h+1).removeClass(i.ACTIVE),et(u),h>-1){if(f=c.slice(h,h+1).addClass(i.ACTIVE),o=f[0],f.hasClass("ac_title"))return y(u),!1;f.hasClass("ac_category")?r.val(r.data("currentValue")):r.val(n(o).data("untruncated")),n("#"+r.data("suggestedId")).val(n(o).data("untruncated").length),t.scroll&&(e=0,c.slice(0,h).each(function(){e+=this.offsetHeight}),e+f[0].offsetHeight-s.scrollTop()>s[0].clientHeight?s.scrollTop(e+f[0].offsetHeight-s.innerHeight()):e<s.scrollTop()&&s.scrollTop(e))}else r.val(r.data("currentValue"))}function et(n){h+=n,(h<0||h>=c.size())&&(h=-1,r.focus())}function it(n){return t.max&&t.max<n?t.max:n}function rt(i,u){for(var b=it(i.length),c,y,p,l,a,w,f=0;f<b;f++)if(i[f]&&(c=i[f].SearchTerm!=null?i[f].SearchTerm:i[f],y=t.formatItem(c),y!==!1)){if(p=t.highlight(y,g),l=n("<li/>").html(p).addClass(f%2==0?"ac_even":"ac_odd").appendTo(s)[0],f==0&&i[f].SuggestedCategories)for(a=0;a<i[f].SuggestedCategories.length;a++){var v=i[f].SuggestedCategories[a],k=p+" in <b>"+v.CategoryName+"<\/b> ",d=n("<li/>").html(k).addClass("ac_even").appendTo(s)[0],h=n(d);h.data("untruncated",i[f].SearchTerm),h.data("ac_data",i[f].SearchTerm),h.data("categoryName",v.CategoryName),h.data("categoryId",v.CategoryId),h.data("rptpath",v.RptPath),b--}u&&(w=n('<a href="javascript:void(0);" class="ac_remove"><i class="remove-icon"><\/i><\/a>'),w.click(function(i){i.preventDefault(),i.stopPropagation();var u=n(this).parent();r.focus(),n.ajax({dataType:"json",url:t.actionUrl,data:{action:"remove",term:u.data("ac_data")},success:function(){u.addClass("ac_removing"),setTimeout(function(){e(),o()},200)}})}),n(l).append(w)),n(l).data("untruncated",c),n(l).data("ac_data",c)}}function ot(t){for(var f=it(t.length),i=0;i<f;i++)if(t[i]){var e="/Browse/CategoryListings.aspx?cid="+t[i].Id,u="<b>"+t[i].Name+"<\/b> "+t[i].AncestorsNames.join(" > "),r=n("<li/>").html(u).addClass(i%2==0?"ac_even":"ac_odd").appendTo(s)[0];n(r).data("untruncated",u),n(r).data("ac_data",u),n(r).data("categoryLink",e),n(r).addClass("ac_category")}}function ut(){e(),l&&l.hide(),c&&c.removeClass(i.ACTIVE),h=-1,d=!0,l.remove(),tt(),r.focus()}function st(){var u,i,f;r.data("stopHideOnBlur","true");n(document).one("click",function(){ut(),r.data("stopHideOnBlur","false")});v.html(k),v.click(function(n){n.stopPropagation()}),u=n(".search-settings-done",v),u.click(function(){ut(),r.data("stopHideOnBlur","false")}),i=n(".search-settings-clear-history",v);i.one("click",function(r){r.preventDefault(),r.stopPropagation(),i.addClass("clearing").addClass("btn-disabled").html("<i><\/i>");var u=(new Date).getMilliseconds();n.ajax({dataType:"json",url:t.actionUrl,data:{action:"removeall"},success:function(){var t=delay=(new Date).getMilliseconds();t-u<100?setTimeout(function(){i.removeClass("clearing").removeClass("btn-disabled").addClass("cleared").html("<i><\/i> Cleared").addClass("btn-disabled")},200):i.removeClass("clearing").removeClass("btn-disabled").addClass("cleared").html("<i><\/i> Cleared").addClass("btn-disabled")}})});f=n("#show-searches-input",v),f.change(function(){var u=n(this).is(":checked"),e=u?"turnon":"turnoff",f,r;n.ajax({dataType:"json",url:t.actionUrl,data:{action:e},success:function(){n.get(t.settingsUrl,function(n){k=n})}}),f=u?59091:59090,r=0,typeof window.TradeMe!="undefined"&&typeof window.TradeMe.MemberID!="undefined"&&(r=window.TradeMe.MemberID),n.ajax({type:"GET",url:"/link.aspx",data:{i:f,"-memberId":r},success:function(){}})})}function ht(){var u,f;s.empty(),s.parent().find(".ac_settings").remove(),ft=r.val(),u="first",t.showSettings&&window.TradeMe.MemberID>0&&(f=n('<a href="javascript:void(0);" class="ac_settings">Settings<i class="settings-cog"><\/i><\/a>'),f.click(function(n){n.preventDefault(),n.stopPropagation(),st()}),s.parent().append(f)),w&&w.length>0&&(n("<li/>").html("Recent").appendTo(s).addClass("ac_title").addClass(u).click(function(n){n.preventDefault(),n.stopPropagation(),r.focus()}),u="",rt(w,!0)),p&&p.length>0&&(n("<li/>").html("Suggestions").appendTo(s).addClass("ac_title").addClass(u).click(function(n){n.preventDefault(),n.stopPropagation(),r.focus()}),u="",rt(p)),b&&b.length>0&&(n("<li/>").html("Categories").appendTo(s).addClass("ac_title").addClass(u).click(function(n){n.preventDefault(),n.stopPropagation(),r.focus()}),ot(b)),c=s.find("li"),t.selectFirst&&(c.slice(0,1).addClass(i.ACTIVE),h=0),n.fn.bgiframe&&l.bgiframe()}var ct=this,c,h=-1,g="",p,w,b,d=!0,l,s,ft,nt,v,k;return{display:function(n,t){tt(),p=t.autoSuggestions,g=n,w=t.recentSearches,b=t.categorySuggestions,ht()},next:function(){y(1)},prev:function(){h==-1?y(c.size()):y(-1)},hide:function(){l&&l.hide(),c&&c.removeClass(i.ACTIVE),h=-1},visible:function(){return l&&l.is(":visible")},current:function(){return this.visible()&&(c.filter("."+i.ACTIVE)[0]||t.selectFirst&&c[0])},toTop:function(){h>-1&&y(-(h+1))},show:function(){var i=t.offsetElement?t.offsetElement.offset():n(r).offset();l.css({top:i.top+r[0].offsetHeight+4,left:i.left}).show(),t.scroll&&(s.scrollTop(0),s.css({maxHeight:t.scrollHeight,overflow:"auto"})),!k&&t.showSettings&&n.get(t.settingsUrl,function(n){k=n})},selected:function(){return c&&c.filter("."+i.ACTIVE).removeClass(i.ACTIVE)},emptyList:function(){s&&s.empty()},unbind:function(){l&&l.remove()}}}function e(t){function e(n,u){r>t.cacheLength&&f(),i[n]||r++,i[n]={autoSuggestions:u.autoSuggestions,recentSearches:u.recentSearches,categorySuggestions:u.categorySuggestions}}function f(){i={},r=0}var i={},r=0,u="";return t.conditionalElementId!=""&&(u=n("#"+t.conditionalElementId).val()),{flush:f,add:e,load:function(e){return!t.cacheLength||!r?null:((t.conditionalElementId==""||u!=n("#"+t.conditionalElementId).val())&&f(),t.conditionalElementId!=""&&(u=n("#"+t.conditionalElementId).val()),i[e])?i[e]:null}}}var r={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8},t={init:function(i){return this.each(function(){var r=this;r.suggestInitialized||(r.suggestInitialized=!0,r.options=n.extend({},f,i),r.options.highlight=r.options.highlight||function(n){return n},r.input=n(r),r.theForm=r.input.closest("form"),r.formId=n(r.theForm).attr("id"),r.hasFocus=0,t.setupHiddenInputs.call(r),t.setupBindings.call(r),r.cache=new e(r.options),r.select=new u(r.options,r.input,function(){t.selectCurrent.call(r)},{mouseDownOnSelect:!1},function(){r.cache.flush()},function(){t.onChange.call(r,0,!0)}))})},selectCurrent:function(){var i=this,r=i.select.selected(),u,o,s;if(!r||r.length==0)return!0;if(u=r.data("ac_data"),o=r.data("categoryLink"),typeof o!="undefined")return i.select.hide(),t.stopLoading.call(i),window.location=o,!1;if(r.data("categoryId")){var f=n("#SearchType"),e=r.data("categoryId"),h=r.data("categoryName"),c=r.data("rptpath");f.val()!==e&&i.suggestedCategory.val(e),f[0].add(new Option(h,e)),f.val(e),f.change(),n("#topBarRptPath").val(c)}return i.previousValue=u,document.selection?(i.input.val(""),i.input.focus(),s=document.selection.createRange(),s.text=u):i.input.val(u),i.select.hide(),t.stopLoading.call(i),!0},onChange:function(){var n=this,i=n.input.val();n.input.data("currentValue",i),n.select.toTop(),n.previousValue=i,i.length==0&&n.suggested.val("0"),i.length>=n.options.minChars?(n.input.addClass(n.options.loadingClass),t.makeRequest.call(n,i)):(t.stopLoading.call(n),n.select.hide())},hideResults:function(n){var i=this;clearTimeout(i.timeout),i.timeout=setTimeout(function(){i.select.hide(),t.stopLoading.call(i)},n?n:200)},receiveData:function(n,i){var r=this;i.autoSuggestions&&i.autoSuggestions.length||i.recentSearches&&i.recentSearches.length||i.categorySuggestions&&i.categorySuggestions.length&&r.hasFocus?(t.stopLoading.call(r),r.select.display(n,i),r.select.show()):(r.select.hide(),t.stopLoading.call(r))},mapData:function(n){var i=this;return{recentSearches:n.RecentSearches,autoSuggestions:n.AutoSuggestions,categorySuggestions:n.CategorySuggestions}},makeRequest:function(i){var r=this,f,u;i=i.toLowerCase(),f=r.cache.load(i),f?t.receiveData.call(r,i,f):(u={timestamp:+new Date},n.each(r.options.extraParams,function(n,t){u[n]=typeof t=="function"?t():t}),typeof u.cid!="undefined"&&isNaN(u.cid)&&u.cid!="all"||n.ajax({mode:"abort",port:"ubersuggest"+r.input[0].name,dataType:r.options.dataType,url:r.options.url,data:n.extend({q:i,limit:r.options.max},u),success:function(n){var u=t.mapData.call(r,n);r.cache.add(i,u),t.receiveData.call(r,i,u)}}))},stopLoading:function(){var n=this;n.input.removeClass(n.options.loadingClass)},setupHiddenInputs:function(){var t=this;t.input.data("keypressesId",t.formId+"_keypresses"),t.input.data("suggestedId",t.formId+"_suggested"),t.input.data("suggestedCategoryId",t.formId+"_suggestedCategory"),t.theForm.append('<input id="'+t.formId+'_keypresses" name="'+t.formId+'_keypresses" type="hidden" value="0" />'),t.theForm.append('<input id="'+t.formId+'_suggested" name="'+t.formId+'_suggested" type="hidden" value="0" />'),t.theForm.append('<input id="'+t.formId+'_suggestedCategory" name="'+t.formId+'_suggestedCategory" type="hidden" value="" />'),t.keypresses=n("#"+t.input.data("keypressesId")),t.suggested=n("#"+t.input.data("suggestedId")),t.suggestedCategory=n("#"+t.input.data("suggestedCategoryId"))},setupBindings:function(){var i=this;i.input.bind((n.browser.opera?"keypress":"keydown")+".ubersuggest",function(n){i.lastKeyPressCode=n.keyCode,i.hasFocus<1&&(i.hasFocus=1);switch(n.keyCode){case r.UP:n.preventDefault(),i.select.visible()?i.select.prev():t.onChange.call(i,0,!0);break;case r.DOWN:n.preventDefault(),i.select.visible()?i.select.next():t.onChange.call(i,0,!0);break;case r.TAB:case r.RETURN:if(i.select.visible()&&(!t.selectCurrent.call(i)||i.options.preventEnterSubmit))return n.preventDefault(),i.blockSubmit=!0,!1;break;case r.ESC:i.select.hide();break;default:var u=parseInt(i.keypresses.val());clearTimeout(i.timeout),i.timeout=setTimeout(function(){t.onChange.call(i)},i.options.delay),i.keypresses.val(u+1)}}).focus(function(){i.hasFocus++}).blur(function(){i.hasFocus=0,setTimeout(function(){i.hasFocus==0&&i.input.data("stopHideOnBlur")!=="true"&&t.hideResults.call(i,1)},200)}).click(function(){i.hasFocus++>1&&!i.select.visible()&&t.onChange.call(i,0,!0)}).bind("flushCache",function(){i.cache.flush()})},destroy:function(){return this.each(function(){var t=n(this);n(window).unbind(".ubersuggest"),t.removeData("ubersuggest")})}},i={ACTIVE:"ac_over"},f={url:"/API/Ajax/Ubersuggestions/Ubersuggestions.ashx",actionUrl:"/API/Ajax/Ubersuggestions/UbersuggestionActions.ashx",settingsUrl:"/API/Ajax/Ubersuggestions/Settings.aspx",extraParams:{cid:function(){return n("#SearchType").val()}},inputClass:"ac_input",resultsClass:"ac_results modal-active-ext",loadingClass:"ac_loading",minChars:1,delay:100,cacheLength:100,selectFirst:!1,formatItem:function(n){var t=n;return t.length>35&&(t=t.substring(0,35),t=t+"&#8230;"),t},width:442,highlight:function(n,t){return t=t.replace(/^[\s]{1,}/,""),n.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+t.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)","i"),'<span class="search-term"><strong>$1<\/strong><\/span>')},scroll:!0,scrollHeight:400,conditionalElementId:"SearchType",clickToSubmit:!0,max:12,preventEnterSubmit:!1,offsetElement:!1,showSettings:!0};n.fn.ubersuggest=function(i){return t[i]?t[i].apply(this,Array.prototype.slice.call(arguments,1)):typeof i!="object"&&i?(n.error("Method "+i+" does not exist on jquery.ubersuggest"),!1):t.init.apply(this,arguments)}}(jQuery),$(function(){$(".SelectAutoSubmit").change(function(){$(this).siblings(".SelectLoadingText").show(),this.form.submit()})}),function(n){n.fn.extend({autocomplete:function(t,i){var r=typeof t=="string";return i=n.extend({},n.Autocompleter.defaults,{url:r?t:null,data:r?null:t,delay:r?n.Autocompleter.defaults.delay:10,max:i&&!i.scroll?i.limit:150},i),i.highlight=i.highlight||function(n){return n},i.formatMatch=i.formatMatch||i.formatItem,this.each(function(){new n.Autocompleter(this,i)})},result:function(n){return this.bind("result",n)},search:function(n){return this.trigger("search",[n])},flushCache:function(){return this.trigger("flushCache")},setOptions:function(n){return this.trigger("setOptions",[n])},unautocomplete:function(){return this.trigger("unautocomplete")}}),n.Autocompleter=function(t,i){function nt(){var t=u.selected(),n,f,e;return t?(n=t.result,c=n,i.multiple&&(f=a(r.val()),f.length>1&&(n=f.slice(0,f.length-1).join(i.multipleSeparator)+i.multipleSeparator+n),n+=i.multipleSeparator),document.selection?(r.val(""),r.focus(),e=document.selection.createRange(),e.text=n):r.val(n),y(),r.trigger("result",[t.data,t.value]),r.trigger("blur"),!0):!1}function s(){var o=r.val();n(t).data("currentValue",o),u.toTop(),c=o,o=v(o),o.length==0&&(n(t).data("userClosed",!1),k.val("0")),o.length>=i.minChars&&!n(t).data("userClosed")?(r.addClass(i.loadingClass),i.matchCase||(o=o.toLowerCase()),tt(o,ut,y)):(b(),u.hide())}function a(t){if(!t)return[""];var u=t.split(i.multipleSeparator),r=[];return n.each(u,function(t,i){n.trim(i)&&(r[t]=n.trim(i))}),r}function v(n){if(!i.multiple)return n;var t=a(n);return t[t.length-1]}function it(u,e){i.autoFill&&v(r.val()).toLowerCase()==u.toLowerCase()&&d!=f.BACKSPACE&&(r.val(r.val()+e.substring(v(c).length)),n.Autocompleter.Selection(t,c.length,c.length+e.length))}function rt(){clearTimeout(h),h=setTimeout(y,200)}function y(){u.hide(),clearTimeout(h),b(),i.mustMatch&&r.search(function(n){if(!n)if(i.multiple){var t=a(r.val()).slice(0,-1);r.val(t.join(i.multipleSeparator)+(t.length?i.multipleSeparator:""))}else r.val("")})}function ut(t,i){if(i&&i.length&&o){b(),u.display(i,t),it(t,i[0].value),u.show();var r=n(".ac_results:visible")}else y()}function tt(r,f,e){var o,s;i.matchCase||(r=r.toLowerCase()),o=l.load(r),o&&o.length?f(r,o):typeof i.url=="string"&&i.url.length>0?(s={timestamp:+new Date},n.each(i.extraParams,function(n,t){s[n]=typeof t=="function"?t():t}),n.ajax({mode:"abort",port:"autocomplete"+t.name,dataType:i.dataType,url:i.url,data:n.extend({q:v(r),limit:i.max},s),success:function(n){var t=i.parse&&i.parse(n)||ft(n);l.add(r,t),f(r,t)}})):(u.emptyList(),e(r))}function ft(t){for(var f=[],e=t.split("\n"),r,u=0;u<e.length;u++)r=n.trim(e[u]),r&&(r=r.split("|"),f[f.length]={data:r,value:r[0],result:i.formatResult&&i.formatResult(r,r[0])||r[0]});return f}function b(){r.removeClass(i.loadingClass)}var f={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8},r=n(t).addClass(i.inputClass),e=n(t.form),p,k,h,c="",l=n.Autocompleter.Cache(i),o=0,d,g={mouseDownOnSelect:!1},u=n.Autocompleter.Select(i,t,nt,g),w;i.turnOffAuto&&r.attr("autocomplete","off"),n.browser.opera&&n(t.form).bind("submit.autocomplete",function(){if(w)return w=!1,!1}),n(t).data("keypressesId",e.attr("id")+"_keypresses"),n(t).data("suggestedId",e.attr("id")+"_suggested"),e.append('<input id="'+e.attr("id")+'_keypresses" name="'+e.attr("id")+'_keypresses" type="hidden" value="0" />'),e.append('<input id="'+e.attr("id")+'_suggested" name="'+e.attr("id")+'_suggested" type="hidden" value="0" />'),p=n("#"+n(t).data("keypressesId")),k=n("#"+n(t).data("suggestedId")),r.bind((n.browser.opera?"keypress":"keydown")+".autocomplete",function(r){d=r.keyCode,o<1&&(o=1);switch(r.keyCode){case f.UP:r.preventDefault(),u.visible()?u.prev():s(0,!0);break;case f.DOWN:r.preventDefault(),n(t).data("userClosed",!1),u.visible()?u.next():s(0,!0);break;case f.PAGEUP:r.preventDefault(),u.visible()?u.pageUp():s(0,!0);break;case f.PAGEDOWN:r.preventDefault(),u.visible()?u.pageDown():s(0,!0);break;case i.multiple&&n.trim(i.multipleSeparator)==","&&f.COMMA:case f.TAB:case f.RETURN:if(nt()&&i.preventEnterSubmit)return r.preventDefault(),w=!0,!1;break;case f.ESC:u.hide();break;default:var e=parseInt(p.val());clearTimeout(h),h=setTimeout(function(){s()},i.delay),p.val(e+1)}}).focus(function(){o++}).blur(function(){o=0,g.mouseDownOnSelect||rt()}).click(function(){o++>1&&!u.visible()&&s(0,!0)}).bind("search",function(){function i(n,i){var u,f;if(i&&i.length)for(f=0;f<i.length;f++)if(i[f].result.toLowerCase()==n.toLowerCase()){u=i[f];break}typeof t=="function"?t(u):r.trigger("result",u&&[u.data,u.value])}var t=arguments.length>1?arguments[1]:null;n.each(a(r.val()),function(n,t){tt(t,i,i)})}).bind("flushCache",function(){l.flush()}).bind("setOptions",function(){n.extend(i,arguments[1]),"data"in arguments[1]&&l.populate()}).bind("unautocomplete",function(){u.unbind(),r.unbind(),n(t.form).unbind(".autocomplete")})},n.Autocompleter.defaults={inputClass:"ac_input",resultsClass:"ac_results modal-active-ext",loadingClass:"ac_loading",minChars:1,delay:400,matchContains:!1,matchSubset:!1,matchContains:!1,cacheLength:100,max:100,mustMatch:!1,extraParams:{},selectFirst:!1,formatItem:function(n){var t=n[0];return t.length>20&&(t=t.substring(0,20),t=t+"&#8230;"),t},formatMatch:null,autoFill:!1,width:0,multiple:!1,multipleSeparator:", ",highlight:function(n,t){return t=t.replace(/^[\s]{1,}/,""),n.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+t.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)","i"),'<span class="search-term"><strong>$1<\/strong><\/span>')},scroll:!0,scrollHeight:280,closeElement:'<div class="CloseSuggestions" id="CloseSuggestions"><span>Close suggestions<\/span><\/div>',conditionalElementId:"",preventEnterSubmit:!0,clickToSubmit:!0,turnOffAuto:!0},n.Autocompleter.Cache=function(t){function e(n,i){t.matchCase||(n=n.toLowerCase());var r=n.indexOf(i);return r==-1?!1:r==0||t.matchContains}function o(n,u){r>t.cacheLength&&f(),i[n]||r++,i[n]=u}function s(){var r,h,u,c,i,f,e,s;if(!t.data)return!1;for(r={},h=0,t.url||(t.cacheLength=1),r[""]=[],u=0,c=t.data.length;u<c;u++)(i=t.data[u],i=typeof i=="string"?[i]:i,f=t.formatMatch(i,u+1,t.data.length),f!==!1)&&(e=f.charAt(0).toLowerCase(),r[e]||(r[e]=[]),s={value:f,data:i,result:t.formatResult&&t.formatResult(i)||f},r[e].push(s),h++<t.max&&r[""].push(s));n.each(r,function(n,i){t.cacheLength++,o(n,i)})}function f(){i={},r=0}var i={},r=0,u="";return t.conditionalElementId!=""&&(u=n("#"+t.conditionalElementId).val()),setTimeout(s,25),{flush:f,add:o,populate:s,load:function(o){var l,c,h,s;if(!t.cacheLength||!r)return null;if((t.conditionalElementId==""||u!=n("#"+t.conditionalElementId).val())&&f(),t.conditionalElementId!=""&&(u=n("#"+t.conditionalElementId).val()),!t.url&&t.matchContains){s=[];for(l in i)l.length>0&&(h=i[l],n.each(h,function(n,t){e(t.value,o)&&s.push(t)}));return s}if(i[o])return i[o];if(t.matchSubset)for(c=o.length-1;c>=t.minChars;c--)if(h=i[o.substr(0,c)],h)return s=[],n.each(h,function(n,t){e(t.value,o)&&(s[s.length]=t)}),s;return null}}},n.Autocompleter.Select=function(t,i,r,u){function w(){y&&(s=n("<div/>").hide().addClass(t.resultsClass).css("position","absolute").appendTo(document.body),elementTwo=n("<div/>").addClass("search-prompts").appendTo(s),elementKeywords=n("<div/>").addClass("filter-keyword").appendTo(elementTwo),o=n("<ul/>").appendTo(elementKeywords).mouseover(function(t){a(t).nodeName&&a(t).nodeName.toUpperCase()=="LI"&&(f=n("li",o).removeClass(h.ACTIVE).index(a(t)),n(a(t)).addClass(h.ACTIVE))}).click(function(u){return n(a(u)).addClass(h.ACTIVE),r(),i.focus(),n("#"+n(i).data("suggestedId")).val(n(i).val().length),t.clickToSubmit&&n(i).closest("form").submit(),!1}).mousedown(function(){u.mouseDownOnSelect=!0}).mouseup(function(){u.mouseDownOnSelect=!1}),s.append(t.closeElement),$closeElement=n("#"+n(t.closeElement).attr("id")),$closeElement.click(function(){n(i).data("userClosed",!0)}),t.input&&s.css("width",t.input.outerWidth()-2),y=!1)}function a(n){for(var t=n.target;t&&t.tagName!="LI";)t=t.parentNode;return t?t:[]}function c(r){var u;if(e.slice(f,f+1).removeClass(h.ACTIVE),b(r),f>-1){var s=e.slice(f,f+1).addClass(h.ACTIVE),c=s[0],l=n(c);n(i).val(n(c).data("untruncated")),n("#"+n(i).data("suggestedId")).val(n(c).data("untruncated")[0].length),t.scroll&&(u=0,e.slice(0,f).each(function(){u+=this.offsetHeight}),u+s[0].offsetHeight-o.scrollTop()>o[0].clientHeight?o.scrollTop(u+s[0].offsetHeight-o.innerHeight()):u<o.scrollTop()&&o.scrollTop(u))}else n(i).val(n(i).data("currentValue"))}function b(t){f+=t,(f<0||f>=e.size())&&(f=-1,n(i).focus())}function k(n){return t.max&&t.max<n?t.max:n}function d(){var u,r,c,a;for(o.empty(),p=n(i).val(),u=k(l.length),r=0;r<u;r++)l[r]&&(c=t.formatItem(l[r].data,r+1,u,l[r].value,v),c!==!1)&&(a=n("<li/>").html(t.highlight(c,v)).addClass(r%2==0?"ac_even":"ac_odd").appendTo(o)[0],n(a).data("untruncated",l[r].data),n(a).data("ac_data",l[r]));e=o.find("li"),t.selectFirst&&(e.slice(0,1).addClass(h.ACTIVE),f=0),n.fn.bgiframe&&s.bgiframe()}var h={ACTIVE:"ac_over"},e,f=-1,l,v="",y=!0,s,o,p;return{display:function(n,t){w(),l=n,v=t,d()},next:function(){c(1)},prev:function(){f==-1?c(e.size()):c(-1)},pageUp:function(){f!=0&&f-8<0?c(-f):c(-8)},pageDown:function(){f!=e.size()-1&&f+8>e.size()?c(e.size()-1-f):c(8)},hide:function(){s&&s.hide(),e&&e.removeClass(h.ACTIVE),f=-1},visible:function(){return s&&s.is(":visible")},current:function(){return this.visible()&&(e.filter("."+h.ACTIVE)[0]||t.selectFirst&&e[0])},toTop:function(){f>-1&&c(-(f+1))},show:function(){var f=n(i).offset(),r,u;s.css({top:f.top+i.offsetHeight,left:f.left}).show(),t.scroll&&(o.scrollTop(0),o.css({maxHeight:t.scrollHeight,overflow:"auto"}),n.browser.msie&&typeof document.body.style.maxHeight=="undefined"&&(r=0,e.each(function(){r+=this.offsetHeight}),u=r>t.scrollHeight,o.css("height",u?t.scrollHeight:r),u||e.width(o.width()-parseInt(e.css("padding-left"))-parseInt(e.css("padding-right")))))},selected:function(){var t=e&&e.filter("."+h.ACTIVE).removeClass(h.ACTIVE);return t&&t.length&&n(t[0]).data("ac_data")},emptyList:function(){o&&o.empty()},unbind:function(){s&&s.remove()}}},n.Autocompleter.Selection=function(n,t,i){if(n.createTextRange){var r=n.createTextRange();r.collapse(!0),r.moveStart("character",t),r.moveEnd("character",i),r.select()}else n.setSelectionRange?n.setSelectionRange(t,i):n.selectionStart&&(n.selectionStart=t,n.selectionEnd=i);n.focus()}}(jQuery),setupOtherSearchSuggest=function(){},function(n){n(document).ready(function(){function t(){var t=n("#searchTitle"),i,r;t.length>0&&(i="/API/Ajax/Suggest.aspx",r={extraParams:{cid:function(){return n("#cid").val()}},delay:100,max:15,input:t,conditionalElementId:"cid",closeElement:"",formatItem:function(n){var t=n[0];return t.length>100&&(t=t.substring(0,100),t=t+"&#8230;"),t},scroll:!1,preventEnterSubmit:!1},t.autocomplete(i,r))}setupOtherSearchSuggest=function(){var i=n("#sidebarSearch input[name=cid], #PropertySearchForm input[name=cid], .jobs-advanced #JobsCat"),t,r,u;i.length<=0||(t=n("#sidebar-15,#sidebar-153,#sidebar-54, .jobs-advanced #Keyword"),t.length>0&&(r="/API/Ajax/GeneralSuggest.aspx",u={extraParams:{cid:function(){var t=n("#SearchType").val(),r=i.val();return t.indexOf(r)>=0?t:r},make:function(){return n("#sidebar-Make").val()}},delay:100,conditionalElementId:"SearchType",input:t,closeElement:"",formatItem:function(n){var t=n[0];return t.length>35&&(t=t.substring(0,35),t=t+"&#8230;"),t},max:10,preventEnterSubmit:!1,turnOffAuto:!0,clickToSubmit:!1},t.unautocomplete(),t.autocomplete(r,u)))},setupHomepageSearchSuggest=function(t){var i="",r,e,u,f;if(t)t=="main-box-jobs"?i="5000":t=="main-box-motors"?i="268":t=="main-box-property"?i="5748":t=="main-box-services"&&(i="9334");else return;i.length<=0||(r=n("#"+t+" .default-input"),e=n("#verticals-feature .verticals-nav-switcher .modal-active"),r.length>0&&(u="/API/Ajax/GeneralSuggest.aspx",f={extraParams:{cid:function(){return i},make:function(){return n("#SearchTabs1_MotorsSearchFormControl_MotorsUsedCarMakeSelect").val()}},delay:100,conditionalElementId:"SearchType",input:r,closeElement:"",formatItem:function(n){var t=n[0];return t.length>35&&(t=t.substring(0,35),t=t+"&#8230;"),t},max:10,preventEnterSubmit:!1,turnOffAuto:!0,clickToSubmit:!1},r.unautocomplete(),r.autocomplete(u,f)))},t(),setupOtherSearchSuggest(),setupHomepageSearchSuggest()})}(jQuery);var BaseRepository=function(n){var t=n,i={json:"json",xml:"xml"},r={post:"POST",get:"GET"},u=this;u.post=function(n,u,f,e){jQuery.ajax({type:r.post,url:t+n,data:u,success:f,error:e,dataType:i.json})},u.get=function(n,u,f,e){jQuery.ajax({type:r.get,url:t+n,data:u,success:f,error:e,dataType:i.json})},u.getCache=function(n,u,f){jQuery.ajax({type:r.get,url:t+n,cache:u,success:f,dataType:i.json})}},ShoppingCartItemRepository=function(){var n=this;n.prototype=new BaseRepository("/API/Ajax/ShoppingCart/"),n.handlers={add:"AddToShoppingCart.ashx",update:"UpdateShoppingCartItemQuantity.ashx",remove:"RemoveFromShoppingCart.ashx",getDetails:"GetCartDetails.ashx",updateShipping:"UpdateShoppingCartItemShipping.ashx",updatePromotionalShipping:"UpdatePromotionalShipping.ashx"},n.removeItemFromCart=function(t,i,r){n.prototype.post(n.handlers.remove,{cartItemId:t.cartItemId(),listingId:t.listingId()},function(n){i(n)},function(n){r(n)})},n.updateItemQuantityInCart=function(t,i,r){n.prototype.post(n.handlers.update,{cartItemId:t.cartItemId(),listingId:t.listingId(),quantity:t.quantity()},function(n){i(n)},function(n){r(n)})},n.updateShoppingCartItemShipping=function(t,i,r,u){n.prototype.post(n.handlers.updateShipping,{cartItemId:t.cartItemId(),listingId:t.listingId(),quantity:t.quantity(),shippingPrice:i.value.price(),shippingDetails:i.value.description()},function(n){r(n,t)},function(n){u(n,t)})},n.updatePromotionalShipping=function(t,i,r,u){n.prototype.post(n.handlers.updatePromotionalShipping,{sellerId:t,shippingPrice:i.value.price(),shippingDetails:i.value.description()},function(n){r(n,i)},function(n){u(n)})},n.addItemToCart=function(t,i,r,u){n.prototype.post(n.handlers.add,{id:t,quantity:i},function(n){r(n)},function(n){u(n)})},n.undoRemoveItemFromCart=function(t,i,r,u){n.prototype.post(n.handlers.add,{id:t,quantity:i,returnItem:!0},function(n){r(n)},function(n){u(n)})},n.getDetails=function(t){n.prototype.getCache(n.handlers.getDetails,!1,function(n){t(n)})}},CartDetailsViewModel=function(n){var i=this,r=new ShoppingCartItemRepository,t=function(n){n.totalListings?($(".cart-total-listings").text(n.totalListings),$(".cart-total-listings").show()):$(".cart-total-listings").hide()};t(n),i.getCartDetails=function(){r.getDetails(t)}},cartDetailsViewModel=new CartDetailsViewModel(globalCartDetailsJson)