// JavaScript Document
var sendit;
var win;
var enterKeyFlag = false;
var openWin;

function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}



function layer_view (layer_name, layer_display){
	if (layer_display == "view"){
		document.getElementById(layer_name).style.display = "block" ;
	} else {
		document.getElementById(layer_name).style.display = "none" ;
	}
}

// F8 키 입력 시 원격조회 페이지호출.
document.onkeydown=function (e)
{
	var shortKey = 119; //F8
	var PopBool = "0";
	var eventKey;
	
	if (window.event){ // IE	
	    eventKey =event.keyCode;	
	}else{		
	    eventKey =e.which;	    
	}

	if(eventKey == shortKey){
		PopBool = "1";
	}
	
	if(PopBool == "1"){
	    var fPosition = getLeftTop(screen.width - 50,screen.height - 50);
		window.open('http://bokji.anyhelp.net/',  'popup_chk_id', 'toolbar=0,  status=0, menubar=no, scrollbars=no, '+fPosition);
	}
		
}


//mipf 프로그램 호출.
function mipf_load(){
var url = "http://www.w4c.go.kr/mipf/App_install/install_321U.jsp?context=AT1";
   try {
			openWin.close();        
			openWin = window.open(url,'MIPF','resizable=yes,width=1024,height=768,scrollbars=no');
     } 
     catch(e) {
			openWin = window.open(url,'MIPF','resizable=yes,width=1024,height=768,scrollbars=no');
     }
} 


// Flash

var EmbedStr = "";
function GetFlash(url,x,y) { 
	EmbedStr = "<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='" + x + "' height='" + y + "'>";
	EmbedStr += "<param name='allowScriptAccess' value='sameDomain' />";
	EmbedStr += "<param name='movie' value='" + url + "' />";
	EmbedStr += "<param name='quality' value='high' />";
	EmbedStr += "<param name='bgcolor' value='#ffffff' />";
	EmbedStr += "<param name='menu' value='false' />";
	EmbedStr += "<param name='wmode' value='transparent' />";
	EmbedStr += "<embed src='" + url + "' id='flashObject' name='flashObject' quality='high' menu='false' wmode='transparent' bgcolor='#ffffff' width='" + x + "' height='" + y + "' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
	EmbedStr += "</object>";
	
	document.write(EmbedStr);
	return;
}

// RollOver
function imageOver(imgs) {
	imgs.src = imgs.src.replace("off.gif", "on.gif");
}
function imageOut(imgs) {
	imgs.src = imgs.src.replace("on.gif", "off.gif");
//  onmouseover="imageOver(this);" onmouseout="imageOut(this);"
} 


/////////////////////////////// 레이어


function popdiv(divname1,divname2,a){ 
	ch = document.body.scrollHeight;
	cw = window.screen.width - 22;
	//cw = document.documentElement.scrollWidth;
	switch(a){
	case 1: 
		document.getElementById(divname1).style.height = ch+"px" ;
		document.getElementById(divname1).style.width = cw+"px" ;
		document.getElementById(divname1).style.display = 'block';
		document.getElementById(divname2).style.display = 'block';  
		break;
	case 2: 
		document.getElementById(divname1).style.display = 'none';
		document.getElementById(divname2).style.display = 'none';
		break;
	}
	 
}


//따라다니는 탑버튼 START

var isDOM = (document.getElementById ? true : false);
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);
var isNS = navigator.appName == "Netscape";

function getRef(id) {
	if (isDOM) return document.getElementById(id);
	if (isIE4) return document.all[id];
	if (isNS4) return document.layers[id];
}

var scrollerHeight = 88;
var puaseBetweenImages = 3000;
var imageIdx = 0;

function moveRightEdge() {
	var yMenuFrom, yMenuTo, yOffset, timeoutNextCheck;

	if (isDOM) {
			yMenuFrom   = parseInt (divMenu.style.top, 10);
			yMenuTo     = (isNS ? window.pageYOffset : document.body.scrollTop) + 50; // 위쪽 위치
	}
	timeoutNextCheck = 500;

	if (yMenuFrom != yMenuTo) {
			yOffset = Math.ceil(Math.abs(yMenuTo - yMenuFrom) / 20);
			if (yMenuTo < yMenuFrom)
					yOffset = -yOffset;
			if (isNS4)
					divMenu.top += yOffset;
			else if (isDOM)
					divMenu.style.top = parseInt (divMenu.style.top, 10) + yOffset;
					timeoutNextCheck = 10;
	}
	setTimeout ('moveRightEdge()', timeoutNextCheck);
}


// 팝업 레이어 리사이즈

var pop_op_height; // 페이지 전체 크기 변수

function resizeIF(Id)
{
	var obj = document.getElementById(Id);
	var Body;
	var H, Min;
	Min = 503;// 최소 높이 설정 (너무 작아지는 것을 방지)
	try
	{
		if (!document.all && obj.contentWindow.document.location.href == 'about:blank')
		{
			setTimeout("resizeIF('"+Id+"')", 10);
			return;
		}

		Body = obj.contentWindow.document.getElementsByTagName('BODY');
		Body = Body[0];

		if (this.Location != obj.contentWindow.document.location.href)
		{
			H = Body.scrollHeight ;
			obj.style.height =  (H<Min?Min:H) + 'px';
			if(H > pop_op_height)
			{
				document.getElementById("pop_op").style.height = H + 200;
			}
			else
			{
				parent.document.body.scrollTop = 0;
				if(H > 1000)
					document.getElementById("pop_op").style.height = pop_op_height + 120;
				else
					document.getElementById("pop_op").style.height = pop_op_height + 50;
			}

			this.Location = obj.contentWindow.document.location.href;
		}
	}
	catch(e)
	{
		setTimeout("resizeIF('"+Id+"')", 10);
		return;
	}
	setTimeout("resizeIF('"+Id+"')", 2000);
}

