/* Å¾ ¸Þ´º
---------------------------------------------------------*/
function initNavigation(seq, menuid) {
	seq = 0; /* ¼­ºê¸Þ´ºÈ°¼ºÈ­ ¾È½ÃÅ´. 20100325 */

	if(!menuid)
		var nav = document.getElementById("mainMenu");
	else
		var nav = document.getElementById(menuid);

	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;
						}

					}
				}
			}, 1000);
		}
	}

	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);

		if (navAnchor.submenu) {
			navAnchor.submenu.style.display = "none";
		}

		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("_on.gif", ".gif");
				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();

}

/* ÅÇ ¸Þ´º
---------------------------------------------------------*/
function initTabMenu(tabContainerID,useImgRoll,useOnMouse) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;
	var imgRoll = 0;
	var onMouse = 0;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "tab")
			thismenu = tabAnchor.item(i);
		else
			continue;

		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);

		/* tab menu event */
		onMouse = useOnMouse;

		if(onMouse) {
			thismenu.onmouseover = thismenu.onfocus = 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("_on.gif", ".gif");
					this.imgEl.src = this.imgEl.src.replace(".gif", "_on.gif");
				} else {
					this.className += " on";
				}
				this.container.current = this;

				return false;
			}
		}
		else {
			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("_on.gif", ".gif");
					this.imgEl.src = this.imgEl.src.replace(".gif", "_on.gif");
				} else {
					this.className += " on";
				}
				this.container.current = this;

				return false;
			}

			/* tab img rollover */
			imgRoll = useImgRoll;

			if(imgRoll) {
				thismenu.onmouseover = thismenu.onfocus = function() {
					tabImg = this.getElementsByTagName("img").item(0);
					tabImg.src = tabImg.src.replace("_on.gif", ".gif");
					tabImg.src = tabImg.src.replace(".gif", "_on.gif");
				}
				thismenu.onmouseout = thismenu.onblur = function() {
					currentmenu = this.container.current;
					if (currentmenu == this)
						return false;

					tabImg = this.getElementsByTagName("img").item(0);
					tabImg.src = tabImg.src.replace("_on.gif", ".gif");
				}
			}
			/* end tab img rollover */
		}
		/* end tab menu event */

		if (!thismenu.container.first)
			thismenu.container.first = thismenu;
	}
	if (tabContainer.first) {
		if(onMouse)
			tabContainer.first.onmouseover();
		else
			tabContainer.first.onclick();
	}
}


