imgNum=0,ipos=0;imges = new Array();var tbnail,photoArea,pageNum;function $n(name){return document.getElementsByName(name)}function init(){	rentCount();	initAppointmentLink();	photoArea=$("photoArea");	pageNum=$("pageNum");	tbnail=$("Thumbnail");	imges=tbnail.getElementsByTagName("img");	imgNum=imges.length;	if(imgNum==0) return false;	addOnClickEvent();	changePreview(0);	pageNum.innerHTML=(ipos+1)+" of "+imgNum;	imgAuto();	//mostViewUpdate();	LoadHistory();}function addOnClickEvent(){	for(i=0;i<imgNum;i++){		imges[i].title=imges[i].alt	}}function changePreview(p){	photoArea.innerHTML="<img src='"+imges[p].src+"' onclick='showGallery("+p+");'>";}function showGallery(p){	var nPic = imges[p];	if(document.all)		nPic.click();	else{		var evt=document.createEvent("MouseEvents");		evt.initEvent("click", true, true);		nPic.dispatchEvent(evt);	}}function slideshow(type,number){	switch (type){	case ("f"):	// first photo		ipos=0;		break;	case ("p"):	// previous photo		if(ipos==0) ipos=imgNum-1;		else ipos--;		break;	case ("n"):	// next photo		if(ipos==imgNum-1) ipos=0;		else ipos++;		break;	case ("l"):	// last photo		ipos=imgNum-1;		break;	case ("d"):	// access photo directly		ipos=number;		break;	}	changePreview(ipos);	pageNum.innerHTML=(ipos+1)+" of "+imgNum;}function imgAuto(){	if($("controlBtn").value=="Play"){		$("controlBtn").value="Stop";		playFlag=setInterval(function(){slideshow("n")},3000);	}else{		$("controlBtn").value="Play";		clearInterval(playFlag);	}}function initAppointmentLink(){	var cunid = document.getElementsByName("ID")[0].value;	var PIqy = getCookie("PInquiry");	var cpath = $n("dbpath")[0].value;	cpath = cpath==""?"Examples/Test/NRentalT.nsf":cpath;	var url;	if(PIqy=="")		url = "/"+cpath+"/PInquiry5?OpenForm&RType=Residential&ParentUNID=" + cunid;	else		url = "/"+cpath+"/Appointment?openform&ParentUNID=" + cunid;	if($("appPart"))		$("appPart").href=url;}function appointment(cunid){	var PIqy = getCookie("PInquiry");	var cpath = $n("dbpath")[0].value;	cpath = cpath==""?"Examples/Test/NRentalT.nsf":cpath;	if(PIqy=="")		return "/"+cpath+"/PInquiry5?OpenForm&RType=Residential&ParentUNID=" + cunid;	else		return "/"+cpath+"/Appointment?openform&ParentUNID=" + cunid;}/*===== Get Direction =====*/function opendirections(path,para){	window.open(path+"Get_directions?openform&addr="+para,null,"width=360px,height=180px,resizable=yes,status=no,toolbar=no");}function showSection(id){	var obj=$(id);	if(obj.style.display=="")		obj.style.display="block";	else		obj.style.display="";}function openImg(obj){	window.open(obj.src,null,"width=500px,height=450px,resizable=yes,toolbar=no");}//-------Ajax-------var mostViewReq;function createRequest() {  try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}      try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}      try { return new XMLHttpRequest( ); } catch(e) {}      alert("XMLHttpRequest not supported");      return null;}function updatePage(vid) {  if (request.readyState == 4) {    if (request.status == 200) {      var response = request.responseText.split("|");      $(vid).innerHTML = response[0];      $(vid+"t").innerHTML = response[1];    } else if (request.status == 404) {      alert ("Requested URL is not found.");    } else if (request.status == 403) {      alert("Access denied.");    } else      alert("status is " + request.status);  }}function rentCount(){	var docid = $("DocumentUniqueID1").value;	if(docid==""){window.status="Can't get document id.";return false;}	var request = createRequest();	var requestUrl="/examples/Test/NRentalT.nsf/AccessCumulate?Openagent&unid="+docid+"&END"+Math.random();	request.open("GET", requestUrl, true);	request.onreadystatechange = function(){if((request.readyState==4)&&(request.status==200)) window.status="Day count:"+request.responseText}	request.send(null);}//--------------------function changeMedia(type,url){	var container = $("player");	var rplHTML;	if(type=="flash"){		url="/EXAMPLES/TEST/NRentalT.nsf/swfplayer.swf?open&source="+url;		rplHTML="<object type=\"application/x-shockwave-flash\" data=\""+url+"\" width=\"280\" height=\"220\"><param name=\"movie\" value=\""+url+"\"><param name=\"allowFullScreen\" value=\"false\"><param name=\"bgcolor\" value=\"#000000\"></object>"	}else if(type=="youtube"){		rplHTML="<object width=\"280\" height=\"220\"><param name=\"movie\" value=\""+url+"\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\""+url+"\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"280\" height=\"220\"></embed></object>"	}else{		rplHTML="<object width=\"280\" height=\"220\" CLASSID=\"CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6\"><PARAM NAME=\"URL\" VALUE=\""+url+"\"><embed src=\""+url+"\" type=\"video/x-ms-wmv\" width=\"280\" height=\"220\" autoStart=\"0\" showControls=\"1\" showstatusbar=\"1\"></object>";	}	container.innerHTML=rplHTML;	if(type!="youtube"){		var videounid=url.substr(27,32);		var request = createRequest();		var requestUrl = "/Examples/Test/NRentalT.nsf/VideoCount?OpenAgent&vunid=" + videounid+"&END"+Math.random();		request.open("GET", requestUrl, true);		request.onreadystatechange = function(){updatePage(videounid)};		request.send(null);	}	return false;}var map;function createMap(address){	var geocoder = new google.maps.Geocoder();	geocoder.geocode( { 'address': address}, function(results, status) {		if (status == google.maps.GeocoderStatus.OK) {			var panoOptions = {				position: results[0].geometry.location,				addressControl: false,				navigationControlOptions: {					style: google.maps.NavigationControlStyle.SMALL				},				enableCloseButton: false			};			var panorama = new google.maps.StreetViewPanorama($("streetView"), panoOptions);			var marker = new google.maps.Marker({				position: results[0].geometry.location,				title: address			});			/*var mapOptions = {				disableDoubleClickZoom: false,				draggable: false,				mapTypeControlOptions: google.maps.MapTypeControlStyle.DROPDOWN_MENU,				navigationControl: false,				center: results[0].geometry.location,				zoom: 14,				mapTypeId: google.maps.MapTypeId.ROADMAP			};*/			var mapOptions = {				mapTypeControlOptions: google.maps.MapTypeControlStyle.DROPDOWN_MENU,				center: results[0].geometry.location,				zoom: 14,				mapTypeId: google.maps.MapTypeId.ROADMAP,				disableDoubleClickZoom: true			};			var iWindow = new google.maps.InfoWindow({				content: address			});			map = new google.maps.Map($("map"), mapOptions);			google.maps.event.addListener(marker, 'click', function() {				iWindow.open(map,marker);			});			iWindow.open(map,marker);			google.maps.event.addListener(map, 'dblclick', function() {				window.open('http://www.heightsre.com/Action/Homepage.nsf/BuildingMap?openform&' + address, null, 'width=600px,height=400px,toolbar=no,resizable=yes');			});			marker.setMap(map);		}else{			alert("Geocode was not successful for the following reason: " + status);		}	});}//============ Change Most View ===================function changeMostList(){  if (mostViewReq.readyState == 4) {    if (mostViewReq.status == 200) {      var response = mostViewReq.responseText;      if(response!="")      	parent.document.getElementById("mostview").innerHTML=response;    } else if (mostViewReq.status == 404) {      alert ("Requested URL is not found.");    } else if (mostViewReq.status == 403) {      alert("Access denied.");    } else      alert("status is " + mostViewReq.status);  }}function mostViewUpdate(){	mostViewReq = createRequest();	var uCity=$n("bldg_city")[0].value;	parent.document.getElementById("uArea").innerHTML=uCity + " Residential ";	var url="/EXAMPLES/TEST/NRentalT.NSF/mostViewUnit?openagent&city="+uCity+"&type=Residential&END";	mostViewReq.open("Get", url, true);	mostViewReq.onreadystatechange = function(){changeMostList()};	mostViewReq.send(null);	return;}function cGallery(){	var wheight=parent.document.body.clientHeight;	var dheight=document.body.clientHeight;	var mpos = dheight/2-200;	parent.scroll(0,mpos);}function ClickToCall(){	var winDial = null;	var cpath = $n("dbpath")[0].value;	var docid = $("docid").innerHTML	var callto = ""//document.getElementById("agPhone").innerHTML	var leaseagent = $("leaseagent").innerHTML	if (leaseagent=="") return;	var url = "http://www.heightsre.com/"+cpath+"/WebClickToCall?Openform&doc=" + docid 			+ "&fname=" + 			+ "&callto=" + callto			+ "&leaseagent=" + leaseagent			+ "&webtype=commercial";	var iWidth = 500;                         	var iHeight = 500;                       	var iTop = (window.screen.availHeight-30-iHeight)/4;       	var iLeft = (window.screen.availWidth-10-iWidth)/4;	winDial =  window.open (url, "_blank", "height=" + iHeight + ", width=" + iWidth + ", top="+ iTop + ",left=" + iLeft + ",toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no, z-look=yes, alwaysRaised=yes")}function showVPic(name){	if(document.readyState=="complete"){		var picObjs = document.getElementsByName(name);		if(document.all)			picObjs[0].click();		else{			var evt=document.createEvent("MouseEvents");			evt.initEvent("click", true, true);			picObjs[0].dispatchEvent(evt);		}	}}
