document.domain='daum.net';

// 리사이징 이미지 Original 크기
var img_originW, img_originH;


function addEvent(target, en, func)
{
	if (window.addEventListener){
		if ((target == window) && (en.toLowerCase() == "load") && !window.opera && !(!document.all && document.childNodes && !navigator.taintEnabled))
			document.addEventListener("DOMContentLoaded", func, false);
		else
			target.addEventListener(en, func, false);
	}else if (target.attachEvent){
		if ((target == window) && (en.toLowerCase() == "load"))
			document.attachEvent("onreadystatechange", function(e) { if (document.readyState == "complete") func(); });
		else
			target.attachEvent("on"+en, func);
	}else{
		var __func = eval("target.on"+en);
		eval("target.on"+en) = function(){
			func();
			__func();
		}
	}
};


var Utf8 = {   
	  
	// public method for url encoding   
	encode : function (string) {   
		string = string.replace(/\r\n/g,"\n");   
		var utftext = "";   
  
		for (var n = 0; n < string.length; n++) {   
  
			var c = string.charCodeAt(n);   
  
			if (c < 128) {   
				utftext += String.fromCharCode(c);   
			}   
			else if((c > 127) && (c < 2048)) {   
				utftext += String.fromCharCode((c >> 6) | 192);   
				utftext += String.fromCharCode((c & 63) | 128);   
			}   
			else {   
				utftext += String.fromCharCode((c >> 12) | 224);   
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);   
				utftext += String.fromCharCode((c & 63) | 128);   
			}   
	  
		}   
  
		return utftext;   
	},   
  
	// public method for url decoding   
	decode : function (utftext) {   
		var string = "";   
		var i = 0;   
		var c = 0;
		var c1 = 0;
		var c2 = 0;   
  
		while ( i < utftext.length ) {   
  
			c = utftext.charCodeAt(i);   
  
			if (c < 128) {   
				string += String.fromCharCode(c);   
				i++;   
			}   
			else if((c > 191) && (c < 224)) {   
				c2 = utftext.charCodeAt(i+1);   
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));   
				i += 2;   
			}   
			else {   
				c2 = utftext.charCodeAt(i+1);   
				c3 = utftext.charCodeAt(i+2);   
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));   
				i += 3;   
			}   
  
		}   
  
		return string;   
	}   
  
}

// Floating Left Menu
function float_leftmenu() {
	// Exception
	if (!document.getElementById("dic_dcTitle")) return;
	if (!document.getElementById("float_LMenu")) return;
	if (document.getElementById("dic_dcLMenu2")) return;
	var titleHeight = document.getElementById("dic_dcTitle").scrollHeight; // IE : 1줄-41px, 2줄-60px | FF : 1줄 45px, 2줄-68px
	if (document.getElementById("dic_dcTitle").className == "dic_dcNoTitleBox") titleHeight = 0;

	// 본문 전체 높이
	var bodyHeight;
	if (document.getElementById("page")) bodyHeight = document.getElementById("page").scrollHeight + 13;
	else if (document.getElementById("page_nobg")) bodyHeight = document.getElementById("page_nobg").scrollHeight + 13;
	// Exception
	else return;

	// 플로팅 메뉴 높이
	var lmenuHeight = document.getElementById("float_LMenu").scrollHeight;
	document.getElementById("dic_dcLMenu").style.height = lmenuHeight - 42 + "px";

	var lmenuPos;
	if (navigator.appName == "Microsoft Internet Explorer") {
		if (titleHeight > 100) lmenuPos = parseInt(lmenuHeight) + document.body.scrollTop - 155;
		else if (titleHeight > 50) lmenuPos = parseInt(lmenuHeight) + document.body.scrollTop - 145;
		else if (titleHeight == 0) lmenuPos = parseInt(lmenuHeight) + document.body.scrollTop - 145;
		else lmenuPos = parseInt(lmenuHeight) + document.body.scrollTop - 95;
	}
	else {
		if (titleHeight > 80) lmenuPos = parseInt(lmenuHeight) + document.body.scrollTop - 155;
		else if (titleHeight > 50) lmenuPos = parseInt(lmenuHeight) + document.body.scrollTop - 145;
		else if (titleHeight == 0) lmenuPos = parseInt(lmenuHeight) + document.body.scrollTop - 145;
		else lmenuPos = parseInt(lmenuHeight) + document.body.scrollTop - 95;
	}

	if (lmenuPos < bodyHeight || !document.getElementById("float_LMenu").style.top) {
		// 세 줄 본문일 경우
		if (titleHeight > 100) {
			if (parseInt(document.body.scrollTop) > 240) document.getElementById("float_LMenu").style.top = document.body.scrollTop - 71 - titleHeight - 14 + "px";
			else document.getElementById("float_LMenu").style.top = titleHeight + 20 + "px";
		}
		// 두 줄 본문일 경우
		else if (titleHeight > 50) {
			if (parseInt(document.body.scrollTop) > 220) document.getElementById("float_LMenu").style.top = document.body.scrollTop - 62 - titleHeight - 14 + "px";
			else document.getElementById("float_LMenu").style.top = titleHeight + 20 + "px";
		}
		else if (titleHeight == 0) {
			if (parseInt(document.body.scrollTop) > 175) document.getElementById("float_LMenu").style.top = document.body.scrollTop - 130 - titleHeight - 14 + "px";
			else document.getElementById("float_LMenu").style.top = titleHeight + 20 + "px";
		}
		else {
			if (parseInt(document.body.scrollTop) > 200) document.getElementById("float_LMenu").style.top = document.body.scrollTop - 85 - titleHeight - 14 + "px";
			else document.getElementById("float_LMenu").style.top = titleHeight + 20 + "px";
		}
	}
}