function smogLayerHeight(){
	pop_op_height = document.body.scrollHeight ;
}

//*********************************************************************************************************
//스크립트명  : SelectVisible
//설      명  : 하위레벨을 Visible, Unvisible하는 함수
//전달  인자  : 하위레벨의 순서(Index)
//일      자  : 2009-09-06
//작  성  자  : 최순희
//*********************************************************************************************************
function SelectVisible(Index, Id, mIndex){

    SelectMenu=document.getElementById("block"+Index);
	if (SelectMenu.style.display=="block"){ 
			SelectMenu.style.display="none";}
	else {
			SelectMenu.style.display="block";}
			
	SelectLevel=document.getElementById(Id);
	SelectLevel.backgroundImage="url(../images/com/bg_LNB_1depth_on.gif)";
}

//*********************************************************************************************************
//스크립트명  : fn_chk_empty
//설      명  : //입력컨트롤을 인자로 받아서 값을 입력했는지 여부 리턴.
//전달  인자  : Object 컨트롤,String 컨트롤명칭 
//일      자  : 2009-09-10
//작  성  자  : 정종우
//*********************************************************************************************************
function fn_chk_empty(obj,strName,sSize)
{
	var rtnValue = true;
	var sMsgsub ="입력";

	if(obj.type == "text" ||obj.type == "hidden" || obj.type == "select-one" || obj.type == "textarea" || obj.type == "password")
	{
		if(obj.value.replace(/[<][^>]*[>]/gi,'').replace(/&nbsp;/gi,'') == "")
		{
			rtnValue = false;
		}
		else
		{
			rtnValue = true;
		}
	}
	
	if(obj.type == "select-one")
	{
		sMsgsub = "선택";
	}
	
	
	if(!rtnValue)
	{
		alert(strName +"은  필수 "+ sMsgsub +" 사항 입니다.");

		if( obj.type != "hidden")
		{
			obj.focus();
		}
	}
	else
	{
		if(fn_chk_byte(obj) > sSize)
		{	
			alert("입력 할 수 있는 최대 길이를 초과하였습니다.  영문 "+sSize +"자 한글 " +parseInt(sSize/2) +"자 이내로 입력 하시기 바랍니다.");
			obj.focus();
			rtnValue = false;
		}
	}
	
	return rtnValue;
} 
//*********************************************************************************************************
//스크립트명  : fn_chk_byte
//설      명  :  입력컨트롤을 인자로 받아서 입력값의 byte 값을 리턴한다.
//전달  인자  : obj 컨트롤 
//일      자  : 2009-10-03
//작  성  자  : 정종우
//********************************************************************************************************* 
function fn_chk_byte(obj)
{
	var strValue = obj.value;			//컨트롤의 값.
	var strLen = obj.value.length;	//컨트롤 값의 길이.
	var oneChar = "";
	var objSize = 0;
	
	var i = 0;  //순환문에 사용할 변수.
	
	for( i = 0; i < strLen ; i++)
	{
		oneChar = strValue.charAt(i);	//한글자씩 추출
		
		if( escape(oneChar).length > 4)  //encoding 된 값의 길이로 한글여부 체크. 
		{
			objSize = objSize + 2;
		}
		else
		{
			objSize ++;
		}
	}
	return objSize;
}



//*********************************************************************************************************
//스크립트명  : fn_DelCheck
//설      명  :   웹 접근성 처리를 위한 이벤트. 체크박스 포커스. 엔터키 입력시 체크,언체크 변경. 
//전달  인자  : Object 컨트롤
//일      자  : 2009-09-30
//작  성  자  : 정종우
//*********************************************************************************************************/
	function fn_DelCheck(obj)
	{
		 if(event.keyCode==13) 
		 {
		 	 if(obj.checked)
		 	 {	
		 	 	obj.checked = false;
		 	 }
		 	 else
		 	 {
		 	 	obj.checked = true;
		 	 }
		 }
	}

// IE6 PNG 투명
function fixPNG(myImage) 
{
	var version = 0; 
	
    if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
    {
	var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
   var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
   var imgTitle = (myImage.title) ? 
             "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
   var imgStyle = "display:inline-block;" + myImage.style.cssText
   var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + "width:" + myImage.width 
                  + "px; height:" + myImage.height 
                  + "px;" + imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
   myImage.outerHTML = strNewHTML   
    }
}
	//*********************************************************************************************************
	//스크립트명  :getRadio
	//설      명  :   라디오 버튼의 현재 선택값을 리턴
	//전달  인자  : formname - 폼 이름  , radioname - 라디오 컨트롤 이름
	//일      자  : 2009-09-30
	//작  성  자  : 정종우
	//*********************************************************************************************************/
	function getRadio(formname, radioname) 
	{	

	//alert( document.getElementsByName(radioname).length);
	  	for (var i=0; i < document.getElementsByName(radioname).length; i++) {
	    	if (document.getElementsByName(radioname)[i].checked) 
	    	{
		      	var rad_val =document.getElementsByName(radioname)[i].value;
		      	return rad_val;
	    	}
	  	}
	}


