// tabbed menu
function initTabMenu(tabContainerID) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		thismenu = tabAnchor.item(i);

		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);
		thismenu.onclick = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
				if (currentmenu.imgEl) {
					currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on.gif", ".gif");
				} else {
					currentmenu.className = currentmenu.className.replace(" on", "");
				}
			}
			this.targetEl.style.display = "";
			if (this.imgEl) {
				this.imgEl.src = this.imgEl.src.replace(".gif", "_on.gif");
			} else {
				this.className += " on";
			}
			this.container.current = this;

			return false;
		};

		if (!thismenu.container.first)
			thismenu.container.first = thismenu;
	}
	if (tabContainer.first)
		tabContainer.first.onclick();
}

function tabMenuClick() {

	currentmenu = this.menuContainer.current;

	if (currentmenu != this) {

		currentmenu.targetEl.style.display = "none";

		currentmenu.getElementsByTagName("img").item(0).onmouseover = menuOver;

		currentmenu.getElementsByTagName("img").item(0).onmouseout = menuOut;

		currentmenu.getElementsByTagName("img").item(0).onmouseout();



		this.targetEl.style.display = "block";

		this.getElementsByTagName("img").item(0).onmouseover = null;

		this.getElementsByTagName("img").item(0).onmouseout = null;

		this.menuContainer.current = this;

	}

	return false;
}



//rollover menu//
<!--
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];}
}

//select menu//
function hun_href(sel){
	var index=sel.selectedIndex;
	href_value=sel.options[index].value;
	self.location=href_value;
}

function q_href(){
	sel=href.q.selectedIndex;
	href_value=href.q.options[sel].value;
	window.open(href_value,"","");
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


//image view//
function pop(title,image,width,height){
	window.open("./pop.html?title="+title+"&image="+image,"win2","width="+width+",height="+height);
}


//select//
function hun_href(sel){
	var index=sel.selectedIndex;
	href_value=sel.options[index].value;
	self.location=href_value;
}

//bluring
function bluring(){ 
if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") 

document.body.focus(); 
} 
document.onfocusin=bluring; 

/*
function allblur() { 
for (i = 0; i < document.links.length; i++) 
document.links[i].onfocus = document.links[i].blur; 
} 
window.onload=allblur
*/

//search
function ch (form_name) {
	str_tmp="document.reser."+form_name+".style";
	eval(str_tmp).backgroundImage="";
}

/* ¸Þ´º 20090405 */
// top-link
function getPosition(){
	var start, end, scale, term;
	start = parseInt (document.getElementById('top-link').style.top, 10);
	end = document.documentElement.scrollTop + 130;
	term = 5;

	if ( start != end ) {
	scale = Math.ceil( Math.abs( end - start ) / 20 );
		if ( end < start )	scale = -scale;
		document.getElementById('top-link').style.top = parseInt (document.getElementById('top-link').style.top, 10)+ scale + "px";
		term = 1;
	}
	setTimeout ("getPosition()", term);
}
function moveBanner() {
	document.getElementById('top-link').style.top = document.documentElement.scrollTop + 300 + "px";
	getPosition();
	return true;
}

//Element ID ºÒ·¯¾²±â
function dEI(elementID){
	return document.getElementById(elementID);
}

/* ¸Þ´º½ºÅ©¸³Æ® */
function onTopNavi(viewNum){
	for(var i =1;i<6; i++){
		var onList=dEI("E0"+i);
		var onImg=onList.getElementsByTagName("img").item(0);
		if(i==viewNum){
			onList.className="on";
			var ImgCheck = onImg.src.substring(onImg.src.length-6,onImg.src.length);
			if (ImgCheck!="on.gif") {
				onImg.src = onImg.src.replace(".gif", "on.gif");
			}
		}else{
			onList.className="";
				if (ImgCheck="on.gif") {
				onImg.src = onImg.src.replace("on.gif", ".gif");
			}

		}
	}
}

function imgRollover(imgBoxID){
	var MenuCounts = dEI(imgBoxID).getElementsByTagName("img");
	for (i=0;i<MenuCounts.length;i++) {

		var numImg=MenuCounts.item(i);
		var ImgCheck = numImg.src.substring(numImg.src.length-6,numImg.src.length);
		if (ImgCheck!="on.gif") {
				numImg.onmouseover = function () {
					this.src = this.src.replace(".gif", "on.gif");
				}
				numImg.onmouseout = function () {
					this.src = this.src.replace("on.gif", ".gif");
				}
			}
	}
}

// ÇÃ·ÎÅÍ
//ex) JSFX_FloatDiv("wing",880,143).floatIt(); //ÇÃ·ÎÅÍ °´Ã¼ ¾Æ·¡¿¡ »ðÀÔ
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
function JSFX_FloatDiv(id, sx, sy)
{
	var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
	var px = document.layers ? "" : "px";
	window[id + "_obj"] = el;
	if(d.layers)el.style=el;
	el.cx = el.sx = sx;el.cy = el.sy = sy;
	el.sP=function(x,y){this.style.left=x+px;this.style.top=y+px;};

	el.floatIt=function()
	{
		var pX, pY;
		pX = (this.sx >= 0) ? 0 : ns ? innerWidth : 
		document.documentElement && document.documentElement.clientWidth ? 
		document.documentElement.clientWidth : document.body.clientWidth;
		pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? 
		document.documentElement.scrollTop : document.body.scrollTop;
		if(this.sy<0) 
		pY += ns ? innerHeight : document.documentElement && document.documentElement.clientHeight ? 
		document.documentElement.clientHeight : document.body.clientHeight;
		this.cx += (pX + this.sx - this.cx)/8;this.cy += (pY + this.sy - this.cy)/8;
		this.sP(this.cx, this.cy);
		setTimeout(this.id + "_obj.floatIt()", 40);
	}
	return el;
}

// ÇÃ·ÎÅÍ - ¹üÀ§Á¦ÇÑ
//ex) initMoving("idname",884,500);
function initMoving(id,xleft,ytop) {
	target = document.getElementById(id);
	if (!target) return false;
	var obj = target;
	obj.initLeft = xleft;//Àý´ëÁÂÇ¥x
	obj.initTop = ytop;//Àý´ëÁÂÇ¥y
	obj.bottomLimit = document.documentElement.scrollHeight - 175;
	//obj.topLimit = 550;
	obj.topLimit = 290;

	obj.style.position = "absolute";
	obj.top = obj.initTop;
	obj.left = obj.initLeft;
	obj.style.top = obj.top + "px";
	obj.style.left = obj.left + "px";

	obj.getTop = function() {
		if (document.documentElement.scrollTop) {
			return document.documentElement.scrollTop;
		} else if (window.pageYOffset) {
			return window.pageYOffset;
		} else {
			return 0;
		}
	}
	obj.getHeight = function() {
		if (self.innerHeight) {
			return self.innerHeight;
		} else if(document.documentElement.clientHeight) {
			return document.documentElement.clientHeight;
		} else {
			return 500;
		}
	}
	obj.move = setInterval(function() {
		pos = obj.getTop() + obj.getHeight() / 2 - 15;

		if (pos > obj.bottomLimit)
			pos = obj.bottomLimit
		if (pos < obj.topLimit)
			pos = obj.topLimit

		interval = obj.top - pos;
		obj.top = obj.top - interval / 3;
		obj.style.top = obj.top + "px";
	}, 40)
}
