var SearchSlider=Class.create();SearchSlider.prototype=Object.extend(new Search(),{setDefaults:function(a){this.defaults={min_price:0,max_price:1025000,bedrooms:0,bathrooms:0,garage:0,min_year:0,max_year:2010,home_type:"",list_class:"",district:"",max_sq_feet:10200,min_sq_feet:0,acreage:0,part_address:""};Object.extend(this.defaults,a||{})},createQuery:function(){var i=$("price-bottom").value;var h=$("price-top").value;var d=$("bed").value;var g=$("bath").value;var t=$("garage").value;var m=$("year-bottom").value;var b=$("year-top").value;var r=0;var c=2010;if(typeof(s3)!="undefined"){r=s3.getMinimum();c=s3.getMaximum();if(m==s3.getMinimum()){m=0}if(b==s3.getMinimum()){b=1}}var j=$("home_type").options[$("home_type").selectedIndex].value;var f=$("list_class").value;var s=$("part_address")?$("part_address").value:"";var k="";var q="";if($("district")!=null){k=getSelectedDistrict();if(k==null){k=""}else{k=k.name}}if($("area")!=null){q=getSelectedArea();if(q==null){q=""}else{q=q.name}}var o=$("sqft-top").value;var p=$("sqft-bottom").value;var n=formatNumber($("lot-size").value/10,1,",",".","","","-","");this.ext_search=false;var e="home.price >= "+i;if(h<this.defaults.max_price&&h>0){e+=" AND home.price <= "+h}if(s!=""){e+=" AND home.street LIKE '%"+s.replace(/[^a-zA-Z0-9]/,"%")+"%'"}if(d>0){e+=" AND home.bedrooms >= "+d}if(g>0){e+=" AND home.bathrooms >= "+g}if(p>0){e+=" AND home.sq_feet >= "+p}if(o>0&&o<this.defaults.max_sq_feet){e+=" AND home.sq_feet <= "+o}if(t>0){e+=" AND home.garage_cap >= "+t}if(n>0){e+=" AND home.acreage >= "+n}if(m>r){e+=" AND home.year >= "+m}if(b!=c&&b!=""){e+=" AND home.year <= "+b}if(j.length>0){e+=" AND home.home_type = '"+j+"'"}if(f.length>0){if(f.substring(0,2)=="--"){e+=" AND home.property_subtype='"+f.substring(2)+"'"}else{e+=" AND home.list_class = '"+f+"'"}}if(q.length>0){e+=" AND home.area = '"+q+"'"}if(k.length>0){e+=" AND ext.district = '"+k+"'";this.ext_search=true}if($("search_open_house")!=null&&$("search_open_house").checked==true){e+=" AND ext.open_house_end >= NOW()";this.ext_search=true}if($("private_pool")!=null&&$("private_pool").checked==true){e+=" AND ext.pool like '%Pool - Private%'";this.ext_search=true}if($("search_pru_only")!=null&&$("search_pru_only").checked==true){e+=" AND home.listing_office_id in (19500, 22400, 203056, 203010, 203011)"}if($("recent_listing")!=null&&$("recent_listing").checked==true){e+=" AND home.list_date >= date_sub(now(), interval 7 day)"}if(($("show_fsbo_agent")!=null)&&($("show_fsbo_agent").disabled==false)&&($("show_fsbo_agent").checked)){e+=" AND home.realtor != '0'"}if($("forclosure")!=null&&$("forclosure").checked==true){e+=" AND (home.listing_condition & 98 > 0)"}if($("foreclosure")!=null&&$("foreclosure").checked==true){e+=" AND home.foreclosure = 'y'"}if($("short_sale")!=null&&$("short_sale").checked==true){e+=" AND home.short_sale = 'y'"}if($("sold_listings")!=null&&$("sold_listings").checked==true){e+=" AND home.sold = 'y'"}if($("sold_date")!=null&&$("sold_date").value!=""){e+=" AND home.list_date >= DATE_SUB(CURDATE(),INTERVAL "+$("sold_date").value+" MONTH)"}if($("lake")!=null){var a=$("lake").options[$("lake").selectedIndex].value;if(a=="ANY"){e+=" AND length(home.lake) > 0"}else{if(a!=""){e+=" AND home.lake like '%"+a+"%'"}}}var l="";if($("all_cities")){e+=" AND home.zip = "+$("city").options[$("city").selectedIndex].value}else{l=getSelectedCity();if((l!=null)&&($("search_city_zips")!=null)&&($("search_city_zips").checked==false)){e+=" AND home.zip = "+l.zip}}return e},appendQueryValue:function(c,d){var g=0;var b=c.indexOf(" ",g);var a=c.substring(5,b);g=a.length+5+1;b=c.indexOf(" ",g);var f=c.substring(g,b);g+=f.length+1;var e=c.substring(g,c.length);if(a=="price"||a=="year"||a=="sq_feet"){if(f==">="){a="min_"+a}else{a="max_"+a}}else{if(a=="garage_cap"){a="garage"}else{if(a=="home_type"){e=e.substring(1,e.length-1)}else{if(a=="list_class"){e=e.substring(1,e.length-1)}else{if(a=="property_subtype"){a="list_class";e="--"+e.substring(1,e.length-1)}else{if(a=="istrict"){a="district";e=e.substring(1,e.length-1)}else{if(a=="pen_house_end"){a="open_house_end";e="true"}else{if(a=="ool"){a="pool";e="true"}else{if(a=="listing_office_id"){e="true"}else{if(a=="realtor"){e="true"}else{if(a=="foreclosure"){e="true"}else{if(a=="short_sale"){e="true"}else{if(a=="sold"){e="true"}else{if(a=="list_date"&&e.length==37){e=e.substring(28,30);a="sold_date"}else{if(a=="lake"){if(f=="like"){e=e.substring(2,e.length-2)}else{e="ANY"}}}}}}}}}}}}}}}}d[a]=e},setSearchValues:function(f){var a=new Array();Object.extend(a,this.defaults);if(f!=null){var g=f.split(" AND ");var b=new Array();for(var c=0;c<g.length;c++){this.appendQueryValue(g[c],b)}Object.extend(a,b);if(window.location.href=="http://ben.blueroof360.com/site/search.php?"){alert(f)}}s1.setTopValue(a.max_price);s1.setBottomValue(a.min_price);s2.setTopValue(a.max_sq_feet);s2.setBottomValue(a.min_sq_feet);s3.setTopValue(a.max_year);s3.setBottomValue(a.min_year);s4.setValue(a.bedrooms);s5.setValue(a.bathrooms);s6.setValue(a.garage);s7.setValue(a.acreage*10);util_setSelectValue($("home_type"),a.home_type);if($("list_class")!=null){var e=a.list_class;if($("list_class").type=="select-one"){if(e!=null){util_setSelectValue($("list_class"),e)}else{util_setSelectValue($("list_class"),"")}}else{if($("list_class").type=="radio"){list_classes=document.search.list_class;for(var c=0;c<list_classes.length;c++){if(list_classes[c].value==e){list_classes[c].checked=true}}}}}if($("district")!=null){var h=getDistrictByName(a.district);if(h!=null){util_setSelectValue($("district"),h.id)}else{util_setSelectValue($("district"),"")}}if($("lake")!=null){util_setSelectValue($("lake"),a.lake)}if($("search_open_house")!=null){if(a.open_house_end!=null&&a.open_house_end=="true"){$("search_open_house").checked=true}}if($("private_pool")!=null&&a.pool=="true"){$("private_pool").checked=true}if($("foreclosure")!=null&&a.foreclosure=="true"){$("foreclosure").checked=true}if($("short_sale")!=null&&a.short_sale=="true"){$("short_sale").checked=true}if($("sold_listings")!=null&&a.sold=="true"){$("sold_listings").checked=true;if($("sold_date")!=null){util_setSelectValue($("sold_date"),a.sold_date)}}if($("part_address")&&a.street){a.street=a.street.replace(/\s+/,"");var d=a.street.substring(2,a.street.length-2).replace(/%/," ");$("part_address").value=d}$("home_num").value="";if(($("recent_listing")!=null)&&a.list_date!=null&&a.list_date.length>0){$("recent_listing").checked=true}if($("search_pru_only")!=null){if(a.listing_office_id!=null&&a.listing_office_id=="true"){$("search_pru_only").checked=true}}this.setTablePrefix(null);if($("show_fsbo_agent")!=null){if(a.realtor!=null&&a.realtor){$("show_fsbo_agent").checked=true}if(this.getTablePrefix()=="fsbo"){$("show_fsbo_agent").disabled=false}}},getSummaryTable:function(g){var i=document.createElement("table");i.cellpadding=0;i.cellspacing=0;i.border=0;i.width="100%";i.className="cdgrey";var l=$("price-bottom").value;var j=$("price-top").value;var e=$("bed").value;var h=$("bath").value;var v=$("garage").value;var q=$("year-bottom").value;if(q==1890){q=1}var b=$("year-top").value;if(b==1890){b=1}var n=$("home_type").options[$("home_type").selectedIndex].value;var f=$("list_class").value;var o="";if($("district")!=null){o=$("district").options[$("district").selectedIndex].value}var t=$("sqft-top").value;var u=$("sqft-bottom").value;var s=formatNumber($("lot-size").value/10,1,",",".","","","-","");var d=this.getTablePrefix();var r=new NumberFormat(l);r.setCurrency(true);var p=r.toFormatted();if(j<this.defaults.max_price){r=new NumberFormat(j);r.setCurrency(true);p+=" - "+r.toFormatted()}else{p+=" - Any"}var c=i.insertRow(0);this.appendSummaryCells("Price:&nbsp;",p,c,3);var a="Any";if(t>0&&t<this.defaults.max_sq_feet&&u==0){a="Less Than ".max_sq_feet}else{if(t==this.defaults.max_sq_feet&&u>0){a="More Than ".min_sq_feet}else{if(u>0&&t>0&&t<this.defaults.max_sq_feet){a=u+" - "+t}}}c=i.insertRow(1);this.appendSummaryCells("Square feet:&nbsp;",a,c,3);c=i.insertRow(2);this.appendSummaryCells("Bedrooms:&nbsp;",(e=="0")?"Any":e,c);this.appendSummaryCells("Baths:&nbsp;",(h=="0")?"Any":h,c);c=i.insertRow(3);this.appendSummaryCells("Garage Size:&nbsp;",(v=="0")?"Any":v+"+ cars",c);this.appendSummaryCells("Lot Size:&nbsp;",(s=="0")?"Any":s+"+ acres",c);c=i.insertRow(4);var k="";if(q==1){if(b==2010){k="Any"}else{k="before "+b}}else{k="after "+q;if(b!=2010){k+=" - before "+b}}this.appendSummaryCells("Year Built:&nbsp;",k,c,3);c=i.insertRow(5);this.appendSummaryCells("Home Type:&nbsp;",(n=="")?"Any":n,c,3);c=i.insertRow(6);this.appendSummaryCells("Property Type:&nbsp;",(f=="")?"Any":f,c,3);c=i.insertRow(7);this.appendSummaryCells("Search For:&nbsp;",$(d+"_name").value,c,3);var m=8;if($("district")!=null){c=i.insertRow(m);m++;this.appendSummaryCells("School Dist:&nbsp;",(o=="")?"Any":o,c,3)}if($("search_open_house")!=null&&$("search_open_house").checked){c=i.insertRow(m);this.appendSummaryCells("Open Houses:","true",c,3)}if($("search_pru_only")!=null&&$("search_pru_only").checked){c=i.insertRow(m);this.appendSummaryCells("Prudential Listings:","true",c,3)}if($("recent_listings")!=null&&$("recent_listings").checked){c=i.insertRow(m);this.appendSummaryCells("Recent Listings:","true",c,3)}return i}});function rem_quotes_slashes(a){if(a==null){return("")}if(a.charAt(0)=="\\"){return(a.substring(2,a.length-2))}return(a.substring(1,a.length-1))};