//*********************************************************************************************************
//스크립트명  : Openpopup
//설      명  : 팝업화면을 호출하는 부분
//전달  인자  : 호출할 페이지, Width, Height
//일      자  : 2009-09-06
//작  성  자  : 최순희
//*********************************************************************************************************
function Openpopup(mUrl, mWidth, mHeight){
	
	window.open(mUrl,"popFindIdPw","toolbar=no,width="+mWidth+"px;,height="+mHeight+"px;,directories=no,status=no,scrollbars=no,resize=no,menubar=no");

}

//*********************************************************************************************************
//스크립트명  : ChangePopDiv
//설      명  : 팝업화면의 해당 Div를 변경하는 부분
//전달  인자  : 해당하는 Div를 변경하는 부분
//일      자  : 2009-09-06
//작  성  자  : 최순희
//*********************************************************************************************************
function ChangePopDiv(mDiv, mBackColor, mBackImage){
	
	document.getElementById(mDiv).style.height = "100%";
	document.getElementById(mDiv).style.width = "42px" ;
/*	document.getElementById(mDiv).style.display = "inline";
	document.getElementById(mDiv).style.backgroundColor = "#93daec";
	document.getElementById(mDiv).style.backgroundImage = "url("+mBackImage+")";
	document.getElementById(mDiv).style.display = 'block';   */

}

//*********************************************************************************************************
//스크립트명  : setMaskNumber
//설      명  : 컨트롤의 Mask Type 을 Number 형으로 변경 시키는 함수 내부적으로  별도의 이벤트를 호출.
//전달  인자  : input  text  Element. 
//일      자  : 2009-11-03
//작  성  자  : 정종우
//*********************************************************************************************************
function setMaskNumber(obj)
{

 obj.onkeypress = chkNumber; //숫자가 아니면 입력이 안되도록 막는다. 
 obj.style.imeMode ="disabled";  //한글 입력 불가.
 obj.style.textAlign ="right"; //우측 정렬
 obj.style.paddingRight = "2px";
 obj.onblur = maskNum;
}

//입력받은 키의 숫자여부 체크.
function chkNumber()
{

 if(event.keyCode >= 48 && event.keyCode <= 57)
 {
  
 }
 else
 {
  event.returnValue=false; //입력 막기.
 }

}
//onblur 이벤트 발생시 문자를 숫자로 변경.
function maskNum()
{
	if(this.value == "") this.value =0;
	
	this.value = parseInt(this.value);
}

//*********************************************************************************************************
//스크립트명  : menu_layer
//설      명  : 탑메뉴 2단계 서브메뉴 보이기
//전달  인자  : 서브메뉴 순서 (Index)
//일      자  : 2009-10-17
//작  성  자  : choi
//*********************************************************************************************************

//서브메뉴 보이기
function menu_layer(n) {
	for(i = 1 ; i < 6; i++){
		tabNum = "submenu" + i;
		tab_sub = document.getElementById(tabNum);
		tab_sub.style.display = "none";
		
		if(n == i){
			tab_sub.style.display = "block";
	
		}
	}
}



//*********************************************************************************************************
//스크립트명  : login_tab
//설      명  : 로그인 탭 바꾸기 
//전달  인자  : 
//일      자  : 2009-10-17
//작  성  자  : choi
//*********************************************************************************************************


function login_tab(n) {
	for(i = 1 ; i < 3; i++){
		tabNum = "pubtxt" + i;
		tab_sub = document.getElementById(tabNum);
		tab_sub.style.display = "none";
		
		if(n == i){
			tab_sub.style.display = "block";
	
		}
	}
}



//*********************************************************************************************************
//스크립트명  : funcon
//설      명  : 주요기능 이미지 바꾸기 
//전달  인자  : 
//일      자  : 2009-10-17
//작  성  자  : choi
//*********************************************************************************************************

function funcon(n) {
	for(i = 1 ; i < 7; i++){
		tabNum = "fimg_" + i;
		tab_sub = document.getElementById(tabNum);
		tab_sub.style.display = "none";
		
		if(n == i){
			tab_sub.style.display = "block";
	
		}
	}
}



//*********************************************************************************************************
//스크립트명  : oimg
//설      명  : 이미지 버튼화 롤오버이미지 보이기
//전달  인자  : 
//일      자  : 2009-10-17
//작  성  자  : choi
//*********************************************************************************************************

// 페이지 로딩후 (body태그에 onload="after_load();" 항상 넣어주어야 실행됨)

function after_load()
{
	new Tooltip("A:IMG:TR:TD:SPAN");
	new ImageButton();
}


