
function save_state(){
	
	country_select = document.getElementById('country');	
	region_select = document.getElementById('region');
	currency_select = document.getElementById('currency');
	minPrice_select = document.getElementById('minPrice');
	maxPrice_select = document.getElementById('maxPrice');
	propertyType_select = document.getElementById('propertyType');
	//bedrooms_select = document.getElementById('bedrooms');
	
	SetCookie('country',country_select.options[country_select.selectedIndex].value);
	SetCookie('region', region_select.options[region_select.selectedIndex].value);
	SetCookie('currency',currency_select.options[currency_select.selectedIndex].value);
	SetCookie('minprice',minPrice_select.options[minPrice_select.selectedIndex].value);
	SetCookie('maxprice',maxPrice_select.options[maxPrice_select.selectedIndex].value);
	SetCookie('property',propertyType_select.options[propertyType_select.selectedIndex].value);
	//SetCookie('bedrooms',bedrooms_select.options[bedrooms_select.selectedIndex].value);
	$('searchForm').submit();
	
}

function getCookieVal (offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1) endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg) return getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	}
return null;
}

function SetCookie (name, value) {
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) +
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
	((path == null) ? "" : ("; path=" + path)) +
	((domain == null) ? "" : ("; domain=" + domain)) +
	((secure == true) ? "; secure" : "");
}

var status="err";