var buildTheSearch;
var whatYouWant;
var findHomesBoxes=1;
var helpdlg;
var loginClicked;
Ext.onReady(function(){configureForm()
});
function configureForm(){createForms();
whatYouWant=new Ext.form.FieldSet({layout:"form",renderTo:"searchForm",border:false,vertical:true,autoHeight:true,columnWidth:1,items:[buildTheSearch]});
var a=new Ext.FormPanel({layout:"form",autoHeight:true,items:[whatYouWant]})
}function addFindhomesBox(){var a=whatYouWant.findById("expandable");
var b=whatYouWant.findById("plusButtonColumn");
if(findHomesBoxes<10){existingEntries="findhomes"+findHomesBoxes+1;
newBox=new Ext.ux.LocationCombo({name:"location",fieldLabel:"or",hiddenName:"location",anchor:"95%",listWidth:250,maxHeight:200});
newSpacer=new Ext.ux.form.Spacer({height:26});
a.insert(findHomesBoxes,newBox);
b.insert(findHomesBoxes,newSpacer);
if(findHomesBoxes==9){var d=whatYouWant.findById("extrafield");
a.remove(d);
var c=whatYouWant.findById("plusButton");
c.hide()
}}findHomesBoxes++;
a.doLayout();
b.doLayout()
}function createForms(){theInputBoxAndLabel={layout:"form",defaultType:"label",id:"expandable",width:330,border:false,vertical:true,items:[new Ext.ux.LocationCombo({id:"thelocation",cls:"inputLabel",name:"location",anchor:"95%",fieldLabel:"Find homes in",hiddenName:"location",listWidth:250,maxHeight:200}),{cls:"inputDisabled",name:"extrafield",anchor:"95%",labelSeparator:"",xtype:"textfield",emptyText:"Add Multiple Locations",disabled:true},{cls:"searchHint",text:"e.g. `Plymouth`, `PL3`, `PL9 7LN` or `Devon`"}]};
thePlusButton={layout:"form",width:40,border:false,vertical:true,id:"plusButtonColumn",cls:"x-form-item thePlusButtonDiv",items:[new Ext.ux.form.Spacer({height:26}),{html:'<img class="thePlusBtn" onclick="addFindhomesBox()" src="images/common/add.gif" />',id:"plusButton",border:false,hideMode:"visibility"}]};
theSearchButton={layout:"column",columnWidth:1,autoWidth:true,border:false,vertical:true,cls:"x-form-item",items:[{columnWidth:0.5,html:'<div id="forsale" class="greenbtns left"><input class="greenrollover" name="forsale" value="For Sale" type="submit" /></div>',id:"forSaleButton",border:false,hideMode:"visibility"},{columnWidth:0.5,html:'<div id="torent" class="greenbtns left"><input class="greenrollover" name="torent" value="To Rent" type="submit" /></div>',id:"forSaleButton",border:false,hideMode:"visibility"}]};
buildTheSearch={layout:"column",border:false,items:[theInputBoxAndLabel,thePlusButton]}
};