var findHomesBoxes=1;
function loadForm(c,e,a){var d=(new String(e).toLowerCase()=="yes")?true:false;
var b=new Ext.form.FieldSet({width:500,border:false,bodyBorder:false,autoHeight:true,items:[{layout:"form",border:false,items:[{layout:"column",border:false,items:[{columnWidth:0.6,layout:"form",items:[{layout:"form",id:"expandable",border:false,items:[new Ext.ux.LocationCombo({id:"locationCombo0",fieldLabel:"Find homes in",name:"location",hiddenName:"location",listWidth:180,maxHeight:200,anchor:"95%"}),{xtype:"textfield",id:"extrafield",labelSeparator:"",emptyText:"Add Multiple Locations",anchor:"95%",disabled:true}]},new Ext.ux.form.LovCombo({fieldLabel:"Property Type",name:"pType",hiddenName:"pType",hideOnSelect:false,triggerAction:"all",mode:"local",store:c.types,width:120,maxHeight:200}),{xtype:"combo",fieldLabel:"Bedrooms",name:"pBed",hiddenName:"pBed",store:[["[1 TO *]","1+"],["[2 TO *]","2+"],["[3 TO *]","3+"],["[4 TO *]","4+"],["[5 TO *]","5+"],["[6 TO *]","6+"],["[7 TO *]","7+"],["[8 TO *]","8+"],["[9 TO *]","9+"],["[10 TO *]","10+"]],displayField:"label",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,width:120,maxHeight:200},{xtype:"combo",fieldLabel:"Price From",name:"budgetMin",hiddenName:"budgetMin",store:getPriceOptions("No Minimum",d),displayField:"label",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,width:120,maxHeight:200},{xtype:"combo",fieldLabel:"Price To",name:"budgetMax",hiddenName:"budgetMax",store:getPriceOptions("No Maximum",d),displayField:"label",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,width:120,maxHeight:200},{xtype:"combo",fieldLabel:"Added to site",name:"addedToSite",hiddenName:"addedToSite",store:getAddedToSiteOptions(),displayField:"label",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,width:120,maxHeight:200}]},{columnWidth:0.4,layout:"form",id:"plusButtonColumn",items:[{xtype:"label",border:false,hideLabel:true,text:"e.g. PL2 or Plymouth"},{xtype:"spacer",height:10},{id:"plusButton",border:false,html:'<img class="thePlusBtn" onclick="addFindhomesBox(26)" src="images/common/add.gif" />'}]}]},{fieldLabel:"",boxLabel:d?"Include Let Agreed properties":"Include Under Offer, Sold STC and Reserved Properties",xtype:"checkbox",labelSeparator:"",inputValue:"true",name:"includeAllStatus",hiddenName:"includeAllStatus",id:"includeAllStatus"},{xtype:"spacer",height:20},{id:d?"toRentButton":"forSaleButton",border:false,html:'<fieldset class="btns"><input name="findhomeswaps" value="'+(d?"Find Homes":"Find Homes")+'" type="submit" onclick="return validation(this.form)" /></fieldset>'}]}]});
b.render(document.getElementById("formPlaceHolder"));
addExistingLocations(a,26)
}function addFindhomesBox(d){if(findHomesBoxes<10){var b=Ext.getCmp("expandable");
var c=Ext.getCmp("plusButtonColumn");
var a=new Ext.ux.LocationCombo({id:"locationCombo"+findHomesBoxes,name:"location",fieldLabel:"or",hiddenName:"location",listWidth:180,maxHeight:200,anchor:"95%"});
b.insert(findHomesBoxes,a);
c.insert(findHomesBoxes,{xtype:"spacer",height:d});
if(findHomesBoxes==9){Ext.getCmp("extrafield").hide();
Ext.getCmp("plusButton").hide()
}findHomesBoxes++;
b.doLayout();
c.doLayout()
}}function getPriceOptions(a,c){var b;
if(c){b=[[0,a],[100,"100 PCM"],[200,"200 PCM"],[300,"300 PCM"],[400,"400 PCM"],[500,"500 PCM"],[600,"600 PCM"],[700,"700 PCM"],[800,"800 PCM"],[900,"900 PCM"],[1000,"1,000 PCM"],[1250,"1,250 PCM"],[1500,"1,500 PCM"],[1750,"1,750 PCM"],[2000,"2,000 PCM"],[2500,"2,500 PCM"],[3000,"3,000 PCM"],[3500,"3,500 PCM"],[4000,"4,000 PCM"],[4500,"4,500 PCM"],[5000,"5,000 PCM"],[6000,"6,000 PCM"],[7000,"7,000 PCM"],[8000,"8,000 PCM"],[9000,"9,000 PCM"],[10000,"10,000 PCM"],[15000,"15,000 PCM"],[20000,"20,000 PCM"],[30000,"30,000 PCM"]]
}else{b=[[0,a],[50000,"50,000"],[60000,"60,000"],[70000,"70,000"],[80000,"80,000"],[90000,"90,000"],[100000,"100,000"],[110000,"110,000"],[120000,"120,000"],[125000,"125,000"],[130000,"130,000"],[140000,"140,000"],[150000,"150,000"],[160000,"160,000"],[170000,"170,000"],[175000,"175,000"],[180000,"180,000"],[185000,"185,000"],[190000,"190,000"],[200000,"200,000"],[210000,"210,000"],[220000,"220,000"],[230000,"230,000"],[240000,"240,000"],[250000,"250,000"],[260000,"260,000"],[270000,"270,000"],[280000,"280,000"],[290000,"290,000"],[300000,"300,000"],[325000,"325,000"],[350000,"350,000"],[375000,"375,000"],[400000,"400,000"],[425000,"425,000"],[450000,"450,000"],[475000,"475,000"],[500000,"500,000"],[550000,"550,000"],[600000,"650,000"],[700000,"700,000"],[800000,"800,000"],[900000,"900,000"],[1000000,"1,000,000"],[1500000,"1,500,000"],[2000000,"2,000,000"],[3000000,"3,000,000"],[5000000,"5,000,000"],[10000000,"10,000,000"]]
}return b
}function getAddedToSiteOptions(){var a=[["","Anytime"],[1,"Last 24 hours"],[3,"Last 3 days"],[7,"Last 7 days"],[14,"Last 14 days"]];
return a
}function loadSidebarForm(d,g,a,c,f){var e=(new String(g).toLowerCase()=="yes")?true:false;
var b=new Ext.form.FieldSet({border:false,bodyBorder:false,autoHeight:true,layout:"column",items:[{columnWidth:0.85,layout:"form",items:[{layout:"form",id:"expandable",border:false,labelAlign:"top",defaults:{labelStyle:"font-size: 80%; font-weight: bold;",anchor:"95%",hideLabel:true},items:[{xtype:"locationcombo",fieldLabel:"Find homes in",hideLabel:false,id:"locationCombo0",name:"location",hiddenName:"location",listWidth:180,maxHeight:200},{xtype:"textfield",fieldLabel:"e.g. PL2 or Plymouth",labelSeparator:"",hideLabel:false,id:"extrafield",emptyText:"Add Multiple Locations",disabled:true}]}]},{columnWidth:0.15,layout:"form",id:"plusButtonColumn",items:[{xtype:"spacer",height:65},{id:"plusButton",border:false,html:'<img class="thePlusBtn" onclick="addFindhomesBox(34)" src="images/common/add.gif" />'}]}]});
b.render(document.getElementById("formPlaceHolder"));
addExistingLocations(a,34)
}function addExistingLocations(b,d){for(var c=0;
c<b.length;
c++){if(c>0){addFindhomesBox(d)
}var a=Ext.getCmp("locationCombo"+c);
if(a!=null){a.setValue(b[c])
}}}function validation(a){if(a.location.value==""){alert("Please enter a location or postcode");
return false
}else{return true
}};