/* SEARCH FUNCTIONS */
var win = null;

function CheckSimpleSearch(theForm){

	if (theForm.minprice && theForm.maxprice){
		if (!isNaN(theForm.minprice.value) && !isNaN(theForm.maxprice.value)){
			if (parseInt(theForm.minprice.value) >= parseInt(theForm.maxprice.value)){
				alert('Please select a maximum price higher than the minimum price selected');
				return false;
			}
		}
	}
	
	return true;
}



function RecalSimpleSearchPriceRanges(x, temp, temp2, group, group2){

		for (m=temp.options.length-1;m>0;m--){
			temp.options[m]=null
		}
		for (i=0;i<group[x].length;i++){
			temp.options[i]=new Option(group[x][i].text,group[x][i].value)
		}
		for (m=temp2.options.length-1;m>0;m--){
			temp2.options[m]=null
		}
		for (i=0;i<group2[x].length;i++){
			temp2.options[i]=new Option(group2[x][i].text,group2[x][i].value)
		}
		temp.options[0].selected=true;
		temp2.options[0].selected=true;
	}
	
	
function OpenWindow(url,name,features){

	window.open(url,name,features);
}


function NewWindow(mypage,myname,w,h,scroll){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
	win = window.open(mypage,myname,settings)
	if(win.window.focus){win.window.focus();}
}

function MM_openBrWindow(theURL,winName,features) { //v1.2
	window.open(theURL,winName,features);
}

function ToggleAdvancedSearch(){
	if (document.getElementById('pnl_AdvancedSearch').style.display == "block")
	{
		document.getElementById('pnl_AdvancedSearch').style.display = "none";
		document.arrow.src = "images/overseas/downArrow.gif";
	}	
	else
	{
		document.getElementById('pnl_AdvancedSearch').style.display = "block";
		document.arrow.src = "images/overseas/upArrow.gif";
	}
}

var conversionCounter = 0;
function ShowConversionRate(ifrom){
	var winConv = window.open('about:blank','conversionWindow','width=800px,height=435px,status=yes');

	document.frm_Conversion.Amount.value = ifrom;
	document.frm_Conversion.target = "conversionWindow";
	document.frm_Conversion.submit();
	
	//winConv.onload = new function () {
															//	conversionCounter += 1; 
															//	alert(conversionCounter);
																//conversionWindow.scrollTo(0,50);
															//}
	winConv.focus();
	//winConv.scrollTo(0,50);
	
}

		
function EstateWeb_Browser_IsMozilla(){
	return document.all ? false : true;
}

function EstateWeb_Request_QueryString(Val){
	var queryString = document.location.href;
	if ( queryString.indexOf("?") > 0 ){
		queryString = queryString.split("?");
		var items = queryString[1].split("&");
		for(i=0; i< items.length; i++){
			var item = items[i].split("=");
			if ( item[0].toUpperCase() == Val.toUpperCase() ) {
				return item[1];
			}
		}
	}
	return "";
}

function EstateWeb_Document_IsObject(ID){
	if ( document.getElementById(ID) ) { return true } else { return false }
}

function EstateWeb_Document_GetObject(ID){
	return document.getElementById(ID);
}