function initNavigation(seq) {
	nav = document.getElementById("topmenu");
	nav.menu = new Array();
	nav.current = null;
	nav.menuseq = 0;
	navLen = nav.childNodes.length;
	
	allA = nav.getElementsByTagName("a")
	for(k = 0; k < allA.length; k++) {
		allA.item(k).onmouseover = allA.item(k).onfocus = function () {
			nav.isOver = true;
		}
		allA.item(k).onmouseout = allA.item(k).onblur = function () {
			nav.isOver = false;
			setTimeout(function () {
				if (nav.isOver == false) {
					if (nav.menu[seq])
						nav.menu[seq].onmouseover();
					else if(nav.current) {
						menuImg = nav.current.childNodes.item(0);
						menuImg.src = menuImg.src.replace("_on.gif", ".gif");
						if (nav.current.submenu)
							nav.current.submenu.style.display = "none";
						nav.current = null;
					}
				}
			}, 500);
		}
	}

	for (i = 0; i < navLen; i++) {
		navItem = nav.childNodes.item(i);
		if (navItem.tagName != "LI")
			continue;

		navAnchor = navItem.getElementsByTagName("a").item(0);
		navAnchor.submenu = navItem.getElementsByTagName("ul").item(0);
		
		navAnchor.onmouseover = navAnchor.onfocus = function () {
			if (nav.current) {
				menuImg = nav.current.childNodes.item(0);
				menuImg.src = menuImg.src.replace("_on.gif", ".gif");
				if (nav.current.submenu)
					nav.current.submenu.style.display = "none";
				nav.current = null;
			}
			if (nav.current != this) {
				menuImg = this.childNodes.item(0);
				menuImg.src = menuImg.src.replace(".gif", "_on.gif");
				if (this.submenu)
					this.submenu.style.display = "block";
				nav.current = this;
			}
			nav.isOver = true;
		}
		nav.menuseq++;
		nav.menu[nav.menuseq] = navAnchor;
	}
	if (nav.menu[seq])
		nav.menu[seq].onmouseover();
}

var zoomRate = 10;			//확대/축소시 증감률
var maxRate = 160;			//최대확대률
var minRate = 100;			//최소축소률

function zoomInOut(contentid, how) {
	if(GetCookie("zoomVal") != null && GetCookie("zoomVal") != ""){
		document.body.style.zoom = GetCookie("zoomVal");
		currZoom=GetCookie("zoomVal");
	} else{
		document.body.style.zoom = '100%'; 
		currZoom = '100%';
	}
		
	if (((how == "in") && (parseInt(currZoom) >= maxRate)) || ((how == "out") && (parseInt(currZoom) <= minRate)) ) {
		return; 
	}
	if (how == "in") {
		document.body.style.zoom = parseInt(document.body.style.zoom)+zoomRate+'%'
	} else {
		document.body.style.zoom = parseInt(document.body.style.zoom)-zoomRate+'%'
	}
		SetCookie("zoomVal",document.body.style.zoom, 1);
}

function SetCookie( name, value, expiredays ){
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";" ;
}
	
function GetCookie( name )
{
	var nameOfCookie = name + "=";
	var x = 0;
	while ( x <= document.cookie.length ) {
		var y = (x+nameOfCookie.length);
			if ( document.cookie.substring( x, y ) == nameOfCookie ) {
				if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
					endOfCookie = document.cookie.length;
				return unescape( document.cookie.substring( y, endOfCookie ) );
			}
		x = document.cookie.indexOf( " ", x ) + 1;
		if ( x == 0 ) break;
	}
	return "";
}
	
function GoZoom(contentid){
	if(GetCookie("zoomVal") != null && GetCookie("zoomVal") != ""){
		document.body.style.zoom = GetCookie("zoomVal");
		currZoom=GetCookie("zoomVal");
	} else {
		document.body.style.zoom = '100%'; 
		currZoom = '100%';
	}
}

function initZoomDisplay(){
	var currZoom = "100%" ;
	if(GetCookie("zoomVal") != null && GetCookie("zoomVal") != ""){
		currZoom=GetCookie("zoomVal");
	}
}

function basicZoom(){
	var currZoom = "100%" ;
	document.body.style.zoom = currZoom ;
	SetCookie("zoomVal",document.body.style.zoom, 1);
}

function flashWrite(url,w,h,id,bg,win)
{
	// 플래시 코드 출력
	var flashStr=
	"<div id='__"+id+"__' style='z-index:100;'>"+
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
	"<param name='movie' value='"+url+"' />"+
	"<param name='wmode' value='"+win+"' />"+
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	"<param name='bgcolor' value='"+bg+"' />"+
	"<embed src='"+url+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object></div>";
	document.write(flashStr);
}

// iframe resize
function autoResize(i)
{
    var iframeHeight=
    (i).contentWindow.document.body.scrollHeight;
    (i).height=iframeHeight+20;
}
