var it_cb = function(it) {
	["sale", "letting"].each(function(t) {
		var button = $(t+"-button");
		button.src = "/images/search-"+t+"-button"+(t==it ? "-over" : "")+".gif";
	});
};

var gmaps_route = function() {
	if (!$F("postcode")) {
		alert("Please enter your address or postcode");
		$("postcode").focus();
		$("postcode").highlight();
		return;
	}
	var q = $F("postcode") + " to " + $F("branch_addr");
	window.open("http://maps.google.co.uk/maps?q="+escape(q), "");
};

(function() {
	if ($("staff-bios")) {
		$$("#bio-thumbnails img").each(function(el) {
			el.observe("click", function(ev) {
				var rev = el.getAttribute("rev");
				$$("#staff-bios .staff").invoke("hide");
				$$("#staff-bios ."+rev).invoke("show");
			});
		});
		var h = 0;
		$$("#bio-text div.staff").each(function(el) {
			var visible = el.visible();
			el.show();
			h = Math.max(h, el.getHeight());
			if (!visible) el.hide();
		});
		$("bio-text").style.height = h+"px";
	};
	if ($("tabs"))
		new Control.Tabs($("tabs"));

	$$("form.letting_search").each(function(el) {
		var bid = el.down("input[name=bid]");
		if ($F(bid) != "354")
			return;
		var area = el.down("input[name=ajax_location]");
		el.observe("submit", function() {
			if ($F(area) == "")
				bid.value = "379";
		});
	});	
}).onLoad();


