
totalmenu = 8;
arrtotal = new Array(10,10,10,10,5,10,10,1);
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 (typeof(document.all["subMenu" + menu])!="undefined") {
			if(document.all["subMenu" + menu].style.visibility!="visible") {
				if(s==0) {hideAll()} else {hidesubAll()};
				width=parseInt(document.body.offsetWidth);
				if(Opera) {
					if(width<780) { poswidth=145+pos } else { poswidth=Math.ceil(((width-780)/2)+pos+145) }
					posheight = 147
				}
				else {
					if(width<780) { poswidth=135+pos } else { poswidth=Math.ceil(((width-780)/2)+pos+135) }
					posheight = 140
				}
				with (document.all["subMenu" + menu].style) {
					visibility="visible";
					pixelLeft=poswidth;
					pixelTop=posheight;
					cursor = "hand";
				}
				child = arrtotal[menu-1];
				for(i=1;i<=child;i++) {
					if (typeof(document.all["td" + menu + String.fromCharCode(96+i)])!="undefined") {
						with (document.all["td" + menu + String.fromCharCode(96+i)].style) {
							if(i==1) borderTop = "1px Solid #D1214E";
							borderBottom = "1px Solid #D1214E";
							borderLeft = "1px Solid #D1214E";
							borderRight = "1px Solid #D1214E";
						}
					}
				}
			}
		}
	}
	else if(NSL) {
		if (typeof(document.getElementsByTagName("div")["subMenu" + menu])!="undefined") {
			if(document.getElementsByTagName("div")["subMenu" + menu].style.visibility!="visible") {
				if(s==0) {hideAll()} else {hidesubAll()};
				width=parseInt(document.body.offsetWidth);
				if(width<780) { poswidth=135+pos } else { poswidth=Math.ceil(((width-780)/2)+144+pos) }
				posheight = 138;
				with (document.getElementsByTagName("div")["subMenu" + menu].style) {
					visibility="visible";
					left=poswidth;
					top=posheight;
				}
				child = arrtotal[menu-1];
				for(i=1;i<=child;i++) {
					if (eval("typeof(document.getElementById('td" + menu + String.fromCharCode(96+i) + "')) !='undefined'")) {
						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(typeof(document.layers["subMenu" + menu]) != "undefined") {
			if(document.layers["subMenu" + menu].visibility != "show") {
				if(s==0) {hideAll()} else {hidesubAll()};
				mmenu = true;
				width = mnL.innerWidth;
				if(width<780) { poswidth=145+pos } else { poswidth = Math.ceil(((width-780)/2)+136 + pos) }
				posheight = 145;
				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 (typeof(document.all["subMenu" + menu])!="undefined") {
			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<684) { poswidth=10+pos } else { poswidth=Math.ceil(((width-684)/2)+pos+10) }
					posheight = 155
				}
				else {
					if(width<684) { poswidth=0+pos } else { poswidth=Math.ceil(((width-684)/2)+pos+0) }
					posheight = 148
				}
				with (document.all["subMenu" + menu].style) {
					visibility="visible";
					pixelLeft=poswidth;
					pixelTop=posheight;
					cursor = "hand";
				}
				child = arrtotal[menu-1];
				for(i=1;i<=child;i++) {
					if (typeof(document.all["td" + menu + String.fromCharCode(96+i)])!="undefined") {
						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 (typeof(document.getElementsByTagName("div")["subMenu" + menu])!="undefined") {
			if(document.getElementsByTagName("div")["subMenu" + menu].style.visibility!="visible") {
				if(s==0) {hideAll()} else {hidesubAll()};
				width=parseInt(document.body.offsetWidth);
				if(width<684) { poswidth=0+pos } else { poswidth=Math.ceil(((width-684)/2)+9+pos) }
				posheight = 146;
				with (document.getElementsByTagName("div")["subMenu" + menu].style) {
					visibility="visible";
					left=poswidth;
					top=posheight;
				}
				child = arrtotal[menu-1];
				for(i=1;i<=child;i++) {
					if (eval("typeof(document.getElementById('td" + menu + String.fromCharCode(96+i) + "')) != 'undefined'")) {
						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(typeof(document.layers["subMenu" + menu]) != "undefined") {
			if(document.layers["subMenu" + menu].visibility != "show") {
				if(s==0) {hideAll()} else {hidesubAll()};
				mmenu = true;
				width = mnL.innerWidth;
				if(width<684) { poswidth=10+pos } else { poswidth = Math.ceil(((width-684)/2)+1 + pos) }
				posheight = 153;
				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(typeof(document.all["subMenu" + i]) != "undefined") {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(typeof(document.getElementsByTagName("div")["subMenu" + i]) != "undefined") {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(typeof(document.layers["subMenu" + i]) != "undefined") {
				document.layers["subMenu" + i].visibility = "hide"
			}
		}
	}
	kena();
	activemenu="";
	activesubmenu="";
}

function hidesubAll() {
	for (i=1;i<=totalmenu;i++) {
		if(IE4) {
			for(x=1;;x++) {
				if(typeof(document.all["subMenu" + i + "_" + x]) != "undefined") {
					document.all["subMenu" + i + "_" + x].style.visibility="hidden"
				}
				else {
					break;
				}
			}
		}
		else if(NSL) {
			for(x=1;;x++) {
				if(typeof(document.getElementsByTagName("div")["subMenu" + i + "_" + x]) != "undefined") {
					document.getElementsByTagName("div")["subMenu" + i + "_" + x].style.visibility="hidden"
				}
				else {
					break;
				}
			}
		}
		else if(NS4) {
			for(x=1;;x++) {
				if(typeof(document.layers["subMenu" + i + "_" + x]) != "undefined") {
					document.layers["subMenu" + i + "_" + x].style.visibility="hidden"
				}
				else {
					break;
				}
			}
		}
	}
	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 = "#000000";
	} else {
		clr="#000000";
		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 chgclr2(idname,clrname) {
	if (clrname) {
		clr="#000000";
		bgclr = "#FFCC55";
	} else {
		clr="#1111ff";
		bgclr = "#E5E0CE";
	};

	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 chgclr3(idname,clrname) {
	if (clrname) {
		clr="#000000";
		bgclr = "#FFE3A2";
	} else {
		clr="#000000";
		bgclr = "#FFCC55";
	};

	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='none'} else {hv='none'}
	if (currentTag) { currentTag.style.textDecoration=hv }
}
function on() {
	src=event.toElement;
	if (src.tagName=="A") {
		currentTag=src; hv='none'; 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='';}

function openPictureWindow_Fever(imageType,imageName,imageWidth,imageHeight,alt,posLeft,posTop) {  // v4.01
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",scrollbars=no,left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" style="margin:auto; text-align:center;" onBlur="self.close()">'); 
	if (imageType == "swf"){
	newWindow.document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
	newWindow.document.write('<param name=movie value=\"'+imageName+'\"><param name=quality value=high>');
	newWindow.document.write('<embed src=\"'+imageName+'\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
	newWindow.document.write('</embed></object>');	}else{
	newWindow.document.write('<img src=\"'+imageName+'\" width='+imageWidth+' height='+imageHeight+' alt=\"'+alt+'\">'); 	}
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}

