var menuWidth = "133";
var slideSpeed = 1;
var waitTime = 700;
var showLoading = 1;
var currBodySrc;
moving = setTimeout('null',1);

		
function DisplayNext(url) 
{
	location.replace(url);
}


function popupWindow(url,widthx, heighty) 
{
	windowHandle = window.open(url,'messagewindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=' + widthx + ',height=' + heighty + ',screenX=100,screenY=100,top=300,left=400');
}

function SubmitForm(DisplayAsMap)
{
     oFrm = document.property12;
     if(DisplayAsMap==true)
     	oFrm.action = "index-message.asp?Sort=PropertyNameTxt&displayasmap=true";
     else
	    oFrm.action = "index-message.asp?Sort=PropertyNameTxt&displayasmap=false";		
     oFrm.submit();
}


function SubmitSearchForm()
{
	property.executioncouter.value=property.executioncouter.value+"1";
	if (property.executioncouter.value=="01")
	{
		displayLoading();
		document.property.target = '_self';
		property.submit();
		pollIFrame("idf1");
	}
	else
	{
		window.history.back();
	}
}	

function UpdateSearchForm()
{
	property.executioncouter.value=property.executioncouter.value+"1";
}	


function SubmitMessageForm(actionTxt)
{
	property.executioncouter.value=property.executioncouter.value+"1";
	if (property.executioncouter.value=="01")
	{
		document.property.action = actionTxt
		displayLoading();
		document.property.target = '_self';
		property.submit();
		pollIFrame("idf1");
	}
	else
	{
		window.history.back();
	}
}	

function UpdateMessageForm()
{
	property.executioncouter.value=property.executioncouter.value+"1";
}	



		///// SLIDE FUNCTION //////
		function moveOut() {
			if (ssm.pixelLeft<0) {
				clearTimeout(moving);
				moving = setTimeout('moveOut()', slideSpeed);
				ssm.pixelLeft += 10;
				
				// Adjust for menu width if not multiple of 10.
				if (ssm.pixelLeft > 0) {
					ssm.pixelLeft = 0;
				}
			}
			else {clearTimeout(moving);
				moving=setTimeout('null',1)
			}
		};

		function setMenuWidth(width) {
			menuWidth= width;

		}

		function moveBack() {
			clearTimeout(moving);
			moving = setTimeout('moveBack1()', waitTime);
		}

		function moveBack1() {
			if (ssm.pixelLeft>(-menuWidth)) {
				clearTimeout(moving);
				moving = setTimeout('moveBack1()', slideSpeed);
				ssm.pixelLeft -= 10;
				
				// Adjust for menu width if not multiple of 10.
				if (ssm.pixelLeft < -menuWidth) {
					ssm.pixelLeft = -menuWidth;
				}
			}
			else {
				clearTimeout(moving);
				moving=setTimeout('null',1)
			}
		};
		
		///// SETS OBJECT NAMES AND LOADS MENU /////
		function initSlide( isPinned ) {
			ssm=document.all("divmenu").style;
			ssm.visibility = "visible";
			
			if (isPinned) {
				ssm.pixelLeft = 0;
			} else {
				ssm.pixelLeft = -menuWidth;
			}
			
		}
		
		
		function EvalSound(soundobj) {
			//var thissound= eval("document."+soundobj);
			//thissound.Play();
		}

		
		function displayBody()
		{
			document.getElementById('divbodyloading').style.display='none';
			document.getElementById('divbody').style.display='inline';

		}
		
		function displayLoading()
		{
				
			document.getElementById('divbodyloading').style.display='inline';
			document.getElementById('divbody').style.display='none';
			
		}
			
		function pollIFrame(pollFrameID) {

				
			if (document.getElementById(pollFrameID).readyState=='complete')
			{
				displayBody();
				currBodySrc = document.getElementById(pollFrameID).src;
			}
			else
			{
				//this if is to help stop looping
				//alert(currBodySrc + '='+document.getElementById(pollFrameID).src);
				if (currBodySrc != document.getElementById(pollFrameID).src)
					displayLoading();
				
			} 
		}
function closing(company)
{
	event.returnValue = 'You are about to navigate away from '+ company ; 
}


function SortResults(sortSection)
{
	if (sortSection=='LeaseProperties')
	{	
	   document.property.action = property.LeaseSort.value;
    }
    else if (sortSection=='SaleProperties')
	{	   
	   document.property.action = property.SaleSort.value;
    }
    else if (sortSection=='InvestmentProperties')
	{	   
	   document.property.action = property.InvestmentSort.value;
    }
	   document.property.target = '_self';
	   property.submit();

}	

function SubmitSearchForm1()
{
	document.SearchResults.action = 'searchresults.asp';
	SearchResults.executioncouter.value=SearchResults.executioncouter.value+"1";
	if (SearchResults.executioncouter.value=="01")
	{
		displayLoading();
		document.SearchResults.target = '_self';
		SearchResults.submit();
		pollIFrame("idf1");
	}
	else
	{
		window.history.back();
	}
}	

function UpdateSearchForm1()
{
	SearchResults.executioncouter.value=SearchResults.executioncouter.value+"1";
}	

			function MM_swapImgRestore() { //v3.0
			var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
			}

			function MM_preloadImages() { //v3.0
			var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
				var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
				if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
			}

			function MM_findObj(n, d) { //v4.01
			var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
				d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
			if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
			for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
			if(!x && d.getElementById) x=d.getElementById(n); return x;
			}

			function MM_swapImage() { //v3.0
			var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
			if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
			}
