var curpath = document.location.pathname;
var curarray = curpath.split("/");

if(curarray.length==4){
	document.write('<script language="javascript" type="text/javascript" src="../js/Ajax.js"></script>');
}else{
	document.write('<script language="javascript" type="text/javascript" src="./js/Ajax.js"></script>');
}

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_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_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];}
}

function tryCon(vs1){
	if(vs1=="N"){
		var usid =document.lgform.usid.value;
		var passwd = document.lgform.passwd.value;
		var indexyn = document.lgform.indexyn.value;

		if(usid==null||usid.length<1){
			alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À");
			document.lgform.usid.focus();
			return;
		}else if(passwd==null||passwd.length<1){
			alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ½Ê½Ã¿À");
			document.lgform.passwd.focus();
			return;
		}
		if(document.lgform.saveid.checked==true){
			saveLogin(usid);
	 	}else {
			saveLogin("");
		}

	 }else{
		var usid =document.lgform2.usid.value;
		var passwd = document.lgform2.passwd.value;
		var indexyn = document.lgform2.indexyn.value;

		if(usid==null||usid.length<1){
			alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À");
			document.lgform2.usid.focus();
			return;
		}else if(passwd==null||passwd.length<1){
			alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ½Ê½Ã¿À");
			document.lgform2.passwd.focus();
			return;
		}
		if(document.lgform2.saveid.checked==true){
		saveLogin(usid);
	 	}else {
			saveLogin("");
		}
	}
	
	//s-ÄíÅ°¿¡ ¾ÆÀÌµð ÀúÀå
	
	//e-
	
	var s1= "usid="+usid+"&passwd="+passwd+"&indexyn="+indexyn;
	new Ajax.xhr.Request("./include/LogIn.jsp",s1,loadResult,"POST", "PopupLayer", null);

}

function tryCon2(vs1){
	if(vs1=="N"){
		var usid =document.lgform.usid.value;
		var passwd = document.lgform.passwd.value;
		var indexyn = document.lgform.indexyn.value;

		if(usid==null||usid.length<1){
			alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À");
			document.lgform.usid.focus();
			return;
		}else if(passwd==null||passwd.length<1){
			alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ½Ê½Ã¿À");
			document.lgform.passwd.focus();
			return;
		}
		if(document.lgform.saveid.checked==true){
			saveLogin(usid);
	 	}else {
			saveLogin("");
		}

	 }else{
		var usid =document.lgform2.usid.value;
		var passwd = document.lgform2.passwd.value;
		var indexyn = document.lgform2.indexyn.value;

		if(usid==null||usid.length<1){
			alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À");
			document.lgform2.usid.focus();
			return;
		}else if(passwd==null||passwd.length<1){
			alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ½Ê½Ã¿À");
			document.lgform2.passwd.focus();
			return;
		}
		if(document.lgform2.saveid.checked==true){
		saveLogin(usid);
	 	}else {
			saveLogin("");
		}
	}
	
	//s-ÄíÅ°¿¡ ¾ÆÀÌµð ÀúÀå
	
	//e-
	
	var s1= "usid="+usid+"&passwd="+passwd+"&indexyn="+indexyn;
	new Ajax.xhr.Request("../include/LogIn2.jsp",s1,loadResult,"POST", "PopupLayer", null);

}

function loadResult(reResult){
	var resultList = document.getElementById(this.vs6);
	if(reResult.readyState==4){
		if(reResult.status==200){
			resultList.innerHTML =reResult.responseText;
		}else if(reResult.status==403){
			resultList.innerHTML = "¼­¹ö·Î ºÎÅÍ Á¢±ÙÀ» °ÅºÎ ´çÇÏ¿´½À´Ï´Ù.";
		}else if(reResult.status==404){
			resultList.innerHTML = "¿äÃ»ÇÑ ÆäÀÌÁö°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.";
		}else if(reResult.status==500){
			resultList.innerHTML = "¼­¹ö¿¡ ¿À·ù°¡ ¹ß»ýÇÏ¿´½À´Ï´Ù.";
		}else{
			resultList.innerHTML = "¾Ë ¼ö ¾ø´Â ¿À·ù·Î ÀÛ¾÷À» ÁøÇàÇÒ ¼ö ¾ø½À´Ï´Ù.";
		}
	}
}

function goMain(){
//	document.location.reload();
	document.location.href="./index.jsp";
}

function goIndex(){
	document.location.href="./index.jsp";
}

function logout(){
	PopupLayerSet(document.getElementById("PopupLayer"),'popup');
	PopupLayerMove(50,50);
	tryLogOut();
}

function tryLogOut(){
		document.getElementById("PopupLayer").innerHTML="Ã³¸®ÁßÀÔ´Ï´Ù.";
		new Ajax.xhr.Request("./include/LogOut.jsp",null,loadResult,"POST", "PopupLayer", null);
}

/*
function viewTheme(vs1){
	for(var i=1;i<=4;i++){
		if(i==vs1){
			document.getElementById("index_layer"+i).style.display="block";
		}else{
			document.getElementById("index_layer"+i).style.display="none";
		}
	}
}
*/

