window.onload = function() {
	var map = document.getElementById('map');
	var counties = map.getElementsByTagName('A');
	var length = counties.length;
	var i = 0;
	var COUNTIES = Array();
	do {
		COUNTIES.push(counties[i].parentNode);
	} while (++i < length);
	var validMatchSent = '';
	var applyMatch = function(itty) {
		if (validMatchSent != itty) {
			var bits = itty.split('');
			var i = 0;
			do {
				COUNTIES[i].className = parseInt(bits[i])? 'whoa' : '';
			} while (++i < length);
		}
		validMatchSent = itty;
	};
	
	var practices = document.getElementById('practices');
	practices.onmouseover = function(e) {
		e = e? e : window.event;
		var node = e.target? e.target : e.srcElement;
		if (node.nodeName == 'A') {
			node.pause = setTimeout(function() {
				applyMatch(node.getAttribute('match'));
			}, 100);
		}
	}
	practices.onmouseout = function(e) {
		e = e? e : window.event;
		var node = e.target? e.target : e.srcElement;
		clearTimeout(node.pause);
		applyMatch('');
	}
}
