/*ºê¶ó¿ìÀúÅ¸ÀÌÆ²*/
function browser_title(){
	document.title = "ÇØ¿ÜÀÚ¿ø°³¹ß Á¤º¸°ø°³ ¼­ºñ½º";
}
browser_title();


//Body Onload 
function BodyOnload() {
		imgOff(depth3);
	}
//1Depth Menu rollOn 
function ImgPreLoad(imgTitle, imageNum) {
		imageNum++;
		rollOn = new Array(imageNum);
		rollOff = new Array(imageNum);
		for (j = 1; j <= imageNum; j++) {
			if (j < 10) {
				tmp = "0";
			} else {
				tmp ="";
			}
			rollOn[j] = new Image();
			rollOn[j].src = imgTitle + tmp + j + "_on.gif";
			rollOff[j] = new Image();
			rollOff[j].src = imgTitle + tmp + j + "_off.gif";
		}
	}
	function imgOn(Num) {
    if (rollOn[Num] != null) {	
				document["T"+Num].src = rollOn[Num].src;
		}
	}
	function imgOff(Num) {
		if (rollOn[Num] != null) {
			if (Num != depth3) {
				document["T"+Num].src = rollOff[Num].src;
			}
      else {  
      document["T"+Num].src = rollOn[Num].src;
      }
		}
	}

/****************** new_0930Ãß°¡****************************/
document.writeln("<form name='down' method='get' action='/common/kep_download.jsp'>");//=>
document.writeln("<input type='hidden' name='FileName3'>");
document.writeln("<input type='hidden' name='FileName2' >");
document.writeln("<input type='hidden' name='FileName1' >");

document.writeln("</form>");
function getDown(sFile1,sFile2) {	
	down.FileName1.value=sFile1;
	down.FileName2.value=sFile2;
	down.submit();
}

//TopArea
function Top_Resource(){
document.writeln("<div id='TopCont'>");
document.writeln("	<div class='timg'><img src='/common/resource/image/resource_timg.gif' alt=''></div>");
document.writeln("</div>");

document.writeln("<div id='BodyCont'>");
document.writeln("	<div class='blue-top'></div>");
document.writeln("	<div id='leftmenu'>");
document.writeln("		<script>LeftMenu();</script>");	/*LeftMenu_Function*/
document.writeln("	</div>");
document.writeln("	<div id='right-content'>");
document.writeln("		<div class='white-box'>");
document.writeln("			<div class='white-top'></div>");
}

//Leftmenu
function LeftMenu(){
ImgPreLoad('/common/resource/image/lmu_',6);
document.writeln("		<table cellpadding='0' cellspacing='0' width='155'>");
document.writeln("		<tr><td height='93'></td></tr>");
document.writeln("		<tr><td><a href='/common/resource/resource_05.html' onmouseover='imgOn(5)' onmouseout='imgOff(5)'><img src='/common/resource/image/lmu_05_off.gif' alt='ÇØ¿ÜÀÚ¿ø°³¹ß' name='T5'></a></td></tr>");
document.writeln("		<tr><td><img src='/common/resource/image/lmu_hline.gif' alt=''></td></tr>");
document.writeln("		<tr><td><a href='/common/resource/resource_01.html' onmouseover='imgOn(1)' onmouseout='imgOff(1)'><img src='/common/resource/image/lmu_01_off.gif' alt='Á¤º¸°ø°³¼­ºñ½º ¾È³»' name='T1'></a></td></tr>");
document.writeln("		<tr><td><img src='/common/resource/image/lmu_hline.gif' alt=''></td></tr>");
document.writeln("		<tr><td><a href='/common/resource/resource_02.html' onmouseover='imgOn(2)' onmouseout='imgOff(2)'><img src='/common/resource/image/lmu_02_off.gif' alt='½Å°íÀýÂ÷' name='T2'></a></td></tr>");
document.writeln("		<tr><td><img src='/common/resource/image/lmu_hline.gif' alt=''></td></tr>");
document.writeln("		<tr><td><a href='/common/resource/resource_03.jsp?div=1' onmouseover='imgOn(3)' onmouseout='imgOff(3)'><img src='/common/resource/image/lmu_03_off.gif' alt='½Å°íÁøÇà' name='T3'></a></td></tr>");
document.writeln("		<tr><td><img src='/common/resource/image/lmu_hline.gif' alt=''></td></tr>");
document.writeln("		<tr><td><a href='/common/resource/resource_04.jsp?div=1' onmouseover='imgOn(4)' onmouseout='imgOff(4)'><img src='/common/resource/image/lmu_04_off.gif' alt='»ç¾÷ÇöÈ²' name='T4'></a></td></tr>");
document.writeln("		<tr><td><img src='/common/resource/image/lmu_hline.gif' alt=''></td></tr>");
document.writeln("		<tr><td><a href='/community/core/div_2180.html' onmouseover='imgOn(6)' onmouseout='imgOff(6)'><img src='/common/resource/image/lmu_06_off.gif' alt='»ç¾÷ÇöÈ²' name='T6'></a></td></tr>");
document.writeln("		<tr><td><img src='/common/resource/image/lmu_hline.gif' alt=''></td></tr>");
document.writeln("		<tr><td height='10'></td></tr>");
document.writeln("		<tr><td><a href='http://dart.fss.or.kr' target='_blank'><img src='/common/resource/image/banner_fsc.gif' alt='±ÝÀ¶°¨µ¶¿ø¹Ù·Î°¡±â'></a></td></tr>");
document.writeln("		</table>");
}

