//if (window.addEventListener) window.addEventListener('load', initMenus, false);
//else if (window.attachEvent) window.attachEvent('onload', initMenus);

// initialize menus
function initMenus() {

	// highlighting for menu items
	var simplemenu = document.getElementById('side');  
	if( !simplemenu ) {} else { selfLink2('side'); }
	simplemenu = document.getElementById('content');  
	if( !simplemenu ) {} else { selfLink2('content'); }
	simplemenu = document.getElementById('nav');  
	if( !simplemenu ) {} else { selfLink1('nav'); }

}

		function selfLink2(oRootElement)
		{
			var oClass = 'samepage'
			var oExpand = true
			if(!document.getElementsByTagName||!document.childNodes) { return; }

			oRootElement = document.getElementById(oRootElement); // select the element that has the id

			var ifindex = location.href;
			ifindex = ifindex.replace(/index.asp/,"");
			ifindex = ifindex.replace(/index.html/,"");

			for( var x = 0, y = oRootElement.getElementsByTagName('a'); y[x]; x++ )  // for each link in that element
			{
				if ( y[x].getAttribute('href') &&							// if there is a link and 
					(location == y[x].getAttribute('href') ||				// the link = the page or
						ifindex == y[x].getAttribute('href')) &&			// the link = the index page and
					y[x].getAttribute('href') != '#' )						// the href does not = #
				{	 					
					y[x].className = (y[x].className?(y[x].className+' '):'') + oClass;
				} //end if
			} //end for

		}//end function

		function selfLink1(oRootElement)
		{
			var oClass = 'samepage'
			var oExpand = true
			if(!document.getElementsByTagName||!document.childNodes) { return; }

			oRootElement = document.getElementById(oRootElement); // select the element that has the id

			for( var x = 0, y = oRootElement.getElementsByTagName('a'); y[x]; x++ )  // for each link in that element
			{
				var thelink = "" + y[x].getAttribute('href');				// get the url of the link
				var thepage = "" + location;									// get the url of this page

				var folder1 = thelink.match("current/");			// if the url contains "current/"
				var folder2 = thepage.match("current/");		// if the url contains "current/"
				if (folder1 && folder2)										// if both contain "current/"
				{ y[x].className = (y[x].className?(y[x].className+' '):'') + oClass; }	// set the class

				folder1 = thelink.match("prospective/");		// if the url contains "prospective/"
				folder2 = thepage.match("prospective/");		// if the url contains "prospective/"
				if (folder1 && folder2)										// if both contain "prospective/"
				{ y[x].className = (y[x].className?(y[x].className+' '):'') + oClass; }	// set the class

				folder1 = thelink.match("realtors/");				// if the url contains "realtors/"
				folder2 = thepage.match("realtors/");			// if the url contains "realtors/"
				if (folder1 && folder2)										// if both contain "realtors/"
				{ y[x].className = (y[x].className?(y[x].className+' '):'') + oClass; }	// set the class

				folder1 = thelink.match("gallery/");				// if the url contains "gallery/"
				folder2 = thepage.match("gallery/");				// if the url contains "gallery/"
				if (folder1 && folder2)										// if both contain "gallery/"
				{ y[x].className = (y[x].className?(y[x].className+' '):'') + oClass; }	// set the class
			} //end for

		}//end function



