<!--
/*
function SetCookie(cookieName,cookieValue,nDays) {
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=1;
 expire.setTime(today.getTime() + 3600000*24*nDays);
 document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();
}
*/
function SetCookie(cookieName,cookieValue) {
	document.cookie = cookieName+"="+escape(cookieValue) + ";";
}


function ReadCookie(cookieName) {
 var theCookie=""+document.cookie;
 var ind=theCookie.indexOf(cookieName);
 if (ind==-1 || cookieName=="") return ""; 
 var ind1=theCookie.indexOf(';',ind);
 if (ind1==-1) ind1=theCookie.length; 
 return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}



function do_search( searchVal )
{
	location.href = 'http://search.hines.com/search?restrict=&ie=&site=my_collection&output=xml_no_dtd&client=my_collection&lr=&proxystylesheet=my_collection&oe=&q='+searchVal;
	return true;
}

function do_press_search( searchVal )
{
	location.href = 'http://search.hines.com/search?restrict=press_releases&ie=&site=my_collection&output=xml_no_dtd&client=my_collection&lr=&proxystylesheet=my_collection&oe=&q='+searchVal;
	return true;
}


function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images && preloadFlag == false) {
		
		// load init state images
		logo01 = newImage("/common/images/head/logo01.gif");
		logo02 = newImage("/common/images/head/logo02.gif");
		about_hines = newImage("/common/images/head/about-hines.gif");
		property_search_ = newImage("/common/images/head/property-search.gif");
		press_room = newImage("/common/images/head/press-room.gif");
		careers= newImage("/common/images/head/careers.gif");
		investment = newImage("/common/images/head/investment.gif");
		development = newImage("/common/images/head/development.gif");
		management = newImage("/common/images/head/management.gif");
		terms = newImage("/common/images/footer/terms.gif");		
		privacy_policy = newImage("/common/images/footer/privacy-policy-.gif");
		site_index = newImage("/common/images/footer/site-index.gif");
		contact_us = newImage("/common/images/footer/contact.gif");
		myhines = newImage("/common/images/footer/myhines.gif");	
		
		// load rollover images
		about_hines_over = newImage("/common/images/head/about-hines-over.gif");
		property_search_over = newImage("/common/images/head/property-search-over.gif");
		press_room_over = newImage("/common/images/head/press-room-over.gif");
		careers_over = newImage("/common/images/head/careers-over.gif");
		investment_over = newImage("/common/images/head/investment-over.gif");
		development_over = newImage("/common/images/head/development-over.gif");
		management_over = newImage("/common/images/head/management-over.gif");
		terms_over = newImage("/common/images/footer/terms-over.gif");		
		privacy_policy_over = newImage("/common/images/footer/privacy-policy-over.gif");
		site_index_over = newImage("/common/images/footer/site-index-over.gif");
		contact_us_over = newImage("/common/images/footer/contact-over.gif");	
		myhines_over = newImage("/common/images/footer/myhines-over.gif");			
		
		// load bg images.
		bkgd2 = newImage("/common/images/bkgd/bkgd_02.gif");
		bkgd4 = newImage("/common/images/bkgd/bkgd_04.gif");
		bkgd5 = newImage("/common/images/bkgd/bkgd_05.gif");
		bkgd6 = newImage("/common/images/bkgd/bkgd_06.gif");
		bkgd7 = newImage("/common/images/bkgd/bkgd_07.gif");
		
		preloadFlag = true;
	}
}


function getURL(url, target){
	if(target==null){
		window.location = url;
	}else{
		window.open(url);
	}
}
 
 
function setTranslationURL(lang, url){
	if(typeof window.translationURLs !== "object") window.translationURLs={};
	var urls = window.translationURLs;
	urls[lang] = url;
	return window;
}

function getTranslationURL(lang){
	return (typeof window.translationURLs !== "object" || typeof window.translationURLs[lang] === "undefined") ? null : window.translationURLs[lang];
}
 
 

/*
	Fetches the path portion of a URL, e.g.
				
		input = http://localhost/about.us/board.of.trustees/trustee.profiles.shtml
		output = http://localhost/about.us/board.of.trustees/

*/
function getPathFromURL( url ) {

	return url.substr( 0, url.lastIndexOf( "/" )+1 );
}


/*
	Fetches the path portion of a URL, e.g.
				
		input = http://localhost/about.us/board.of.trustees/trustee.profiles.shtml
		output = http://localhost/about.us/board.of.trustees/

*/
function getStripParamFromURL( url ) {

	if( url.substr( 0, url.lastIndexOf( "?" ) ) != '' )
		return url.substr( 0, url.lastIndexOf( "?" ) );
	else
		return url;
}