//이미지 버튼
Tooltip = function(tags){ 
    if (!document.body.getAttribute) return false; 
	this.tooltip = this.createTipbox();
    this.offsetX = this.offsetY = 10; 

	this.ns5 = ((navigator.userAgent.indexOf("Gecko")>-1)) ? true: false;

    
	if (document.getElementsByTagName) 
    { 
		var tag = tags.split(":");
		for (var i=0;i<tag.length;i++)
		{
			this.init(document.getElementsByTagName(tag[i]));
		}
    } 
} 
Tooltip.prototype.createTipbox = function()
{
	var box=document.createElement("div");
	// box 속성.. (style)
	box.style.display = "none";
	box.style.position = "absolute";
	box.style.fontFamily = "새굴림";
	box.style.fontSize = "9pt";
	box.style.lineHeight = "170%";
	box.style.padding = "3px";
	box.style.borderStyle = "solid";
	box.style.borderWidth = "1px";
	box.style.borderColor = "black";
	box.style.backgroundColor = "white";
	box.style.filter = "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";

	document.body.appendChild(box);
    return box;
}
Tooltip.prototype.init = function(){ 
    Tooltip.object = this; 
    Tooltip.element = null; 
    for (var i=0, s=arguments[0].length; i<s; i++) 
    { 
        Tooltip.element = arguments[0][i]; 
        if (arguments[0][i].getAttribute("tip") !== null) 
        { 
			if (this.ns5)
			{
				arguments[0][i].onmouseover = function(evt){ 
					Tooltip.object.show(this, evt.pageX, evt.pageY);
				} 
				arguments[0][i].onmousemove = function(evt){
					Tooltip.object.move(evt.pageX, evt.pageY);
				} 
				arguments[0][i].onmouseout = function(){ 
					Tooltip.object.hide(); 
				} 
			}
			else
			{
				arguments[0][i].onmouseover = function(){ 
					Tooltip.object.show(event.srcElement, event.x, event.y); 
				} 
				arguments[0][i].onmousemove = function(){ 
					Tooltip.object.move(event.x, event.y); 
				} 
				arguments[0][i].onmouseout = function(){ 
					Tooltip.object.hide(); 
				} 
			}
        } 
    } 
} 




ImageButton = function(overSuffix)
{
	if (!document.body.getAttribute) return false;
	this.overSuffix = (overSuffix==null) ? '_on' : overSuffix;

	this.num = 0;
	this.srcList = new Array();
	this.oversrcList = new Array();

	this.selectedLayer = new Array();
	this.selectedImage = new Array();
	this.defaultImage = new Array();

	var imgtags = document.getElementsByTagName("img");
	for (var i=0; i<imgtags.length; i++)
	{
		if (imgtags[i].getAttribute("png")!=null) this.forPNG(imgtags[i]);
		if (imgtags[i].getAttribute("oimg")!=null) this.createButton(imgtags[i]);
	}
}
ImageButton.prototype.createButton = function(img)
{
	ImageButton.object = this;
	img.style.borderWidth = 0;
	img.setAttribute("oimg", this.num);
	this.srcList[this.num] = new Image;
	this.srcList[this.num].src = img.src;
	this.oversrcList[this.num] = new Image;

	var group = (img.getAttribute("group") != null) ? img.getAttribute("group") : 'default';
	img.group = group;

	if (img.getAttribute("oversrc")!=null) this.oversrcList[this.num].src = img.getAttribute("oversrc");
	else this.oversrcList[this.num].src = img.src.replace(RegExp("(\.[^\.]+)$"), this.overSuffix + "$1");

	if (img.getAttribute("selected")!=null)
	{
		img.src = this.oversrcList[this.num].src;
		img.style.cursor = 'hand';
	}
	else img.style.cursor = 'hand';

	if (img.getAttribute("defaultbutton")!=null)
	{
		img.src = this.oversrcList[this.num].src;
		this.defaultImage[group] = img;
	}

	if (img.getAttribute("show")!=null)
	{
		var layer = document.getElementById(img.getAttribute("show"));
		//if (img.getAttribute("selected")==null) layer.style.display = 'none';
		if (img.getAttribute("selected")==null && img.getAttribute("defaultbutton")==null) layer.style.display = 'none';
		else this.selectedLayer[group] = layer;
	}

	if (document.all)
	{
		if (img.getAttribute("selected") == null)
		{
			// mouse over action
			if (img.onmouseover)
			{
				eval("img._onmouseover=function()" + img.onmouseover.toString().replace(/^[^)]+\)/,''));
				img.onmouseover = function()
				{
					this._onmouseover();
					ImageButton.object.over_action(this);
				}
			}
			else
			{
				img.onmouseover = function(){ImageButton.object.over_action(this);}
			}
			// mouse out action
			if (img.getAttribute("noout") == null)
			{
				if (img.onmouseout)
				{
					eval("img._onmouseout=function()" + img.onmouseout.toString().replace(/^[^)]+\)/,''));
					img.onmouseout = function()
					{
						this._onmouseout();
						ImageButton.object.out_action(this);
					}
				}
				else
				{
					img.onmouseout = function(){ImageButton.object.out_action(this);}
				}
			}
		}

		if (img.getAttribute("url")!=null || img.getAttribute("java")!=null)
		{
			// mouse click action
			if (img.onclick)
			{
				eval("img._onclick=function()" + img.onclick.toString().replace(/^[^)]+\)/,''));
				img.onclick = function()
				{
					this._onclick();
					ImageButton.object.click_action(this);
				}
			}
			else
			{
				img.onclick = function(){ImageButton.object.click_action(this);}
			}
		}
	}
	else if (img.addEventListener)
	{
		if (img.getAttribute("selected") == null)
		{
			img.addEventListener('mouseover', function(){ImageButton.object.over_action(this)}, true);
			if (img.getAttribute("noout") == null) img.addEventListener('mouseout',  function(){ImageButton.object.out_action (this)}, true);
		}
		if (img.getAttribute("url")!=null || img.getAttribute("java")!=null) img.addEventListener('click',  function(){ImageButton.object.click_action (this)}, true);
	}
	this.num++;
}

/*
* onMouseOver
*/

