
totalmenu = 1;
arrtotal = new Array(3);
NS4 = (document.layers);
IE4 = (document.all);
NSL = (document.getElementById);
var download;
var loader = 0;
Opera = false;
navname = navigator.userAgent;
activemenu = "";
activesubmenu = "";
mmenu = false;
if (IE4) {Opera = (navname.indexOf("Opera")!=-1)};

if (!Opera) {
	mnL = eval("parent.frames");
	if (NS4) mnL.document.captureEvents(Event.MOUSEDOWN);
	mnL.document.onmousedown = clicked;
}

function clicked() { loader=setTimeout("hideAll()",2000)};

hv=0; currentTag=0;
v=navigator.appVersion.substring(0,1);

if((navname.lastIndexOf("MSIE") != -1) && (v != '1') && (v != '2') && (v != '3')) {
	document.onmouseover=on;
	document.onmouseout=off;
	window.setInterval(onoff,300);
}

function tshowmenu(menu,pos,s) {
	kena();
	if (s==0) {activemenu=menu } else {activesubmenu = menu};
	if(IE4) {
		if(document.all["subMenu" + menu].style.visibility!="visible") {
			if(s==0) {hideAll()} else {hidesubAll()};
			width=parseInt(document.body.offsetWidth);
			if(Opera) {
				if(width<800) { poswidth=157+pos } else { poswidth=Math.ceil(((width-800)/2)+pos+157) }
				posheight = 461
			}
			else {
				if(width<800) { poswidth=157+pos } else { poswidth=Math.ceil(((width-800)/2)+pos+157) }
				posheight = 462
			}
			with (document.all["subMenu" + menu].style) {
				visibility="visible";
				pixelLeft=poswidth;
				pixelTop=posheight;
				cursor = "hand";
			}
			child = arrtotal[menu-1];
			for(i=1;i<=child;i++) {
				with (document.all["td" + menu + String.fromCharCode(96+i)].style) {
					if(i==1) borderTop = "1px Solid #000000";
					borderBottom = "1px Solid #000000";
					borderLeft = "1px Solid #000000";
					borderRight = "1px Solid #000000";
				}
			}
		}
	}
	else if(NSL) {
		if(document.getElementsByTagName("div")["subMenu" + menu].style.visibility!="visible") {
			if(s==0) {hideAll()} else {hidesubAll()};
			width=parseInt(document.body.offsetWidth);
			if(width<800) { poswidth=157+pos } else { poswidth=Math.ceil(((width-800)/2)+158+pos) }
			posheight = 450;
			with (document.getElementsByTagName("div")["subMenu" + menu].style) {
				visibility="visible";
				left=poswidth;
				top=posheight;
				border = "1px Solid #DC2282";
			}
			child = arrtotal[menu-1];
			for(i=1;i<=child;i++) {
				if(i==1) eval("document.getElementById('td" + menu + String.fromCharCode(96+i) + "').style.borderTop = '1px Solid #000000';");
				eval("document.getElementById('td" + menu + String.fromCharCode(96+i) + "').style.borderBottom = '1px Solid #000000';");
				eval("document.getElementById('td" + menu + String.fromCharCode(96+i) + "').style.borderLeft = '1px Solid #000000';");
				eval("document.getElementById('td" + menu + String.fromCharCode(96+i) + "').style.borderRight = '1px Solid #000000';");
			}
		}
	}	
	else if(NS4) {
		if(document.layers["subMenu" + menu].visibility != "show") {
			if(s==0) {hideAll()} else {hidesubAll()};
			mmenu = true;
			width = mnL.innerWidth;
			if(width<800) { poswidth=157+pos } else { poswidth = Math.ceil(((width-800)/2)+148+pos) }
			posheight = 457;
			document.layers["subMenu" + menu].visibility = "show";
			document.layers["subMenu" + menu].left = poswidth;
			document.layers["subMenu" + menu].top = posheight;
			document.layers["subMenu" + menu].onMouseOver = kenamenu;
			document.layers["subMenu" + menu].onMouseOut = keluarmenu;
		}
	}
}