function open_small_popup(url, q) {
	if(q == '') {
		var url = url;
	} else {
		var url = url + '?q=' + q;
	}
	openWindow=window.open(url, 'smalldic', 'width=411,height=530,resizable=no,scrollbars=yes');
   	openWindow.focus();
}
	
function popWin(url, width, height) {
	openWindow = window.open(url, '_blank', 'width=' + width + ',height=' + height + ',resizable=yes,scrollbars=yes');
	openWindow.focus();
}
	
function check_submit(chkVal,chkSel) {
	var w = "dictab";
	var m = "";
	//var searchURL = "http://my.ndic.daum.net/dic100/search_result_total.do?";
	searchURL = "search_result_total.do?";
	var f = document.dicSearch;
	var q = "";
	var urlPrefix="";
	if ( document.urlForm.LAYOUT_URL_PREFIX ) {
		urlPrefix=document.urlForm.LAYOUT_URL_PREFIX.value;
	}
	if(chkVal == 'dic100' || chkVal == 'ec') { // 백과
		w="100";
		m="dic";
		// 로컬에서 검색
		//if (document.location.host.substring(0,3) == "my.") 
		searchURL = document.urlForm.HOME_EC_HIDDEN.value + "search.do?";
		// 개발서버와 실서버에서 검색
		//else searchURL = document.urlForm.HOME_EC_HIDDEN.value;
		f.action = searchURL;
		q = document.urlForm.ENCODED_EC_KWD.value;
	}else if (chkVal == 'dicen'){ // 영어
		if ( document.urlForm && document.urlForm.LAYOUT_SEARCH_URL) {
			searchURL = document.urlForm.HOME_EN_HIDDEN.value + urlPrefix + document.urlForm.LAYOUT_SEARCH_URL.value+"?"
		} else {
			searchURL = document.urlForm.HOME_EN_HIDDEN.value + urlPrefix + "search.do?"
		}
		
		if ( f.endicKind && f.endicKind.value && f.endicKind.value !="" ) {
			searchURL+="endic_kind="+f.endicKind.value+"&";
		}
		if ( f.m && f.m.value &&  f.m.value !="" ) {
			searchURL+="m="+f.m.value+"&";
		}
		q = document.urlForm.ENCODED_EN_KWD.value;
	
	}else if (chkVal == 'dickr' || chkVal == 'kr'){ // 국어
		searchURL = document.urlForm.HOME_KR_HIDDEN.value + urlPrefix + "search.do?"
		if ( f.old_kor && f.old_kor.checked ) {
			searchURL+="old_kor=Y&";
		}
		q = document.urlForm.ENCODED_KR_KWD.value;
	}else if (chkVal == 'dicee'){ // 영영
		searchURL = document.urlForm.HOME_EE_HIDDEN.value +  urlPrefix + "search_result_total.do?"
		q = document.urlForm.ENCODED_EE_KWD.value;
	}else if (chkVal == 'dicit'){ // IT용어
		searchURL = document.urlForm.HOME_IT_HIDDEN.value +  urlPrefix + "search_result_total.do?"
		q = document.urlForm.ENCODED_IT_KWD.value;
	}else if (chkVal == 'diccc'){ // 한자
		searchURL = document.urlForm.HOME_HA_HIDDEN.value +  urlPrefix + "search_result_total.do?"
		q = document.urlForm.ENCODED_HA_KWD.value;
	}else if (chkVal == 'dicha'){ // 한자
		searchURL = document.urlForm.HOME_HA_HIDDEN.value +  urlPrefix + "search_result_total.do?"
		q = document.urlForm.ENCODED_HA_KWD.value;
	}else if (chkVal == 'dicjp'){ // 일어
		searchURL = document.urlForm.HOME_JP_HIDDEN.value +  urlPrefix + "search_result_total.do?"
		q = document.urlForm.ENCODED_JP_KWD.value;
	}else if (chkVal == 'diccl'){ // 문화원형
		searchURL = document.urlForm.HOME_CL_HIDDEN.value +  urlPrefix + "dictionary_search.asp?"
		q = document.urlForm.ENCODED_CL_KWD.value;
	}else if (chkVal == 'dicch'){ // 중국어
		searchURL = document.urlForm.HOME_CN_HIDDEN.value +  urlPrefix + "index.html?search=yes&"
		q = document.urlForm.ENCODED_CN_KWD.value;
	}else{ // 통합
		searchURL = document.urlForm.HOME_DIC_HIDDEN.value +  urlPrefix + "search_result_total.do?"
		q = document.urlForm.ENCODED_DIC_KWD.value;
	}

	if (chkSel == "tab") {
		if (f.q.value == "") {
			alert("검색어를 입력해 주십시오.");
			return false;
		} else {
			f.method = "get";
			if (chkVal == 'diccl') {
				document.location.href = searchURL + "query=" + q;
				return false;
			} else {
				// 로컬에서 검색
				//if (document.location.host.substring(0,3) == "my.") 
				document.location.href = searchURL + "q=" + q.replace("/", "");
				// 개발서버와 실서버에서 검색
				//else document.location.href = searchURL + q.replace("/", "");
				return false;
			}
		}
	}
	else {
		if (f.q.value == "") {
			alert("검색어를 입력해 주십시오.");
			return false;
		} else {
			q = f.q.value;
			f.method = "get";
			if (chkVal == 'diccl') {
				document.location.href = searchURL + "query=" + encodeURIComponent(q).replace("/", "");
				return false;
			} else {
				// 로컬에서 검색
				//if (document.location.host.substring(0,3) == "my.") 
				document.location.href = searchURL + "q=" + encodeURIComponent(q).replace("/", "");
				// 개발서버와 실서버에서 검색
				//else document.location.href = searchURL + decodeURIComponent(q).replace("/", "");
				return false;
			}
		}
	}
}

