//Element ID ºÒ·¯¾²±â
function dEI(elementID){
	return document.getElementById(elementID);
}

// roundBox Layout
function initLayout(layoutEl,childEl) {
	var layoutId = dEI(layoutEl);
	var contentsId = dEI(childEl);

	//create and build div structure
	var bodyTH = document.createElement('div');
	var bodyLV = document.createElement('div');
	var bodyRV = document.createElement('div');
	var bodyBH = document.createElement('div');
	var bodyTL = document.createElement('div');
	var bodyTR = document.createElement('div');
	var bodyBL = document.createElement('div');
	var bodyBR = document.createElement('div');
	bodyTH.className = "bodyTH";
	bodyLV.className = "bodyLV";
	bodyRV.className = "bodyRV";
	bodyBH.className = "bodyBH";
	bodyTL.className = "bodyTL";
	bodyTR.className = "bodyTR";
	bodyBL.className = "bodyBL";
	bodyBR.className = "bodyBR";
	layoutId.appendChild(bodyTH);
	bodyTH.appendChild(bodyLV);
	bodyLV.appendChild(bodyRV);
	bodyRV.appendChild(bodyBH);
	bodyBH.appendChild(bodyTL);
	bodyTL.appendChild(bodyTR);
	bodyTR.appendChild(bodyBL);
	bodyBL.appendChild(bodyBR);
	bodyBR.appendChild(contentsId);
}

//Images Btn_KSS
function BtnOn(imgEl){
	imgEl.src = imgEl.src.replace(".gif", "_on.gif");
}
function BtnOut(imgEl){
	imgEl.src = imgEl.src.replace("_on.gif", ".gif");
}

// first ¿¹¿ÜÃ³¸® firstChild(ºí·°Id, ÅÂ±×³×ÀÓ, Ã³¸®ÇÒ ¾ÆÀÌÅÛ ¹øÈ£) // ¾ÆÀÌÅÛ¹øÈ£´Â 0¹øºÎÅÍ ¹ÝÈ¯
function firstChild(Elid, Etn, Num){
	if(Num==""){Num=0;}
	liEl = dEI(Elid).getElementsByTagName(Etn);
	if (liEl.item(Num)) {
		liEl.item(Num).className += " first-child";
	}
}

// first line¿¹¿ÜÃ³¸®(ºí·°ID, ÅÂ±×³×ÀÓ, Ã³¸®ÇÒ ¾ÆÀÌÅÛ °¹¼ö) // ¾ÆÀÌÅÛ¹øÈ£´Â 0¹øºÎÅÍ ¹ÝÈ¯
function firstCheck(Elid, Etn, Num){
	var itemNum = Num;
	var liEl = dEI(Elid).getElementsByTagName(Etn);
	if(liEl.length<Num){
		itemNum=liEl.length;
	}
	for(i=0; i<itemNum; i++){
		liEl.item(i).className += " list-first";
	}

}

// first ¿¹¿ÜÃ³¸® listFirst(ºí·°Id, ÅÂ±×³×ÀÓ, Ã³¸®ÇÒ ¾ÆÀÌÅÛ °¹¼ö) // ¾ÆÀÌÅÛ¹øÈ£´Â 0¹øºÎÅÍ ¹ÝÈ¯
function listFirst(Elid, Etn, Num){
	liEl = dEI(Elid).getElementsByTagName(Etn);
	for(i=0; liEl.length>i; i=i+Num){
		liEl.item(i) .className += " first";
	}
}

// Tab Content
function tabCheck(dotabid, num){
		var inum=parseInt(num)-1;
		var linkTab=dEI(dotabid).getElementsByTagName("a");
		for (i=0;i<linkTab.length;i++) {
			var tabimg = linkTab.item(i).getElementsByTagName("img").item(0);
			var tabContents= dEI(dotabid+(1+i));
			if (i==inum) {
				if(tabContents.style.display!="block"){
					tabimg.src=tabimg.src.replace(".gif", "on.gif");
					tabContents.style.display="block";
				}
		}else{
			tabimg.src=tabimg.src.replace("on.gif", ".gif");
			tabContents.style.display="none";
		}
	}
}

//ÆË¾÷¶ç¿ì±â
function openPop(url,idn,intWidth,intHeight,scroll) {
	//alert("pop_scroll");
	window.open(url, idn,"width="+intWidth+", height="+intHeight+",resizable=0,scrollbars="+scroll) ;
}

//IE6 pngÆÐÄ¡
function setPng24(obj) {
	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 '';
}

// ÀÌ¹ÌÁö ·Ñ¿À¹ö
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");
				}
			}
	}
}

//Footer select Open
function selectOn(boxID){
	var selectBox = document.getElementById(boxID);

	if(selectBox.style.display!="block"){
	selectBox.style.display="block";
	selectBox.onmouseover = function(){selectBox.style.display="block";}
	selectBox.onmouseout = function(){selectBox.style.display="none";}
	}else{
		selectBox.style.display="none";
	}
}


