function ietag(type, tag, parentId) {
	if (window.attachEvent) {
		window.attachEvent("onload", function() {
			var ieEls = (parentId==null)?document.getElementsByTagName(tag):document.getElementById(parentId).getElementsByTagName(tag);
			type(ieEls);
		});
	}
}

ieHover = function(ieEls) {
	for (var i=0; i<ieEls.length; i++) {
		ieEls[i].onmouseover=function() {
			this.className+=" iehover";
		}
		ieEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" iehover\\b"), "");
		}
	}
}

ieFocus = function(ieEls) {
	for (var i=0; i<ieEls.length; i++) {
		ieEls[i].onfocus=function() {
			this.className+=" iefocus";
		}
		ieEls[i].onblur=function() {
			this.className=this.className.replace(new RegExp(" iefocus\\b"), "");
		}
	}
}

ieTarget = function(ieEls) {
	var aEls = document.getElementsByTagName("A");
	document.lastTarget = null;
	for (var i=0; i<ieEls.length; i++) {
		if (ieEls[i].id) {
			if (location.hash==("#" + ieEls[i].id)) {
				ieEls[i].className+=" ietarget";
				document.lastTarget=ieEls[i];
			}
			for (var j=0; j<aEls.length; j++) {
				if (aEls[j].hash==("#" + ieEls[i].id)) aEls[j].targetEl = ieEls[i];
				aEls[j].onclick = function() {
					if (document.lastTarget) document.lastTarget.className = document.lastTarget.className.replace(new RegExp(" ietarget\\b"), "");
					if (this.targetEl) this.targetEl.className+=" ietarget";
					document.lastTarget=this.targetEl;
					return true;
				}
			}
		}
	}
}

ietag(ieHover, "LI", "menu");
ietag(ieTarget, "DIV", "targets");
ietag(ieFocus, "INPUT");
ietag(ieFocus, "TEXTAREA");