//BottomArea
function Bottom_Resource(){
document.writeln("			<div class='white-bot'></div>");
document.writeln("		</div>");
document.writeln("	</div>");
document.writeln("	<div class='blue-bot'></div>");
document.writeln("</div>");

document.writeln("<div id='FooterCont'>");
document.writeln("	<div class='copyright'><img src='/common/resource/image/resource_footer.gif' width='865' height='64' alt=''></div>");
document.writeln("</div>");
}

function PopAverage(){
	var panew = window.open('/common/resource/pop_average02.html','_av','width=715,height=550,top=30,left=0,scrollbars=yes');
	//alert("µ¥ÀÌÅ¸ º¯°æ ÀÛ¾÷Áß");
}

function PopAverage2(){
	var panew = window.open('/common/resource/pop_average01.html','_av','width=715,height=550,top=30,left=0,scrollbars=yes');
	//alert("µ¥ÀÌÅ¸ º¯°æ ÀÛ¾÷Áß");
}

function Popresource(){
	var panew = window.open('/common/resource/pop_resource01.html','_av','width=715,height=550,top=30,left=0,scrollbars=yes');
}

// common.js
var tabcurrentSeq = -1;
function initTabMenu2(menuEl) {
	for (i=0; i<menuEl.length; i++) {
		if (i != tabcurrentSeq) {
			menuEl[i].onmouseover = menuOver2;
			menuEl[i].onmouseout = menuOut2;
		} else {
			menuEl[i].src = menuEl[i].src.replace("_off.gif", "_on.gif")
		}
	}
}

/* depth4*/
// image roll
function menuOver2() {
	this.src = this.src.replace("_off.gif", "_on.gif");
}
function menuOut2() {
	this.src = this.src.replace("_on.gif", "_off.gif");
}

var tabcurrentSeq = -1;
function initTabMenu2(menuEl) {
	for (i=0; i<menuEl.length; i++) {
		if (i != tabcurrentSeq) {
			menuEl[i].onmouseover = menuOver2;
			menuEl[i].onmouseout = menuOut2;
		} else {
			menuEl[i].src = menuEl[i].src.replace("_off.gif", "_on.gif")
		}
	}
}
document.getElementsBySelector = function(selector) {
	// Attempt to fail gracefully in lesser browsers
	if (!document.getElementsByTagName) {
		return new Array();
	}
	// Split selector in to tokens
	var tokens = selector.split(' ');
	var currentContext = new Array(document);
	for (var i = 0; i < tokens.length; i++) {
		token = tokens[i].replace(/^\s+/,'').replace(/\s+$/,'');;
		if (token.indexOf('#') > -1) {
			// Token is an ID selector
			var bits = token.split('#');
			var tagName = bits[0];
			var id = bits[1];
			var element = document.getElementById(id);
			if (tagName && element.nodeName.toLowerCase() != tagName) {
				// tag with that ID not found, return false
				return new Array();
			}
			// Set currentContext to contain just this element
			currentContext = new Array(element);
			continue; // Skip to next token
		}
		if (token.indexOf('.') > -1) {
			// Token contains a class selector
			var bits = token.split('.');
			var tagName = bits[0];
			var className = bits[1];
			if (!tagName) {
				tagName = '*';
			}
			// Get elements matching tag, filter them for class selector
			var found = new Array;
			var foundCount = 0;
			for (var h = 0; h < currentContext.length; h++) {
				var elements;
				if (tagName == '*') {
						elements = getAllChildren(currentContext[h]);
				} else {
						elements = currentContext[h].getElementsByTagName(tagName);
				}
				for (var j = 0; j < elements.length; j++) {
					found[foundCount++] = elements[j];
				}
			}
			currentContext = new Array;
			var currentContextIndex = 0;
			for (var k = 0; k < found.length; k++) {
				if (found[k].className && found[k].className.match(new RegExp('\\b'+className+'\\b'))) {
					currentContext[currentContextIndex++] = found[k];
				}
			}
			continue; // Skip to next token
		}
		// Code to deal with attribute selectors
		if (token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)) {
			var tagName = RegExp.$1;
			var attrName = RegExp.$2;
			var attrOperator = RegExp.$3;
			var attrValue = RegExp.$4;
			if (!tagName) {
				tagName = '*';
			}
			// Grab all of the tagName elements within current context
			var found = new Array;
			var foundCount = 0;
			for (var h = 0; h < currentContext.length; h++) {
				var elements;
				if (tagName == '*') {
						elements = getAllChildren(currentContext[h]);
				} else {
						elements = currentContext[h].getElementsByTagName(tagName);
				}
				for (var j = 0; j < elements.length; j++) {
					found[foundCount++] = elements[j];
				}
			}
			currentContext = new Array;
			var currentContextIndex = 0;
			var checkFunction; // This function will be used to filter the elements
			switch (attrOperator) {
				case '=': // Equality
					checkFunction = function(e) { return (e.getAttribute(attrName) == attrValue); };
					break;
				case '~': // Match one of space seperated words 
					checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('\\b'+attrValue+'\\b'))); };
					break;
				case '|': // Match start with value followed by optional hyphen
					checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('^'+attrValue+'-?'))); };
					break;
				case '^': // Match starts with value
					checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) == 0); };
					break;
				case '$': // Match ends with value - fails with "Warning" in Opera 7
					checkFunction = function(e) { return (e.getAttribute(attrName).lastIndexOf(attrValue) == e.getAttribute(attrName).length - attrValue.length); };
					break;
				case '*': // Match ends with value
					checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) > -1); };
					break;
				default :
					// Just test for existence of attribute
					checkFunction = function(e) { return e.getAttribute(attrName); };
			}
			currentContext = new Array;
			var currentContextIndex = 0;
			for (var k = 0; k < found.length; k++) {
				if (checkFunction(found[k])) {
					currentContext[currentContextIndex++] = found[k];
				}
			}
			// alert('Attribute Selector: '+tagName+' '+attrName+' '+attrOperator+' '+attrValue);
			continue; // Skip to next token
		}
		// If we get here, token is JUST an element (not a class or ID selector)
		tagName = token;
		var found = new Array;
		var foundCount = 0;
		for (var h = 0; h < currentContext.length; h++) {
			var elements = currentContext[h].getElementsByTagName(tagName);
			for (var j = 0; j < elements.length; j++) {
				found[foundCount++] = elements[j];
			}
		}
		currentContext = found;
	}
	return currentContext;
}