function dicSearchSubmit() {
	var f = document.dicSearch;
	if ( f.q.value !="" ) {
		check_submit(f.type.value,"tab");
	}
}

// 스트링 내에서 파라미터만 변경 
function changeParamValueFromStr( param_name, mlVal, fromStr) {
	var url=document.URL;
	if ( fromStr && fromStr !='') {
		url = fromStr;
	} 
	
	if ( url.indexOf("?") > 0) {
		url=url.replace("#?","?");
		url=url.replace("?#","?");
		if ( url.indexOf(param_name+"=") > 0 ) {
			var url_front=url.substring(0,url.indexOf(param_name+"=")) 
			var url_back=url.substring(url.indexOf(param_name+"="))
			if ( url_back.indexOf("&") > 0) { 
				var url_back_removed =url_back.substring(url_back.indexOf("&")+1); 
			} else {
				var url_back_removed ="";
			}
			url = url_front +  url_back_removed;
		}
		
		url=url.replace("?","?"+param_name+"="+mlVal+"&");
	} else {
		url = url+"?"+param_name+"="+mlVal;
	}
	return url;
}

// 현재 url에서 해당 변수를 바꾼 뒤 이동 
function changeParamValueFromUrl( param_name, mlVal, fromUrl ) {
	url = changeParamValueFromStr ( param_name, mlVal, fromUrl );
	document.location.href=url;
}
function getReplacedUrl( sOrgStr , sReplaceStr) {
	var mlObj = document.dicSearch.menu_locale;
	var url=document.URL;
	
	url=url.replace(sOrgStr,sReplaceStr);
	return url;
	
}


// 검색어를 다른 탭에서 검색
function chkEncodedQuery(query, encoded_query) {
	if (document.dicSearch.dic_q.value == query) {
		location.href="http://culturedic.daum.net/dictionary_search.asp?query=" + encoded_query;
	}
}

