function trim(text){
	text = text.replace(/^\s+/, "");
	text = text.replace(/\s+$/, "");
	text = text.replace(/\s+/g, " ");
	return text;
}

function showHideSaleBuyQS(strVal){
	if(strVal == 'SALE'){
		document.getElementById('ps_search_sel_sale_qs').style.display = 'inline';
		document.getElementById('ps_search_sel_rent_qs').style.display = 'none';
	}else{
		document.getElementById('ps_search_sel_sale_qs').style.display = 'none';
		document.getElementById('ps_search_sel_rent_qs').style.display = 'inline';
	}
}

function showHideSaleBuy(strVal){
	if(strVal == 'SALE'){
		document.getElementById('ps_search_sel_sale').style.display = 'inline';
		document.getElementById('ps_search_sel_rent').style.display = 'none';
	}else{
		document.getElementById('ps_search_sel_sale').style.display = 'none';
		document.getElementById('ps_search_sel_rent').style.display = 'inline';
	}
}

function bookmarksite(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}

function RefreshImage(valImageId) {
	var objImage = document.images[valImageId];
	if (objImage == undefined) {
		return;
	}
	var now = new Date();
	objImage.src = objImage.src.split('?')[0] + '?x=' + now.toUTCString();
}

function transportMe(strID){
	new Effect.ScrollTo(strID, {offset: -24});
}

function loadRegions(intCountry){
	new Ajax.Updater('zone_loader_region', 'code/includes/members_regions_listbox.asp?country=' + intCountry + '&_r='+Math.random(), { method: 'get', 
		onComplete: function(transport, json){
			$("zone_loader_area").innerHTML = "<select name=\"frm_area\"><option value=\"0\">&nbsp;Select...</option></select>";
		}
	});
}

function loadAreas(intRegion){
	new Ajax.Updater('zone_loader_area', 'code/includes/members_areas_listbox.asp?region=' + intRegion + '&_r='+Math.random(), { method: 'get', 
		onComplete: function(transport, json){
			//
		}
	});
}

/* --------------------------------------------------------------------- */
function loadRegionsPS(intCountry){
	new Ajax.Updater('zone_loader_region_ps', 'code/includes/property_search_regions_listbox.asp?country=' + intCountry + '&_r='+Math.random(), { method: 'get', 
		onComplete: function(transport, json){
			$("zone_loader_area_ps").innerHTML = "<select name=\"area\" style=\"width:170px;\"><option value=\"0\">&nbsp;Any</option></select>";
		}
	});
}

function loadAreasPS(intRegion){
	new Ajax.Updater('zone_loader_area_ps', 'code/includes/property_search_areas_listbox.asp?region=' + intRegion + '&_r='+Math.random(), { method: 'get', 
		onComplete: function(transport, json){
			//
		}	
	});
}

/* --------------------------------------------------------------------- */
function loadRegionsQSTop(intCountry){
	new Ajax.Updater('zone_qs_top', 'code/includes/quick_search_regions_listbox.asp?country=' + intCountry + '&_r='+Math.random(), { method: 'get'});
}
function loadRegionsQSBottom(intCountry){
	new Ajax.Updater('zone_qs_bot', 'code/includes/quick_search_regions_listbox2.asp?country=' + intCountry + '&_r='+Math.random(), { method: 'get'});
}

function show_Control(strWhich){
	$("prop_picture_frame").style.display = "none";
	$("prop_map_frame").style.display = "none";
	$(strWhich).style.display = "block";
}
