function Querystring(A){this.params={};if(A==null){A=location.search.substring(1,location.search.length)}if(A.length==0){return }A=A.replace(/\+/g," ");var C=A.split("&");for(var D=0;D<C.length;D++){var F=C[D].split("=");var B=decodeURIComponent(F[0]);var E=(F.length==2)?decodeURIComponent(F[1]):B;this.params[B]=E}}Querystring.prototype.get=function(A,B){var C=this.params[A];return(C!=null)?C:B};Querystring.prototype.contains=function(A){var B=this.params[A];return(B!=null)};var facetSrch="";function dosearch(B,C,A){sr=B.stext.value;sr=sr.replace(/\ba\b|\ban\b|\band\b|\bare\b|\bas\b|\bat\b|\bbe\b|\bbut\b|\bby\b|\bfor\b|\bif\b|\bin\b|\binto\b|\bis\b|\bit\b|\bno\b|\bnot\b|\bof\b|\bon\b|\bor\b|\bsuch\b|\bthat\b|\bthe\b|\btheir\b|\bthen\b|\bthere\b|\bthese\b|\bthey\b|\bthis\b|\bto\b|\bwas\b|\bwill\b|\bwith\b/,"");if(C=="2"){sr=sr.replace(/^\s*/,"").replace(/\s*$/,"");sr=sr.replace(/\s+/g," ");sr=sr.replace(/"/,"");re=/[\s+]/g;str=sr;newstr=str.replace(re," AND ");sr=escape(newstr)}else{if(C=="3"){sr='"'+escape(B.stext.value)+'"'}else{sr=escape(sr)}}random_num=(Math.round((Math.random()*900000)+1));if(facetSrch.length>0){facetSrch="&f="+facetSrch}location.href=A+"?s="+sr+"&ss="+escape(B.stext.value)+"&n="+random_num+facetSrch}function searchOnFacet(A){if(facetSrch.length>0){facetSrch+=";"}facetSrch+=A;dosearch(document.search2,srchType,srchUrl)}function unSearchFacet(C){var E=facetSrch.split(";");var A="";for(si=0;si<E.length;si++){var B=E[si];if(B.length==0){continue}var D=B.split(":");if(D[0]!=C){A+=B}}facetSrch=A;dosearch(document.search2,srchType,srchUrl)}function changeSort(B){var A=document.search2.sortby.options[document.search2.sortby.selectedIndex].value;random_num=(Math.round((Math.random()*900000)+1));location.href=B+"?sort="+A+"&n="+random_num}function changeView(B){var A=document.search2.show.options[document.search2.show.selectedIndex].value;random_num=(Math.round((Math.random()*900000)+1));location.href=B+"?show="+A+"&n="+random_num,"_self"}function catSort(B,A){if(B.label==A.label){return 0}if(B.label<A.label){return -1}if(B.label>A.label){return 1}}function iterCollection(A){var B=this.list;var D=this.isSearchedOn;A+='<div class="facettitle">'+this.name+'</div><div class="facetelems">';if(D){var C="'"+this.varname+"'";A+='<div class="facetunselect"><a href="" onclick="unSearchFacet('+C+');return false;">All '+this.name+"</a></div>"}if(B.length==1){D=true}A+="<ul>";for(j=0;j<B.length;j++){var E=B[j];A=E.displayFacet(A,D)}A+="</ul></div>";return A}function displayFacet(A,C){if(!C){C=this.isSearchedOn}A+="<nobr><li>";if(!C){var B="'"+this.srch+"'";A+='<a href="" onclick="searchOnFacet('+B+');return false;">'}A+=this.label;if(!C){A+=" ("+this.count+")</a>"}A+="</li>";return A}function SrchFacetCollection(B,A){this.name=B;this.varname=A;this.list=new Array();this.display=iterCollection;this.isSearchedOn=false}function SrchFacet(A){this.label=A;this.count=count;this.type=type;this.id=id;this.displayFacet=displayFacet;this.srch=this.type+":"+this.id;this.isSearchedOn=true}function SrchFacet(A,C,B,D){this.label=A;this.count=C;this.type=B;this.id=D;this.displayFacet=displayFacet;this.srch=this.type+":"+this.id;this.isSearchedOn=false}var priceRanges=[{l:"0.00",r:"24"},{l:"25",r:"49"},{l:"50",r:"99"},{l:"100",r:"199"},{l:"200",r:"499"},{l:"500",r:"999"},{l:"1,000",r:"1,999"},{l:"2,000",r:"4,999"},{l:"5,000",r:"9,999"},{l:"10,000",r:"above"}];function PriceFacet(A){this.id=A;this.displayFacet=displayFacet;this.label=currency+priceRanges[A].l+"-"+currency+priceRanges[A].r;this.isSearchedOn=true;this.srch=this.type+":"+this.id}function PriceFacet(A,B){this.count=A;this.type="p";this.id=B;this.displayFacet=displayFacet;this.label=currency+priceRanges[B].l+"-"+currency+priceRanges[B].r;this.srch=this.type+":"+this.id}PriceFacet.prototype=SrchFacet;var facets=new Array();var facetCat=new SrchFacetCollection("Categories","c");facets[0]=facetCat;var facetPrice=new SrchFacetCollection("Prices","p");facets[1]=facetPrice;function srchDisplayFacets(){var A=new Querystring();facetSrch=A.get("f","");facetCat.list.sort(catSort);var B="";for(var D=0;D<facets.length;D++){var C=facets[D];B=C.display(B)}document.getElementById("facetsidebar").innerHTML=B};