window.onload = function()
{
	/*check to see if one of the wwwork image map ids exists before doing anything*/
	if ($("id-worldmap") || $("id-regionmap") || $("id-countrymap"))	
	{		
		/*make an array of every element with the class 'node' -- you must class area elements with 'node' to give them the popup*/
		var map_nodes = $("wwwork_imagemap").getElementsByClassName("node");
		for (var i=0; i<map_nodes.length; i++)		
		{
			/*when user mouses over area element with 'node' class, show the popup*/
			map_nodes[i].onmouseover = function showmenu()
			{
				/*Give popup menu attributes and position, from area elements*/
				$("maplink").innerHTML = this.getAttribute("id");
				$("maplink").href = this.getAttribute("href");
				$("maplink").style.left = this.getAttribute("coords").split(",")[0] + "px";
				$("maplink").style.top = this.getAttribute("coords").split(",")[1] + "px";
				
/*				Assign border colors -- WHEN WORLD MAP CHANGES< THESE WILL NEED TO BE CHANGED AS WELL -- need to be very specific as well
				if ($("id-worldmap")){
					if (this.getAttribute("coords").split(",")[0]<180){$("maplink").style.borderColor = "#D58E24";}
					if (this.getAttribute("coords").split(",")[0]>180 && this.getAttribute("coords").split(",")[1]>122) {$("maplink").style.borderColor = "#CA9803";}
					 if ( this.getAttribute("coords").split(",")[1]<69) {$("maplink").style.borderColor = "#868556";}
					 if ( this.getAttribute("coords").split(",")[1]>69 && this.getAttribute("coords").split(",")[1]<99) {$("maplink").style.borderColor = "#43676C";}
				}*/
					
				/*once it's properly styled and positioned, show it*/	
				$("maplink").style.display = "block";
												
				/*make popup persist when user is over it*/								
				$("maplink").onmouseover = function()
				{
					$("maplink").style.display = "block";
				}				
			}

			/*make it go away, either when user mouses off circle or popup. if user mouses off circle, but is on popup, popup stays*/
			$("maplink").onmouseout = function() {this.style.display = "none"};	
			map_nodes[i].onmouseout = function() {$("maplink").style.display = "none"};	
		}				
	}
			
}