var AgentOfficeForm={init:function(){this.agentOfficesRadio=this.agentOfficeSwitch();
this.agentOfficesRadio.init();
prettycheckboxes.init($("input.openHousesFirst"))
},agentOfficeSwitch:function(){var agentOfficeSwitch={selected:"",onClick:function(){var element="#"+this.id;
var selected="#"+agentOfficeSwitch.selected;
$(selected).bind("click",agentOfficeSwitch.onClick);
$(selected).removeClass("selected");
agentOfficeSwitch.selected=this.id;
$(element).addClass("selected");
$(element).unbind();
(this.id=="agentSwitchRadio")?($("#formTypeOptionStringId input[type=hidden]").attr("value","Agent")):null;
(this.id=="officeSwitchRadio")?($("#formTypeOptionStringId input[type=hidden]").attr("value","Office")):null;
agentOfficeSwitch.onSwitch();
return false
},select:function(option){var selected="#"+this.selected;
$(selected).bind("click",agentOfficeSwitch.onClick);
$(selected).removeClass("selected");
if(option=="agent"){$("#formTypeOptionStringId input[type=hidden]").attr("value","Agent");
$("#agentSwitchRadio").addClass("selected");
$("div#agentOfficeSwitch span.selected").unbind("click");
this.selected="agentSwitchRadio"
}else{if(option=="office"){$("#formTypeOptionStringId input[type=hidden]").attr("value","Office");
$("#officeSwitchRadio").addClass("selected");
$("div#agentOfficeSwitch span.selected").unbind("click");
this.selected="officeSwitchRadio"
}}this.onSwitch()
},onSwitch:function(){if($("#formTypeOptionStringId input[type=hidden]").val()=="Agent"){$("div#agentMoreOptionsBtn").css("display","none");
$("div#homesearchAgentMoreOptions").css("display","none")
}else{$("div#agentMoreOptionsBtn").css("display","block")
}},init:function(){var selected=$("#formTypeOptionStringId input[type=hidden]").attr("value");
if(selected=="Agents"){$("#agentSwitchRadio").addClass("selected");
$("div#agentMoreOptionsBtn").css("display","none");
$("div#homesearchAgentMoreOptions").css("display","none")
}else{$("#officeSwitchRadio").addClass("selected");
$("div#agentMoreOptionsBtn").css("display","block")
}$("div#agentOfficeSwitch span").bind("click",this.onClick);
$("div#agentOfficeSwitch span.selected").unbind("click");
this.selected=$("div#agentOfficeSwitch span.selected").attr("id")
}};
return agentOfficeSwitch
},submitOnEnterPress:function(elements,callback){var execute=function(){};
if(callback!=false){execute=callback
}$(elements).bind("keyup",function(event){if(event.keyCode==13){execute()
}})
}};
