jQuery.fn.featureFilter=function(f,q,e,m,j,d,h,i,r,n,p,s,o,v,a,l,g,t){f.change(c);q.change(c);e.change(c);m.change(c);j.change(c);d.change(c);h.click(c);c();function c(F){var G=0;h.each(function(I){if(this.checked){G+=t[I];}});var z=0;if(f.get(0).selectedIndex!=0){z=f.get(0).value;}var w=b(q.get(0).value);var H=u(j.get(0).value);var A=d.get(0).value;var C={from:e.get(0).value,upto:m.get(0).value};var D=f.get(0).value;var E=f.get(0).options.length;for(var y=0;y<E;y++){f.get(0).remove(0);}var B=document.createElement("option");B.text="All sub regions";B.value="0";f.get(0).options[f.get(0).options.length]=B;for(var y=0;y<s.length;y++){x=k(G,s[y].value,C.from,C.upto,w.min,w.max,H.min,H.max,A);if(x==0){continue;}B=document.createElement("option");B.text=s[y].text+" ("+x+")";B.value=s[y].value;if(B.value==D){B.selected=true;}f.get(0).options[f.get(0).options.length]=B;}var D=q.get(0).value;E=q.get(0).options.length;for(var y=0;y<E;y++){q.get(0).remove(0);}var B=document.createElement("option");B.text="Any";B.value="Any";q.get(0).options[q.get(0).options.length]=B;for(var y=0;y<o.length;y++){w=b(o[y].value);x=k(G,z,C.from,C.upto,w.min,w.max,H.min,H.max,A);if(x==0){continue;}B=document.createElement("option");B.text=o[y].text+" ("+x+")";B.value=o[y].value;if(B.value==D){B.selected=true;}q.get(0).options[q.get(0).options.length]=B;}w=b(q.get(0).value);var D=j.get(0).value;E=j.get(0).options.length;for(var y=0;y<E;y++){j.get(0).remove(0);}var B=document.createElement("option");B.text="Any";B.value="Any";j.get(0).options[j.get(0).options.length]=B;for(var y=0;y<l.length;y++){H=u(l[y].value);x=k(G,z,C.from,C.upto,w.min,w.max,H.min,H.max,A);if(x==0){continue;}B=document.createElement("option");B.text=l[y].text+" ("+x+")";B.value=l[y].value;if(B.value==D){B.selected=true;}j.get(0).options[j.get(0).options.length]=B;}H=u(j.get(0).value);var D=d.get(0).value;E=d.get(0).options.length;for(var y=0;y<E;y++){d.get(0).remove(0);}var B=document.createElement("option");B.text="Any";B.value="Any";d.get(0).options[d.get(0).options.length]=B;for(var y=0;y<g.length;y++){A=g[y].value;x=k(G,z,C.from,C.upto,w.min,w.max,H.min,H.max,A);if(x==0){continue;}B=document.createElement("option");B.text=g[y].text+" ("+x+")";B.value=g[y].value;if(B.value==D){B.selected=true;}d.get(0).options[d.get(0).options.length]=B;}A=d.get(0).value;if(e.length>0){var D=e.get(0).value;E=e.get(0).options.length;for(var y=0;y<E;y++){e.get(0).remove(0);}var B;for(var y=0;y<v.length;y++){x=k(G,z,v[y].value,C.upto,w.min,w.max,H.min,H.max,A);if(x==0){continue;}B=document.createElement("option");B.text=v[y].text;B.value=v[y].value;if(B.value==D){B.selected=true;}e.get(0).options[e.get(0).options.length]=B;}}if(m.length>0){var D=m.get(0).value;E=m.get(0).options.length;for(var y=0;y<E;y++){m.get(0).remove(0);}var B;for(var y=0;y<a.length;y++){x=k(G,z,C.from,a[y].value,w.min,w.max,H.min,H.max,A);if(x==0){continue;}B=document.createElement("option");B.text=a[y].text;B.value=a[y].value;if(B.value==D){B.selected=true;}m.get(0).options[m.get(0).options.length]=B;}}h.each(function(I){if(this.checked){return;}var J=G+t[I];x=k(J,z,C.from,C.upto,w.min,w.max,H.min,H.max,A);this.disabled=x==0;});var x=k(G,z,C.from,C.upto,w.min,w.max,H.min,H.max,A);r.html(x);}function k(G,B,F,z,H,E,y,w,D){var x=0;for(var A=0;A<p.length;A++){if((p[A].f&G)==G){if(B==0||B==p[A].r){if(p[A].s>=H&&(E==0||p[A].s<=E)){if(p[A].b>=y&&(w==-1||p[A].b<=w)){if(D=="Any"||D==""||p[A].t==D){for(var C=0;C<p[A].p.length;C++){if(p[A].p[C]>=F&&(z==0||p[A].p[C]<=z)){x++;break;}}}}}}}}return x;}function b(x){var w=0;var y=0;if(x=="TwoToFour"){w=2;y=4;}else{if(x=="FiveToSeven"){w=5;y=7;}else{if(x=="EightToTen"){w=8;y=10;}else{if(x=="ElevenPlus"){w=11;}}}}return{min:w,max:y};}function u(y){var x=-1;var w=-1;if(y=="Studio"){x=0;w=0;}else{if(y=="One"){x=1;w=1;}else{if(y=="Two"){x=2;w=2;}else{if(y=="Three"){x=3;w=3;}else{if(y=="Four"){x=4;w=4;}else{if(y=="Five"){x=5;w=5;}else{if(y=="SixPlus"){x=6;}}}}}}}return{min:x,max:w};}n.click(function(w){if(i.css("display")=="none"){n.html("<< View less filters");i.each(function(x){$(this).css("display","inline");});}else{i.each(function(x){n.html("View more filters &#187;");$(this).css("display","none");});}});};function eventTrack_featuresCheckBoxList(){try{var b=$(".featureCheckboxes input");var a="";var c="";b.each(function(e){if(this.type.substr(0,8)=="checkbox"&&this.checked==true){a+=c+this.nextSibling.innerHTML;c=", ";}});pageTracker2._trackEvent("Feature Filters Checked",a);}catch(d){}}