ImageButton.prototype.over_action = function(img)
{
	if (this.defaultImage[img.group] != null)
	{
		if (this.defaultImage[img.group] != img) this.defaultImage[img.group].src = this.srcList[this.defaultImage[img.group].getAttribute("oimg")].src;
		this.defaultImage[img.group] = null;
	}

	img.src = this.oversrcList[img.getAttribute("oimg")].src;
	if (img.getAttribute("show"))
	{
		var layer = document.getElementById(img.getAttribute("show"));
		if (layer==this.selectedLayer[img.group]) return;
		if (this.selectedLayer[img.group]!=null) this.selectedLayer[img.group].style.display = 'none';
		layer.style.display = 'inline';
		this.selectedLayer[img.group] = layer;
	}

	if (img != this.selectedImage[img.group])
	{
		if (this.selectedImage[img.group] != null) this.out_action(this.selectedImage[img.group]);
		this.selectedImage[img.group] = img;
	}
}
/*
* onMouseOut
*/
ImageButton.prototype.out_action = function(img)
{
	img.src = this.srcList[img.getAttribute("oimg")].src;
}

/*
//*********************************************************************************************************
//스크립트명  : setPng24
//설      명  : png 파일 투명배경 색깔 오류 패치 (IE 6.0 버전 이하)
//전달  인자  : 
//일      자  : 2009-10-17
//작  성  자  : choi
//********************************************************************************************************


//png 파일 투명배경 색깔 오류 패치 (IE 6.0 버전 이하)
//------- img 태그에 class="png24" 추가해서 사용 (이미지 원본 사이즈 고정) ---------
function setPng24(obj)
{
	var arVersion = navigator.appVersion.split("MSIE");
	var version = parseFloat(arVersion[1]);

	if ((version >= 5.5) && (version < 7) && (document.body.filters))
	{
		obj.width=obj.height=1;
		obj.className=obj.className.replace(/\bpng24\b/i,'');
		obj.style.filter =
		"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
		obj.src='';
		return '';
	}
}
*/

//*********************************************************************************************************
//스크립트명  : rolling
//설      명  : 시간별, 오버 배너 롤링
//전달  인자  : 
//일      자  : 2009-10-17
//작  성  자  : choi
//*******************************************************************************************************


// 배너 바꾸기
function rolling(str,num) {//롤링 베너 ...
	for(i = 1 ; i < (parseInt(num)+1) ; i++){
		tabNum = "roll0" + i;

		tab_sub = document.getElementById(tabNum);
		tab_sub.style.display = "none";
		tabImg = "roll_button0" + i;
		try{
		tab_img = document.getElementById(tabImg);
		tab_img.src="images/main/popup/n0"+i+".gif";
		if(str == i){			
			tab_sub.style.display = "block";
			tab_img.src="images/main/popup/n0"+i+"_on.gif";
			counter = i - 1;
		}
	  }catch(e){
		  break;
		  return;
	  }
	}
}
var counter = 0;
var change_flag = "T";

function changeBanner(num){
//alert(num);
	if (change_flag =="T")
	{
	if(counter > (parseInt(num)-1))
	counter = 0;
	
	rolling((counter + 1),num);
	
	counter++;
	}
}


// 배너 바꾸기


//*********************************************************************************************************
//스크립트명  : zoomIn, zoomOut
//설      명  : 확대축소기능
//전달  인자  : 
//일      자  : 2009-10-17
//작  성  자  : choi
//*******************************************************************************************************

/* 화면 확대 축소 시작 */
 var nowZoom = 100; // 현재비율
 var maxZoom = 120; // 최대비율(500으로하면 5배 커진다)
 var minZoom = 100; // 최소비율

 //화면 키운다.
 function zoomIn() {

  if (nowZoom < maxZoom) {
   nowZoom += 10; //25%씩 커진다.
  } else {
   return;
  }
  document.body.style.zoom = nowZoom + "%";
 }

 //화면 줄인다.
 function zoomOut() {

  if (nowZoom > minZoom) {
   nowZoom -= 10; //25%씩 작아진다.
  } else {
   return;
  }
  document.body.style.zoom = nowZoom + "%";
 }
/* 화면 확대 축소 끝 */

//*********************************************************************************************************
//스크립트명  : tabSubmenu
//설      명  : 시설,생생,FAQ 탭 보이기
//전달  인자  : 
//일      자  : 2009-10-21
//작  성  자  : choi
//*******************************************************************************************************

function tabSubmenu(n) {
	for(i = 1 ; i < 4; i++){
		tabNum = "list0" + i;
		tab_sub = document.getElementById(tabNum);
		tab_sub.style.display = "none";
		tabImg = "list_button0" + i;
		tab_img = document.getElementById(tabImg);
		tab_img.src="images/main/tab0"+i+".gif"; /* 이미지 경로설정 */
		if(n == i){
			tab_sub.style.display = "block";
			tab_img.src="images/main/tab0"+i+"_on.gif"; /* 이미지 경로설정 */
		}
	}
}


//*********************************************************************************************************
//스크립트명  : 
//설      명  : 하단 배너 스크롤 스크립트 2
//전달  인자  : 
//일      자  : 2009-10-22
//작  성  자  : choi
//*******************************************************************************************************