/*========================================
js_rolling.js

#°£´Ü¼³¸í
<div><img /><img /></div>
¶ó°í ÇßÀ» °æ¿ì div¾ÈÀÇ img¸¦ À§,¿À¸¥ÂÊ,¾Æ·¡,¿ÞÂÊÀ¸·Î ·Ñ¸µ ½ÃÅ²´Ù.




# »ç¿ë¹ý
<script type="text/javascript" charset='utf-8' src="js_rolling.js"></script> 
//JS½ºÅ©¸³Æ® ·Îµå

<div id='div1'><img /><img /><img /><img /><img /></div>
//Ã³·³ ±¸¼ºÈÄ divÀÇ ³Êºñ¿Í ³ôÀÌ´Â ²À Á¤ÇØÁÖ±â ¹Ù¶ø´Ï´Ù.
<div>
	<div>1<img />etc</div>
	<div>2</div>
	<div>3</div>
	<div>4</div>
</div>
ÀÌ·¸°Ô ±¸¼ºÇÒ °æ¿ì ¹æÇâÀº À§,¾Æ·¡·Î¸¸ °¡´ÉÇÕ´Ï´Ù


var roll = new js_rolling('rolling');
or
var roll = new js_rolling(document.getElementById('rolling'));
// idÀÌ¸§À» Àû´øÁö, Á÷Á¢ ´ë»óÀ» Áö¸ñÇØ¼­ ·Ñ¸µ Å¬·¡½º·Î °´Ã¼¸¦ ¸¸µë

roll.set_direction(4); // ¹æÇâÀ» ¹Ù²Þ. 1: top, 2:right, 3:bottom 4:left ±×¿ÜÀÇ °æ¿ì µ¿ÀÛ¾ÈÇÔ
roll.move_gap = 1;	//¿òÁ÷ÀÌ´Â ÇÈ¼¿´ÜÀ§
roll.time_dealy = 10; //¿òÁ÷ÀÌ´Â Å¸ÀÓµô·¹ÀÌ
roll.time_dealy_pause = 5000;//ÇÏ³ªÀÇ ´ë»óÀÌ »õ·Î ½ÃÀÛÇÒ ¶§ ¸ØÃß´Â ½Ã°£, 0 ÀÌ¸é Àû¿ë ¾ÈÇÔ
roll.start(); //·Ñ¸µ µ¿ÀÛ

roll.move_up(); //À§·Î ÇÑ¹ø ·Ñ¸µ (¹æÇâÀÌ top,bottonÀÏ¶§¸¸ µ¿ÀÛ)
roll.move_right(); //¿À¸¥ÂÊÀ¸·Î ÇÑ¹ø ·Ñ¸µ(¹æÇâÀÌ right,leftÀÏ¶§¸¸ µ¿ÀÛ)
roll.move_down(); //¾Æ·¡·Î ÇÑ¹ø ·Ñ¸µ(¹æÇâÀÌ top,bottonÀÏ¶§¸¸ µ¿ÀÛ)
roll.move_left(); //¿ÞÂÊÀ¸·Î ÇÑ¹ø ·Ñ¸µ(¹æÇâÀÌ right,leftÀÏ¶§¸¸ µ¿ÀÛ)

roll.direction = {¹æÇâ¼ýÀÚ} //»ç¿ë½Ã ÁÖÀÇ : ÃÊ±âÈ­¸¦ ½ÃÅ°Áö ¾Ê°í ¹æÇâ¸¸ ¹Ù²Ù´Â °ÍÀ¸·Î left:right , top:bottom À¸·Î¸¸ Â¦À» ÀÌ·ï ½á¾ßÇÑ´Ù
roll.mouseover_pause = true , false //true¸é ¸¶¿ì½º¿À¹ö ½Ã ¸ØÃã(±âº»°ª), false ¸é ¸¶¿ì½º¿À¹ö¿¡¼­µµ °è¼Ó ·Ñ¸µÇÔ

#ÁÖÀÇ
¹æÇâÀÌ top,bottomÀÏ °æ¿ì ³»ºÎ ÅÂ±×´Â block¿ä¼Ò(div)·Î
¹æÇâÀÌ left,rightÀÏ °æ¿ì ³»ºÎÅÂ±×´Â inline¿ä¼Ò(a,span)À¸·Î ÇØ¼ö¼¼¿ä.
FF¿¡¼­ top,bottomÀÇ °æ¿ì inline¿ä¼ÒÀÏ °æ¿ì offsetHeight¸¦ Àß¸ø¾Ë¾Æ¿É´Ï´Ù.
ÀÌ¹ÌÁö°¡ ³¡ ºÎºÐ¿¡¼­ °©ÀÚ±â ³ªÅ¸³ª´Â Çö»óÀÌ ÀÖÀ» °æ¿ì ³»ºÎ ÀÌ¹ÌÁöµéÀÇ ¼ö¸¦ 2¹è·Î ´Ã·ÁÁÖ¼¼¿ä.(1,2,3 ÀÌ¸é 1,2,3,1,2,3 Ã³·³ º¸ÀÌµµ·Ï)


#»ç¿ëÁ¦¾à
»ç¿ë½Ã "°ø´ë¿©ÀÚ´Â ¿¹»Ú´Ù"¸¦ ³ªÅ¸³»¼Å¾ßÇÕ´Ï´Ù.

¸¸µç³¯ : 2007-06-07
¼öÁ¤ÀÏ : 2007-08-11
¼öÁ¤ÀÏ : 2008-08-08
¸¸µçÀÌ : mins01,mins,°ø´ë¿©ÀÚ
È¨ÆäÀÌÁö : http://www.mins01.com 
NateOn&MSN : mins01(at)lycos.co.kr
========================================*/
var js_rolling = function(box){
	// ½Ã°£´ÜÀ§´Â ms·Î 1000ÀÌ 1ÃÊ
	if(box.nodeType==1){
		this.box = box;
	}else{
		this.box = document.getElementById(box);
	}
	this.is_rolling = false;
	this.mouseover_pause = true;
	this.direction = 1; //1:top, 2:right, 3:bottom, 4:left (½Ã°è¹æÇâ) // 1¹ø°ú 4¹ø¸¸ µÊ
	this.children =	null;
	this.move_gap = 1;	//¿òÁ÷ÀÌ´Â ÇÈ¼¿´ÜÀ§
	this.time_dealy = 50; //¿òÁ÷ÀÌ´Â Å¸ÀÓµô·¹ÀÌ
	this.time_dealy_pause = 1000;//ÇÏ³ªÀÇ ´ë»óÀÌ »õ·Î ½ÃÀÛÇÒ ¶§ ¸ØÃß´Â ½Ã°£, 0 ÀÌ¸é Àû¿ë ¾ÈÇÔ
	this.time_timer=null;
	this.time_timer_pause=null;
	this.mouseover=false;
	this.init();
	this.set_direction(this.direction);
}
js_rolling.prototype.init = function(){
	this.box.style.position='relative';
	this.box.style.overflow='hidden';
	var children = this.box.childNodes;
	for(var i=(children.length-1);0<=i;i--){
		if(children[i].nodeType==1){
			children[i].style.position='relative';
		}else{
			this.box.removeChild(children[i]);
		}
	}
	var thisC=this;

	this.box.onmouseover=function(){
		if(!thisC.mouseover_pause){	return;	}
		thisC.mouseover=true;
		if(!thisC.time_timer_pause){
			thisC.pause();
		}
	}
	this.box.onmouseout=function(){
		if(!thisC.mouseover_pause){return;}
		thisC.mouseover=false;
		if(!thisC.time_timer_pause){
			thisC.resume();
		}
	}	
}
js_rolling.prototype.set_direction = function(direction){
	this.direction=direction;
	if(this.direction==2 ||this.direction==4){
		this.box.style.whiteSpace='nowrap';
	}else{
		this.box.style.whiteSpace='normal';
	}
	var children = this.box.childNodes;
	for(var i=(children.length-1);0<=i;i--){
			if(this.direction==1){
				children[i].style.display='block';
			}else if(this.direction==2){
				children[i].style.textlign='right';
				children[i].style.display='inline';
			}else if(this.direction==3){
				children[i].style.display='block';
			}else if(this.direction==4){
				children[i].style.display='inline';
			}
	}
	this.init_element_children();	
}
js_rolling.prototype.init_element_children = function(){
	var children = this.box.childNodes;
	this.children = children;
	for(var i=(children.length-1);0<=i;i--){
			if(this.direction==1){
				children[i].style.top='0px';
			}else if(this.direction==2){
				children[i].style.left='-'+this.box.firstChild.offsetWidth+'px';
			}else if(this.direction==3){
				children[i].style.top='-'+this.box.firstChild.offsetHeight+'px';
			}else if(this.direction==4){
				children[i].style.left='0px';
			}
	}
}
js_rolling.prototype.act_move_up = function(){
	for(var i = 0,m=this.children.length;i<m;i++){
		var child = this.children[i];
		child.style.top=(parseInt(child.style.top)-this.move_gap)+'px';
	}
	if((this.children[0].offsetHeight+parseInt(this.children[0].style.top))<=0){
		this.box.appendChild(this.children[0]);
		this.init_element_children();
		this.pause_act();		
	}
}
js_rolling.prototype.move_up = function(){
	if(this.direction!=1&&this.direction!=3){return false;}
	this.box.appendChild(this.children[0]);
	this.init_element_children();
	this.pause_act();	
}
js_rolling.prototype.act_move_down = function(){
	for(var i = 0,m=this.children.length;i<m;i++){
		var child = this.children[i];
		child.style.top=(parseInt(child.style.top)+this.move_gap)+'px';
	}
	if(parseInt(this.children[0].style.top)>=0){
		this.box.insertBefore(this.box.lastChild,this.box.firstChild);
		this.init_element_children();
		this.pause_act();	
	}
}
js_rolling.prototype.move_down = function(){
	if(this.direction!=1&&this.direction!=3){return false;}	
	this.box.insertBefore(this.box.lastChild,this.box.firstChild);
	this.init_element_children();
	this.pause_act();
}
js_rolling.prototype.act_move_left = function(){
	for(var i = 0,m=this.children.length;i<m;i++){
		var child = this.children[i];
		child.style.left=(parseInt(child.style.left)-this.move_gap)+'px';
	}
	if((this.children[0].offsetWidth+parseInt(this.children[0].style.left))<=0){
		this.box.appendChild(this.box.firstChild);
		this.init_element_children();
		this.pause_act();		
	}
}
js_rolling.prototype.move_left = function(){
	if(this.direction!=2&&this.direction!=4){return false;}		
	this.box.appendChild(this.box.firstChild);
	this.init_element_children();
	this.pause_act();		
}
js_rolling.prototype.act_move_right = function(){
	for(var i = 0,m=this.children.length;i<m;i++){
		var child = this.children[i];
		child.style.left=(parseInt(child.style.left)+this.move_gap)+'px';
	}
	
	if(parseInt(this.box.lastChild.style.left)>=0){
		this.box.insertBefore(this.box.lastChild,this.box.firstChild);
		this.init_element_children();
		this.pause_act();		
	}
}
js_rolling.prototype.move_right = function(){
	if(this.direction!=2&&this.direction!=4){return false;}			
	this.box.insertBefore(this.box.lastChild,this.box.firstChild);
	this.init_element_children();
	this.pause_act();
}
js_rolling.prototype.start = function(){ //·Ñ¸µ ½ÃÀÛ
	var thisC = this;
	this.stop();
	this.is_rolling = true;
	var act = function(){
		if(thisC.is_rolling){
			if(thisC.direction==1){thisC.act_move_up();}
			else if(thisC.direction==2){thisC.act_move_right();}
			else if(thisC.direction==3){thisC.act_move_down();}
			else if(thisC.direction==4){thisC.act_move_left();}
		}
	}
	this.time_timer = setInterval(act,this.time_dealy);
}
js_rolling.prototype.pause_act = function(){ //ÀÏ½Ã µ¿ÀÛ
	if(this.time_dealy_pause){
		var thisC = this;
		var act = function(){thisC.resume();clearTimeout(thisC.time_timer_pause);thisC.time_timer_pause=null;}
		if(this.time_timer_pause){clearTimeout(this.time_timer_pause);}
		this.time_timer_pause = setTimeout(act,this.time_dealy_pause);
		this.is_rolling = false;
	}
}
js_rolling.prototype.pause = function(){ //ÀÏ½Ã ¸ØÃã
	if(this.time_timer_pause){clearTimeout(this.time_timer_pause);}
	this.is_rolling = false;
}
js_rolling.prototype.resume = function(){ //ÀÏ½Ã ¸ØÃã ÇØÁ¦
	if(!this.mouseover){
		this.is_rolling = true;
	}
}
js_rolling.prototype.stop = function(){ //·Ñ¸µÀ» ³¡³¿
	this.is_rolling = false;
	if(!this.time_timer){
		clearInterval(this.time_timer);
	}
	this.time_timer = null
}

