var state_list;
function initMap() {
	var _map = document.getElementById("map-area");
	if (_map) {
		createMap(_map);
	}
}

function createMap(_map) {
	state_list = document.getElementById("map").getElementsByTagName("li");
	var _areas = _map.getElementsByTagName("area");
		for (i = 0; i < _areas.length; i ++) {
			if (_areas[i].alt) {
				var _node = document.getElementById(_areas[i].alt);
				if (_node) {
					_areas[i]._node = _node;
					_areas[i].onmouseover = function() {
						if (this._node.className.indexOf("activestate") == -1)
						{
							this._node.className += " activestate";

						}
					}
					_areas[i].onmouseout = function() {
						this._node.className = this._node.className.replace("activestate", "");
					}
					_areas[i].onclick = function() {
						for (var i = 0; i < state_list.length; i++ ) {
							if(state_list[i].className.indexOf("select") != -1) {
								state_list[i].className = state_list[i].className.replace("select", "");
							}
						}
						this._node.className += " select";
					}
				}
			}
		}
}
if (window.addEventListener){
	window.addEventListener("load", initMap, false);
}
else if (window.attachEvent){
	window.attachEvent("onload", initMap);
}
