function element(id){
	if(document.getElementById != null){
		return document.getElementById(id);
	}
	if(document.all != null){
		return document.all[id];
	}
	if(document.layers != null){
		return document.layers[id];
	}
	return null;
}

function searchJump(x,y){
	if(x == 'search'){
		element('qs_Arrow').style.display='';
		element('qj_Arrow').style.display='none';
	}
	else{
		element('qs_Arrow').style.display='none';
		element('qj_Arrow').style.display='';
	}
	element(x).style.display='';
	element(y).style.display='none';	
}

function gj2Agent(x){
	if(x != ''){
		window.location.href = 'agentlistings.php?agent='+x;
	}
}

function qj2Listing(x,y,z){
	if(!isNaN(x)){
		ret = x;
	}
	else if(!isNaN(y)){
		ret = y;
	}
	else if(!isNaN(z)){
		ret = z;
	}
	window.location.href = 'propertydetail.php?id='+ret;
}

function qSearchPrice(x,y){
	/*if(x == 'Price_From_M1'){
		opts = element('Price_Thru_M1').options;
		for(i=0;i<opts.length;i++){
			if(element('Price_Thru_M1').options[i].value > y){
				element('Price_Thru_M1').options[i].disabled = false;
			}
			else{
				element('Price_Thru_M1').options[i].disabled = true;
			}
		}
	}
	if(x == 'Price_Thru_M1'){
		opts = element('Price_From_M1').options;
		for(i=0;i<opts.length;i++){
			if(element('Price_From_M1').options[i].value < y){
				element('Price_From_M1').options[i].disabled = false;
			}
			else{
				element('Price_From_M1').options[i].disabled = true;
			}
		}
	}*/
}

function goLink(x){
	window.location.href = x;
}

function qjValid(x){
	if(x == 'resoption'){
		element('comoption').selectedIndex=0;
		element('landoption').selectedIndex=0;
	}
	else if(x == 'landoption'){
		element('resoption').selectedIndex=0;
		element('comoption').selectedIndex=0;
	}
	else if(x == 'comoption'){
		element('resoption').selectedIndex=0;
		element('landoption').selectedIndex=0;
	}
}

var orig = '';
var oheight;
function addImageSwap(x){
	if(orig == ''){
		orig = element('bigIMG').src;
		oheight = element('bigIMG').height;
	}
	element('bigIMG').src = x;
	element('bigIMG').height = oheight;
}

function addImageRestore(){
	element('bigIMG').src = orig;
}

function goImage(x){
	y = element('holderFrm').agent.value
	z = element('holderFrm').phone.value;
	imgHldr = new Image();
    imgHldr.src = x;
	url = "popimage.php?src="+x+"&agent="+y+":"+z;
	//w = imgHldr.width;
	//h = imgHldr.height;
	w = imgHldr.width + 15;
	h = imgHldr.height + 25;
	var f = "width="+w+",height="+h;
	 {
		i = window.open(url,"imageWindow",+f);
		i.blur();
		window.focus();
		i.resizeTo(w,h);
		i.moveTo(5,5);
	}
	i.focus();
}

var a=410;
var b=400;
var c = 100;
var d = 5;
var e = "Window";
var f = "width="+a+",height="+b;
var g = false;
function oFPUW(h) {
    {
		p = window.open(h,"PopUpWindow",+f);
		p.blur();
		window.focus();
		p.resizeTo(a,b);
		p.moveTo(c,d);
	}
	p.focus();
	if (g) {
		window.onunload = function() { p.close();
	}}
}

function MM_callJS(jsStr) {
  return eval(jsStr)
}

function sendMoreInfo(){
	oFPUW('requestHandler.php');
	element('moreInfo').submit();
}