/* IE6 Flicker Bug¸¦ execCommand¹®À¸·Î ÇØ°á
-----------------------------------------------*/
try {document.execCommand('BackgroundImageCache', false, true);} catch(e) {}

/* Toggle : faq Çü ¸®½ºÆ®
-----------------------------------------------*/
function initToggle(tabContainer) {
	triggers = tabContainer.getElementsByTagName("a");

	for(i = 0; i < triggers.length; i++) {
		if (triggers.item(i).href.split("#")[1])
			triggers.item(i).targetEl = document.getElementById(triggers.item(i).href.split("#")[1]);

		if (!triggers.item(i).targetEl)
			continue;

		triggers.item(i).targetEl.style.display = "none";
		triggers.item(i).onclick = function () {
			if (tabContainer.current == this) {
				this.targetEl.style.display = "none";
				tabContainer.current = null;
			} else {
				if (tabContainer.current) {
					tabContainer.current.targetEl.style.display = "none";
				}
				this.targetEl.style.display = "block";
				tabContainer.current = this;
			}
			return false;
		}
	}
}

/* È­¸é È®´ë,Ãà¼Ò
-----------------------------------------------*/
var nowZoom = 100; // ÇöÀçºñÀ²
var maxZoom = 150; // ÃÖ´ëºñÀ²(500À¸·ÎÇÏ¸é 5¹è Ä¿Áø´Ù)
var minZoom = 80; // ÃÖ¼ÒºñÀ²

function zoomInOut(value) {
	var browser = navigator.userAgent.toLowerCase();
	if(browser.indexOf('msie') == -1){ alert("ÀÍ½ºÇÃ·Î·¯¿¡¼­¸¸ µ¿ÀÛÇÕ´Ï´Ù. \nºê¶ó¿ìÀú ¸Þ´ºÀÇ È®´ëÃà¼Ò ±â´ÉÀ» ÀÌ¿ëÇÏ¼¼¿ä.") }
	else {

		if(value == "in") {
			if (nowZoom < maxZoom) {
				nowZoom += 10;
			} else {
				alert("´õÀÌ»ó Ä¿ÁöÁö ¾Ê½À´Ï´Ù.");
				return;
			}
		}
		else if(value == "out") {
			if (nowZoom > minZoom) {
				nowZoom -= 10;
			} else {
				alert("´õÀÌ»ó ÀÛ¾ÆÁöÁö ¾Ê½À´Ï´Ù.");
				return;
			}
		}
		else if(value == "base") {
			nowZoom = 100;
		}
		else {
			return;
		}

		document.getElementsByTagName("body").item(0).style.position = "relative";
		document.getElementsByTagName("body").item(0).style.zoom = nowZoom + "%";
	}
}


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];}
}