/*
	The following is an override variable for the highlightMenuLink() function. To force
	 a menu item to be highlighted, set 'highlightMenuLinkOverride' equal to the EXACT
	 URL specified in the menu's <a href=> tag, e.g.:
	 
	 <script language='javascript'>highlightMenuLinkOverride = 'http://localhost/about.us/board.of.trustees/index.shtml';</script>
		
	 This SHOULD NOT BE DONE HERE -- place the override command anywhere in an editable region.
*/
var highlightMenuLinkOverride = null;

/*
	This function highlights a menu item using three different methods:
	
		1) If highlightMenuLinkOverride has been set to the exact URL (see above), this is used.
		2) An exact URL match is attempted (index pages MUST be named 'index.shtml')
		3) A directory name match is attempted
*/
function highlightMenuLink() {

	// make an alternate 'document.URL' that contains the default page name 'index.shtml'
	//  to make URL matching easier
	if( document.URL.lastIndexOf( '/' ) == document.URL.length-1 ) {
		var documentURL = document.URL.toLowerCase() + 'default.aspx';
	} else {
		var documentURL = document.URL.toLowerCase();
	}

	//
	// Pass #1: check for the override
	//
	if( highlightMenuLinkOverride != null ) {

		// loop through the links in the document
		for( var i=document.links.length-1; i >= 0; i-- ) {
			if( highlightMenuLinkOverride.toLowerCase() == document.links[i].href.toLowerCase() ) {
				document.links[i].className = 'mmhide_secondaryNav mmhide_secondaryNavOn';
				break;
			}
		}				
		return;
	}
	//
	// Pass #2: find the closest match
	//
	else{
		var matchLvl = -1,
			match = null;
		for(var i=0; i<document.links.length; i++){
			var link = document.links[i];
			//SEW - Error in Contribute  console.log(document.location.toString().toLowerCase(), link.href.toString().toLowerCase());
			if(link.className.indexOf("mmhide_secondaryNav") > -1){
				var _lvl = compareURLs(document.location.toString().toLowerCase(), link.href.toString().toLowerCase());
				if(_lvl > matchLvl){
					matchLvl = _lvl;
					match = link;
				}
			}
		}
		if(match!==null){
			match.className += " mmhide_secondaryNavOn";
		}
	}

	
}



(function(){

	function prepURL(dirtyURL){
		var url = dirtyURL.toString().split(/\/+/),
			extra = [];
		
		url[url.length-1] = url[url.length-1].replace(/#.[^\?]+/, function(){
			extra.push(arguments[0]);
			return "";
		}).replace(/\?.+$/, function(){
			//[].push.apply(extra, arguments[0].split("&"));
			extra.push(arguments[0]);
			return "";
		});
		
		[].push.apply(url, extra);
		return url;
	}

	window.compareURLs=function(pivot, subject){
		pivot = prepURL(pivot);
		subject = prepURL(subject);
		var match = -1;
		
		for(var u=0; u<pivot.length; u++){
			if(pivot[u] !== subject[u]){
				break;
			}
			match = u;
		}
		return match;
	}
	

})();


// Mapping functions
function ShowMap(URL) {
    var id = 'Map';
    var Settings = 'scrollbars=yes, resizable=no, width=655, height=540, left=50, top=20';
    newWin = window.open(URL, id, Settings);
    newWin.focus();
}

function ShowMapFile(URL) {
    var id = 'Map';
    var Settings = 'toolbar=no,menubar=yes,location=no,directories=no,status=no,scrollbars=yes,resizable=no,width=640,height=450,top=40,left=40';
    var newWin = window.open(URL,id,Settings)
    newWin.focus();
}

//uses an interval in case the mapObj functions are not available at the time setFlashMapPos() is called.
function setFlashMapPos(posTo, mapObj){
	//console.log("setFlashMapPos("+posTo+", "+mapObj+")");	
	var interval=50;
	var timeout=10000;
	var time=0;
	var posInterval = setInterval(onInterval, interval);
	
	var posTo = posTo.split(",");
	function onInterval(){
		if(typeof(mapObj.setPosition)=="function"){
			
			mapObj.setPosition(parseInt(posTo[0]),parseInt(posTo[1]), parseInt(posTo[2]));
			clearInterval(posInterval);
		}
		if(time>=timeout) clearInterval(posInterval);
		time+=interval;
	}
	
}

//Macromedia functions

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];}
}

preloadImages();


// -->
