	var currentForm;
	var currentFormIndex;
	var debugWin = null;
	var nav_ie=true;
	var currentSelected = "";
	var focused = false;
	
	function clearOnFocus(obj) {
		if (obj == null)
			return;
		obj.value = "";
		focused = true;
	}
	
	
	if(navigator.appName == 'Netscape'){
		nav_ie=false;
	}  
	
	var currentd = "";
	
	function checkResultType() {
		var param = "";
		if (document.frmSearch.ResultType != null && document.frmSearch.ResultType.value != "") {
			param = "&ResultType=" + document.frmSearch.ResultType.value; 
		}
		return "";
	}
	
	//페이지 이동
	function goPage(page) {
		document.frmSearch.CurrentPage.value = page;
		document.frmSearch.ReSearch.value = "N";
		document.frmSearch.SortSearch.value = "Y";
		document.frmSearch.submit();
	}

	function initSearchForm() {
		var f = document.getElementsByName("frmTemp");
		if (f != null && f.length > 0) {
			try {
				f[0].SearchWord.focus();
				currentForm = f[0];
				currentFormIndex = 0;
			} catch (e) {
				alert(e);
			}
		} 
	}
	// trim함수
	function trim(str) {
		return str.replace(/(^\s*)|(\s*$)/g, ""); 
	}
	// 재검색 필드에서 검색을 시도했을 때
	function checkResearchField(f, limit) {
		var isResearch = false;
		if (f.ReSearchFlag != null) 
			isResearch = f.ReSearchFlag.checked;
		if (limit == null)
			limit = false;
		if (trim(f.SearchWord.value) == "" && !limit) {
			alert("검색어를 입력하십시오.");
			return false;
		}
		if (f.Branch != null)
			document.frmSearch.Branch.value = f.Branch.value;
		if (f.Division != null)
			document.frmSearch.Division.value = f.Division.value;
		document.frmSearch.SearchType.value = getRadioValue(f.SearchType);
		document.frmSearch.IndexID[0].value = f.IndexID.value;
		document.frmSearch.SearchWord[0].value = f.SearchWord.value;
		document.frmSearch.SearchOperator[0].value = f.SearchOperator.value;
		document.frmSearch.IndexID[1].value = "";
		document.frmSearch.SearchWord[1].value = "";
		document.frmSearch.SearchOperator[1].value = "";
		document.frmSearch.IndexID[2].value = "";
		document.frmSearch.SearchWord[2].value = "";
		document.frmSearch.SearchOperator[2].value = "";
		document.frmSearch.IndexSearch.value = "";
		if (f.ContentList != null)
			document.frmSearch.ContentList.value = f.ContentList.value;
		document.frmSearch.ReSearch.value = (isResearch ? "Y" : "N");
		document.frmSearch.CurrentPage.value = "0";
		document.frmSearch.FirstChar.value = "";
		document.frmSearch.Multi.value = "";
		if (!isResearch) {
			document.frmSearch.SetNum.value = "0";
			document.frmSearch.IndexID[1].value = "";
			document.frmSearch.SearchWord[1].value = "";
			document.frmSearch.IndexID[2].value = "";
			document.frmSearch.SearchWord[2].value = "";
			document.frmSearch.SortSearch.value = "N";
			document.frmSearch.CurrentPage.value = "1";
			document.frmSearch.LANG.value = "";
			document.frmSearch.CLASS.value = "";
			document.frmSearch.Relation.value = "";
			document.frmSearch.Collection.value = "";
		}
		checkExtra();
		checkExtraLimit();
		document.frmSearch.action = "SearchResult.jsp";
		document.frmSearch.submit(); 
	}
	
	// 간략 검색 필드에서 검색을 시도했을 때
	function simpleSearch(f) {
		if (trim(f.SearchWord[0].value) == "") {
			alert("검색어를 입력하십시오.");
			return false;
		}
		f.submit(); 
	}
	
	function checkSearchField(frm) {
		if (frm != null) {
			var fname = frm.name;
			var f = document.getElementsByName(fname);
			var checker = false;
			for (var i = 0; i < f.length; i++) {
				if (f[i].name != "frmTemp")
					continue;
				if (trim(f[i].SearchWord.value) != "") {
					checker = true;
					break;
				}
			}
			
			if (document.frmLimit != null && document.frmLimit.CLASS != null) {
				if (document.frmLimit.CLASS.value != "") {
					checker = true;
				}
			}
			
			if (!checker) {
				alert("검색어를 입력하세요.");
				return false;
			}
			checkSearch(f);
		}
		checkGeneral();
		checkLimit();
		checkExtra();
		checkExtraLimit();
		frmSearch.action = "SearchResult.jsp";
		frmSearch.submit();
	}
	function doSearch() {
		checkSearchField(currentForm);
	}
	
	function goEResourceSearch(v1, v2) {
		if (document.frmSearch) {
			var arglen = goEResourceSearch.arguments.length;
			document.frmSearch.SearchType.value = "START_WITH";
			document.frmSearch.SetNum.value = "0";
			document.frmSearch.IndexID[0].value = "";
			document.frmSearch.SearchWord[0].value = "";
			document.frmSearch.SearchOperator[0].value = "AND";
			document.frmSearch.SearchWord[1].value = "";
			document.frmSearch.IndexID[1].value = "";
			document.frmSearch.SearchOperator[1].value = "AND";
			document.frmSearch.SearchWord[2].value = v1;
			document.frmSearch.IndexID[2].value = "ECLS";
			document.frmSearch.SearchOperator[2].value = "AND";
			document.frmSearch.CurrentPage.value = "0";
			document.frmSearch.CLASS.value = "";
			document.frmSearch.IndexSearch.value = "";
			if (arglen == 2 && v2 != 0)
				document.frmSearch.ContentList.value = v2;
			checkLimit();
			checkExtra();
			checkExtraLimit();
			frmSearch.action = "SearchResult.jsp"
			frmSearch.submit();
		}
	}
	
	function goClassSearch(value) {
		document.frmSearch.CLASS.value = value;
		document.frmSearch.FirstChar.value = "";
		checkLimit();
		checkExtra();
		checkExtraLimit();
		frmSearch.action = "SearchResult.jsp"
		frmSearch.submit();
	}
	
	function goStartWithSearch(field, value, uid) {
		if (document.frmSearch) {
			if (goStartWithSearch.arguments.length == 3) {
				document.frmSearch.UID.value = uid;
				document.frmSearch.Collection.value = "";
			}
			document.frmSearch.SearchType.value = "START_WITH";
			document.frmSearch.SetNum.value = "0";
			document.frmSearch.IndexID[0].value = field;
			document.frmSearch.SearchWord[0].value = value;
			document.frmSearch.SearchOperator[0].value = "AND";
			document.frmSearch.SearchWord[1].value = "";
			document.frmSearch.IndexID[1].value = "";
			document.frmSearch.SearchOperator[1].value = "";
			document.frmSearch.SearchWord[2].value = "";
			document.frmSearch.IndexID[2].value = "";
			document.frmSearch.SearchOperator[2].value = "";
			document.frmSearch.CurrentPage.value = "0";
			document.frmSearch.IndexSearch.value = "";
			checkLimit();
			checkExtra();
			checkExtraLimit();
			frmSearch.action = "SearchResult.jsp"
			frmSearch.submit();
		}
	}
	
	function goOpSearch(field, v1, v2, v3, op) {
		var argSize = goOpSearch.arguments.length;
		if (document.frmSearch) {
			document.frmSearch.SetNum.value = "0";
			document.frmSearch.IndexID[0].value = field;
			document.frmSearch.SearchWord[0].value = v1;
			document.frmSearch.SearchOperator[0].value = (argSize == 5 ? op : "AND");
			document.frmSearch.SearchWord[1].value = (argSize > 2 ? v2 : "");
			document.frmSearch.IndexID[1].value = field;
			document.frmSearch.SearchOperator[1].value = (argSize == 5 ? op : "AND");
			document.frmSearch.SearchWord[2].value = (argSize > 3 ? v3 : "");
			document.frmSearch.IndexID[2].value = field;
			document.frmSearch.SearchOperator[2].value = (argSize == 5 ? op : "AND");
			document.frmSearch.CurrentPage.value = "0";
			document.frmSearch.IndexSearch.value = "";
			checkLimit();
			checkExtra();
			checkExtraLimit();
			frmSearch.action = "SearchResult.jsp"
			frmSearch.submit();
		}
	}
	
	function goSearch(field, value, type) {
		if (document.frmSearch) {
			if (goSearch.arguments.length == 3) {
				document.frmSearch.SearchType.value = type;
				document.frmSearch.Collection.value = "";
			}
			document.frmSearch.ContentList.value = "";
			document.frmSearch.SetNum.value = "0";
			document.frmSearch.IndexID[0].value = field;
			document.frmSearch.SearchWord[0].value = value;
			document.frmSearch.SearchOperator[0].value = "AND";
			document.frmSearch.SearchWord[1].value = "";
			document.frmSearch.IndexID[1].value = "";
			document.frmSearch.SearchOperator[1].value = "";
			document.frmSearch.SearchWord[2].value = "";
			document.frmSearch.IndexID[2].value = "";
			document.frmSearch.SearchOperator[2].value = "";
			document.frmSearch.CurrentPage.value = "0";
			document.frmSearch.IndexSearch.value = "";
			document.frmSearch.FirstChar.value = "";
			document.frmSearch.Multi.value = "";
			checkLimit();
			checkExtra();
			checkExtraLimit();
			frmSearch.action = "SearchResult.jsp"
			frmSearch.submit();
		}
	}
	
	// 미리보기
	function preview(cid, brch) {
		if (currentSelected == cid + "|" + brch) {
			document.getElementById("preview" + cid).innerHTML = "";
			currentSelected = "";
			return;
		}
		var url = "";
		url = url + "services/common/search/Preview.jsp?cid=" + cid;
		if (brch != null)
			url = url + "&brch=" + brch;
		generalRequest(url, "preview" + cid, false);
		currentSelected = cid + "|" + brch;
	}
	// 미리보기 닫기
	function closeThis(id) {
		var div = document.getElementById(id);
		div.innerHTML = "";
		currentSelected = "";
	}
	
	function getRadioValue(ctrl) {
		if (ctrl == null)
			return "";
		try {		
			for (var i = 0; i < ctrl.length; i++) {
				if (ctrl[i].checked)
					return ctrl[i].value;
			}
			return "";
		} catch (e) {
			return ctrl.value;
		}
	}
	
	// 일반사항 체크
	function checkGeneral() {
		if (document.frmGeneral == null)
			return;
		var f = document.frmGeneral;
		document.frmSearch.Division.value = f.Division.value;
		document.frmSearch.Branch.value = f.Branch.value;
		document.frmSearch.SearchType.value = getRadioValue(f.SearchType);
		document.frmSearch.FirstChar.value = "";
		if (f._ContentList != null)
			document.frmSearch.ContentList.value = f._ContentList.value; 
	}
	
	
	
	// 검색사항 체크
	function checkSearch(f) {
		var currentIndex = 0;
		for (var i = 0; i < f.length; i++) {
			if (f[i].name != "frmTemp")
				continue;
			frmSearch.IndexID[currentIndex].value = f[i].IndexID.value;
			frmSearch.SearchWord[currentIndex].value = f[i].SearchWord.value;
			frmSearch.SearchOperator[currentIndex].value = getRadioValue(f[i].SearchOperator);
			currentIndex++;
		}
	}
	
	function getCheckedValues(ctrl, sep, dv) {
		var objCnt = 0;
		try {
			objCnt = ctrl.length;
		} catch (e) {
			objCnt = 1;
		}
		if (ctrl == null) {
			if (getCheckedValues.arguments.length == 3)
				return dv;
			return "";
		}
		var v = "";
		if (objCnt > 1) {
			for (var i = 0; i < ctrl.length; i++) {
				if (ctrl[i].checked) {
					if (v == "") {
						v += ctrl[i].value;
					} else {
						v += sep + ctrl[i].value;
					}
				}
			}
			return v;
		} else {
			return ctrl.value;
		}
	}
	
	function checkLimit() {
		if (document.frmLimit == null)
			return;
		var f = document.frmLimit;
		if (f._ContentList != null)
			document.frmSearch.ContentList.value =   f._ContentList.value;
		if (f.PYB != null)
			document.frmSearch.PYB.value =           f.PYB.value ;
		if (f.PYE != null)
			document.frmSearch.PYE.value = 	         f.PYE.value ;
		if (f.LANG != null)
			document.frmSearch.LANG.value = 	 	 f.LANG.value;
		if (f.CLASS!= null)
			document.frmSearch.CLASS.value = 	 	 f.CLASS.value;
		if (f._Relation!= null)
			document.frmSearch.Relation.value =      getCheckedValues(f._Relation, '^', document.frmSearch.Relation.value) ;
		if (f.PageSize!= null)
			document.frmSearch.PageSize.value =      f.PageSize.value ;
		if (f.MaxLimit != null)
			document.frmSearch.MaxLimit.value =      f.MaxLimit.value ;
		if (f.Sort != null)
			document.frmSearch.Sort.value =           f.Sort.value ;
		if (f.SortType != null)
			document.frmSearch.SortType.value =       getCheckedValues(f.SortType,'','') ;
		if (f.DEGREE != null) {
			document.frmSearch.ExtraLimit[0].value = 	  "GRAD";
			document.frmSearch.ExtraValue[0].value =  getRadioValue(f.DEGREE);
		}
		document.frmSearch.CurrentPage.value = "1";
		checkNewArrival();
	}
	// DB상에 설정되어있는 hidden tag의 값을 가지고 처리하는 js
	function checkExtra() {
		if (document.frmExtra == null)
			return;
		if (document.frmExtra.Param == null)
			return;
		var obj = eval("document.frmSearch." + document.frmExtra.Param.value);
		if (obj == null)
			return;
		if (obj.value == '')
			obj.value = document.frmExtra.ParamValue.value;
	}
	
	function checkNewArrival() {
		var f = document.frmLimit;
		if (f == null)
			return;
		if (f.radNewArrival == null) 
			return;
		
		if (f.radNewArrival[0].checked) {
			var dateDiff = f.ArrivedDate.value;
			var dateFrom = getDiffDate(-1 * dateDiff);
			var dateTo = getDiffDate(0);
			document.frmSearch.ArrivalFrom.value = getFormattedDate(dateFrom);
			document.frmSearch.ArrivalTo.value = getFormattedDate(dateTo); 
		} else {
			document.frmSearch.ArrivalFrom.value =    f.ArrivalFrom.value ;
			document.frmSearch.ArrivalTo.value =      f.ArrivalTo.value ;
		}
	}
	
	function checkReverse(isPrimary, checkBoxName) {
		var checkBoxList = document.getElementsByName(checkBoxName);
		var checked = false;
		if (checkBoxList == null || checkBoxList.length == 0)
			return;
		if (isPrimary) {
			if (!checkBoxList[0].checked)
				checkBoxList[0].checked = true;
			for (var i = 1; i < checkBoxList.length; i++) {
				if (checkBoxList[i].checked)
					checked = true;
				checkBoxList[i].checked = false;
			}
		} else {
			for (var i = 1; i < checkBoxList.length; i++) {
				checked = checkBoxList[i].checked;
				if (checked)
					break;
			}
			checkBoxList[0].checked = !checked;
		}
	}
	// 검색 히스토리를 가져온다.
	function getSearchHistory(setNum, uid) {
		document.frmSearch.SetNum.value = setNum;
		document.frmSearch.ReSearch.value = "N";
		document.frmSearch.SortSearch.value = "Y";
		document.frmSearch.CurrentPage.value = "1";
		document.frmSearch.PageSize.value = document.frmSearch.PageSize.value == "" ? "20" : document.frmSearch.PageSize.value;
		if (getSearchHistory.arguments.length == 2) {
			document.frmSearch.UID.value = uid;
		}
		checkExtra();
		checkExtraLimit();
		document.frmSearch.action = "SearchResult.jsp";
		document.frmSearch.submit();
	}
	
	// 정렬을 한다.
	function goSort(frm, v) {
		frm.Sort.value = v;
		reCalcPage(frm);
	}
	
	// 페이지 사이즈를 재계산한다.
	function reCalcPage(frm) {
		if (isAcqResult()) {
			alert("수서자료 검색중에는 정렬기능을 지원하지 않습니다.");
			return;
		}
		if (frm.PageSize.value == "" && frm.Sort.value == "")
			return;
		document.frmSearch.Sort.value = frm.Sort.value;
		if (frm.PageSize.value != "")
			document.frmSearch.PageSize.value = frm.PageSize.value;
		if (frm.SortType.value != "")
			document.frmSearch.SortType.value = frm.SortType.value;
		if (frm.Sort.value != "" && frm.SortType.value == "") {
			document.frmSearch.SortType.value = "ASC";
		}
		
		checkExtra();
		checkExtraLimit();
		getSearchHistory(document.frmSearch.SetNum.value);
	}
	
	function sortResult(c) {
		if (frmActions.Sort.value == c) { // 같은 경우에
			frmActions.SortType.value = (frmActions.SortType.value == "ASC" ? "DESC" : "ASC");  
		} else {
			frmActions.SortType.value = "ASC";				
		}
		frmActions.Sort.value = c;
		reCalcPage(frmActions);
	}
	
	function isAcqResult() {
		var obj = document.getElementById("AcqChecker");
		return obj != null;
	}
	
	// 전체선택
	function resultSelectAll() {
		if (isAcqResult()) {
			alert("전체선택 기능을 사용할 수 없습니다.");
			return;
		}
		var f = document.getElementById("frmSearchResult");
		var imgs = document.getElementsByName("imgBtn");
		if (f == null)
			return;
		var fc = document.getElementsByName("chkCID");
		if (fc.length == 1)
			return;
		var checked = fc[0].checked = !fc[0].checked;
		for (var i = 1; i < fc.length; i++) {
			fc[i].checked = checked; 
		}
		for (var i = 0; i < imgs.length; i++) {
			imgs[i].src = checked ? "images/snu/search/bt_all_cancel.gif" : "images/snu/search/bt_all_select.gif";
		}
	}
	
	function saveBasket() {
		if (isAcqResult()) {
			alert("보관함 담기 기능을 사용할 수 없습니다.");
			return;
		}
		var f = document.getElementById("frmSearchResult");
		if (f == null) {
			alert("잘못된 영역");
			return;
		}
		var fc = f.chkCID;
		if (fc.length == 1)
			return;
		var count = 0;
		for (var i = 1; i < fc.length; i++) {
			if (fc[i].checked) {
				count++;
			} 
		}
		if (count == 0) {
			alert("선택한 내용이 없습니다.");
			return;
		}
		// 쿠키로 저장 시작
		for (var i = 1; i < fc.length; i++) {
			if (fc[i].checked) {
				setCookie("CID_BASKET", fc[i].value);
			} 
		}
		alert("보관되었습니다.");
		checkBasket();
	}
	
	function checkBasket() {
		var cookie = getCookie("CID_BASKET");
		var el = document.getElementById("VIEWBASKET");
		if (el == null)
			return;
		if (cookie != "")
			el.style.display = "";
		else
			el.style.display = "none";
	}
	
	function viewBasket() {
		document.frmSearch.action = "ViewBasket.jsp?uid=" + document.frmSearch.UID.value + checkResultType();
		document.frmSearch.submit();
	}
	
	function deleteBasket() {
		deleteCookie("CID_BASKET");
		alert("삭제되었습니다.");
		document.location = "ViewBasket.jsp?uid=" + document.frmSearch.UID.value + checkResultType();
	}
	// 쿠키 삭제
	function deleteSelected() {
		var chk = document.getElementsByName("chkCID");
		var cookie = getCookie("CID_BASKET");
		var index = 0;
		for (var i = 1; i < chk.length; i++) {
			if (chk[i].checked) {
				if ((index = cookie.indexOf(chk[i].value)) >= 0) {
					if (index == 0 && cookie.length == chk[i].value)
						deleteCookie("CID_BASKET");
					else if (index == 0)
						cookie = cookie.substring(chk[i].value.length + 1);
					else {
						if (cookie.length == index + chk[i].value.length)
							cookie = cookie.substring(0, index - 1);
						else
							cookie = cookie.substring(0, index - 1) + cookie.substring(index + chk[i].value.length);
					}
				}
			}
		}
		deleteCookie("CID_BASKET");
		setCookie("CID_BASKET", cookie);
		alert("항목을 삭제했습니다.");
		window.location = "ViewBasket.jsp?uid=" + document.frmSearch.UID.value + checkResultType();
	}
	
	function indexSearch(indexID, text, opt) {
		try {
			document.frmSearch.SetNum.value = "0";
			document.frmSearch.SearchType.value = "START_WITH";
			document.frmSearch.IndexID[0].value = indexID;
			document.frmSearch.SearchWord[0].value = text;
			document.frmSearch.IndexID[1].value = "";
			document.frmSearch.SearchWord[1].value = "";
			document.frmSearch.IndexID[2].value = "";
			document.frmSearch.SearchWord[2].value = "";
			document.frmSearch.ReSearch.value = "N";
			document.frmSearch.SortSearch.value = "N";
			document.frmSearch.CurrentPage.value = "0";
			document.frmSearch.Division.value = "";
			document.frmSearch.Branch.value = "";
			document.frmSearch.PYB.value = "";
			document.frmSearch.PYE.value = "";
			document.frmSearch.LANG.value = "";
			document.frmSearch.CLASS.value = "";
			document.frmSearch.Relation.value = "";
			document.frmSearch.PageSize.value = "20";
			document.frmSearch.MaxLimit.value = "300";
			document.frmSearch.Collection.value = "";
			document.frmSearch.ArrivalFrom.value = "";
			document.frmSearch.ArrivalTo.value = "";
			if (indexSearch.arguments.length == 3) {
				document.frmSearch.IndexSearch.value = opt;
				document.frmSearch.ContentList.value = "";
			}
			document.frmSearch.submit();
		} catch (e) {
			alert(e);	
		}
	}
	
	
	// 폼내에서 택스트 변경상태에 대한 상태를 알린다. 
	function focusChanged(form, index) {
		currentForm = form;
		currentIndex = index;
	}
	// 주제분류 선택창을 띄운다.
	function showClassifyWin(c, depth) {
		var url;
		if (showClassifyWin.arguments.length == 0)
			url = "popup/Classify.jsp?type=2";
		else {
			if (c == "OLDEAST")
				url = "popup/OldEastDDC.jsp";
			else if (c == "OLDWEST")
				url = "popup/OldWestDDC.jsp";
			else {
				if (c == '') {
					url = "popup/Classify.jsp?type=2";
				} else
					url = "popup/Classify.jsp?type=2&class=" + c;
				if (showClassifyWin.arguments.length == 2) {
					url = url + "&depth=" + depth 
				} 
			}
		}
		
		
		var win = window.open(url, "_CLASSIFY", "height=600,width=700,scrollbars=yes,location=no,statusbar=yes,toolbar=no");
	}
	
	function showClassify(classID, type) {
		var url = "";
		url = "services/common/search/ClassifyForSearch.jsp?&mode=s&id=" + classID;
		generalRequest(url, "classify", true);
		var obj = document.getElementsByName("_HEAD");
		if (obj == null || obj.length == 0)
			return;
		try {
			var id = classID == '' ? 0 : parseInt(classID) + 1;
			for (var i = 0; i < obj.length; i++) {
				if (i == id) {
					obj[i].className = "accent_b";
				} else {
					obj[i].className = "result01";
				}
			}
		} catch (e) {
		}
		
	}
			
	// 주제분류를 선택했을 때 (파라메터가 2개인 경우는 폼에 넣어주는 로직)
	function selected() {
		if (selected.arguments.length == 2) {
			var classify = selected.arguments[0];
			var classifyName = selected.arguments[1];
			if (opener == null) {
				alert("대상이 없습니다.");
				return;
			}
			var c1 = opener.document.frmLimit.CLASS;
			var c2 = opener.document.frmLimit.ClassText;
			if (c1 == null) {
				alert("이 창을 생성한 부모가 없습니다.");
				return;
			}
			c1.value = classify;
			if (c2 != null)
				c2.value = classifyName;
			window.close();
		} else if (selected.arguments.length == 1) {
			var classify = selected.arguments[0];
			document.frmSearch.CLASS.value = classify;
			checkGeneral();
			checkLimit();
			checkExtra();
			checkExtraLimit();
			//document.frmSearch.action = (frmSearch.ResultType != null ? frmSearch.ResultType.value : "") + "SearchResult.jsp"
			document.frmSearch.action = "SearchResult.jsp"
			document.frmSearch.submit();
		}
	}
	// 상세 Display
	var isStartup = true;
	
	function initPage() {
		sortItem();
		isStartup = false;
		var linking = document.getElementById("_LINKING");
		// 링킹이 있는 경우 링킹을 조회한다.
		if (linking != null) {
			generalRequest("services/common/search/ExtendedSearcher.jsp?cid=" + frmDetail.CID.value, "_LINKING", true, "Extended Linking 조회중..");
		}
	}
	function sortItem(orderColumn, brch) {
		var args = sortItem.arguments;
		var form = document.frmDetail;
		if (args.length == 1) {
			if (form.Sort.value == orderColumn) {
				form.Order.value = (form.Order.value == "1" ? "0" : "1");
			} else {
				form.Sort.value = "1";
				form.Order.value = "0"
			}
			form.Sort.value = orderColumn;
		} else {
			form.Order.value = "0";
		}
		var url = "services/common/search/ItemDetail.jsp?cid=" + form.CID.value;
		url = url + "&sort=" + form.Sort.value;
		url = url + "&order=" + form.Order.value;
		if (args.length == 2 && args[1] != "") {
			url = url + "&branch=" + brch;
		} else {
			url = url + "&branch=" + form.Branch.value;
		}
		if (!isStartup) {
			url = url + "&type=0";
		}
		var obj = document.getElementById("chkinDetail");
		if (obj != null)
			obj.innerHTML = "";
		
		generalRequest(url, "itmdtl", true);
	}
	
	function showItem() {
		sortItem();
	}
	
	function showCheckin(brch) {
		var form = document.frmDetail;
		var url = "services/common/search/ItemDetail.jsp?cid=" + form.CID.value;
		url = url + "&sort=" + form.Sort.value;
		url = url + "&order=" + form.Order.value;
		if (brch != null) {
			url = url + "&branch=" + brch;
		} else {
			url = url + "&branch=" + form.Branch.value;
		}
		url = url + "&type=1";
		if (document.getElementById("selYear") != null) {
			url = url + "&year=" + document.getElementById("selYear").value;
		}
		
		var obj = document.getElementById("chkinDetail");
		if (obj != null)
			obj.innerHTML = "";
			
		generalRequest(url, "itmdtl", true);
	}
	
	function hold(branch, idid) {
		var url = "";
		openWindow("HOLD", "popup/Hold.jsp?br=" + branch + "&idid=" + idid, 400, 460);
	}
	
	function getChkin(value) {
		try {
			var url = "";
			url = url + "services/common/search/CheckInDetail.jsp?chkin=" + value;
			window.location.href = "#__CHKIN_DETAIL";
			generalRequest(url, "chkinDetail", false);
		} catch (e) {
			alert(e);
		}
	}
	
	function showBibliography() {
		var url = "";
		var form = document.frmDetail;
		url = url + "services/common/search/DetailBibliography.jsp?cid=" + form.CID.value;
		url = url + "&locale=" + form.locale.value;
		generalRequest(url, "Detail", false);
	}
	
	function showMetaData() {
		var url = "";
		var form = document.frmDetail;
		url = url + "services/common/search/ViewMetaData.jsp?cid=" + form.CID.value;
		url = url + "&locale=" + form.locale.value;
		generalRequest(url, "Detail", false);
	}
	// ------ 상세 보기
	
	function newArrivalRadioCheck() {
		var dateTo = new Date();
		var dateFrom = getDiffDate(-7); // 1주일전
		if (frmLimit.radNewArrival[0].checked) {
			frmLimit.ArrivedDate.disabled = false;
			frmLimit.ArrivalFrom.value = "";
			frmLimit.ArrivalFrom.disabled = true;
			frmLimit.ArrivalTo.value = "";	
			frmLimit.ArrivalTo.disabled = true;
			return;
		} 
		if (frmLimit.radNewArrival[1].checked) {
			frmLimit.ArrivedDate.disabled = true;
			frmLimit.ArrivalFrom.value = getFormattedDate(dateFrom);
			frmLimit.ArrivalFrom.disabled = false;
			frmLimit.ArrivalTo.value = getFormattedDate(dateTo);	
			frmLimit.ArrivalTo.disabled = false;
			return;
		}
	}
	// 추천검색어
	function showSearchAdvice(setNum) {
		var url = "services/common/search/AuthoritySearch.jsp?setNum=" + setNum;
		generalRequest(url, "searchAdvice", false);
		var obj = document.getElementById("searchAdvice");
		if (obj != null)
			obj.style.display = "";
	}

	
	function ddsService() {
		var chkin = document.getElementsByName("radChkin");
		var chkinID = 0;
		for (var i = 0; i < chkin.length; i++) {
			if (chkin[i].checked && !chkin[i].disabled) {
				chkinID = chkin[i].value;
				break;
			}
		}
		if(chkinID == 0){
			alert('이용 불가능한 자료 입니다.');
			return;
		}
		var win = window.open("popup/ApplyDDS.jsp?chkin=" + chkinID, 'DDS', "height=600,width=720,scrollbars=yes,location=no,statusbar=yes,toolbar=no");
	}
	
	function inlineSearch(id, value) {
		indexSearch(id, value);
	}
	
	function searchAuth(id, value) {
		indexSearch(id, value);
	}
	
	function limitSearch(classid) {
		document.frmSearch.reset();
		document.frmSearch.ContentList.value = classid;
		document.frmSearch.ReSearch.value = "N";
		document.frmSearch.SortSearch.value = "Y";
		document.frmSearch.CurrentPage.value = "0";
		if (document.frmSearch.Multi != null) {
			document.frmSearch.Multi.value = "N";
		}
		document.frmSearch.IndexSearch.value = "";
		checkExtra();
		checkExtraLimit();
		document.frmSearch.action = "SearchResult.jsp";
		document.frmSearch.submit(); 

	}
	// 탭을 토글한다.
	function toggleTab(id) {
		var el = document.getElementById(id);
		if (el == null)
			return;
		el.style.backgroundColor = "#728FA1";
		el.style.color = "#FFFFFF";
		
	}
	
	// 파일 뷰어
	function viewMedia(cid, moi, fid, type, f, chkin) {
		if (viewMedia.arguments.length < 5) {
			if (viewMedia.arguments.length < 4) 
				type = "A";
			openWindow("MEDIA_VIEWER", "viewer/CommonViewer.jsp?cid=" + cid + "&moi=" + moi + "&file=" + fid + "&type=" + type + "&close=N", 600, 800, 'no', 'no', 'no', 'no', 'yes');
		} else {
			var ff = eval("parent." + f);
			ff.location = "CommonViewer.jsp?cid=" + cid + "&moi=" + moi + "&file=" + fid + "&type=" + type + "&chkin=" + chkin;
			if (chkin != 'Y') {
				var fd = eval("parent.DetailLayer");
				fd.location = "DetailView.jsp?cid=" + cid;
			}
		}
	}
	
	// 파일 뷰어
	function viewMedia2(cid, moi, fid, start, end) {
		openWindow("MEDIA_VIEWER", "viewer/CommonViewer.jsp?cid=" + cid + "&moi=" + moi + "&file=" + fid + "&type=A&close=N", 600, 800, 'no', 'no', 'no', 'no', 'yes');
	}
	// File Viewer (그룹)
	function showViewer(cid, type, isChkin) {
		openWindow("MEDIA_VIEWER", "viewer/CommonViewer.jsp?cid=" + cid + "&type=" + type + "&chkin=" + (isChkin ? "Y" : "N") , 600, 800, 'no', 'no', 'no', 'no', 'yes');
	}
	
	function showMOAsso(moi, rid, cid) {
		var url = "viewer/MediaObjectTextView.jsp?moi=" + moi + "&rid=" + rid;
		if (showMOAsso.arguments.length == 3 || cid != null)
			url = url + "&cid=" + cid;
		openWindow("MO_ASSOCICATION_VIEWER", url , 600, 800, 'yes', 'no', 'no', 'no', 'yes');
	}
	
	function showAsso(cid, rid, isChkin,from) {
		if (nav_ie)
			openWindow("ASSOCICATION_VIEWER", "viewer/TextViewer.jsp?cid=" + cid + "&rid=" + rid + "&mode=" + from + "&chkin=" + (isChkin ? "Y" : "N"), 600, 800, 'no', 'no', 'no', 'no', 'yes');
		else
			openWindow("ASSOCICATION_VIEWER", "viewer/TextViewer.jsp?cid=" + cid + "&rid=" + rid + "&mode=" + from + "&chkin=" + (isChkin ? "Y" : "N"), 600, 800, 'yes', 'no', 'no', 'no', 'yes');
	}
	
	function showRelationBib(cid, rid) {
		openWindow("ASSOCICATION_VIEWER", "viewer/TextViewer.jsp?cid=" + cid + "&rid=" + rid + "&mode=R", 600, 800, 'no', 'no', 'no', 'no', 'yes');
	}
	
	function showRelation(cid, rid, from, isChkin) {
		if (showRelation.arguments.length < 4)
			isChkin = false;
		switch (from) {
			case 'M' :
				showViewer(cid, 'S', isChkin);
				break;
			case 'A' :
				showAsso(cid, rid, isChkin,'A');
				break;
			case 'D' :
				showMOAsso(0, rid, cid);
				break;
			case 'R' :
				showRelationBib(cid, rid);
				break;
			case 'F' : 
				showViewer(cid, 'S', isChkin);
				break;
		}
	}
	// Assocication Data를 보여준다.
	function showData(infoid) {
		generalRequest("../services/common/search/AssocicationDataView.jsp?id=" + infoid , "ASSO", true);
	}
	
	function showRelatedBib(cid) {
		var url = "";
		url = url + "DetailView.jsp?cid=" + cid;
		generalRequest(url, "ASSO", true);
	}
	
	function showSpecialChar() {
		openWindow("SPECIAL", "popup/SpecialChars.jsp", 400, 450, 'yes', 'no', 'no', 'no', 'no');
	}
	
	function searchHanja(str, type) {
		try {
			if (str == "")
				return;
			var url = "../services/common/search/SearchRomanize.jsp?text=" + encodeURIComponent(str);
			if (searchHanja.arguments.length == 2) {
				url = url + "&type=" + type;
			}
			xmlRequest(url, "hanjaSearchResult");
		} catch (e) {
			alert(e.message);
		}
	}
	// 한자 결과를 Display
	function hanjaSearchResult(xmldoc) {
		try {
			var	root = xmldoc.documentElement;
			var	results = root.getElementsByTagName("Result");
			var	messages = root.getElementsByTagName("Message");
			var	types = root.getElementsByTagName("SearchType");
			var	result = getNodeValue(results[0]);
			var	message = getNodeValue(messages[0]);
			 	// 검색 유형 (hanja, kata, hira...)
			var	type = getNodeValue(types[0]);
			var	hanja = root.getElementsByTagName("RESULT");
			var	uniType = root.getElementsByTagName("TYPE");
			if (eval(result)) {
				var resultArea = document.getElementById(type + "Area");
				if (hanja.length == 0) {
					alert("결과가 없습니다.");
					return;
				}
				var sb = "";
				sb += ("<table width=100% border=0 cellpadding=0 cellspacing=0 bgcolor=D8DFE3>");
				sb += ("<tr><td style=\"padding:5\">");
				sb += ("<table width=100% border=0 cellpadding=0 cellspacing=1 bgcolor=FFFFFF>");
				sb += ("<tr><td style=\"padding:3;font-size:20px;\"><font face=\"새굴림\">");
				for (var i = 0; i < hanja.length; i++) {
					if (getNodeValue(uniType[i]) == 'U')
						sb += ("<a href=\"javascript:send('" + getNodeValue(hanja[i]) + "');\" title=\"유니코드 영역\" style=\"font-size:13px\">" + getNodeValue(hanja[i]) + "</a> ");
					else
						sb += ("<a href=\"javascript:send('" + getNodeValue(hanja[i]) + "');\" title=\"KSC 영역\" style=\"font-size:13px\">" + getNodeValue(hanja[i]) + "</a> ");
					if (i % 20 == 19) {
						sb += ("<br>");
					}
				}
				sb += ("</font></td></tr></table></td></tr></table>");
				resultArea.innerHTML = sb;
			} else {
				alert(message);
			}
		} catch (e) {
			alert(e.message);
		}
	}
	
	function resetForm(f) {
		if (f != null) {
			f.reset();
		}
	}
	
	function resetAllForm() {
		var f = document.getElementsByTagName("form");
		for (var i = 0; i < f.length; i++) {
			f[i].reset();
		}
	}
	
	var currentScrollIndex = 0;
	var isStop = false;
	var delay = 2000;
	
	function startKeywordRankScroll() {
		if (isStop) {
			setTimeout(startKeywordRankScroll, delay);
			return;
		}
		var o = document.getElementById("KEYWORD_RANK_BACK");
		if (o == null)
			return;
		var obj = document.getElementById("KEYWORD_RANK");
		for (var i = 0; i < o.clientHeight; i++)
			obj.style.top = i * currentScrollIndex * -1;
		if (currentScrollIndex == 20)
			currentScrollIndex = 0;
		currentScrollIndex++; 
		setTimeout("startKeywordRankScroll()", delay);
	}
	
	function getKeywordRanking() {
		var o = document.getElementById("KEYWORD_RANK");
		if (o == null)
			return;
		generalRequest("services/common/search/KeywordRanking.jsp", "KEYWORD_RANK", false);
		var o1 = document.getElementById("FAV_WORD");
		var o2 = document.getElementById("FAV_LOAN");
		if (o1 != null) {
			o1.style.fontWeight="bold";
		}
		if (o2 != null) {
			o2.style.fontWeight="";
		}
	}
	
	function getLoanRanking() {
		var o = document.getElementById("KEYWORD_RANK");
		if (o == null)
			return;
		generalRequest("services/common/search/MostLoanedRanking.jsp", "KEYWORD_RANK", false);
		var o1 = document.getElementById("FAV_WORD");
		var o2 = document.getElementById("FAV_LOAN");
		if (o1 != null) {
			o1.style.fontWeight="";
		}
		if (o2 != null) {
			o2.style.fontWeight="bold";
		}
	}
	
	function showBrief() {
		if (frmSearch == null)
			return;
		document.frmSearch.reset();
		if (document.frmSearch.SetNum.value == "" || document.frmSearch.SetNum.value == "0") {
			window.history.back();
			return;
		}
		if (frmSearch.CurrentPage.value == "")
			document.frmSearch.CurrentPage.value = "1";
		document.frmSearch.SortSearch.value = "Y";
		if (document.frmSearch.CIDList != null) {
			document.frmSearch.CIDList.value = "";
		}
		//checkExtra();
		//checkExtraLimit();
		//frmSearch.action = (frmSearch.ResultType != null ? frmSearch.ResultType.value : "") + "SearchResult.jsp";
		frmSearch.action = "SearchResult.jsp";
		frmSearch.submit();
	}

	function checkIndexSearch() {
		if (frmIndexSearch.SearchWord.value == "") {
			alert("검색어를 입력하십시오.");
			return;
		}
		checkExtra();
		checkExtraLimit();
		frmIndexSearch.submit();
	}
	function initIndexSearchForm() {
		frmIndexSearch.SearchWord.focus();
	}
	function searchFirstChar(v) {
		if (document.frmSearch) {
			document.frmSearch.SearchType.value = "START_WITH";
			document.frmSearch.IndexID[0].value = "";
			document.frmSearch.SearchWord[0].value = "";
			document.frmSearch.SearchOperator[0].value = "";
			document.frmSearch.SearchWord[1].value = "";
			document.frmSearch.IndexID[1].value = "";
			document.frmSearch.SearchOperator[1].value = "";
			document.frmSearch.SearchWord[2].value = "";
			document.frmSearch.IndexID[2].value = "";
			document.frmSearch.SearchOperator[2].value = "";
			document.frmSearch.FirstChar.value = v;
			document.frmSearch.CurrentPage.value = '1';
			document.frmSearch.MenuType.value = 'H';
			document.frmSearch.Sort.value = "TITL";
			document.frmSearch.SortType.value = "ASC";
			document.frmSearch.IndexSearch.value = "";
			checkLimit();
			checkExtra();
			checkExtraLimit();
			frmSearch.action = "SearchResult.jsp";
			frmSearch.submit();
		}
	}
	// 검색 모드를 변경
	function searchMode(uid, type) {
		var url = "Search.jsp?uid=" + uid;
		if (searchMode.arguments.length >= 2)
			url = url + "&type=" + type
		var layout = document.getElementById("NoLayout");
		if (layout != null) {
			if (layout.value == "Y")
				url = url + "&NoLayout=" + layout.value;
		}
		window.location.href = url;	
	}
	// 폐가제 서고 대출신청
	function chargeRequest(br, idid) {
		var url = "services/common/search/CloseChargeRequest.jsp?br=" + br;
		url = url + "&idid=" + idid;
		xmlRequest(url, "chargeRequestResult");
	}
	
	
	// 폐가제 서고 대출신청 결과
	function chargeRequestResult(xmlDoc) {
		var root = xmlDoc.documentElement;
		var results = root.getElementsByTagName("Result");
		var messages = root.getElementsByTagName("Message");
		var codes = root.getElementsByTagName("Code");
		var idids = root.getElementsByTagName("IDID");
		var brchs = root.getElementsByTagName("Branch");
		
		var result = getNodeValue(results[0]);
		var message = getNodeValue(messages[0]);
		var code = getNodeValue(codes[0]);
		var idid = getNodeValue(idids[0]);
		var brch = getNodeValue(brchs[0]);
		// 실패인 경우
		// 0. 로그인
		// 1. 권고
		// 2. 팝업
		if (eval(result)) {
			switch (code) {
				case "0" :
					if (confirm(message + "\n\n로그인 하시겠습니까?"))
						showLogin();
					break;
				case "1" :
					if (confirm(message)) {
						showChargeRequestWin(brch, idid);
					}
					break;
				case "2" :
					showChargeRequestWin(brch, idid); 
					break;
			}
		} else {
			alert(message);
		}
	}
	
	function showChargeRequestWin(br, idid) {
		var url = "popup/CloseChargeRequest.jsp?idid=" + idid + "&br=" + br;
		openWindow("CLOSE_CHARGE", url , 330, 500);
	}
	
	// 반납알림
	function returnAlarm(br, idid) {
		var url = "services/common/search/ReturnAlarm.jsp?br=" + br;
		url = url + "&idid=" + idid;
		xmlRequest(url, "returnAlarmResult");
	}
	
	
	// 폐가제 서고 대출신청 결과
	function returnAlarmResult(xmlDoc) {
		var root = xmlDoc.documentElement;
		var results = root.getElementsByTagName("Result");
		var messages = root.getElementsByTagName("Message");
		var codes = root.getElementsByTagName("Code");
		var idids = root.getElementsByTagName("IDID");
		var brchs = root.getElementsByTagName("Branch");
		
		var result = getNodeValue(results[0]);
		var message = getNodeValue(messages[0]);
		var code = getNodeValue(codes[0]);
		var idid = getNodeValue(idids[0]);
		var brch = getNodeValue(brchs[0]);
		// 실패인 경우
		// 0. 로그인
		// 1. 팝업
		if (eval(result)) {
			switch (code) {
				case "0" :
					if (confirm(message + "\n\n로그인 하시겠습니까?"))
						showLogin();
					break;
				case "1" :
					alert(message);
					break;
			}
		} else {
			alert(message);
		}
	}

	function goLecturePage(page) {
		document.frmLecture.page.value = page;
		document.frmLecture.submit(); 
	}
	
	function showContent(cid) {
		var url = "DetailView.jsp?uid=" + document.frmSearch.UID.value + "&cid=" + cid;
		if (document.frmSearch.CIDList != null) {
			document.frmSearch.CIDList.value = "";
		}
		if (document.frmSearch.CurrentIndex != null) {
			document.frmSearch.CurrentIndex.value = "";
		}
		document.frmSearch.action = url;
		document.frmSearch.submit();
	}
	
	// 상세보기
	function showDetail(cid, uid, rt) {
		var _uid = "";
		var initCID = "";
		var obj = document.getElementsByName("chkCID");
		var cidList = "";
		var cidFind = false;
		for (var i = 0; i < obj.length; i++) {
			if (obj[i].checked) {
				if (cidList != "")
					cidList += ("," + obj[i].value);
				else { 
					cidList += obj[i].value;
					initCID = obj[i].value;
				}
			} else {
				if (obj[i].value == cid) {
					cidFind = true;
					if (cidList != "")
						cidList += ("," + obj[i].value);
					else { 
						cidList += obj[i].value;
						initCID = obj[i].value;
					}
				}
			}
		}
		document.frmSearch.CIDList.value = cidList;
		
		// 없을 경우에
		if (showDetail.arguments.length == 0) {
			if (cidList == "") {
				alert("상세서지를 볼 항목을 선택하십시오.");
				return;
			}
			document.frmSearch.reset();
			if (document.frmSearch.CurrentIndex != null)
				document.frmSearch.CurrentIndex.value = 0;
			document.frmSearch.CIDList.value = cidList;
			document.frmSearch.action = "DetailView.jsp?uid=" + document.frmSearch.UID.value + "&cid=" + initCID;
			document.frmSearch.submit();
			return;
		}
		if (showDetail.arguments.length == 1) {
			if (document.frmSearch != null)
				_uid = document.frmSearch.UID.value;
		} else if (showDetail.arguments.length > 1) {
			_uid = uid;
		}
		
		var cidIndex = 0;
		if (showDetail.arguments.length >= 2) {
			for (var i = 0; i < obj.length; i++) {
				if (!obj[i].checked) {
					if (obj[i].value == cid) {
						obj[i].checked = true;
						initCID = cid;
						document.frmSearch.CurrentIndex.value = cidIndex;
						cidIndex++;
						break;
					}
				} else {
					if (obj[i].value == cid) {
						obj[i].checked = true;
						initCID = cid;
						document.frmSearch.CurrentIndex.value = cidIndex;
						break;
					}
					cidIndex++;
				}
			}
		}
		var url = "DetailView.jsp?uid=" + document.frmSearch.UID.value + "&cid=" + initCID;
		
		if (showDetail.arguments.length == 3) {
			url = url + "&ResultType=" + rt;
		} else {
			if (document.frmSearch != null) {
				if (document.frmSearch.ResultType && document.frmSearch.ResultType.value != "") {
					url = url + "&ResultType=" + document.frmSearch.ResultType.value;
				}
			}
			else {
				url = url + "&ResultType=" + rt;
			}
		}
		document.frmSearch.action = url;
		document.frmSearch.submit();
		//window.location.href = url;
	}
	
	function inquiryRequest(br, idid) {
		var url = "popup/InquiryRequest.jsp?br=" + br;
		url = url + "&idid=" + idid;
		openWindow("INQUIRY_REQUEST", url , 250, 500);
	}

	function mediaSearch(v1, v2, v3) {
		if (mediaSearch.arguments.length >= 1) {
			frmSearch.MDA.value = v1;
			frmSearch.MDX.value = "";
		}
		if (mediaSearch.arguments.length >= 2) {
			frmSearch.MDX.value = v2;
		}
		if (mediaSearch.arguments.length >= 3) {
			frmSearch.MDX.value = frmSearch.MDX.value + " " + v3;
		}
		document.frmSearch.SearchType.value = "MATCH";
		document.frmSearch.Sort.value = "PYB";
		document.frmSearch.SortType.value = "DESC";
		document.frmSearch.FirstChar.value = "";
		document.frmSearch.IndexID[0].value = "";
		document.frmSearch.IndexID[1].value = "";
		document.frmSearch.IndexID[2].value = "";
		document.frmSearch.SearchWord[0].value = "";
		document.frmSearch.SearchWord[1].value = "";
		document.frmSearch.SearchWord[2].value = "";
		document.frmSearch.SearchOperator[0].value = "";
		document.frmSearch.SearchOperator[1].value = "";
		document.frmSearch.SearchOperator[2].value = "";
		document.frmSearch.IndexSearch.value = "";
		checkExtra();
		checkExtraLimit();
		document.frmSearch.action = "SearchResult.jsp";
		document.frmSearch.submit();
	}
	
	// 전공학과 리스트 조회
	function getMajorList() {
		var url = "services/common/search/MajorDepartList.jsp";
		generalRequest(url, "MajorType", false);
	}
	
	function printList() {
		if (document.frmSearchResult == null) {
			alert("출력할 결과가 없습니다.");
			return;
		}
		var checked = false;
		for (var i = 1; i < document.frmSearchResult.chkCID.length; i++){
			if (document.frmSearchResult.chkCID[i].checked) {
				checked = true;
				break;
			}
		}
		
		if (!checked) {
			alert("출력할 항목을 선택하십시오.");
			return;
		}
		
		openWindow("__PRINT_OPTION", "", 300, 400);
		
		document.frmSearchResult.method = "post";
		document.frmSearchResult.action = "popup/PrintOption.jsp";
		document.frmSearchResult.target = "__PRINT_OPTION";
		document.frmSearchResult.submit();
	}
	
	function setValue(cv, tv) {
		if (currentForm == null)
			return;
		currentForm.IndexID.value = cv;
		currentForm.SearchWord.value = tv;
	}
	
	function showMajorList() {
		openWindow("__MAJOR_LIST","popup/MajorList.jsp", 400, 200, 'yes','no','no','no','no','no' );
	}
	
	function goDL(cid,lkey,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) {
		var url = "GoDLSite.jsp?cid="+ cid +"&lkey=" + encodeURIComponent(lkey);
		for (var i = 2; i < goDL.arguments.length; i++) {
			url = url + "&p" + (i - 1) + "=" + encodeURIComponent(goDL.arguments[i]); 
		}
		window.open(url, "__DL_JUMPER");
	}
	
	function sendDetail(f) {
		openWindow("__MAIL", "", 100, 100);
		f.target = "__MAIL";
		f.method = "POST";
		f.action = "popup/ContentsMailSender.jsp";
		f.submit(); 
	}
	
	function getDBList(uid) {
		generalRequest("services/common/search/ERMDBList.jsp?uid=" + uid, "DB_LIST", true);
	}
	
	// 주간 인기 검색어 자동 스크롤
	function doScrollerIE(direction, id, time){
		if(direction == 'down'){
			document.getElementById(id).doScroll('down');
		}else if(direction == 'up'){
			document.getElementById(id).doScroll('up');
		}else{
			clearTimeout(tid); 
			return;
		}
		tid=setTimeout("doScrollerIE('"+direction+"','"+ id+"','"+ time+"')",time);		
	}
	// 검색 결과 조회
	function showSearchResult(u, d, s, c, n, l, cnt) {
		var url = "services/" + DEFAULT + "/" + "SearchResultGenerator.jsp";
		url = url + "?u=" + u + "&s=" + s + "&l=" + l + "&c=" + encodeURIComponent(c) + "&n=" + encodeURIComponent(n) + "&cnt=" + cnt;
		generalRequest(url, "ResultMap" + d, false);
	}
	
	function moreWord() {
		var tr = document.getElementById("MORE_TR");
		if (tr != null)
			tr.style.display = "none";
		var tb = document.getElementById("MORE_TABLE");
		if (tb != null) 
			tb.style.display = "";
	}
	
	function goWebDB(id, url) {
		var url = "WebDBRedirect.jsp?id=" + id + "&url=" + encodeURIComponent(url);
		window.open(url); 
	}
	
	function getFavoriteDB(count, uid) {
		var url = "services/common/search/FavERMDB.jsp?cnt=" + count + "&uid=" + uid;
		generalRequest(url, "DB_LIST");
	}
	
	function journalList(first, uid, start, end) {
		var url = "services/common/search/EJournalList.jsp?first=" + encodeURIComponent(first) + "&uid=" + uid + "&start=" + start + "&end=" + end;
		generalRequest(url, "JOURNAL_LIST" + start, false);
	}
	
	function eResourceClassList(classID, type) {
		var url = "services/common/search/EResourceClass.jsp?type=" + type + "&class=" + classID;
		if (eResourceClassList.arguments.length >= 3)
		for (var i = 2; i < eResourceClassList.arguments.length; i++) {
			url = url + "&res=" + eResourceClassList.arguments[i]; 
		} 
		generalRequest(url, "DB_LIST");
	}
	
	function displayWebDB(idx) {
		var list = document.getElementsByName("DB");
		for (var i = 0; i < list.length; i++) {
			if (i == idx) {
				list[i].style.display = "";
			} else {
				list[i].style.display = "none";
			}
		}
	}
	
	function goEResourceMenu(uid, by, type) {
		var url = "Search.jsp?uid=" + uid + "&by=" + by;
		if (goEResourceMenu.arguments.length == 3) 
			url = url + "&type=" + type;
		window.location = url;
	}
	
	function checkExtraLimit() {
		var extraObject = document.getElementsByName("EXTRA_LIMIT");
		var extraValue = document.getElementsByName("EXTRA_VALUE");
		var extraType = document.getElementsByName("EXTRA_TYPE");
		var extraID = document.getElementsByName("EXTRA_ID");
		
		var indexID = document.getElementsByName("ExtraLimit");
		var limitValue = document.getElementsByName("ExtraValue"); 
		var limitID = document.getElementsByName("ExtraID");
		var temp = "";
		
		for (var i = 0; i < extraObject.length; i++) {
			if (extraType[i].value == "CHECK") {
				var objs = document.getElementsByName(extraObject[i].value);
				for (var j = 0; j < objs.length; j++) {
					if (objs[j].checked)
						temp = temp + objs[j].value + " ";
				}
				extraValue[i].value = temp;
				temp = "";
			}
			if (extraType[i].value == "COMBO") {
				var obj = document.getElementById(extraObject[i].value);
				if (obj == null)
					continue;
				extraValue[i].value = obj.value;
			}
			indexID[i].value = extraObject[i].value;
			limitValue[i].value = extraValue[i].value;
			limitID[i].value = extraID[i].value;
		}
	}
	
	function searchExtraLimit(v, idx) {
		var extraObject = document.getElementsByName("EXTRA_LIMIT");
		var extraValue = document.getElementsByName("EXTRA_VALUE");
		var extraType = document.getElementsByName("EXTRA_TYPE");
		var extraID = document.getElementsByName("EXTRA_ID");
		if (searchExtraLimit.arguments.length == 1) {
			extraValue[0].value = v;
		} else {
			extraValue[idx].value = v;
		}
		doSearch();
	}
	
	function getCID(index) {
		var cidList = document.frmSearch.CIDList.value
		var arr = cidList.split(",");
		return arr[index];
	}
	
	function goPrevious() {
		var v; 
		if (document.frmSearch.CurrentIndex.value == "")
			v = 0;
		else
			v = parseInt(document.frmSearch.CurrentIndex.value) - 1;
		document.frmSearch.CurrentIndex.value = v;
		document.frmSearch.action = "DetailView.jsp?uid=" + document.frmSearch.UID.value + "&cid=" + getCID(v);
		document.frmSearch.submit();
	}
	
	function goNext() {
		var v; 
		if (document.frmSearch.CurrentIndex.value == "")
			v = 1;
		else
			v = parseInt(document.frmSearch.CurrentIndex.value) + 1;
		document.frmSearch.CurrentIndex.value = v;
		document.frmSearch.action = "DetailView.jsp?uid=" + document.frmSearch.UID.value + "&cid=" + getCID(v);
		document.frmSearch.submit();
	}
	
	function checkSimpleSearchField(obj) {
		if (!focused) {
			alert("검색어를 입력하십시오!");
			obj.SearchWord[0].focus();
			return;
		} else {
			simpleSearch(obj);
		}
	}
	
	function showHistory() {
		window.location = "SearchHistory.jsp";
	}
	
	function getDatabaseVOD() {
		url = "services/common/search/DatabaseVOD.jsp";
		generalRequest(url, "DB_LIST");
	}
	
	function goRequestBook(searchNumber) {
		url = "Mylibrary.jsp?id=req&file=UserWrite&reqSearch=" + searchNumber;
		document.frmSearch.action = url;
		document.frmSearch.submit();
	}
	// 관계로 찾을 때...
	function relationSearch(uid) {
		document.frmSearch.UID.value = uid;
		var relation = "";
		for (var i = 1; i < relationSearch.arguments.length; i++) {
			if (relation.length != 0)
				relation += "^";
			relation += relationSearch.arguments[i];
		}
		document.frmSearch.PageSize.value = "20";
		document.frmSearch.Relation.value = relation;
		document.frmSearch.IndexSearch.value = "";
		document.frmSearch.action = "SearchResult.jsp";
		document.frmSearch.submit();
	}
	
	function requestDepartSearch(uid, dept, first) {
		document.frmSearch.UID.value = uid;
		document.frmSearch.RDEP.value = dept;
		document.frmSearch.PageSize.value = "20";
		if (requestDepartSearch.arguments.length == 3) {
			document.frmSearch.FirstChar.value = first;
			document.frmSearch.MenuType.value = "H";
		}
		document.frmSearch.SearchType.value = "START_WITH";
		document.frmSearch.IndexSearch.value = "";
		document.frmSearch.action = "SearchResult.jsp";
		document.frmSearch.submit();
	}
	
	function getStartingPoint() {
		generalRequest("services/snu/StartingPoint.jsp", "DB_LIST", true);
	}
	
	function getRelativeIndex(id, word) {
		var url = "services/common/search/RelativeIndex.jsp?id=" + id + "&word=" + encodeURIComponent(word);
		generalRequest(url, "RELATIVE_INDEX", true);
	}
	
	function searchYearRange(pyb, pye) {
		document.frmSearch.PYB.value = pyb;
		document.frmSearch.PYE.value = pye;
		document.frmSearch.action = "SearchResult.jsp";
		document.frmSearch.IndexSearch.value = "";
		document.frmSearch.submit();
	}
	
	function searchABC(id, c) {
		document.frmSearch.UID.value = id;
		document.frmSearch.FirstChar.value = c;
		document.frmSearch.ContentList.value = "";
		document.frmSearch.Multi.value = "";
		document.frmSearch.MenuType.value = "H";
		document.frmSearch.PageSize.value = "50";
		document.frmSearch.Sort.value = "TITL";
		document.frmSearch.SortType.value = "ASC";
		document.frmSearch.action = "SearchResult.jsp";
		document.frmSearch.submit();
	}
	
	function viewMarc(cid) {
		openWindow("MARC", "popup/MarcDisplay.jsp?cid=" + cid, 600, 800);
	}
	
	function viewFulltext(cid) {
		window.open("popup/viewOrigin.jsp?cid=" + cid, "ORIGIN", "width=620,height=400,toolbar=no,scrollbars=no,location=no,statusbar=no,resizable=yes");
		//openWindow("ORIGIN", "popup/viewOrigin.jsp?cid=" + cid, 400, 620, 'yes','no','no','no','no','yes');
	}
	
	function openServiceOrgan() {
		openWindow("SERVICE_ORGAN", "popup/ThesisOrgan.jsp", 650, 300, 'yes','no','no','no','no','no');
	}
