// JavaScript Document




/*-------------------------------------------------------------

	drop down menu

-------------------------------------------------------------*/

var mmOpenContainer = null;
var mmOpenMenus = null;
var mmHideMenuTimer = null;

function MM_menuStartTimeout(hideTimeout) {
	mmHideMenuTimer = setTimeout("MM_menuHideMenus()", hideTimeout);	
}

function MM_menuHideMenus() {
	MM_menuResetTimeout();
	if(mmOpenContainer) {
		var c = document.getElementById(mmOpenContainer);
		c.style.visibility = "inherit";
		mmOpenContainer = null;
	}
	if( mmOpenMenus ) {
		for(var i in mmOpenMenus) {
			var m = document.getElementById(mmOpenMenus[i]);
			m.style.visibility = "hidden";			
		}
		mmOpenMenus = null;
	}
}

function MM_menuHideSubmenus(menuName) {
	if( mmOpenMenus ) {
		var h = false;
		var c = 0;
		for(var i in mmOpenMenus) {
			if( h ) {
				var m = document.getElementById(mmOpenMenus[i]);
				m.style.visibility = "hidden";
			} else if( mmOpenMenus[i] == menuName ) {
				h = true;
			} else {
				c++;
			}
		}
		mmOpenMenus.length = c+1;
	}
}

function MM_menuOverMenuItem(menuName, subMenuSuffix) {
	MM_menuResetTimeout();
	MM_menuHideSubmenus(menuName);
	if( subMenuSuffix ) {
		var subMenuName = "" + menuName + "_" + subMenuSuffix;
		MM_menuShowSubMenu(subMenuName);
	}
}

function MM_menuShowSubMenu(subMenuName) {
	MM_menuResetTimeout();
	var e = document.getElementById(subMenuName);
	e.style.visibility = "inherit";
	if( !mmOpenMenus ) {
		mmOpenMenus = new Array;
	}
	mmOpenMenus[mmOpenMenus.length] = "" + subMenuName;
}

function MM_menuResetTimeout() {
	if (mmHideMenuTimer) clearTimeout(mmHideMenuTimer);
	mmHideMenuTimer = null;
}

function MM_menuShowMenu(containName, menuName, triggerName) {
	MM_menuHideMenus();
	MM_menuResetTimeout();
	MM_menuShowMenuContainer(containName, triggerName);
	MM_menuShowSubMenu(menuName);
}

function MM_menuShowMenuContainer(containName, triggerName) {	
	var c = document.getElementById(containName);
	var s = c.style;
	s.visibility = "inherit";
	
	mmOpenContainer = "" + containName;
}
/*-------------------------------------------------------------

	swap image

-------------------------------------------------------------*/

function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


/*-------------------------------------------------------------

	window scroll

-------------------------------------------------------------*/

var Mac = (navigator.appVersion.indexOf('Mac',0) != -1);
var Win = (navigator.appVersion.indexOf('Win',0) != -1);
var IE  = (getBrouwserName() == 'Explorer');
var NN  = (getBrouwserName() == 'Netscape');
var Moz = (navigator.userAgent.indexOf("Gecko") != -1);
var VER = parseInt(navigator.appVersion);
var ver = navigator.appVersion;
var Vmajor = parseInt(navigator.appVersion);	// ex. 3
var Vminor = parseFloat(navigator.appVersion);	// ex. 3.01
var MacIE5 = ((Mac && navigator.appVersion.indexOf('MSIE 5',0) != -1) || (Mac && IE && VER > 4));
var MacIE4 = ((Mac && navigator.appVersion.indexOf('MSIE 4.',0) != -1));
var MacIE3 = ((Mac && navigator.appVersion.indexOf('MSIE 3.',0) != -1));
var MIE4 = (Mac && IE && VER == 4);
var WinIE = (Win && IE);
var IE6 = (ver.indexOf("MSIE 6")>-1);
var IE55 = (ver.indexOf("MSIE 5.5")>-1);
var IE5 = (ver.indexOf("MSIE 5")>-1);
var IE56 = (IE6||IE55||IE5);

var NN40 = (NN && navigator.appVersion.indexOf('4.0',0) != -1);

function getBrouwserName() {
	var ap = navigator.appName;
	var ua = navigator.userAgent;

	if (ap.indexOf("Microsoft Internet Explorer",0) != -1) return "Explorer";
	if (ap.indexOf("Netscape",0) != -1) return "Netscape";
	return "";
}

var pageScrollTimer;

function pageScroll(toX,toY,frms) {
	var tmpX = 0 + getScrollLeft();
	var tmpY = 0 + getScrollTop();
	var cuX = tmpX;
	var cuY = tmpY;

	if (pageScrollTimer) clearTimeout(pageScrollTimer);

	if (!toX || toX < 0 ) {toX = 0;}  
	if (!toY || toY < 0 ) {toY = 0;}

	if (!frms) frms = 6;

	cuX += (toX - getScrollLeft()) / frms;
	if (cuX < 0) cuX = 0;
	cuY += (toY - getScrollTop()) / frms;
	if (cuY < 0) cuY = 0;

	var posX = Math.floor(cuX);
	var posY = Math.floor(cuY);

	if (posX == tmpX) posX = toX;
	if (posY == tmpY) posX = toY;

	window.scrollTo(posX, posY);

	if (posX != getScrollLeft()) toX = getScrollLeft();
	if (posY != getScrollTop()) toY = getScrollTop();

	if (posX != toX || posY != toY) {
		pageScrollTimer = setTimeout("pageScroll("+toX+","+toY+","+frms+")",16);
	}
}

function jumpToPageTop() {
	if (!MacIE3 && !MacIE4 && !NN && window.scrollTo || NN && (Vminor >= 4.75) && window.scrollTo) {
		pageScroll(0,0,5);
	}else{
		location.hash="top";
	}
}

function getScrollLeft() {
	if ((navigator.appName.indexOf("Microsoft Internet Explorer",0) != -1)) {
		return document.body.scrollLeft;
	}else if(window.pageXOffset) {
		return window.pageXOffset;
	}else{
		return 0;
	}
}

function getScrollTop() {
	if ((navigator.appName.indexOf("Microsoft Internet Explorer",0) != -1)) {
		return document.body.scrollTop;
	} else if (window.pageYOffset) {
		return window.pageYOffset;
	} else {
		return 0;
	}
}


/*-------------------------------------------------------------

	pop up window

-------------------------------------------------------------*/

function disp(url, width, height){
	window.open(url, "window01", "width=" + width + ",height=" + height + ",menubar=no,toolbar=no,scrollbars=yes,resizable=no");
}


/*-------------------------------------------------------------

	jump menu

-------------------------------------------------------------*/

function popJump(selOBJ) {
	n = selOBJ.selectedIndex;
	location.href = selOBJ.options[n].value;
}



