/* menuTab */
function getChildElementNodes(parentNode){
		var childNodes = parentNode.childNodes;
		var childArray = new Array();
		for(var i=0; i<childNodes.length; i++){
			if(childNodes[i].nodeType == 1){
				childArray.push(childNodes[i]);
			}
		}
		return childArray;
	}

	function toggleImg(imgNode, onOff){
		var imgFileName = imgNode.src;
		if(onOff == "on"){
			if(imgFileName.lastIndexOf("_ov.gif") < 0){
				imgNode.src = imgFileName.substring(0, imgFileName.lastIndexOf(".gif")) + "_ov.gif";
			}
		}else{
			if(imgFileName.lastIndexOf("_ov.gif") > 0){
				imgNode.src = imgFileName.substring(0, imgFileName.lastIndexOf(".gif")-3) + ".gif";
			}
		}
	}

	function changeImage(targetNode){
		var allNodes = getChildElementNodes(targetNode.parentNode);
		for(var i=0; i<allNodes.length; i++){
			var img = allNodes[i].getElementsByTagName("img")[0];
			if(img != undefined){
				if(allNodes[i] == targetNode){
					toggleImg(img, "on");
				}else{
					toggleImg(img, "off");
				}
			}
		}
	}

	function showContent(targetNode){
		var allNodes = getChildElementNodes(targetNode.parentNode);
		for(var i=0; i<allNodes.length; i++){
			var content = allNodes[i].getElementsByTagName("ul")[0];
			if(content != undefined){
				if(allNodes[i] == targetNode){
					content.style.display = "block";
				}else{
					content.style.display = "none";
				}
			}
		}
	}

	function initMain(){
		var navigation = document.getElementById("navigation");
		var mainMenuList = getChildElementNodes(navigation);
		for(var i=0; i<mainMenuList.length; i++){
			var a = mainMenuList[i].getElementsByTagName("a")[0];
			a.onmouseover = function(){
				changeImage(this.parentNode);
				showContent(this.parentNode);
			}
			a.onfocus = function(){
				changeImage(this.parentNode);
				showContent(this.parentNode);
			}
		}

		
		var boardBox = document.getElementById("boardBox");
		var boardBoxList = boardBox.getElementsByTagName("h3");	
		for(var i=0; i<boardBoxList.length; i++){
			boardBoxList[i].onclick = function(){
				changeImage(this);
				showContent(getElementNextSibling(this));
			}
		}
		showContent(getElementNextSibling(boardBoxList[0]));
	}

	function getElementNextSibling(node){
		var nextElement = node.nextSibling;
		if(nextElement == null){
			return null;
		}else if(nextElement.nodeType != 1){
			return getElementNextSibling(nextElement);
		}
		return nextElement;
	}


/************** ÅëÇÔ°Ë»ö ****************/
// ¹Ù·Î°¡±â »ç¿ë
function layerOpen(id) {
	try {
		var obj = document.getElementById(id);
		obj.style.display = (obj.style.display == "none") ? "block" : "none";
	} catch (e) { }
	return true;
}
// ¼¿·ºÆ® ·¹ÀÌ¾î ¼±ÅÃ½Ã ¹è°æ»ö»ó º¯°æ
function Chgbg(obj, color) {
    obj.style.backgroundColor = color;
    return false;
}

function selectSearch(txt) {
    var obj = document.getElementById('selectbox');
    document.getElementById('select_layer').style.display = "none";
    obj.innerHTML = txt;
    return false;
}




/**************** swfÆÄÀÏ ****************/
function swf(src,w,h){
	html = '';
	html += '<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="param" width="'+w+'" height="'+h+'">';
	html += '<param name="movie" value="'+src+'">';
	html += '<param name="quality" value="best">';
	html += '<param name="wmode" value="transparent">';
	html += '<embed src="'+src+'" quality=best width="'+w+'" height="'+h+'" quality="best" pluginspage="https://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent"><\/embed>';
	html += '<\/object>';
	document.write(html);
}

	function isKey(obj)
	{
		if(event.keyCode == 13)
		{
			obj.submit();
		}
	}



/***************************************
* IMAGE_ROLLOVER  
***************************************/

function menuOn(imgEl, gbn) {
  alert(gbn);
 imgEl.onmouseout = function() {
  
  if(gbn = ""){
    imgEl.src = imgEl.src.replace("_on.gif", ".gif");
  }
  
 }
 imgEl.src = imgEl.src.replace(".gif", "_on.gif");
}


function goMenu(Val,Sel)
{
  Sel.value = '';
  if (Val) location=Val;
  
}


// [[ ÀÌ¹ÌÁö ·Ñ¿À¹ö ]]  ex) <img src="url" onmouseover="menuOn(this);" onmouseout="menuOut(this);"  />
/*
 * @title : ÀÌ¹ÌÁö on´ëÃ¼
 * @version : 1.0
 * @writer :
 * @modify(date,writer) :
 * @what's new :
 */
function menuOn(imgEl)
{
  if(imgEl.src.indexOf("_on") < 0) imgEl.src = imgEl.src.replace(".gif", "_on.gif");
  if(imgEl.src.indexOf("_on") < 0) imgEl.src = imgEl.src.replace(".jpg", "_on.jpg");
}

/*
 * @title : ÀÌ¹ÌÁö off´ëÃ¼
 * @version : 1.0
 * @writer :
 * @modify(date,writer) :
 * @what's new :
 */
function menuOut(imgEl)
{
  imgEl.src = imgEl.src.replace("_on.gif", ".gif");
  imgEl.src = imgEl.src.replace("_on.jpg", ".jpg");
}





