// JavaScript Document
//custom
function rollListing(id,toggle,xCoord,yCoord){
	var thePop=document.getElementById("popup");
	var thePopHTML=document.getElementById("popHTML"+id).innerHTML;
	var mapMarker=document.getElementById("markerMap"+id);
	var listMarker=document.getElementById("markerList"+id);
	var listRow=document.getElementById("listRow"+id);
	var theMap=document.getElementById("map");

	if (toggle==1){
		mapMarker.src='/userFiles/pageGraphics/177/communities/maps/MarkerOver.png';
		listMarker.src='/userFiles/pageGraphics/177/communities/maps/MarkerOver.png';
		listRow.style.backgroundColor='#f4e3c6';
		thePop.style.left=(theMap.offsetLeft+xCoord+25)+'px';
		thePop.style.top=(theMap.offsetTop+yCoord-85)+'px';
		thePop.innerHTML=thePopHTML;
		thePop.style.display='block';
	}else{
		thePop.style.display='none';
		mapMarker.src='/userFiles/pageGraphics/177/communities/maps/Marker.png';
		listMarker.src='/userFiles/pageGraphics/177/communities/maps/Marker.png';
		if (listRow.className=='oddRow clearfix'){
			listRow.style.backgroundColor='#f0f1ed';
		}else{
			listRow.style.backgroundColor='#ffffff';
		}
	}
}

function loadDetail(url){
	window.location=url;
}

//utilities
function btn_overs(sel, newImage){
	var theImage=document.getElementById(sel);
	theImage.src=newImage;
}

//auto clear a text field when clicked
function clickclear(thisfield, defaulttext) {
	if (thisfield.value == defaulttext) {
		thisfield.value = "";
	}
}
//submit a start search form
function startSearchSubmit(){
	var ui=document.getElementById("startSearchInput").value;
	if (ui!='Enter neighborhood or MLS#'){
		if (ui == parseInt(ui)){
			window.location = '/'+ui;
		}else{
			window.location = '/properties/search#search/'+ui;
		}
	}
	return false;
}
//parse <body> onload functions
function loaders(jsonStrFns){
	for (t=0;t<jsonStrFns.length;t++){
		valueStr='';
		for (v=0;v<jsonStrFns[t][1].length;v++){
			valueStr+="'"+jsonStrFns[t][1][v]+"'";
			if (v!=jsonStrFns[t][1].length-1){valueStr+=",";}	
		}
		functionStr=jsonStrFns[t][0]+"("+valueStr+")";
		eval(functionStr);		
	}
}
//load flash in a div after page is loaded
function loadFlashInDiv(flash,theDiv){
	//alert (theDiv);
	var flash_width="100%";
	var flash_height="100%";
	var version='8,0,24,0';
	var str='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+version+'" width="'+flash_width+'" height="'+flash_height+'">';
	str+='<param name="movie" value="'+flash+'"><param name="quality" value="high"><param name="wmode" value="transparent"><param name="SCALE" value="noborder">';
	str+='<embed src="'+flash+'" width="'+flash_width+'" height="'+flash_height+'" wmode="transparent" scale="noborder" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed></object>';
	var theTarg=document.getElementById(theDiv);
	theTarg.innerHTML=str;
}
