/*
function correctPNG() {
	for(var i=0; i<document.images.length; i++) {
		var img = document.images[i]
		var imgName = img.src.toUpperCase()
		if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {
			var imgID = (img.id) ? "id='" + img.id + "' " : ""
			var imgClass = (img.className) ? "class='" + img.className + "' " : ""
			var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
			var imgStyle = "display:inline-block;" + img.style.cssText 
			if (img.align == "left") imgStyle = "float:left;" + imgStyle
			if (img.align == "right") imgStyle = "float:right;" + imgStyle
			if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle  
			var strNewHTML = "<span " + imgID + imgClass + imgTitle + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
			img.outerHTML = strNewHTML
			i = i-1
		}
	}
}

if(navigator.userAgent.indexOf("MSIE") > -1) {
	window.attachEvent("onload", correctPNG);
}
*/

function g(o) { return document.getElementById(o); }

if (document.attachEvent) {
	addEvent = function(o,evn,f) { o.attachEvent("on"+evn,f) }
}

else if (document.addEventListener) {
	addEvent = function(o,evn,f) { o.addEventListener(evn,f,false) }
}

function initTab(nid,cid,action,defaultIndex) {
	var ls = g(nid).getElementsByTagName("li");
	var cc = g(cid).childNodes;
	var c = [];
	var index = defaultIndex?defaultIndex:0;
	for (var i = 0 ; i < cc.length ; i ++) if (cc[i].nodeType==1)c.push(cc[i]);
	for (var i = 0 ; i < ls.length ; i ++) {
		ls[i].index = i;
		if (i==index) {
			ls[i].className = "hovertab";
			c[i].className = "app"
			ls[i].parentNode.last = ls[i];
		}
		addEvent(ls[i],action,function(e) {
			var self = window.event?window.event.srcElement:e?e.target:null;
			if (self.parentNode.last) {
				self.parentNode.last.className = "normaltab";
				c[self.parentNode.last.index].className = "dis";
			};
		self.className = "hovertab";
		c[self.index].className = "app";
		self.parentNode.last = self;
		} );
	}
}

window.onload = function() {
	initTab("navmenu","submenu","mouseover",-1);
}