var cNewsKey = 0;
var cNewsTimer = 0;
var cNewsCount = 0;
var cNewsCh = 1;
function news_scroll()
{
	clearTimeout(cNewsTimer);
	if(cNewsCh == 0)
	{
		document.getElementById('news_item'+cNewsKey).style.display='none';
		cNewsKey++;
		if(cNewsKey>=cNewsCount)	 cNewsKey = 0;
		document.getElementById('news_item'+cNewsKey).style.display = 'block';
	}
	cNewsCh = 0;
	cNewsTimer = setTimeout('news_scroll()', 3000);
}
function news_stop()
{
	clearTimeout(cNewsTimer);
	cNewsCh = 1;
}
function news_prev()
{
	document.getElementById('news_item'+cNewsKey).style.display='none';
	cNewsKey = cNewsKey-1;
	if(cNewsKey<0)	 cNewsKey = cNewsCount-1;
	document.getElementById('news_item'+cNewsKey).style.display = 'block';
	document.getElementById('news_link'+cNewsKey).focus();
}
function news_next()
{
	document.getElementById('news_item'+cNewsKey).style.display='none';
	cNewsKey++;
	if(cNewsKey>=cNewsCount)	 cNewsKey = 0;
	document.getElementById('news_item'+cNewsKey).style.display = 'block';
	document.getElementById('news_link'+cNewsKey).focus();
}



//*********************************************************************************************************
//스크립트명  : 
//설      명  : 하단 배너 스크롤 스크립트 2
//전달  인자  : 
//일      자  : 2009-10-26
//작  성  자  : choi
//*******************************************************************************************************

/* rotate content */

function ImageRotation() {
	// options
	var scrollType = 'vertical'; // 'horizontal', 'vertical', 'none';

	// private
	var currentNumber = 0;
	var objWrap = null;
	var objContentBox = null;
	var objWrapLIs = null;
	var cellWidth = 0;
	var cellHeight = 0;
	this.GoodsSetTime = null;

	// scroll animation variables.
	var scroll = {time:1, start:0, change:0, duration:25, timer:null};
	var originaltime = scroll.time;

	this.setScrollType = function (type) {
		switch (type) {
			case 'vertical':
			case 'horizontal':
			case 'none':
				scrollType = type;
				break;
			default:
				alert('!');
				break;
		}
	}
	// constructor
	this.initialize = function () {
		objWrap = document.getElementById(this.wrapId);
		objContentBox = document.getElementById(this.listId);
		objWrapLIs = objWrap.getElementsByTagName('li');
		cellWidth = objWrapLIs[0].offsetWidth;
		cellHeight= objWrapLIs[0].offsetHeight;

		switch (scrollType) {
			case 'vertical':
				this.objWrapSize = objWrap.offsetHeight;
				this.objSize = objWrapLIs.length * cellHeight;
				break;
			case 'none':
				this.objWrapSize = objWrap.offsetWidth;
				this.objSize = objWrapLIs.length * cellWidth;
				break;
			default:
				this.objWrapSize = objWrap.offsetWidth;
				this.objSize = objWrapLIs.length * cellWidth;
				break;
		}
		//alert(this.objWrapSize +' / '+ this.objSize);
		if (this.objWrapSize <= this.objSize) {

			if (objWrapLIs.length > 0) {
				switch (scrollType) {
					case 'vertical':
						objContentBox.style.height = objWrapLIs.length * cellHeight + 'px';
						break;
					case 'none':
						objContentBox.style.width = objWrapLIs.length * cellWidth + 'px';
						break;
					default:
						objContentBox.style.width = objWrapLIs.length * cellWidth + 'px';
						break;
				}
			}
		    document.getElementById(this.btnPrev).href = "javascript:" + this.objName + ".prev();";
	        document.getElementById(this.btnNext).href = "javascript:" + this.objName + ".next();";	


			if (this.autoScroll == 'none') {
			} else {
				if (this.scrollDirection == 'direction') {
					this.GoodsSetTime = setInterval(this.objName + ".next()", this.scrollGap);
				} else {
					this.GoodsSetTime = setInterval(this.objName + ".prev()", this.scrollGap);
				}
			}
		} else {
			document.getElementById(this.btnPrev).href = "javascript:" + this.objName + ".none();";
			document.getElementById(this.btnNext).href = "javascript:" + this.objName + ".none();";
		}
	}
	this.none = function() {
		return;
	}   
	this.prev = function () {
		if (currentNumber == 0) {
			var objLastNode = objContentBox.removeChild(objContentBox.getElementsByTagName('li').item(objWrapLIs.length - 1));
			objContentBox.insertBefore(objLastNode, objContentBox.getElementsByTagName('li').item(0));
			switch (scrollType) {
				case 'vertical':
					objWrap.scrollTop += cellHeight;
					break;
				case 'none':
					objWrap.scrollLeft += cellWidth;
					break;
				default:
					objWrap.scrollLeft += cellWidth;
					break;
			}

			currentNumber++;
		}

		//objWrap.scrollLeft -= cellWidth;
		var position = getActionPoint('indirect');
		//console.log('start x:' + position.start +', change x:' + position.end);
		startScroll(position.start, position.end);

		currentNumber = currentNumber - 1;
		//console.log(currentNumber);

		if (currentNumber > 0)
			currentNumber = 0;
		if (this.autoScroll == 'none') {
		} else {
			this.scrollDirection = 'indirection';
			clearInterval(this.GoodsSetTime);
			this.GoodsSetTime = setInterval(this.objName + ".prev()", this.scrollGap);
		}
	}

	this.next = function () {
	
		if (currentNumber == objWrapLIs.length - 1) {
			var objLastNode = objContentBox.removeChild(objContentBox.getElementsByTagName('li').item(0));
			objContentBox.appendChild(objLastNode);
			switch (scrollType) {
				case 'vertical':
					objWrap.scrollTop -= cellHeight;
					break;
				case 'none':
					objWrap.scrollLeft -= cellWidth;
					break;
				default:
					objWrap.scrollLeft -= cellWidth;
					break;
			}
			currentNumber--;
		}

		//objWrap.scrollLeft += cellWidth;
		var position = getActionPoint('direct');
		//console.log('start x:' + position.start +', change x:' + position.end);
		startScroll(position.start, position.end);

		currentNumber = currentNumber + 1;

		if (currentNumber < objWrapLIs.length - 1)
			currentNumber = objWrapLIs.length - 1;
		//console.log(currentNumber);

		if (this.autoScroll == 'none') {
		} else {
			this.scrollDirection = 'indirection';
			clearInterval(this.GoodsSetTime);
			this.GoodsSetTime = setInterval(this.objName + ".next()", this.scrollGap);
		}
	}

	var startScroll = function (start, end) {
		if (scroll.timer != null) {
			clearInterval(scroll.timer);
			scroll.timer = null;
		}

		scroll.start = start;
		scroll.change = end - start;

		switch (scrollType) {
			case 'vertical':
				scroll.timer = setInterval(scrollVertical,15);
				break;
			case 'none':
				objWrap.scrollLeft = end;
				break;
			default:
				scroll.timer = setInterval(scrollHorizontal, 15);
				break;
		}
	}

	var scrollVertical = function () {
		if (scroll.time > scroll.duration) {
			clearInterval(scroll.timer);
			scroll.time = originaltime;
			scroll.timer = null;
		}
		else {
			objWrap.scrollTop = sineInOut(scroll.time, scroll.start, scroll.change, scroll.duration);
			scroll.time++;
		}
	}

	var scrollHorizontal = function () {
		if (scroll.time > scroll.duration) {
			clearInterval(scroll.timer);
			scroll.time = originaltime;
			scroll.timer = null;
		} else {
			objWrap.scrollLeft = sineInOut(scroll.time, scroll.start, scroll.change, scroll.duration);
			scroll.time++;
		}
	}

	var getActionPoint = function (dir) {
		if (dir == 'direct') {
			var position = findElementPos(objWrap.getElementsByTagName('li').item(currentNumber + 1)); // target image.
			var offsetPos = findElementPos(objWrap.getElementsByTagName('li').item(currentNumber)); // first image.
		} else {
			var position = findElementPos(objWrap.getElementsByTagName('li').item(currentNumber - 1)); // target image.
			var offsetPos = findElementPos(objWrap.getElementsByTagName('li').item(currentNumber)); // first image.
		}

		//console.log('current(' + offsetPos[0] + ',' + offsetPos[1] + '), target(' + position[0] + ',' + position[1] + ')');

		switch (scrollType) {
			case 'vertical':
				var start = objWrap.scrollTop;
				var end = position[1] - offsetPos[1];
				break;
			case 'none':
				// do nothing.
				break;
			default:
				var start =  objWrap.scrollLeft;
				var end = position[0] - offsetPos[0];
				break;
		}
		//console.log(scrollType);

		var position = {start:0, end:0};
		position.start = start;
		position.end = end;

		return position;
	}

	var sineInOut = function (t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	}

	var findElementPos = function (elemFind) {
		var elemX = 0;
		var elemY = 0;
		do {
			elemX += elemFind.offsetLeft;
			elemY += elemFind.offsetTop;
		} while (elemFind = elemFind.offsetParent)

		return Array(elemX, elemY);
	}

}