// 리스트 아이템 폴딩&언폴딩 함수
function dcFoldList(obj) {
	var dcObj = obj.parentNode;
	var dcPObj = dcObj.parentNode;
	var dcDepth = parseInt(dcObj.className.replace("depth",""));
	if (dcDepth == 1) {
		for (var h=0; h<dcPObj.getElementsByTagName("LI").length; h++) {
			if (dcPObj.getElementsByTagName("LI")[h].className != "depth1"){
				dcPObj.getElementsByTagName("LI")[h].style.display = "none";
			}else{
				dcPObj.getElementsByTagName("LI")[h].style.backgroundImage = "url(http://imgsrc.search.daum-img.net/dic/2008/ico_left_open.gif)";
			}
		}
		if(dcObj.className == "depth1"){
			for (var h=0; h<dcPObj.getElementsByTagName("UL").length; h++) {
				dcPObj.getElementsByTagName("UL")[h].style.display = "none";
			}
		}
	}
	for (var i=0; i<dcObj.childNodes.length; i++) {
		if (dcObj.childNodes[i].tagName == "UL") {
			for (var j=0; j<dcObj.childNodes[i].childNodes.length; j++) {
				if (dcObj.childNodes[i].childNodes[j].tagName == "LI") {
					if (dcObj.childNodes[i].childNodes[j].style.display == "none" || dcObj.childNodes[i].childNodes[j].style.display == "") {
						for (var k=0; k<dcPObj.childNodes.length; k++) {
							if (dcPObj.childNodes[k].tagName == "LI") dcPObj.childNodes[k].style.fontWeight = "normal";
						}
						dcObj.style.fontWeight = "bold";
						dcObj.style.backgroundImage = "url(http://imgsrc.search.daum-img.net/dic/2008/ico_left_close.gif)";
						dcObj.childNodes[i].style.display = "block";
						dcObj.childNodes[i].style.marginTop = "6px";
						dcObj.childNodes[i].style.paddingBottom = "5px";
						dcObj.childNodes[i].style.marginBottom = "10px";
						dcObj.childNodes[i].style.backgroundColor = "#fbfbfb";
						dcObj.childNodes[i].childNodes[j].style.display = "block";
						dcObj.childNodes[i].childNodes[j].className = "depth" + (dcDepth + 1);
					}else {
						dcObj.style.fontWeight = "normal";
						dcObj.childNodes[i].style.display = "none";
						dcObj.childNodes[i].childNodes[j].style.display = "none";
					}
				}
			}
		}
	}
	var dcLstObj = document.getElementById("dic_dcTable").getElementsByTagName("A");
	for (i=0; i<dcLstObj.length; i++) {
		dcLstObj[i].style.fontWeight = "normal";
	}
	
	if(dcObj.className == "depth1"){
		obj.style.fontWeight = "bold";
	}else{
		var dcdepth2Obj = document.getElementById("dic_dcTable").getElementsByTagName("LI");
		for (i=0; i<dcdepth2Obj.length; i++) {
			if(dcdepth2Obj[i].className == "depth2"){
				for (j=0; j<dcdepth2Obj[i].childNodes.length; j++) {
					if(dcdepth2Obj[i].childNodes[j].tagName == "A"){
						dcdepth2Obj[i].childNodes[j].style.color = "#333333";
					}
				}	
			}
		}
		for(i=0; i<obj.parentNode.parentNode.parentNode.childNodes.length; i++){
			if(obj.parentNode.parentNode.parentNode.childNodes[i].tagName == "A"){
				obj.parentNode.parentNode.parentNode.childNodes[i].style.fontWeight = "bold";
			}
		}
		obj.style.color = "#526AE8";
	}
}


// 우측 리스트 펼쳐보기 함수
function dcFoldRBoxDir(obj) {
	obj.innerHTML = "";
	var dcLstObj = obj.parentNode.parentNode.getElementsByTagName("LI");
	if (obj.className == "lstClose") {
		obj.innerHTML = "접기";
		obj.className = "lstOpen"
		for (var j=0; j<obj.parentNode.getElementsByTagName("IMG").length; j++) obj.parentNode.getElementsByTagName("IMG")[j].src = "http://imgsrc.search.daum-img.net/dic/r_ico_close.gif";
	}
	else if (obj.className == "lstOpen") {
		obj.innerHTML = "펼쳐보기";
		obj.className = "lstClose";
		for (var k=0; k<obj.parentNode.getElementsByTagName("IMG").length; k++) obj.parentNode.getElementsByTagName("IMG")[k].src = "http://imgsrc.search.daum-img.net/dic/r_ico_open.gif";
	}
	for (var i=0; i<dcLstObj.length; i++) {
		if (dcLstObj[i].className.substr(0,6) != "depth1") {
			if (dcLstObj[i].style.display == "none" || dcLstObj[i].style.display == "") dcLstObj[i].style.display = "block";
			else dcLstObj[i].style.display = "none";
		}
	}
}

