function submit_search() {
	if (document.getElementById('area').value=="0") {
		document.location = "search"+window.location.pathname+"#|area=point|km="+km+"|lat="+lat+"|long="+long+"|bedrooms="+document.getElementById('bedrooms').value+"|availible="+document.getElementById('available').value;
	} else {
		document.location = "search/"+document.getElementById('area').value+"#|bedrooms="+document.getElementById('bedrooms').value+"|availible="+document.getElementById('available').value;	
	}
}


function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}



function page_load() {
	if (readCookie('bedrooms')) {
		document.getElementById('bedrooms').value = readCookie('bedrooms');
	}
	
	if (readCookie('available')) {
		document.getElementById('available').value = readCookie('available');
	}
	
	if (readCookie('area') && document.getElementById("area").selectedIndex==0) {
		document.getElementById('area').value = readCookie('area');
	}
	if (document.getElementById('map')) {
		update_map();
	}
}