function showmenu(menu,pos,s) {
	kena();
	if(IE4) {
		if(document.all["subMenu" + menu].style.visibility!="visible") {
			if(s==0) {hideAll()} else {hidemenu(menu,s)};
			width=parseInt(document.body.offsetWidth);
			if(Opera) {
				if(width<800) { poswidth=157+pos } else { poswidth=Math.ceil(((width-800)/2)+pos+157) }
				posheight = 459
			}
			else {
				if(width<800) { poswidth=157+pos } else { poswidth=Math.ceil(((width-800)/2)+pos+157) }
				posheight = 452
			}
			with (document.all["subMenu" + menu].style) {
				visibility="visible";
				pixelLeft=poswidth;
				pixelTop=posheight;
				cursor = "hand";
			}
			child = arrtotal[menu-1];
			for(i=1;i<=child;i++) {
				with (document.all["td" + menu + String.fromCharCode(96+i)].style) {
					if(i==1) borderTop = "1px Solid #000000";
					borderBottom = "1px Solid #000000";
					borderLeft = "1px Solid #000000";
					borderRight = "1px Solid #000000";
				}
			}
		}
	}
	else if(NSL) {
		if(document.getElementsByTagName("div")["subMenu" + menu].style.visibility!="visible") {
			if(s==0) {hideAll()} else {hidesubAll()};
			width=parseInt(document.body.offsetWidth);
			if(width<800) { poswidth=152+pos } else { poswidth=Math.ceil(((width-800)/2)+151+pos) }
			posheight = 445;
			with (document.getElementsByTagName("div")["subMenu" + menu].style) {
				visibility="visible";
				left=poswidth;
				top=posheight;
			}
			child = arrtotal[menu-1];
			for(i=1;i<=child;i++) {
				if(i==1) eval("document.getElementById('td" + menu + String.fromCharCode(96+i) + "').style.borderTop = '1px Solid #000000';");
				eval("document.getElementById('td" + menu + String.fromCharCode(96+i) + "').style.borderBottom = '1px Solid #000000';");
				eval("document.getElementById('td" + menu + String.fromCharCode(96+i) + "').style.borderLeft = '1px Solid #000000';");
				eval("document.getElementById('td" + menu + String.fromCharCode(96+i) + "').style.borderRight = '1px Solid #000000';");
			}
		}
	}	
	else if(NS4) {
		if(document.layers["subMenu" + menu].visibility != "show") {
			if(s==0) {hideAll()} else {hidesubAll()};
			mmenu = true;
			width = mnL.innerWidth;
			if(width<800) { poswidth=157+pos } else { poswidth = Math.ceil(((width-800)/2)+1657+pos) }
			posheight = 457;
			document.layers["subMenu" + menu].visibility = "show";
			document.layers["subMenu" + menu].left = poswidth;
			document.layers["subMenu" + menu].top = posheight;
			document.layers["subMenu" + menu].onMouseOver = kenamenu;
			document.layers["subMenu" + menu].onMouseOut = keluarmenu;
		}
	}
}

function hideAll() {
	for (i=1;i<=totalmenu;i++) {
		if(IE4) {
			if(document.all["subMenu" + i] != null) {document.all["subMenu" + i].style.visibility="hidden"}
			for(x=1;;x++) {
				if(document.all["subMenu" + i + "_" + x] != null) {
					document.all["subMenu" + i + "_" + x].style.visibility="hidden"
				}
				else {
					break;
				}
			}
		}
		else if(NSL) {
			if(document.getElementsByTagName("div")["subMenu" + i] != null) {document.getElementsByTagName("div")["subMenu" + i].style.visibility="hidden" }
			for(x=1;;x++) {
				if(document.getElementsByTagName("div")["subMenu" + i + "_" + x] != null) {
					document.getElementsByTagName("div")["subMenu" + i + "_" + x].style.visibility="hidden"
				}
				else {
					break;
				}
			}
		}
		else if(NS4) {
			if(document.layers["subMenu" + i] != null) {document.layers["subMenu" + i].visibility = "hide"}
		}
	}
	kena();
	activemenu="";
	activesubmenu="";
}

function hidesubAll() {
	for (i=1;i<=totalmenu;i++) {
		if(IE4) {
			for(x=1;;x++) {
				if(document.all["subMenu" + i + "_" + x] != null) {
					document.all["subMenu" + i + "_" + x].style.visibility="hidden"
				}
				else {
					break;
				}
			}
		}
		else if(NSL) {
			for(x=1;;x++) {
				if(document.getElementsByTagName("div")["subMenu" + i + "_" + x] != null) {
					document.getElementsByTagName("div")["subMenu" + i + "_" + x].style.visibility="hidden"
				}
				else {
					break;
				}
			}
		}
		else if(NS4) {
		}
	}
	kena();
	activesubmenu="";
}

function hidemenu(menu,s) {
	if(s==0) {
		if(activemenu!=menu) {loader=setTimeout("hideAll()",200) }
	}
	else {
		if(activesubmenu!=menu) {loader=setTimeout("hidesubAll()",200) }
	}
}

function thidemenu(s) {
	if(s==0) {
		loader=setTimeout("hideAll()",200) 
	} 
	else { 
		loader=setTimeout("hidesubAll()",300) 
	}
}

function kena(){ clearTimeout(loader);}
function kenamenu(menu){clearTimeout(loader);}
function keluarmenu() {loader=setTimeout("hideAll()",200);}

function chgclr(idname,clrname) {
	if (clrname) {
		clr="#FFFFFF";
		bgclr = "#D1214E";
	} else {
		clr="#D1214E";
		bgclr = "#FFFFFF";
	};

	if((IE4)&&(!Opera)){
		eval("font" + idname + ".style.color='" + clr + "'");
		eval("td" + idname + ".style.background='" + bgclr + "'");
	}
	else if (NSL) {
		eval("document.getElementById('font" + idname + "').style.color='" + clr + "'");
		eval("document.getElementById('td" + idname + "').style.background='" + bgclr + "'");
	}
}

function linkit(nil) {
	location.href = nil;
}

function onoff() {
	if (hv=='none') {hv='underline'} else {hv='none'}
	if (currentTag) { currentTag.style.textDecoration=hv }
}
function on() {
	src=event.toElement;
	if (src.tagName=="A") {
		currentTag=src; hv='underline'; src.style.textDecoration=hv;
	}
}
function off() {
	src=event.fromElement;
	if (src.tagName=="A") {
		currentTag=0; hv='none'; src.style.textDecoration=hv;
	}
}

function onColor(frm) {frm.style.backgroundColor='#EC8904';}

function offColor(frm) {frm.style.backgroundColor='';}