// 우측 리스트 펼쳐보기 함수
function dcFoldRBoxLst(obj) {
	var pobj = obj.parentNode;
	obj.innerHTML = "";
	var dcLstObj = obj.parentNode.parentNode.getElementsByTagName("LI");
	if (pobj.className == "lstClose") {
		obj.innerHTML = "접기";
		pobj.className = "lstOpen"
	}
	else if (pobj.className == "lstOpen") {
		obj.innerHTML = "펼쳐보기";
		pobj.className = "lstClose";
	}
	for (var i=0; i<dcLstObj.length; i++) {
		if (pobj.className == "lstOpen" && dcLstObj[i].className.substr(0,9) == "dcRHidLst") dcLstObj[i].className = "dcRHidLst";
		else if (pobj.className == "lstClose" && dcLstObj[i].className.substr(0,9) == "dcRHidLst") dcLstObj[i].className = "dcRHidLst dcChkHid";
	}
}

// 좌측 관련태그 펼쳐보기 함수
function dcFoldRelTag(obj) {
	var tagObj = document.getElementById("dcTagMain").getElementsByTagName("SPAN");
	var pauseObj = document.getElementById("dcTagMain").getElementsByTagName("FONT");
	var aObj = document.getElementById("dcTagMain").getElementsByTagName("A");
	var pObj = obj.parentNode;
	var i;
	if (pObj.className == "lstOpen") {
		pObj.className = "lstClose";
		obj.innerHTML = "펼쳐보기";
		for (i=0; i<tagObj.length; i++) {
			if (tagObj[i].className == "open") tagObj[i].className = "close";
		}
		for (i=0; i<pauseObj.length; i++) {
			if (pauseObj[i].className == "open") pauseObj[i].className = "close";
		}
		for (i=0; i<aObj.length; i++) {
			if (aObj[i].className.indexOf("open") != -1) aObj[i].className = aObj[i].className.replace("open","close");
		}
	}
	else if (pObj.className == "lstClose") {
		pObj.className = "lstOpen";
		obj.innerHTML = "접기";
		for (i=0; i<tagObj.length; i++) {
			if (tagObj[i].className == "close") tagObj[i].className = "open";
		}
		for (i=0; i<pauseObj.length; i++) {
			if (pauseObj[i].className == "close") pauseObj[i].className = "open";
		}
		for (i=0; i<aObj.length; i++) {
			if (aObj[i].className.indexOf("close") != -1) aObj[i].className = aObj[i].className.replace("close","open");
		}
	}
}

function resizeFrame(obj) {
	try {
		var dcInnerBody;
		//var fObj = document.getElementsByTagName("IFRAME");
		//for (var i=0; i<fObj.length; i++) {
		//	if (fObj[i].parentNode.className == "dcTableContent") {
		//		if (fObj[i] == obj) {
		//			if (navigator.appName == "Microsoft Internet Explorer") dcInnerBody = obj.contentWindow.document.body;
		//			else dcInnerBody = obj.contentWindow.document.body;
		//		}
		//	}
		//}
		dcInnerBody = obj.contentWindow.document.body;
		//oldEvent = dcInnerBody.onclick;
		//dcInnerBody.onclick = function() {resizeFrame(obj, 1); oldEvent;};

		var dcInnerHeight = dcInnerBody.scrollHeight + (dcInnerBody.offsetHeight - dcInnerBody.clientHeight);
		if (navigator.appName == "Microsoft Internet Explorer") obj.style.height = parseInt(dcInnerHeight) + 14 + "px";
		else obj.style.height = parseInt(dcInnerHeight) + "px";

		//if (!arguments[1]) this.scrollTo(1,1);
	} catch(e) {
		return;
	}
}

function searchUrl(url) {
	if (document.location.host.substring(0,3) == "my.") location.href = url;
	else {
		if (url.indexOf("/dic100") != -1) location.href = encodeURIComponent(url.replace("search_result_total.do?q=", ""));
	}
}

// 참조항목 펼쳐보기&접기 함수
function dcFoldRefItem(obj) {
	var pobj = obj.parentNode;
	var arrList = pobj.parentNode.getElementsByTagName("LI");
	if (pobj.className.indexOf("Open") != -1) {
		pobj.className = pobj.className.replace("Open","Close");
		obj.innerHTML = "펼쳐보기";
		for (var i=0; i<arrList.length; i++) {
			if (arrList[i].className == "depth2" || arrList[i].className == "depth3") arrList[i].style.display = "none";
		}
	}
	else if (pobj.className.indexOf("Close") != -1) {
		pobj.className = pobj.className.replace("Close","Open");
		obj.innerHTML = "접기";
		for (var i=0; i<arrList.length; i++) {
			if (arrList[i].className == "depth2" || arrList[i].className == "depth3") arrList[i].style.display = "block";
		}
	}
}

