
//	mapId = the ID of the <map> element
//	imageId = ID of the image to be replaced AND!!!! the folder in which to look for the image
//	The AREA that will call a DIV MUST!!!!!! have the following syntax:
//	id = "map-DivId" and the DIV must have an id = "DivId"!!!

function initFloorplansMaps(mapId, imageId) {
	mapObj = document.getElementById(mapId);
	for (i=0; i < mapObj.childNodes.length; i++) {
		node = mapObj.childNodes[i];
		if (node.nodeName=="AREA") {
		
		//	When the mouse is on top or TAB out of the link
			node.onmouseover=function() {
				tempDivId = this.id.substr(4);
				document.getElementById(tempDivId).className = document.getElementById(tempDivId).className.replace("no_show", "do_show");
				document.getElementById(imageId).src = "images/" + imageId + "/" + tempDivId + ".gif";
			}
			
//			node.onfocus=function() {
//				tempDivId = this.id.substr(4);
//				document.getElementById(tempDivId).className = document.getElementById(tempDivId).className.replace("no_show", "do_show");
//				document.getElementById(imageId).src = "images/" + imageId + "/" + tempDivId + ".gif";
//			}
			
			//	When the mouse moves out or TAB out of the link
			node.onmouseout=function() {
				tempDivId = this.id.substr(4);
				document.getElementById(tempDivId).className = document.getElementById(tempDivId).className.replace("do_show", "no_show");
				document.getElementById(imageId).src = "images/" + imageId + "/main.gif";
			}
			
//			node.onblur=function() {
//				tempDivId = this.id.substr(4);
//				document.getElementById(tempDivId).className = document.getElementById(tempDivId).className.replace("do_show", "no_show");
//				document.getElementById(imageId).src = "images/" + imageId + "/main.gif";
//			}
			
			
			//	Need to throw a function here since when clicked & calling the pop-up,
			//	the onmouseout event is not called
			node.onclick=function() {
				
			//	If NOT dealing with one of the areas that is a placeholder,
			//	which does not call a PDF but only has href="#", we do the
			//	same as the onmouseout
				if(this.getAttribute("href").indexOf("#") < 0) {
					
					//	Return the page to its default state
					tempDivId = this.id.substr(4);
					document.getElementById(tempDivId).className = document.getElementById(tempDivId).className.replace("do_show", "no_show");
					document.getElementById(imageId).src = "images/" + imageId + "/main.gif";
				
					//	Call the PDF in a JS pop-up window
					window.open(this.getAttribute("href"));
				}
				return false;
			}
		}
	}
}