//*********************************************************************************************************
//스크립트명  : 
//설      명  : 레프트 3단계 메뉴
//전달  인자  : 
//일      자  : 2009-10-26
//작  성  자  : choi
//*******************************************************************************************************
function cur(obj){
	if(obj.parentNode.parentNode.getElementsByTagName('ul').length>0){
	for(var i=0; i<obj.parentNode.parentNode.getElementsByTagName('ul').length; i++){
		obj.parentNode.parentNode.getElementsByTagName('ul')[i].style.display='none';
	}
	}
	if(obj.parentNode.getElementsByTagName('ul').length>0){
		obj.parentNode.getElementsByTagName('ul')[0].style.display='block';
	}
}




//*********************************************************************************************************
//스크립트명  : 
//설      명  : 플래시 삽입소스
//전달  인자  : 
//일      자  : 2009-10-28
//작  성  자  : choi
//*******************************************************************************************************



function FlashInsert(FlashIDName, FlashFileName, FlashWidth, FlashHeight, DNSSetting, WMODESetting, FlashBGColor, FlashMenu, QSetting, FlashAlign)
{
	document.write('<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
	document.write('CODEBASE="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab#version=8,0,22,0" ');
	document.write(' ID="'+FlashIDName+'" WIDTH="' + FlashWidth + '" HEIGHT="' + FlashHeight + '" ALIGN="'+FlashAlign+'">');
	document.write('<PARAM NAME="movie" VALUE="'+ FlashFileName +'">');
	document.write('<PARAM NAME="menu" VALUE="'+FlashMenu+'">');
	document.write('<PARAM NAME="quality" VALUE="'+QSetting+'">');
	document.write('<PARAM NAME="bgcolor" VALUE="'+FlashBGColor+'">');
	document.write('<PARAM NAME="wmode" VALUE="'+WMODESetting+'">');
	document.write('<PARAM NAME="allowScriptAccess" VALUE="'+DNSSetting+'">');
	document.write('<EMBED SRC="'+ FlashFileName +'"  NAME="'+FlashIDName+'"');
	document.write(' WIDTH="' + FlashWidth + '" HEIGHT="' + FlashHeight + '" QUALITY="'+QSetting+'" BGCOLOR="'+FlashBGColor+'"');
	document.write(' ALLOWSCRIPTACCESS="'+DNSSetting+'" ALIGN="'+FlashAlign+'" WMODE="'+WMODESetting+'" TYPE="application/x-shockwave-flash" ');
	document.write(' PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" >');
	document.write('</EMBED>');
	document.write('</OBJECT>');
}

//쿠기 셋팅하기 
/* function name : setCookie(name,value,expires)
    description     : read cookie value. 
	param 			  : name - cookie name.
						  : value - cookie value.
						  : expires - expires tick
	write date       : 2009-11-09
	writer 			  : jjw 
*/
function setCookie(name,value,expires)
{
	var today = new Date();
	var expiry = new Date(today.getTime() + 28 *24 * 60 * 60 * 1000); 
	document.cookie = name+ "=" + escape(value) + ((expires)? "; expires=" + expiry.toGMTString() : "");
}

//쿠기 가져오기 .
/* function name : getCookie(name)
    description     : read cookie value. 
	param 			  : name - cookie name.
	write date       : 2009-11-09
	writer 			  : jjw 
*/
function getCookie(name)
{
	var index =  document.cookie.indexOf(name + "=");
	
	if(index == -1) return null;
	
	index = document.cookie.indexOf("=",index) + 1;
	
	var endstr = document.cookie.indexOf(";",index);
	
	if(endstr == -1) endstr = document.cookie.length;
	
	return unescape(document.cookie.substring(index,endstr));
}

function printURL(url) {
  document.all.idPrintHidden.disabled = true;
  window.onprintcomplete = function() {
    document.all.idPrintHidden.disabled = false;
  }
  printHidden(url);
}


function printHidden(url) {
	document.body.insertAdjacentHTML("beforeEnd",
    "<iframe name=printHiddenFrame width=0 height=0></iframe>");
  var doc = printHiddenFrame.document;
  doc.open();
  doc.write("<body onload=\"setTimeout('parent.onprintHiddenFrame()', 0)\">");
  doc.write("<iframe name=printMe width=0 height=0 src=\"" + url + "\"></iframe>");
  doc.write("</body>");
  doc.close();
}

function onprintHiddenFrame() {
  function onfinish() {
    printHiddenFrame.outerHTML = "";
    if ( window.onprintcomplete ) window.onprintcomplete();
  }
  printFrame(printHiddenFrame.printMe, onfinish);
}


//*********************************************************************************************************
//스크립트명  : get url 페이지이동.
//설      명  : 페이지이동 스크립트.
//전달  인자  : 이동 주소.
//일      자  : 2010-01-15
//작  성  자  : 범대원.
//*******************************************************************************************************
function goToUrl(url)
{

	location.href = url;

}

//*********************************************************************************************************
//스크립트명  : 화면가운데띄우기스크립트.
//설      명  : 화면가운데띄우기스크립트.
//전달  인자  : 폼 길이, 폼높이.
//일      자  : 2010-01-15
//작  성  자  : 범대원.
//*******************************************************************************************************
function getLeftTop(w,h)
{
	
	var fLeft   = (screen.width - w) / 2;
	var fTop    = (screen.height - h) / 2;
	
	return "width="+w+", height="+h+", left="+fLeft+", top="+fTop+" ";

}

//*********************************************************************************************************
//스크립트명  : 태그 입력 여부체크.
//설      명  : 태그 입력 여부체크.
//전달  인자  : 입력스트링.
//일      자  : 2010-01-20
//작  성  자  : 김보람.
//*******************************************************************************************************
function fn_chk_tags(checkObj) {
  var checkStr = checkObj.value;
  var checkOK = "<>";

  for (i = 0;  i < checkStr.length;  i++) {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++) {
      if (ch == checkOK.charAt(j)) {
      	alert("태그를 사용하실 수 없습니다."); 
      	checkObj.focus();
      	return true; 
      	break;
      }
    }
  }
  return false;
}

//입력과 동시에 날짜형식(YYYY-MM-DD)으로 변환하는 함수
function getDateDash(object) {
    if((event.keyCode == 8) // 백스페이스
        || (event.keyCode == 13) //Enter
        || (event.keyCode == 27) //Esc
        || ((event.keyCode >= 48) && (event.keyCode <= 57))) //숫자(0~9)
        event.returnValue = true;
    else event.returnValue = false;

    var str = object.value;
    str = getNumb(str);
    if(str.length == 5 || str.length == 6)
        str = str.substring(0,4) + "-" + str.substring(4);
    else if(str.length == 7 || str.length == 8)
            str = str.substring(0,4) + "-" + str.substring(4,6) + "-" + str.substring(6);
    object.value = str;

	//alert(str);

}



//스트링에서 숫자만 취하는 함수
function getNumb(str) {
    var num = "";
    for(var i = 0; i < str.length; i++) {
        var tmp = Number(str.charAt(i));
        if(tmp >= 0 && tmp <= 9)
            num += tmp;
    }
    return num;
}