// 이미지 리사이징 함수
function dic_resizeMultiImg(w) {
	if (document.getElementById("dic_resizingImg")) {
		if (w == "" || w == null) return;
		// 이미지 width 가 440px 이하일때 취소
		if (document.getElementById("dic_resizingImg").width.toString().replace("px","") <= w) return;
		document.getElementById("dic_resizingImg").width = w;
	}
}

// 이미지 리사이징 함수2 (멀티미디어 검색 리스트, 멀티미디어 본문 리스트)
function dic_resizeMultiLstImg(o,w,h) {
	if (o) {
		var lstimg_originW = o.width;
		var lstimg_originH = o.height;

		if (w == "" || w == null) return;
		if (parseInt(lstimg_originW.toString().replace("px","")) > w) {
			if (parseInt(lstimg_originH.toString().replace("px","")) > h) {
				if (lstimg_originH / h > lstimg_originW / w) {
					o.height = h;
				}
				else {
					o.width = w;
				}
			}
			else {
				o.width = w;
			}
		}
		else {
			if (parseInt(lstimg_originH.toString().replace("px","")) > h) {
				o.height = h;
			}
			else {
				return;
			}
		}
	}
}

// 이미지 크기 저장 함수
function dic_storeImgSize() {
	if (document.getElementById("dic_resizingImg")) {
		img_originW = document.getElementById("dic_resizingImg").width;
		img_originH = document.getElementById("dic_resizingImg").height;
	}
}

// 이미지 팝업창 오픈
function dic_openImgPopup(obj) {
	var iurl;
	if (obj == "" || obj == null) return;
	iurl = obj.src;
	var dicImgPopup = window.open(iurl, "imgPopupWindow", "menubar=0, resizable=0, width=" + img_originW + ", height=" + img_originH);
}

function dic_resizePopupWindow(w) {
	if (imgw > w) {
		document.getElementById("dic_popupImg").width = w;
	}
}

// 스페셜 메뉴가 있는 컨텐츠일 경우
var nowSMenu = 1;

// 스페셜 메뉴 마우스 오버/아웃 처리
function overDicItem(obj, chk, num) {
	var pobj = obj.parentNode;
	var arrlst = pobj.getElementsByTagName("LI");

	for (i=0; i<arrlst.length; i++) {
		if (i != nowSMenu - 1) {
			arrlst[i].className = arrlst[i].className.replace("_on", "_off");
		}
		if (i != nowSMenu - 1 && chk == "on" && arrlst[i] == obj) arrlst[i].className = arrlst[i].className.replace("_off", "_on");
	}
	dic_changeSpecialMenu(num);
}

// 스페셜 메뉴 변경
function dic_changeSpecialMenu(num) {
	var pobj = document.getElementById("dic_topSpecial");
	var arrobj = pobj.getElementsByTagName("DIV");
	for (var i=0; i<arrobj.length; i++) {
		if (arrobj[i].className == "specialContent") {
			if (arrobj[i].id == "specialContent" + num.toString()) arrobj[i].style.display = "block";
			else arrobj[i].style.display = "none";
		}
	}
	if (navigator.appName == "Microsoft Internet Explorer") document.getElementById("smenuArrow").style.top = num * 38 - 18 + "px";
	else document.getElementById("smenuArrow").style.top = num * 36 - 17 + "px";
	dic_activeSpecialMenu(num);
}

// 스페셜 메뉴 활성화
function dic_activeSpecialMenu(num) {
	var pobj = document.getElementById("specialMenu");
	var arrobj = pobj.getElementsByTagName("LI");
	for (var i=0; i<arrobj.length; i++) {
		if (i+1 == num) arrobj[i].className = arrobj[i].className.replace("_off", "_on");
		else arrobj[i].className = arrobj[i].className.replace("_on", "_off");
	}
	nowSMenu = num;
}

// 관련태그 펼쳐보기 텍스트 추가
function dic_addTagFoldTxt() {
	var tobj = document.getElementById("dic_dcRelTagFold");
	tobj.className = "lstClose";
	tobj.innerHTML = "<a href=\"javascript:;\" onclick=\"javascript:dcFoldRelTag(this);\">펼쳐보기</a>";
}