//FAQ
function toggleList(tabContainer) {
	var tabContainer=document.getElementById(tabContainer)
	var 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).className="";
		triggers.item(i).onclick = function () {
			if (tabContainer.current == this) {
				this.targetEl.style.display = "none";
				this.className="";
				tabContainer.current = null;
			} else {
				if (tabContainer.current) {
					tabContainer.current.targetEl.style.display = "none";
					tabContainer.current.className="";
				}
				this.targetEl.style.display = "block";
				this.className="on";
				tabContainer.current = this;
			}
			return false;
		}
	}
	//triggers.item(0).targetEl.style.display = "block";
}

//FAQ ¼öÁ¤»çÇ×
function onCheck(dotabid, num){
		var inum=parseInt(num);
		var linkTab=dEI(dotabid).getElementsByTagName("a");
		for (i=1;i<=linkTab.length;i++) {
			//var tabimg = linkTab.item(i).getElementsByTagName("img").item(0);
			var aa= dotabid+i;
			var tabContents=dEI(dotabid+i);
			if (i==inum) {
				if(tabContents.style.display!="block"){
					tabContents.style.display="block";
				}
		}else{
			tabContents.style.display="none";
		}
	}
}

// print
function cntPrint(){
	window.print();
}

//·¹ÀÌ¾î ÆË¿±
function openLayer(IdName){
	//alert(IdName);
	var pop = dEI(IdName);
	pop.style.display = "block";
}

//·¹ÀÌ¾î ÆË¿± ´Ý±â
function closeLayer(IdName){
	var pop = dEI(IdName);
	pop.style.display = "none";
}

// TR Rollover
function tblRollover(Elid, Etn){
	var targetTag = document.getElementById(Elid).getElementsByTagName(Etn);
	for(i=0;i<targetTag.length;i++){
		targetTag.item(i).onmouseover = function(){this.className = " on";};
		targetTag.item(i).onmouseout = function(){this.className = " "};
	}
}

// scrolling layer
function initMoving(target, position, topLimit, btmLimit) {
	if (!target)
		return false;

	var obj = target;
	obj.initTop = position;
	obj.topLimit = topLimit;
	obj.bottomLimit = document.documentElement.scrollHeight - btmLimit;

	obj.style.position = "absolute";
	obj.top = obj.initTop;
	obj.left = obj.initLeft;

	if (typeof(window.pageYOffset) == "number") {
		obj.getTop = function() {
			return window.pageYOffset;
		}
	} else if (typeof(document.documentElement.scrollTop) == "number") {
		obj.getTop = function() {
			return document.documentElement.scrollTop;
		}
	} else {
		obj.getTop = function() {
			return 0;
		}
	}

	if (self.innerHeight) {
		obj.getHeight = function() {
			return self.innerHeight;
		}
	} else if(document.documentElement.clientHeight) {
		obj.getHeight = function() {
			return document.documentElement.clientHeight;
		}
	} else {
		obj.getHeight = function() {
			return 500;
		}
	}

	obj.move = setInterval(function() {
		if (obj.initTop > 0) {
			pos = obj.getTop() + obj.initTop;
		} else {
			pos = obj.getTop() + obj.getHeight() + obj.initTop;
			//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";
	}, 30)
}
//scrolling layer end


/* ½ºÅ©¸³Æ® link »ý¼º 
	var aaa= new createLink(»ý¼º¼Ó¼º, url); 
*/

createLink=function(attType, attSrc){
	if(attType=="css"){ //cSS»ý¼º
		var newLink=document.createElement("link");
		newLink.setAttribute("type", "text/css");
		newLink.setAttribute("rel", "stylesheet");
		newLink.setAttribute("href", attSrc); 
	}else{
		var newLink=document.createElement("script");
		newLink.setAttribute("type", "text/javascript");
		newLink.setAttribute("src", attSrc);
	}
	document.getElementsByTagName('head')[0].appendChild(newLink); // 
}

/* È­¸é È®´ë Ãà¼Ò ½ÃÀÛ IE Àü¿ë */
var nowZoom = 100; // ÇöÀçºñÀ² 
var maxZoom = 120; // ÃÖ´ëºñÀ²(500À¸·ÎÇÏ¸é 5¹è Ä¿Áø´Ù) 
var minZoom = 80; // ÃÖ¼ÒºñÀ² 

 

//È­¸é Å°¿î´Ù. 
function zoomIn(){ 
    if (nowZoom < maxZoom){ 
        nowZoom += 5; //25%¾¿ Ä¿Áø´Ù. 
    }else{ 
  alert("´õÀÌ»óÅ©°Ôº¼¼ö ¾ø½À´Ï´Ù.");
        return; 
    } 
    document.body.style.zoom = nowZoom + "%"; 
} 

//È­¸é ÁÙÀÎ´Ù. 
function zoomOut(){ 

    if (nowZoom > minZoom){ 
        nowZoom -= 5; //25%¾¿ ÀÛ¾ÆÁø´Ù. 
    }else{ 
 alert("´õÀÌ»óÀÛ°Ôº¼¼ö ¾ø½À´Ï´Ù.");
        return; 
    } 
    document.body.style.zoom = nowZoom + "%"; 
} 

//È­¸é ¿ø·¡´ë·Î 
function zoomDefault(){ 
    nowZoom = 100; 
    document.body.style.zoom = nowZoom + "%"; 
}