function getSub(vs1){
	for(var i=1;i<=4;i++){
		if(i==vs1){
			if(document.getElementById("index_layer_sub"+i)!=null)document.getElementById("index_layer_sub"+i).style.display="block";
			if(document.getElementById("submain"+i)!=null)document.getElementById("submain"+i).style.display="block";
		}else{
			if(document.getElementById("index_layer_sub"+i)!=null)document.getElementById("index_layer_sub"+i).style.display="none";
			if(document.getElementById("submain"+i)!=null)document.getElementById("submain"+i).style.display="none";
		}
	}
}

function flashload(flsName,flsWidth,flsHeigt){
	var wirtTxt = " <object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width="+flsWidth+" height="+flsHeigt+" id=\"sub_menu_2\" align=\"middle\">"
				+ " <param name=\"movie\" value="+flsName+" /> "
				+ " <param name=\"quality\" value=\"high\" />"
				+ " <PARAM NAME=\"wmode\" VALUE=\"transparent\">"
				+ " <embed src="+flsName+" quality=\"high\" bgcolor=\"#ffffff\" width="+flsWidth+" height="+flsHeigt+" name=\"sub_menu_2\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />"
				+ " </object>"
	document.write(wirtTxt);
}

function getNavigatorType() {
	if ( navigator.appName == "Microsoft Internet Explorer" )
		return 1;
	else if ( navigator.appName == "Netscape" )
		return 2;
	else
		return 0;
}

function SetSearchBox(event, flag) {
	var searchbox = document.sform.searchfield;
	var _event;
	var keystatus = 0;
	switch ( getNavigatorType() ) {
		case 1 : // IE
		_event = window.event;
		nodeName = _event.srcElement.nodeName;
		break;
		case 2 : // Netscape
		_event = event;
		nodeName = _event.target.nodeName;
		break;
		default :
		nodeName = "None";
		break;
	}
	key = _event.keyCode;
	searchbox.style.backgroundImage="";
	searchbox.style.border="";
	window.event.cancelBubble = true;   // td ¾È¿¡ Áßº¹µÇ´Â ÇÔ¼ö¸¦ Ãë¼ÒÇØÁØ´Ù.
	if ( keystatus == 1 && flag && key != 13) {
		searchbox.value = "";
		keystatus = 2;
		searchbox.style.border="10px solid #FFFFFF";
	}

}

/* index banner roling*/

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 = 100; //¿òÁ÷ÀÌ´Â Å¸ÀÓµô·¹ÀÌ
	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();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.pause();
	}
}
js_rolling.prototype.pause = function(){ //ÀÏ½Ã ¸ØÃã
	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
}

/** ÁÜÀÎ, ÁÜ¾Æ¿ô *************************************************************/
var nowZoom = 100;
var maxZoom = 200;
var minZoom = 80;
function zoomIn() {
	if (nowZoom < maxZoom) {
		nowZoom += 10;
	} else {
		return;
	}
	document.body.style.zoom = nowZoom + "%";
}
function zoomOut() {
	if (nowZoom > minZoom) {
		nowZoom -= 10;
	} else {
		return;
	}
	document.body.style.zoom = nowZoom + "%";
}

function zoomreset(){
	nowZoom = 100;
	document.body.style.zoom = nowZoom + "%";
}

//¾ÆÀÌµð¸¦ ÄíÅ°¿¡ ÀúÀåÇÏ±â
function setsave(name, value, expiredays){
 var today = new Date();
 today.setDate( today.getDate() + expiredays );
 document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + today.toGMTString() + ";"
}

function saveLogin(id){
 if(id != ""){
  // userid ÄíÅ°¿¡ id °ªÀ» 7ÀÏ°£ ÀúÀå
  setsave("websitepp", id, 7);
 }else{
  // userid ÄíÅ° »èÁ¦
  setsave("websitepp", id, -1);
 }
}


function getLogin(){
 // userid ÄíÅ°¿¡¼­ id °ªÀ» °¡Á®¿Â´Ù.
 var cook = document.cookie + ";";
 var idx = cook.indexOf("websitepp", 0);
 var val = "";

 if(idx != -1)
 {
  cook = cook.substring(idx, cook.length);
  begin = cook.indexOf("=", 0) + 1;
  end = cook.indexOf(";", begin);
  val = unescape( cook.substring(begin, end) );
 }

 // °¡Á®¿Â ÄíÅ°°ªÀÌ ÀÖÀ¸¸é
 if(val!= ""){
 	document.lgform.usid.value=val;
 	document.lgform.saveid.checked=true;
 }
}
//¸Þ´º flash ¸µÅ©ÁÖ¼Ò

function menu1() { location.href = "./in/Main.jsp"; }
function menu2() { location.href = "./su/Main.jsp"; }
function menu3() { location.href = "./ng/Main.jsp"; }
function menu4() { location.href = "./gl/Main.jsp"; }
function menu5() { location.href = "./ss/Main.jsp"; }
function menu6() { location.href = "./mo/Main.jsp"; }
function menu7() { location.href = "./wh/Main.jsp"; }
function menu8() {
	var inputEffect = $('#effectTypes1').val();
	var options = {};
	$("#menulayer").toggle(inputEffect,options,500);
}