// 참조항목 펼쳐보기 텍스트 추가
function dic_addRefItemFoldTxt() {
	var robj = document.getElementById("dic_refBox");
	var lstobj = robj.getElementsByTagName("LI");
	var chklst = 0;
	for (var i=0; i<lstobj.length; i++) {
		if (lstobj[i].className.indexOf("depth1") == -1) chklst++;
	}
	if (chklst != 0) {
		var fobj = document.getElementById("dic_refFoldBox");
		fobj.className = "lstOpen";
		fobj.innerHTML = "<a href=\"javascript:;\" onclick=\"javascript:dcFoldRefItem(this);\">접기</a>";
	}
}

function print_popup(id) {
	if (document.urlForm.HOME_EC_HIDDEN.value != "" || document.urlForm.HOME_EC_HIDDEN.value != null) {
		strPath = document.urlForm.HOME_EC_HIDDEN.value+"contents.do?query1=" + id + "&print=y";
		window.open(strPath, "", "width=675, height=650, resizable=No ,scrollbars=Yes");
	}
}

function autoResizePopup() {
	var winW, winH, sizeToW, sizeToH;
	if ( parseInt(navigator.appVersion) > 3 ) {
 		if ( navigator.appName=="Netscape" ) {
  			winW = window.innerWidth;
			winH = window.innerHeight;
 		}
 		if ( navigator.appName.indexOf("Microsoft") != -1 ) {
  			winW = document.body.scrollWidth;
  			winH = document.body.scrollHeight;
 		}
	}
	sizeToW = 0;
	sizeToH = 0;
	if ( winW > 1000 ) {
		sizeToW = 1000 - document.body.clientWidth;
	} else if ( Math.abs(document.body.clientWidth - winW ) > 3 ) {
		sizeToW = winW - document.body.clientWidth;
	}
	if ( winH > 680 ) {
		sizeToH = 680 - document.body.clientHeight;
	} else if ( Math.abs(document.body.clientHeight - winH) > 4 ) {
		sizeToH = winH - document.body.clientHeight;
	}
	if ( (sizeToW != 0 || sizeToH != 0) && (sizeToW > 0 && sizeToH > 0) )
		window.resizeBy(sizeToW, sizeToH);
}

// to remove links of print popup page
function removePopupLink() {
	var printLinks;
	if (document.getElementById("d100_dcBodyBox")) printLinks = document.getElementById("d100_dcBodyBox").getElementsByTagName("A");
	else if (document.getElementById("content")) printLinks = document.getElementById("content").getElementsByTagName("A");
	for (var p=0; p<printLinks.length; p++) {
		printLinks[p].href = "javascript:;";
		printLinks[p].className = "disabledLink";
	}
}

function resize_clixad() {
	if (document.getElementById("clixad_proc")) {
		try {
			var obj = document.getElementById("clixad_proc");
			var dcInnerBody;
			dcInnerBody = obj.contentWindow.document.body;
		
			dcInnerBody.style.margin = "0 0 0 -4px";
			obj.height = dcInnerBody.scrollHeight;

		} catch(e) {
			return;
		}
	}
}

// 사전 초기화 함수
function dic_init() {
	if (document.urlForm.OFFSET.value == "" || document.urlForm.OFFSET.value == null) {
		if(document.dicSearch) {
			document.dicSearch.dic_q.focus();
			document.dicSearch.dic_q.select();
		}
		if(document.dicSearch_mini) {
			document.dicSearch_mini.dic_q_mini.focus();
			document.dicSearch_mini.dic_q_mini.select();
		}
	}
	startTooltip();
	resize_clixad();
}

// 사전 서제스트 관련 스크립트
function getNavigatorType() {
	if ( navigator.appName == "Microsoft Internet Explorer" )
		return 1;  
	else if ( navigator.appName == "Netscape" )
		return 2;	
	else 
		return 0;
}

