right_arrow_img=new Image();
right_arrow_img.src="http://re.naz360.com/images/right-arrow.png";
down_arrow_img=new Image();
down_arrow_img.src="http://re.naz360.com/images/down-arrow.png";

search_on_arrow_img=new Image();
search_on_arrow_img.src="http://re.naz360.com/images/search-on.png";
search_off_arrow_img=new Image();
search_off_arrow_img.src="http://re.naz360.com/images/search-off.png";

reset_on_arrow_img=new Image();
reset_on_arrow_img.src="http://re.naz360.com/images/reset-on.png";
reset_off_arrow_img=new Image();
reset_off_arrow_img.src="http://re.naz360.com/images/reset-off.png";

var feamap = "";
var map = "";
var panoClient = "";

function loadContent(file) {
	var head = document.getElementsByTagName("head").item(0);
	var scriptTag = document.getElementById("loadScript");
	if(scriptTag) { head.removeChild(scriptTag); }
	script = document.createElement("script");
	script.src = file;
	script.type = "text/javascript";
	script.id = "loadScript";
	head.appendChild(script);
}
function resetValues() {
	fillForm("price_min","price_max","","");
	chkValOff(document.getElementById("price_min"),"price_num","price_min","price_max","min",1,"$");
	chkValOff(document.getElementById("price_max"),"price_num","price_min","price_max","max",1,"$");

	fillForm("bedroom_min","bedroom_max","","");
	chkValOff(document.getElementById("bedroom_min"),"bedroom_num","bedroom_min","bedroom_max","min",0,"");
	chkValOff(document.getElementById("bedroom_max"),"bedroom_num","bedroom_min","bedroom_max","max",0,"");

	fillForm("bathroom_min","bathroom_max","","");
	chkValOff(document.getElementById("bathroom_min"),"bathroom_num","bathroom_min","bathroom_max","min",0,"");
	chkValOff(document.getElementById("bathroom_max"),"bathroom_num","bathroom_min","bathroom_max","max",0,"");

	fillForm("size_min","size_max","","");
	chkValOff(document.getElementById("size_min"),"size_num","size_min","size_max","min",1,"");
	chkValOff(document.getElementById("size_max"),"size_num","size_min","size_max","max",1,"");

	fillForm("lot_min","lot_max","","");
	chkValOff(document.getElementById("lot_min"),"lot_num","lot_min","lot_max","min",1,"");
	chkValOff(document.getElementById("lot_max"),"lot_num","lot_min","lot_max","max",1,"");

	document.getElementById("type_name").selectedIndex = 0;
	regionChange(document.getElementById("region"));

	document.getElementById("region").selectedIndex = 0;
	regionChange(document.getElementById("region"));

	document.getElementById("type_name").selectedIndex = 0;
	typeChange(document.getElementById("type_name"),"type_num");

	closeAll("");
	openMain("featured");
	countPreview();
}
function chkValOn(obj) {
	if(obj.value == "min") { obj.value = ""; };
	if(obj.value == "max") { obj.value = ""; };
}
function chkValOff(obj,chgnum,chgmin,chgmax,orig,nl,symbol) {
  	chgnumobj = document.getElementById(chgnum);
  	chgminobj = document.getElementById(chgmin);
  	chgmaxobj = document.getElementById(chgmax);

  	if (chgminobj.value == "min") { min_value = ""; }
  	else { min_value = chgminobj.value; }

  	if (chgmaxobj.value == "max") { max_value = ""; }
  	else { max_value = chgmaxobj.value; }

  	if (nl == 1) { chgnumobj.innerHTML = "<br>&nbsp;" + symbol + min_value + " to " + symbol + max_value; }
  	else { chgnumobj.innerHTML = symbol + min_value + " to " + symbol + max_value; }

  	if (chgminobj.value == "min") { if (chgmaxobj.value == "max") { chgnumobj.innerHTML = "Any"; } }
	if (chgminobj.value == "")    { if (chgmaxobj.value == "")    { chgnumobj.innerHTML = "Any"; } }
}
function showHide(theHidden, theArrow) {
	var obj  = document.getElementById(theHidden);
	var obj2 = document.getElementById(theArrow);
	if(obj.style.display=="block"){
		obj.style.display="none";
		obj2.src=right_arrow_img.src;
	}else{
		obj.style.display="block";
		obj2.src=down_arrow_img.src;
	}
}
function typeChange(obj,obj2) {
	document.getElementById(obj2).innerHTML = obj.value;
}
function fillForm(form1,form2,value1,value2) {
	obj1 = document.getElementById(form1);
	obj2 = document.getElementById(form2);

	obj1.value = value1;
	obj2.value = value2;
}
function closeAll(keepOpen) {
	if (keepOpen != "type")     {
		document.getElementById("type_hide").style.display="none";
		document.getElementById("type_arrow").src=right_arrow_img.src;
	}
	if (keepOpen != "price")    {
		document.getElementById("price_hide").style.display="none";
		document.getElementById("price_arrow").src=right_arrow_img.src;
	}
	if (keepOpen != "bedroom")  {
		document.getElementById("bedroom_hide").style.display="none";
		document.getElementById("bedroom_arrow").src=right_arrow_img.src;
	}
	if (keepOpen != "bathroom") {
		document.getElementById("bathroom_hide").style.display="none";
		document.getElementById("bathroom_arrow").src=right_arrow_img.src;
	}
	if (keepOpen != "size")     {
		document.getElementById("size_hide").style.display="none";
		document.getElementById("size_arrow").src=right_arrow_img.src;
	}
	if (keepOpen != "lot")      {
		 document.getElementById("lot_hide").style.display="none";
		 document.getElementById("lot_arrow").src=right_arrow_img.src;
	}
	if (keepOpen != "region")      {
		 document.getElementById("region_hide").style.display="none";
		 document.getElementById("region_arrow").src=right_arrow_img.src;
	}
}
function openMain(openWin) {
	document.getElementById("featured").style.display="none";
	document.getElementById("summary").style.display="none";
	document.getElementById("detail").style.display="none";
	document.getElementById("saved").style.display="none";

	if (openWin == "featured") { document.getElementById("featured").style.display=""; }
	if (openWin == "summary")  { document.getElementById("summary").style.display=""; }
	if (openWin == "detail")   { document.getElementById("detail").style.display=""; }
	if (openWin == "saved")    { document.getElementById("saved").style.display=""; }
}
function backToSearch() {
	openMain("summary");
}
function regionChange(selectObj) {
	if (selectObj.value == "")                 { $region_short = "Any" };
	if (selectObj.value == "North West City")  { $region_short = "NW City" };
	if (selectObj.value == "South West City")  { $region_short = "SW City" };
	if (selectObj.value == "South East City")  { $region_short = "SE City" };
	if (selectObj.value == "North East City")  { $region_short = "NE City" };
	if (selectObj.value == "East Rural")       { $region_short = "E Rural" };
	if (selectObj.value == "North West Rural") { $region_short = "NW Rural" };
	if (selectObj.value == "South Rural")      { $region_short = "S Rural" };
	if (selectObj.value == "West Rural")       { $region_short = "W Rural" };
	if (selectObj.value == "Williams Area")    { $region_short = "Williams" };
	if (selectObj.value == "Other Area")       { $region_short = "Other" };

	document.getElementById("region_num").innerHTML = $region_short;
}
function countPreview() {
	queryStr = "";
	queryStr = queryStr + "type="+document.getElementById("type_name").value+"&";
	queryStr = queryStr + "region="+document.getElementById("region").value+"&";
	queryStr = queryStr + "price_min="+document.getElementById("price_min").value+"&";
	queryStr = queryStr + "price_max="+document.getElementById("price_max").value+"&";
	queryStr = queryStr + "bedroom_min="+document.getElementById("bedroom_min").value+"&";
	queryStr = queryStr + "bedroom_max="+document.getElementById("bedroom_max").value+"&";
	queryStr = queryStr + "bathroom_min="+document.getElementById("bathroom_min").value+"&";
	queryStr = queryStr + "bathroom_max="+document.getElementById("bathroom_max").value+"&";
	queryStr = queryStr + "size_min="+document.getElementById("size_min").value+"&";
	queryStr = queryStr + "size_max="+document.getElementById("size_max").value+"&";
	queryStr = queryStr + "lot_min="+document.getElementById("lot_min").value+"&";
	queryStr = queryStr + "lot_max="+document.getElementById("lot_max").value;

	document.getElementById("prop_count").innerHTML = "--";
	loadContent("http://re.naz360.com/w1/index.php?action=countPreview&"+queryStr);
}
function searchMLS() {
	queryStr = "";
	queryStr = queryStr + "type="+document.getElementById("type_name").value+"&";
	queryStr = queryStr + "region="+document.getElementById("region").value+"&";
	queryStr = queryStr + "price_min="+document.getElementById("price_min").value+"&";
	queryStr = queryStr + "price_max="+document.getElementById("price_max").value+"&";
	queryStr = queryStr + "bedroom_min="+document.getElementById("bedroom_min").value+"&";
	queryStr = queryStr + "bedroom_max="+document.getElementById("bedroom_max").value+"&";
	queryStr = queryStr + "bathroom_min="+document.getElementById("bathroom_min").value+"&";
	queryStr = queryStr + "bathroom_max="+document.getElementById("bathroom_max").value+"&";
	queryStr = queryStr + "size_min="+document.getElementById("size_min").value+"&";
	queryStr = queryStr + "size_max="+document.getElementById("size_max").value+"&";
	queryStr = queryStr + "lot_min="+document.getElementById("lot_min").value+"&";
	queryStr = queryStr + "lot_max="+document.getElementById("lot_max").value;

	document.getElementById("summary").innerHTML = "<center><b><br><br><img src=\"http://re.naz360.com/images/loading.gif\">LOADING<img src=\"http://re.naz360.com/images/loading.gif\"><br>PLEASE WAIT<br></b></center>";
	loadContent("http://re.naz360.com/w1/index.php?action=search&"+queryStr);
}
function searchMLSPage(queryStr) {
	new_obj = getAnchorPosition("mlstop");
	window.scrollTo((new_obj.x),(new_obj.y-50));
	document.getElementById("summary").innerHTML = "<center><b><br><br><img src=\"http://re.naz360.com/images/loading.gif\">LOADING<img src=\"http://re.naz360.com/images/loading.gif\"><br>PLEASE WAIT<br></b></center>";
	loadContent("http://re.naz360.com/w1/index.php?action=search&"+queryStr);
}
function detail(mlsnum,source,src) {
	openMain("detail");
	new_obj = getAnchorPosition("mlstop");
	window.scrollTo((new_obj.x),(new_obj.y-50));
	document.getElementById("detail").innerHTML = "<center><b><br><br><img src=\"http://re.naz360.com/images/loading.gif\">LOADING<img src=\"http://re.naz360.com/images/loading.gif\"><br>PLEASE WAIT<br></b></center>";
	loadContent("http://re.naz360.com/w1/index.php?action=detail&MLNumber="+mlsnum+"&source="+source+"&MLS_src="+src+"&saved_mls="+document.getElementById("savedmls").value);
}
function featured() {
	openMain("featured");
	new_obj = getAnchorPosition("mlstop");
	window.scrollTo((new_obj.x),(new_obj.y-50));
	document.getElementById("featured").innerHTML = "<center><b><br><br><img src=\"http://re.naz360.com/images/loading.gif\">LOADING<img src=\"http://re.naz360.com/images/loading.gif\"><br>PLEASE WAIT<br></b></center>";
	loadContent("http://re.naz360.com/w1/index.php?action=featured");
}
function requestShowing(mls,fea) {
	document.getElementById("request_"+mls+fea).style.display = "";
}
function closeRequestShowing(mls,fea) {
	document.getElementById("request_"+mls+fea).style.display = "none";
}
function sendRequestShowing(mls,mlsid,officemlsid,fea) {
	queryStr = "";
	queryStr = queryStr + "MLNumber="+mls+"&";
	queryStr = queryStr + "MLSID="+mlsid+"&";
	queryStr = queryStr + "OfficeMLSID="+officemlsid+"&";
	queryStr = queryStr + "feature="+fea+"&";
	queryStr = queryStr + "firstname="+document.getElementById("firstname_"+mls+fea).value+"&";
	queryStr = queryStr + "lastname="+document.getElementById("lastname_"+mls+fea).value+"&";
	queryStr = queryStr + "email="+document.getElementById("email_"+mls+fea).value+"&";
	queryStr = queryStr + "phone="+document.getElementById("phone_"+mls+fea).value+"&";
	queryStr = queryStr + "comments="+document.getElementById("comments_"+mls+fea).value;
	//alert(queryStr);
	loadContent("http://re.naz360.com/w1/index.php?action=requestShowing&"+queryStr);
}
function saveListing(mlsnum,fea) {
	if (document.getElementById("savedmls").value != null) {
		var arrSaved = document.getElementById("savedmls").value.split(",");
	} else { var arrSaved = ""; }
	found = 0;
	for (x in arrSaved) {if (arrSaved[x] == mlsnum) { found = 1;}}
	if (found == 0) {document.getElementById("savedmls").value = document.getElementById("savedmls").value + mlsnum + ",";}

	document.getElementById("savedCount").innerHTML	= countSaved();
	document.getElementById("removeListing_"+mlsnum+fea).style.display = "";
	document.getElementById("saveListing_"+mlsnum+fea).style.display   = "none";
	loadContent("http://re.naz360.com/w1/index.php?action=saveListings&MLNumber="+mlsnum+"&type="+type+"&feature="+fea);
}
function removeListing(mlsnum,fea) {
	if (document.getElementById("savedmls").value != null) {
		var arrSaved = document.getElementById("savedmls").value.split(",");
	} else { var arrSaved = ""; }
	document.getElementById("savedmls").value = "";
	for (x in arrSaved) {
		if (arrSaved[x] != mlsnum && arrSaved[x] != "") {
			document.getElementById("savedmls").value = document.getElementById("savedmls").value + arrSaved[x] + ",";
		}
	}
	document.getElementById("savedCount").innerHTML	= countSaved();
	document.getElementById("removeListing_"+mlsnum+fea).style.display = "none";
	document.getElementById("saveListing_"+mlsnum+fea).style.display   = "";
	loadContent("http://re.naz360.com/w1/index.php?action=removeListing&MLNumber="+mlsnum+"&feature="+fea);
}
function countSaved() {
	if (document.getElementById("savedmls").value != null) {
		var arrSaved = document.getElementById("savedmls").value.split(",");
		return arrSaved.length-1;
	} else { return 0; }
}
function findSaved(mlsnum,fea) {
	if (document.getElementById("savedmls").value != null) {
		var arrSaved = document.getElementById("savedmls").value.split(",");
	} else { var arrSaved = ""; }
	found = 0;
	for (x in arrSaved) {if (arrSaved[x] == mlsnum) { found = 1;}}
	if (found == 1) {
		document.getElementById("savedCount").innerHTML	= countSaved();
		document.getElementById("removeListing_"+mlsnum+fea).style.display = "";
		document.getElementById("saveListing_"+mlsnum+fea).style.display = "none";
	}
}
function viewSaved() {
	document.getElementById("saved").innerHTML = "<center><b><br><br><img src=\"http://re.naz360.com/images/loading.gif\">LOADING<img src=\"http://re.naz360.com/images/loading.gif\"><br>PLEASE WAIT<br></b></center>";
	openMain("saved");
	loadContent("http://re.naz360.com/w1/index.php?action=viewSaved&saved_mls="+document.getElementById("savedmls").value);
}
function showMoreDetails(mls,fea) {
	long  = "mls_desc_long_"+mls;
	short = "mls_desc_short_"+mls;
	document.getElementById("mls_desc_short_"+mls+fea).style.display = "none";
	document.getElementById("mls_desc_long_"+mls+fea).style.display  = "";
}
function hideMoreDetails(mls,fea) {
	long  = "mls_desc_long_"+mls+fea;
	short = "mls_desc_short_"+mls+fea;
	document.getElementById("mls_desc_short_"+mls+fea).style.display = "";
	document.getElementById("mls_desc_long_"+mls+fea).style.display  = "none";
}
function getURLVarMLS(urlVarName) {
	var urlHalves = String(document.location).split("?");
	var urlVarValue = "";
	if(urlHalves[1]){
		var urlVars = urlHalves[1].split("&");
		for(i=0; i<=(urlVars.length); i++){
			if(urlVars[i]){
			var urlVarPair = urlVars[i].split("=");
				if (urlVarPair[0] && urlVarPair[0] == urlVarName) { urlVarValue = urlVarPair[1]; }
			}
		}
	}
	return urlVarValue;
}
function showMap(mls,fea) {
	document.getElementById("main_map_"+mls+fea).style.display="";
	document.getElementById("main_details_"+mls+fea).style.display="none";
	document.getElementById("main_pano_"+mls+fea).style.display="none";
}
function showPano(mls,fea) {
	document.getElementById("main_map_"+mls+fea).style.display="none";
	document.getElementById("main_details_"+mls+fea).style.display="none";
	document.getElementById("main_pano_"+mls+fea).style.display="";
}
function showDetails(mls,fea) {
	document.getElementById("main_map_"+mls+fea).style.display="none";
	document.getElementById("main_details_"+mls+fea).style.display="";
	document.getElementById("main_pano_"+mls+fea).style.display="none";
}
function chgcolor(obj,color) {
	obj.style.backgroundColor = color;
}
function chgcolortext(obj,color) {
	obj.style.color = color;
}
function loadPano(lat,lng,mls,fea) {
	var map_POV = {yaw:370.64659986187695,pitch:-20};
	panoClient = new GStreetviewClient();
	myPano = new GStreetviewPanorama(document.getElementById("pano_"+mls+fea));
	myPano.setLocationAndPOV(new GLatLng(lat,lng), map_POV);
	GEvent.addListener(myPano, "error", handleNoFlash);
	panoClient.getNearestPanorama(new GLatLng(lat,lng), function(panoData) {
		if (panoData.code != 200) {
			document.getElementById("details_two_tabs_"+mls+fea).style.display="";
			document.getElementById("details_three_tabs_"+mls+fea).style.display="none";
			return;
		}
		document.getElementById("details_two_tabs_"+mls+fea).style.display="none";
		document.getElementById("details_three_tabs_"+mls+fea).style.display="";
		myPano.setLocationAndPOV(panoData.location.latlng);
	});
}
function loadMap(lat,lng,mls,fea) {
	map = new GMap2(document.getElementById("gmap_"+mls+fea));
	map.setCenter(new GLatLng(lat, lng), 15);
	//var point = new GLatLng(lat,lng);
	//map.addOverlay(new GMarker(point));

	GEvent.addListener(map, "moveend", function() {
		getMapData(mls);
	});

	var label = new ELabel(new GLatLng(lat,lng), mls, "style1",new GSize(-30,-3), 70);
	map.addOverlay(label);
	getMapData(mls);

	loadPano(lat,lng,mls,fea);
}
function getMapData(mls) {
	var bounds = map.getBounds();
        var southWest = bounds.getSouthWest();
        var northEast = bounds.getNorthEast();
	loadContent("http://re.naz360.com/w1/index.php?action=getMapData&mls="+mls+"&SWlat="+southWest.lat()+"&SWlng="+southWest.lng()+"&NElat="+northEast.lat()+"&NElng="+northEast.lng());
}
// *********************************************************
// KEEP AT BOTTOM ******************************************
function mlsURLvar() {
	if (getURLVarMLS("mls") != "") {
		if (getURLVarMLS("mls_src") != "") {
			detail(getURLVarMLS("mls"),"detail",getURLVarMLS("mls_src"));
		} else {
			detail(getURLVarMLS("mls"),"detail","unknown");
		}
	} else {
		featured();
	}
}
function loadelabel() {
	file = "http://re.naz360.com/w1/js/elabel.js";
	var head = document.getElementsByTagName("head").item(0);
	var scriptTag = document.getElementById("elabel");
	if(scriptTag) { head.removeChild(scriptTag); }
	script = document.createElement("script");
	script.src = file;
	script.type = "text/javascript";
	script.id = "elabel";
	head.appendChild(script);
}

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != "function") {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) { oldonload(); }
			func();
		}
	}
}
addLoadEvent(mlsURLvar);
addLoadEvent(loadelabel);
var _atu="undefined",_euc=encodeURIComponent,_atc={samp:0.05,addr:-1};if(typeof(addthis_conf)===_atu){var addthis_conf={};}
for(i in addthis_conf){_atc[i]=addthis_conf[i];}
if(typeof(_ate)===_atu){var _ate={ab:"-",clck:1,show:1,samp:_atc.samp-Math.random(),scnt:1,seqn:1,inst:1,wait:500,tmot:null,cvt:[],svt:[],sttm:new Date().getTime(),max:268435455,pix:"tev",sid:0,sub:typeof(at_sub)!==_atu,uid:null,wid:"AT-"+(typeof(addthis_pub)!==_atu?_euc(addthis_pub):"unknown"),swf:"http://bin.clearspring.com/at/v/1/button1.swf",evu:"http://e1.clearspring.com/at/",mun:function(s){var mv=291;for(var i=0;i<s.length;i++){mv=(mv*(s.charCodeAt(i)+i)+3)&1048575;}
return(mv&16777215).toString(32);},off:function(){return Math.floor((new Date().getTime()-_ate.sttm)/100).toString(16);},ran:function(){return Math.floor(Math.random()*4294967295).toString(36);},img:function(i,a){if(typeof(at_sub)===_atu){new Image().src="http://s7.addthis.com/cs/1/"+i+".png?"+_ate.ran()+"=1&"+(a||"");}},cuid:function(){return(_ate.sttm&_ate.max).toString(16)+(Math.floor(Math.random()*_ate.max)).toString(16);},ssid:function(){if(_ate.sid===0){_ate.sid=_ate.cuid();}
return _ate.sid;},sev:function(id,_7){_ate.pix="sev-"+(typeof(id)!=="number"?_euc(id):id);_ate.svt.push(id+";"+_ate.off());if(_7===1){_ate.xmi(true);}else{_ate.sxm(true);}},cev:function(k,v){_ate.pix="cev-"+_euc(k);_ate.cvt.push(_euc(k)+"="+_euc(v)+";"+_ate.off());_ate.sxm(true);},sxm:function(b){if(_ate.tmot!==null){clearTimeout(_ate.tmot);}
if(b){_ate.tmot=_ate.sto("_ate.xmi(false)",_ate.wait);}},sto:function(c,t){return setTimeout(c,t);},sta:function(){var a=_ate;return a.wid+"/-/"+a.ab+"/"+a.ssid()+"/"+(a.seqn++)+(a.uid!==null?"/"+a.uid:"");},xmi:function(_e){var a=_ate;if(!a.uid){a.dck("X"+a.cuid());}
if(a.cvt.length+a.svt.length>0){a.sxm(false);if(a.seqn===1){a.cev("pin",a.inst);}
var url=a.evu+a.pix+"-"+a.ran()+".png?ev="+_ate.sta()+"&se="+a.svt.join(",")+"&ce="+a.cvt.join(",");a.cvt=[];a.svt=[];if(_e){var d=document,i=d.createElement("iframe");i.id="_atf";i.src=url;_ate.opp(i.style);d.body.appendChild(i);i=d.getElementById("_atf");}else{new Image().src=url;}}},opp:function(st){st.width="1px";st.height="1px";st.position="absolute";st.zIndex=100000;},lod:function(){var a=_ate;if(a.samp>=0&&!a.sub){a.sev("20");a.cev("plo",1/_atc.samp);}
var d=document,n=navigator,u=n.userAgent.toLowerCase(),b={msi:/msie/.test(u)&&!(/opera/.test(u))};if(!_atc.noswf&&a.uid==null&&a.swf!==null){var _19=function(o,n,v){var c=d.createElement("param");c.name=n;c.value=v;o.appendChild(c);};var ato=d.createElement("object");a.opp(ato.style);ato.id="_atff";if(b.msi){ato.classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";_19(ato,"movie",a.swf);}else{ato.data=a.swf;ato.quality="high";ato.type="application/x-shockwave-flash";}
_19(ato,"wmode","transparent");_19(ato,"allowScriptAccess","always");d.body.insertBefore(ato,d.body.firstChild);if(b.msi){ato.outerHTML+=" ";}}},unl:function(){var a=_ate;if(a.samp>=0&&!a.sub){a.sev("21",1);a.cev("pun",1/_atc.samp);}
return true;},dck:function(c){_ate.uid=c;document.cookie="_csuid="+c+"; expires=Wed, 04 Oct 2028 03:19:53 GMT; path=/";},asetup:function(x){var a=_ate;try{if(x!==null&&x!==_atu){a.dck(x);}}
catch(e){}
return x;}};(function(){var a=_ate,d=document,w=window,wa=w.addEventListener,we=w.attachEvent;if(wa){wa("load",a.lod,false);wa("unload",a.unl,false);}else{if(we){we("onload",a.lod);we("onunload",a.unl);}else{w.onload=a.lod;w.onunload=a.unl;}}
var ck=d.cookie.split(";");for(var i=0;i<ck.length;i++){var c=ck[i];var x=c.indexOf("_csuid=");if(x>=0){_ate.uid=c.substring(x+7);}}})();}else{_ate.inst++;}
if(typeof _atw===_atu){var _atw={addr:_atc.addr-Math.random(),addt:_atc.addt>=0?_atc.addt:Math.floor(4*Math.random()),host:"http://s7.addthis.com/",serv:"http://s7.addthis.com/services/",path:"http://s7.addthis.com/select/",list:{"ask":["Ask"],"delicious":["Del.icio.us"],"digg":["Digg"],"email":["Email"],"favorites":["Favorites"],"facebook":["Facebook"],"fark":["Fark"],"furl":["Furl"],"google":["Google"],"live":["Live"],"myspace":["MySpace"],"myweb":["Yahoo MyWeb","yahoo-myweb"],"newsvine":["Newsvine"],"reddit":["Reddit"],"sk*rt":["Sk*rt","skrt"],"slashdot":["Slashdot"],"stumbleupon":["StumbleUpon","su"],"stylehive":["Stylehive"],"tailrank":["Tailrank","tailrank2"],"technorati":["Technorati"],"thisnext":["ThisNext"],"twitter":["Twitter"],"ballhype":["BallHype"],"yardbarker":["Yardbarker"],"kaboodle":["Kaboodle"],"more":["More ..."]},div:null,pub:(typeof(addthis_pub)!==_atu?_euc(addthis_pub):""),get:function(id){return document.getElementById(id);},xwa:function(){if(_atw.cwa!==null){clearTimeout(_atw.cwa);}},cwa:null,ost:false,did:"addthis_dropdown15",sli:function(_2d){for(var i=0;i<_atw.sin.length;i++){var sio=_atw.sin[i];if(sio.pos>=sio.end){_atw.sin.splice(i,1);}else{sio.pos+=sio.inc;sio.obj.style.height=sio.pos+"px";}}
if(_atw.sin.length>0){_ate.sto("_atw.sli("+_2d+")",_2d);}},sla:function(obj,end,_32,inc,_34){_atw.sin.push({"obj":obj,"pos":0,"end":end,"inc":inc});_ate.sto("_atw.sli("+_32+")",_34);},sin:[],clo:function(){var _35=_atw.get(_atw.did);if(_35){_35.style.display="none";}
var e=document.getElementsByTagName("embed");if(e&&addthis_hide_embed){for(i=0;i<e.length;i++){if(e[i].addthis_hidden){e[i].style.visibility="visible";}}}
return false;},cof:function(obj){obj.style.color="#000000";if(obj.value==" email address"){obj.value="";}},sho:function(_38){var _39=_atw.get("at_share"),_3a=_atw.get("at_email"),_3b=_atw.get("at_caption"),_3c=_atw.get("at_success");_39.style.display="none";_3a.style.display="none";_3c.innerHTML="";if(_38=="share"||_38==""){_39.style.display="block";_3b.innerHTML=addthis_caption_share;if(_ate.show-->0){_ate.sev("40");_ate.cev("sho","share");}}else{_3a.style.display="block";_3b.innerHTML=addthis_caption_email;if(_ate.show-->0){_ate.sev("40");_ate.cev("sho","email");}}},uadd:function(svc){return"pub="+_atw.pub+"&s="+svc+"&url="+_euc(addthis_url)+"&title="+_euc(addthis_title)+"&logo="+_euc(addthis_logo)+"&logobg="+addthis_logo_background+"&logocolor="+addthis_logo_color+"&ate="+_ate.sta()+"&adt="+_atw.addt;},genurl:function(svc){return"http://www.addthis.com/bookmark.php?v=15&winname=addthis&"+_atw.uadd(svc);},cumpos:function(a){var b=0,c=0;do{b+=a.offsetTop||0;c+=a.offsetLeft||0;a=a.offsetParent;}while(a);return[c,b];},wsize:function(){var w=window,d=document,de=d.documentElement,db=d.body;if(typeof(w.innerWidth)=="number"){return[w.innerWidth,w.innerHeight];}else{if(de&&(de.clientWidth||de.clientHeight)){return[de.clientWidth,de.clientHeight];}else{if(db&&(db.clientWidth||db.clientHeight)){return[db.clientWidth,db.clientHeight];}else{return[0,0];}}}},spos:function(){var w=window,d=document,de=d.documentElement,db=d.body;if(typeof(w.pageYOffset)=="number"){return[w.pageXOffset,w.pageYOffset];}else{if(db&&(db.scrollLeft||db.scrollTop)){return[db.scrollLeft,db.scrollTop];}else{if(de&&(de.scrollLeft||de.scrollTop)){return[de.scrollLeft,de.scrollTop];}else{return[0,0];}}}}};function addthis_open(elt,_4b,_4c,_4d){var d=document;if(_atw.div){d.body.insertBefore(_atw.div,d.body.firstChild);_atw.div.style.zIndex=1000000;_atw.div=null;}
_atw.xwa();addthis_url=_4c;addthis_title=_4d;if(addthis_url===""||addthis_url==="[URL]"){addthis_url=location.href;}
if(addthis_title===""||addthis_title==="[TITLE]"){addthis_title=d.title;}
var _4f=16;var _50=elt.getElementsByTagName("img");if(_50&&_50[0]){elt=_50[0];_4f=0;}
_atw.sho(_4b);var _51=_atw.cumpos(elt),_52=_51[0]+addthis_offset_left,_53=_51[1]+_4f+1+addthis_offset_top,_54=_atw.wsize(),_55=_atw.spos(),_56=_atw.get(_atw.did),_57=_56.style,dir=0;_57.display="block";var _59=_56.clientWidth,_5a=_56.clientHeight;if(_52-_55[0]+_59+20>_54[0]){_52=_52-_59+50;dir++;}
if(_53-_55[1]+_5a+elt.clientHeight+20>_54[1]){_53=_53-_5a-20;dir+=2;}
_ate.cev("dir",dir);_57.left=_52+"px";_57.top=(_53+elt.clientHeight)+"px";if(addthis_hide_embed){var _5b=_52+_59,_5c=_53+_5a,e=d.getElementsByTagName("embed"),_5e=0,_5f=0,_60=0;for(i=0;i<e.length;i++){_5e=_atw.cumpos(e[i]);_5f=_5e[0];_60=_5e[1];if(_52<_5f+e[i].clientWidth&&_53<_60+e[i].clientHeight){if(_5b>_5f&&_5c>_60){if(e[i].style.visibility!="hidden"){e[i].addthis_hidden=true;e[i].style.visibility="hidden";}}}}}
if(!_atw.ost){if(_atw.addr>=0){_ate.ab=_atw.addt;var nl=2;switch(_ate.ab){case 3:nl=65;break;}
var _62=nl,pxl=_62*23,atf=_atw.get("at_plus");if(_62>3){pxl=_62;}
if(_62>250){_56.style.width="310px";}else{if(_62>50&&_62<100){_56.style.width="240px";}}
atf.src="http://www.addthis.com/ads.php?r="+_ate.ran()+"&url="+_euc(addthis_url)+"&ate="+_ate.sta()+"&adt="+_atw.addt+"&pub="+_atw.pub+"&lnz="+_62;switch(_ate.ab){case 0:_atw.sla(atf,pxl,5,pxl/16,2000);break;case 1:_atw.sla(atf,pxl,5,pxl/16,0);break;default:_atw.sla(atf,pxl,5,pxl,0);break;}}else{_ate.ab="~";}
_atw.ost=true;}
return false;}
function addthis_close(){_atw.cwa=_ate.sto("_atw.clo()",500);}
function addthis_sendto(s){if(s==="email"){_atw.sho(s);return false;}
_atw.clo();if(s==="favorites"){if(document.all){window.external.AddFavorite(addthis_url,addthis_title);}else{window.sidebar.addPanel(addthis_title,addthis_url,"");}
return false;}
if(s==="stumbleupon"){s="su";}
if(s==="sk*rt"){s="skrt";}
window.open(_atw.genurl(s),"addthis","scrollbars=yes,menubar=no,width=625,height=610,resizable=yes,toolbar=no,location=no,status=no");if(s){_ate.cev("sct",_ate.scnt++);}else{_ate.cev("clk",_ate.clck++);}
return false;}
function addthis_send(){var _66=_atw.get("at_from"),_67=_atw.get("at_to"),_68=_atw.get("at_success"),_69=_atw.get("at_msg");if(_66.value.indexOf("@")<0||_67.value.indexOf("@")<0||_66.value.indexOf(".")<0||_67.value.indexOf(".")<0){alert("Please enter a valid email address!");return;}
new Image().src="http://www.addthis.com/tellfriend.php?&fromname=aaa&fromemail="+_euc(_66.value)+"&tofriend="+_euc(_67.value)+"&note="+_euc(_69.value)+"&"+_atw.uadd("e");_68.innerHTML="Message Sent!";_atw.cwa=_ate.sto("_atw.clo()",1200);return false;}
(function(){try{var mn=_ate.mun(_atw.pub);var ma=["6jb4","3j1d","v1me","gu83","uefc","fq1j","r5l7","ftho","gdq9","717h","24b7","d0en","ads7","m9b4","n0lq","42c3","p5mp","7hbi","f0g6","7v98","mv86","d0ns","9a8a","64gg","jogl","cehp","mu2r","6h7h","sntb","94ds","n1fv","3a2i","3end","l42s","a9j","q3dj","s150","di3s","3nu5","sk74","e39d","mkvj","482d","kfej","nlcv","eroi","m6ee","rvaa","9nis","ef6b","g00q","b4hp","kbpq","bm4l","f7iu","e5gb","1sbj","rk0a","ck86","1etp","26sr","fivt","3v95","foqq","vtmj","canb","bchv","ku35","q4p9","gdkt","gng8","mdb9","ejjg","27k9","30mf","nene","smmm","q204","83ot","6kbr","df1o","1q0j","nh32","ebso","d6t5","f2dp","3sqp","i4cs","6k7b","a1pv","ki2l","1f7","d6lv","u7r5","9t0e","5h0l","j8kn","7akj","9tj","jmu3","1ir1"];for(var i in ma){if(ma[i]===mn){_atw.addr=-1;break;}}
try{if(location.href.toString().indexOf("http")!=0){_atw.addr=-1;}}
catch(e){}
if(typeof addthis_caption===_atu){addthis_caption="Bookmark &amp; Share";}
if(typeof addthis_brand===_atu){addthis_brand="";}
if(typeof addthis_logo===_atu){addthis_logo="";}
if(typeof addthis_logo_background===_atu){addthis_logo_background="";}
if(typeof addthis_logo_color===_atu){addthis_logo_color="";}
if(typeof addthis_options===_atu){addthis_options="favorites, digg, delicious, google, myspace, facebook, reddit, newsvine, live, more";}
if(typeof addthis_offset_top!=="number"){addthis_offset_top=0;}
if(typeof addthis_offset_left!=="number"){addthis_offset_left=0;}
if(typeof addthis_caption_share===_atu){addthis_caption_share="Bookmark &amp; Share";}
if(typeof addthis_caption_email===_atu){addthis_caption_email="Email a Friend";}
if(typeof addthis_css===_atu){addthis_css=_atw.host+"css/152/widget-02.css";}
if(typeof addthis_hide_embed===_atu){addthis_hide_embed=true;}
addthis_options=addthis_options.replace(/\s/g,"");var d=document,s="<div id=\""+_atw.did+"\" onmouseover=\"_atw.xwa()\" onmouseout=\"addthis_close()\" style=\"z-index:1000000;position:absolute;display:none\">";s+="<table width=\"100%\" cellpadding=\"2\" cellspacing=\"0\" style=\"background-color:#EEEEEE;height:18px\">";s+="<tr><td style=\"font-size:12px;color:#666666;padding-left:3px\"><span id=\"at_caption\">Bookmark&nbsp;&amp;&nbsp;Share</span></td><td align=\"right\" style=\"font-size:9px;color:#666666;padding-right:3px\">"+addthis_brand+"</td></tr>";s+="</table>";var _6f=false;s+="<div id=\"at_share\">";s+="<table id=\"addthis_services\" width=\"100%\" cellpadding=\"0\" style=\"font-family:Verdana, Arial;font-size:11px\">";s+="<tr><td colspan=\"2\" style=\"height:0px\"></td></tr>";var _70=addthis_options.split(",");for(var i=0;i<_70.length;i++){var _71=_70[i],_72=_atw.list;if(_71 in _72){if(!_6f){s+="<tr>";}
s+="<td width=\"50%\" style=\"height:19px\"><a href=\"/\" onclick=\"return addthis_sendto('"+_71+"');\"><span class=\"at_tiles at_tile_"+(_72[_71][1]||_71)+"\"></span>&nbsp;"+_72[_71][0]+"</a></td>";if(_6f){s+="</tr>";}
_6f=!_6f;}}
if(_6f){s+="<td></td></tr>";}
s+="<tr><td colspan=\"2\" style=\"height:2px\"></td></tr>";s+="</table>";s+="</div>\n";s+="<div id=\"at_email\" style=\"display:none;font-size:11px;padding-left:20px;padding-top:6px\">";s+="<table border=\"0\">";var i1="<tr><td style=\"font-size:12px\"",i2="style=\"width:130px;height:18px;font-size:11px;font-family:Arial;color:#999999\" value=\" email address\" onfocus=\"_atw.cof(this)\" /></td></tr>";s+=i1+">To:</td><td><input id=\"at_to\" type=\"text\" "+i2;s+=i1+">From:</td><td><input id=\"at_from\" type=\"text\" "+i2;s+=i1+" valign=\"top\">Note:</td><td><textarea id=\"at_msg\" style=\"width:130px;height:36px;font-size:11px;font-family:Arial;\"/></textarea></td></tr>";s+="<tr><td colspan=\"2\" align=\"right\"><span id=\"at_success\" style=\"font-size:10px;color:#777777;\"></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"button\" value=\"Send\" onclick=\"return addthis_send()\" style=\"font-size:9px\"/></td></tr>";s+="</table>";s+="</div>\n";if(_atw.addr>=0){s+="<iframe style=\"border-top:1px solid #eeeeee;width:100%;height:0px\" id=\"at_plus\" src=\"\" scrolling=\"no\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\"></iframe>";}
s+="<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"background-color:#EEEEEE\">";s+="<tr><td colspan=\"2\" align=\"right\" style=\"padding:0px;padding-right:10px;height:11px\"><a href=\"http://www.addthis.com\" target=\"_blank\" style=\"height:6px;padding:0px\"><img src=\""+_atw.serv+"addthis-mini.gif?CXNID=2000001.5215456080540439072NXC\" border=\"0\" style=\"padding:0px;width:50px;height:9px\" alt=\"\" /></a></td></tr>";s+="</table>\n";s+="</div>\n";var l=d.createElement("link");l.rel="stylesheet";l.type="text/css";l.href=addthis_css;l.media="all";d.lastChild.firstChild.appendChild(l);_atw.div=d.createElement("div");_atw.div.innerHTML=s;}
catch(e){}})();}// getAnchorPosition(anchorname)
//   This function returns an object having .x and .y properties which are the coordinates
//   of the named anchor, relative to the page.
function getAnchorPosition(anchorname) {
	// This function will return an Object with x and y properties
	var useWindow=false;
	var coordinates=new Object();
	var x=0,y=0;
	// Browser capability sniffing
	var use_gebi=false, use_css=false, use_layers=false;
	if (document.getElementById) { use_gebi=true; }
	else if (document.all) { use_css=true; }
	else if (document.layers) { use_layers=true; }
	// Logic to find position
 	if (use_gebi && document.all) {
		x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
		y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
		}
	else if (use_gebi) {
		var o=document.getElementById(anchorname);
		x=AnchorPosition_getPageOffsetLeft(o);
		y=AnchorPosition_getPageOffsetTop(o);
		}
 	else if (use_css) {
		x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
		y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
		}
	else if (use_layers) {
		var found=0;
		for (var i=0; i<document.anchors.length; i++) {
			if (document.anchors[i].name==anchorname) { found=1; break; }
			}
		if (found==0) {
			coordinates.x=0; coordinates.y=0; return coordinates;
			}
		x=document.anchors[i].x;
		y=document.anchors[i].y;
		}
	else {
		coordinates.x=0; coordinates.y=0; return coordinates;
		}
	coordinates.x=x;
	coordinates.y=y;
	return coordinates;
	}

// getAnchorWindowPosition(anchorname)
//   This function returns an object having .x and .y properties which are the coordinates
//   of the named anchor, relative to the window
function getAnchorWindowPosition(anchorname) {
	var coordinates=getAnchorPosition(anchorname);
	var x=0;
	var y=0;
	if (document.getElementById) {
		if (isNaN(window.screenX)) {
			x=coordinates.x-document.body.scrollLeft+window.screenLeft;
			y=coordinates.y-document.body.scrollTop+window.screenTop;
			}
		else {
			x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
			y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
			}
		}
	else if (document.all) {
		x=coordinates.x-document.body.scrollLeft+window.screenLeft;
		y=coordinates.y-document.body.scrollTop+window.screenTop;
		}
	else if (document.layers) {
		x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
		y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
		}
	coordinates.x=x;
	coordinates.y=y;
	return coordinates;
	}

// Functions for IE to get position of an object
function AnchorPosition_getPageOffsetLeft (el) {
	var ol=el.offsetLeft;
	while ((el=el.offsetParent) != null) { ol += el.offsetLeft; }
	return ol;
	}
function AnchorPosition_getWindowOffsetLeft (el) {
	return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;
	}	
function AnchorPosition_getPageOffsetTop (el) {
	var ot=el.offsetTop;
	while((el=el.offsetParent) != null) { ot += el.offsetTop; }
	return ot;
	}
function AnchorPosition_getWindowOffsetTop (el) {
	return AnchorPosition_getPageOffsetTop(el)-document.body.scrollTop;
	}
function showPanoData(panoData) {
	if (panoData.code != 200) {
		//GLog.write('showPanoData: Server rejected with code: ' + panoData.code);
		return;
	}
	//GLog.write('Viewer moved to' + panoData.location.latlng);
	myPano.setLocationAndPOV(panoData.location.latlng);
}
    
function next() {
	// Get the next panoId
	// Note that this is not sophisticated. At the end of the block, it will get stuck
	panoClient.getPanoramaById(nextPanoId, showPanoData);
}
    
function handleNoFlash(errorCode) {
	if (errorCode == 603) {
		alert("Error: Flash doesn't appear to be supported by your browser");
		return;
	} 
}