function Pagelist(fn)    {
		 document.form1.action=fn;
		 document.form1.submit();
}

//°Ë»öÈÄ ÀüÃ¼ ¸ñ·Ï Å¬¸¯½Ã¿¡ ÀÌµ¿
function LinkFirst() {
	 document.form1.sch.value="";
	 document.form1.kwd.value="";
	 document.form1.submit();
}

// °Ë»ö¾î ÀÔ·ÂÃ¢¿¡¼­ ¿£ÅÍ½Ã °Ë»ö
function checkEnter(){
	if(event.keyCode == 13) PageSearch();
}

//°Ë»öÃ³¸®
var SearchProgress = false;
function PageSearch()    {
	if (SearchProgress == true) {
		alert("°Ë»öÃ³¸®ÁßÀÔ´Ï´Ù. Àá½Ã¸¸ ±â´Ù·Á ÁÖ½Ê½Ã¿À.");
		return;
	}	
	SearchProgress = true;
	document.form1.pagenum.value="1";
	document.form1.submit();
}

function PageView(pagenum){	
	document.form1.pagenum.value=pagenum;	
	document.form1.submit();
}

function view(sn,fn)    {
		 document.form1.sn.value=sn;
		 document.form1.action=fn;
		 document.form1.submit();
}

//lib.js
// tabbed menu
function initTabMenu(menuElId) {
	var tabMenu = document.getElementById(menuElId).getElementsByTagName("a");
	for(i=0; i<tabMenu.length; i++) {
		thismenu = tabMenu.item(i);
		thismenu.menuContainer = document.getElementById(menuElId);
		thismenu.targetEl = document.getElementById(tabMenu.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.getElementsByTagName("img").item(0).onmouseover = menuOver;
		thismenu.getElementsByTagName("img").item(0).onmouseout = menuOut;
		thismenu.onclick = tabMenuClick;
	}

	initmenu = tabMenu.item(0);
	initmenu.targetEl.style.display = "block";
	initmenu.getElementsByTagName("img").item(0).onmouseover();
	initmenu.getElementsByTagName("img").item(0).onmouseover = null;
	initmenu.getElementsByTagName("img").item(0).onmouseout = null;
	initmenu.menuContainer.current = initmenu;
}
function tabMenuClick() {
	currentmenu = this.menuContainer.current;
	if (currentmenu != this) {
		currentmenu.targetEl.style.display = "none";
		currentmenu.getElementsByTagName("img").item(0).onmouseover = menuOver;
		currentmenu.getElementsByTagName("img").item(0).onmouseout = menuOut;
		currentmenu.getElementsByTagName("img").item(0).onmouseout();
	
		this.targetEl.style.display = "block";
		this.getElementsByTagName("img").item(0).onmouseover = null;
		this.getElementsByTagName("img").item(0).onmouseout = null;
		this.menuContainer.current = this;
	}
	return false;
}