function setFocusQBox(event) {
	var textbox;
	var _event;

	textbox = document.dicSearch.q;

	switch ( getNavigatorType() ) {
		case 1 : // IE
			_event = window.event;
			node = _event.srcElement;
			nodeName = _event.srcElement.nodeName;
			break;
		case 2 : // Netscape
			_event = event;
			node = _event.target;
			nodeName = _event.target.nodeName;
			break;
		default :
			nodeName = "None"; 
			break;
	}

	key = _event.keyCode;

	if(!(nodeName=="INPUT"||nodeName=="SELECT"||nodeName=="TEXTAREA"||(_event.ctrlKey&&key!=86))){
		if(key==8||(key>32&&key<41)||(key!=21&&key<32)||_event.altKey||key==91||key==92||_event.metaKey){
		} else if (key==32) { 
			if (_event.shiftKey) {
				textbox.focus();
				textbox.style.imeMode ="active";
				textbox.select();
				_event.returnValue=false;
			}
		} else if (key == 21) {
			scrollTo(0,0);
			textbox.focus();
			textbox.style.imeMode ="active";
			textbox.select();
			_event.returnValue=false;
		} else if (node!=textbox) {
			scrollTo(0,0);
			textbox.focus();
			textbox.style.imeMode ="inactive";
			textbox.select();
		}
	}

	try{
		document.getElementById("hFrame").contentWindow.eventHandler(event);
	}catch(e){}
}
function setSelBox(event){
	try{
		document.getElementById("hFrame").contentWindow.eventHandlerBody(event);
	}catch(e){}
}

// 공백제거 함수
function trimStr(str) {
	str = str.replace(/(^\s*)|(\s&$)/g,"");
	return str;
}

function a() {
	alert("스크립트 공사중입니다. 양해부탁드려요 (_ _) ..by Yuki");
}
// 로그인 여부 체크 
function checkLogin() {
	//login check
	if( urlForm && urlForm.LAYOUT_LOGIN && urlForm.LAYOUT_LOGIN.value == "Y") {
		return true; 
	} else {
		alert("로그인하지 않으셨습니다.");
		var goLogin = "http://www.daum.net/Mail-bin/login.html?";
		
		if( urlForm && urlForm.LAYOUT_SMALL_WINDOW && urlForm.LAYOUT_SMALL_WINDOW.value == "Y") {
			goLogin += "popup=1&";
		}
		goLogin += "url="+encodeURIComponent(document.URL);
		document.location.href = goLogin; 
		return false;
	}
}

// 스펠러 보여주기 
var showBtn = function ( id, kind ) {
	//changeImg
	btn = document.getElementById(id);
	imgf = document.splrImg;
	imgLink="http://imgsrc.search.daum-img.net";
	if (kind=="openBtn") {
		btn.src = imgLink + imgf.openImgUrl.value;
		btn.alt = imgf.openImgName.value;
		btn.width = imgf.openImgWidth.value;
		btn.height = imgf.openImgHeight.value;
	} else if ( kind == "closeBtn") {
		btn.src = imgLink + imgf.closeImgUrl.value;
		btn.alt = imgf.closeImgName.value;
		btn.width = imgf.closeImgWidth.value;
		btn.height = imgf.closeImgHeight.value;
		
	}
}
// 스펠러 보여주기 
var showSplrFirstLine = function (){
	document.getElementById("open_verb").style.display = "inline";
	hv = document.getElementById("hidden_verb");
	if ( hv ) {
		hv.style.display = "none";
	}
	showBtn("open_bt","openBtn");
}
// 스펠러 보여주기 
var showSplrSecondLine = function (){
	document.getElementById("open_verb").style.display = "none";
	hv = document.getElementById("hidden_verb");
	if ( hv ) {
		hv.style.display = "block";
	}
	showBtn("open_bt","closeBtn");
}
// 스펠러 보여주기 
var showSplrLine = function() {
	if ( document.getElementById("open_verb").style.display == "none" ) {
		showSplrFirstLine()
	} else {
		showSplrSecondLine()
	}
}

// 스펠러 보여주기 
var showSplrLineSmall = function() {  
	if ( document.getElementById("open_verb").style.display == "none" ) { //스펠러 더보기 닫기
		document.getElementById("hidden_verb").style.display = "none"; 
		document.getElementById("open_verb").style.display = "block"; 
		document.getElementById("close_bt_a").style.display = "none";
		document.getElementById("open_bt_a").style.display = "inline"; 

	}else{
		document.getElementById("hidden_verb").style.display = "block"; 
		document.getElementById("open_verb").style.display = "none"; 
		document.getElementById("close_bt_a").style.display = "inline";
		document.getElementById("open_bt_a").style.display = "none"; 

	}
}



var keyEvent = function(e){
	if(e.keyCode == '13'){
		meanSearch('search');
	}
}

var keyEventFunc =  function(e ,_num){
	if(e.keyCode == '13'){
		if(_num == "1"){
			go_search1();
		}else if(_num == "2"){
			go_search2();
		}else if(_num == "3"){
			go_search3();
		}
	}	
}

var keyEventOther = function(e){
	if(e.keyCode == '13'){
		go_search('ch')
	}
}


function defocus() {
	document.dicSearch.q.select();
}

