//ÀÌÀü µ¥ÀÌÅÍ, ´ÙÀ½ µ¥ÀÌÅÍ, Ã³À½ µ¥ÀÌÅÍ, ¸¶Áö¸· µ¥ÀÌÅÍ·Î ³Ñ¾î°¡´Â ¸µÅ© Ã³¸®
function GoToData(strData)
{
	var intDataNo = parseInt(document.forms[0].FullViewDataNo.value);
	var intCurrDataNo = intDataNo;
	
	if (strData == "+")
		intDataNo = intDataNo + 1;
	else if (strData == "-")	
		intDataNo = intDataNo - 1;
	else if (strData == "first")
		intDataNo = 1;		
	else if (strData == "last")
		intDataNo = intLastDataNo;	
	
	if (intCurrDataNo == intDataNo)
		return;
	else if (intDataNo <= 0)
	{
		alert(lngAlertFirstPage);
		return;
	}
	else if (intDataNo > intLastDataNo)	
	{
		alert(lngAlertLastPage);
		return;
	}
	else if (intDataNo >= 1 && intDataNo <= intLastDataNo)
	{
		with (document.forms[0])
		{
			FullViewDataNo.value = intDataNo;
			action = strGotoPageAction;
			//target = self.window.name;
			submit();
		}
	}
}

// strService : MARC, Cri, ...
// strTarget : self-> ÇöÀç È­¸é¿¡¼­ , popup->ÆË¾÷ È­¸é¿¡¼­ º¸¿©ÁØ´Ù. 
function Service(strService, strIdentifier)	
{
	if (strService == "URL")
	{
		strService = "URL2";
		strIdentifier = "URL2";
		//strHref = ServiceTD_URL.getAttribute("URL");
		//window.open (strHref, strService);
		//return;
	}

	with (document.forms[0])
	{
		var index = parseInt(FullViewDataNo.value, 10) - (parseInt(FullViewPageNo.value, 10)-1)*parseInt(ResultPerPage.value, 10) - 1;
		var strSysDiv = FullViewSysDiv.value.split("")[index];
		var strControlNo = FullViewControlNo.value.split("")[index];
	}
	ServiceDisplay(strService, strIdentifier, strSysDiv, strControlNo);
}
	
function ServiceDisplay(strService, strIdentifier, strSysDiv, strControlNo)
{

//alert(strService + "," + strIdentifier + "," + strSysDiv + "," + strControlNo);

	var strHref;
	if (strIdentifier == "")
		strIdentifier = strService;
	
	// URL2´Â URLÀ» °¡Áö°í ÀÖ´Ù´Â Á¤º¸¸¸ ¾Ë°í ÀÖÀ½. 
	if (strService == "URL2")
	{
		strHref = getServiceASPName(strService) + "?Service=" + strService + "&SysDiv=" + strSysDiv + "&ControlNo=" + strControlNo + "&Gubun=" + strIdentifier;
		window.open (strHref, strService);
		return;
	}
	else
	{
//alert(strHref);
		strHref = getServiceASPName(strService) + "?SysDiv=" + strSysDiv + "&ControlNo=" + strControlNo + "&Gubun=" + strIdentifier + "&Service=" + strIdentifier;
		//strHref = getServiceASPName(strService) + "?SysDiv=" + strSysDiv + "&ControlNo=" + strControlNo + "&Gubun=" + strIdentifier;
//alert(strHref);
	}
	
	if (strService == "MARC" || strService == "XML")
	{
		wndWidth = "550";
		wndHeight = "600";
	}
	/*
	else if (strService == "IMG" || strService == "OLD")
	{
		wndWidth = "800";
		wndHeight = "700";
		
	}
	else if (strService == "VOD")
	*/
	else if (strService == "IMG" || strService == "OLD" || strService == "VOD")
	{	
		/*
		wndWidth = "640";
		wndHeight = "470";
		*/
		wndWidth = "800";
		wndHeight = "600";
	}
	else
	{
		wndWidth = "630";
		wndHeight = "500";
	}
	
	window.open (strHref, strService, "toolbar=no,width=" + wndWidth + ",height=" + wndHeight + ",resizable=yes,scrollbars=yes,location=no,status=no,directory=no,menubar=no");

	/*
	if (strService == "MARC" || strService == "XML")	
		window.open (strHref, "Service");
	else
		self.location.href = strHref;
	*/
}
function getServiceASPName(strService)
{
	switch (strService)
	{
		case "MARC"	: return "TOTWServiceMARC.asp";
		case "XML"	: return "TOTWServiceXML.asp";
		
		case "IMG"	: return "TOTWServiceIMG.asp";				
		case "VOD"	: return "TOTWServiceVODRedirect.asp";
		case "OLD"	: return "TOTWServiceIMG.asp";

  /*		
		case "IMG"	: return "COMWServiceMOBJGate.asp";				
		case "VOD"	: return "COMWServiceMOBJGate.asp";
		case "OLD"	: return "COMWServiceMOBJGate.asp";
  */
		case "Crit"	: return "TOTWServiceCriticism.asp";
		case "CRI"	: return "/DLSearch/dlsearch/TOTWServiceCriticism.asp";
		case "REV"	: return "TOTWServiceREV.asp";
		case "EXC"	: return "TOTWServiceExcerpt.asp";
		case "CON"	: return "TOTWServiceContent.asp";
		default		: return "TOTWServiceRedirect.asp";
	}
}

function handleLink_New(intDRowIndex, intElementIndex, strLinkType, strTDID, strSysDiv, strControlNo)
{
	if (strLinkType == "FullView_NB")
	{
		self.location.href = "/DLSearch/dlsearch/NEWWSearchFullView.asp?FullViewSysDiv="+ strSysDiv +"&FullViewControlNo="+strControlNo;
	}
}

function handleLink(intRowIndex, intElementIndex, strLinkType, strTDID)
{
	if (strLinkType == "Search")
	{
		objTD = eval(strTDID + intRowIndex + "_" + intElementIndex);	
		handleLinkDelem(intRowIndex, intElementIndex, strLinkType, objTD.innerText, strTDID);
	}
	else 
	{
		if (strLinkType == "Reserve" || strLinkType == "BranchLoan") 	//2005/03/17 TGWin Modify by mhlee : ÆË¾÷ ·Î±×ÀÎ¶§¹®¿¡(BranchLoan)
		{
			//alert("½Ã¹ü¿î¿µ±â°£¿¡´Â »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.");
			//return;
			if (intLogon == 0)
			{
				self.parent.frames[0].login("Y");
				return;
			}
		}  

		handleLinkDelem(intRowIndex, intElementIndex, strLinkType, '', strTDID);
	}
}
// ¸µÅ©°¡ °É·Á ÀÖ´Â °Í Áß ±¸ºÐÀÚ¿¡ ÀÇÇØ ÆÄ½ÌµÇ¾î ¿Â °Íµé¿¡ ´ëÇÑ ¸µÅ©¸¦ Ã³¸®ÇÑ´Ù. 
function handleLinkDelem(intRowIndex, intElementIndex, strLinkType, strData, strTDID, strMainMenuNo)
{
// ²¿¸® °Ë»ö Àü¹æÀÏÄ¡, Å°¿öµå Ç×¸ñ
	if (strLinkType == "Search")
	{
		objTD = eval(strTDID + intRowIndex + "_" + intElementIndex);		
		strSearch = objTD.getAttribute("Search");
//alert(strInitialSysKey + "\n" + strInitialSysDiv + "\n" + strData + "\n" + strSearch);
		strSearchQuery = getSearchQuery(strInitialSysKey, strInitialSysDiv, strData, strSearch, "");


		
		
		strViewQuery = "[" + objTD.parentElement.firstChild.innerText + "/" + strData + "]"; 
		// Àü¹æÀÏÄ¡ÀÌ¸é "FRNT", Å°¿öµåÀÌ¸é "KWRD"
		strSearchMethod = (strSearch.substr(0, 4).toUpperCase() == "KEYW") ? "KWRD" : "FRNT";		
//alert(strSearchQuery + "\n" + strViewQuery + "\n" + strSearchMethod); 
		self.location.href = "TOTWSearchList.asp?SysKey=" + strInitialSysKey + "&SysDiv=" + strInitialSysDiv 
								+ "&SearchQuery=" + strSearchQuery + "&ViewQuery=" + strViewQuery + "&SearchMethod="
								 + strSearchMethod + "&" + getStrAboutHistory();  

	}
	// ¿ÏÀü ÀÏÄ¡ Ç×¸ñ
	// ¿ÏÀü ÀÏÄ¡ Ç×¸ñÀÏ ¶§´Â ÀÎÁ¢¾î Ã³¸®¸¦ ÇÑ´Ù. 
	else if (strLinkType == "ExactSearch")
	{
		objTD = eval(strTDID + intRowIndex + "_" + intElementIndex);		
		strSearch = objTD.getAttribute("Search");
		
		// ¿ÏÀüÀÏÄ¡ ¶§¹®¿¡ Ãß°¡
		strSearchQuery = "";
		strViewQuery = "[" + objTD.parentElement.firstChild.innerText + "/";
		
		arrData = strData.split("");
		for (i=1;2*i<arrData.length;i++)
		{
			strSplitData = arrData[2*i-1];
			if (strSplitData.length > 0) 	
			{	
				if (2*i<arrData.length-2)
					strAnd = " ";
				else
					strAnd = "";

				strSearchQuery = strSearchQuery + strSplitData;
				strViewQuery = strViewQuery + strSplitData + strAnd;
			}
		}
		
		strViewQuery = strViewQuery + "]";
		//³¡ ------------- ¿ÏÀüÀÏÄ¡ ¶§¹®¿¡ Ãß°¡
			
		
		strSearchQuery = getSearchQuery(strInitialSysKey, strInitialSysDiv, strSearchQuery, strSearch, "Exact");	
		//strViewQuery = "[" + objTD.parentElement.firstChild.innerText + "/" + strData + "]"; 
		// Àü¹æÀÏÄ¡ÀÌ¸é "FRNT", Å°¿öµåÀÌ¸é "KWRD"
		strSearchMethod = (strSearch.substr(0, 4).toUpperCase() == "KEYW") ? "KWRD" : "FRNT";		
		self.location.href = "TOTWSearchList.asp?SysKey=" + strInitialSysKey + "&SysDiv=" + strInitialSysDiv 
								+ "&SearchQuery=" + strSearchQuery + "&ViewQuery=" + strViewQuery + "&SearchMethod="
								 + strSearchMethod + "&" + getStrAboutHistory(); 
	}

	// ÇöÀç´Â ExactSearch´Â Delemeter3Search°ú °°Àº ¹æ¹ýÀ¸·Î Ã³¸®ÇÑ´Ù. 
	// Delemeter3¿¡ ´ëÇÑ Search
	// °Ë»öÇ×¸ñ1.....°Ë»öÇ×¸ñ2 ÀÌ·± Çü½ÄÀ¸·Î ³Ñ¾î¿À´Âµ¥, 
	else if (strLinkType == "Delemeter3Search" || strLinkType == "ExactSearch")
	{
		objTD = eval(strTDID + intRowIndex + "_" + intElementIndex);		
		strSearch = objTD.getAttribute("Search");
		arrData = strData.split("");
		// Àü¹æÀÏÄ¡ÀÌ¸é, FRNT Å°¿öµåÀÌ¸é KWRD
		strSearchMethod = (strSearch.substr(0, 4).toUpperCase() == "KEYW") ? "KWRD" : "FRNT";		

		strSearchQuery = "";
		strViewQuery = "[" + objTD.parentElement.firstChild.innerText + "/";
		
		// Ç×»ó ÀÌ ÇÏ³ª ÀÌ»ó Æ÷ÇÔµÇ¾î ÀÖÀ¸¹Ç·Î, for¹®À» ÇÑ ¹ø ÀÌ»ó ½ÇÇàÇÑ´Ù. 
		// Å°¿öµå °Ë»öÀÎ °æ¿ì "[°Ë»öÇ×¸ñ1, ....] and [°Ë»öÇ×¸ñ2, ...]" Çü½ÄÀ¸·Î Äõ¸®¸¦ ±¸¼ºÇÑ´Ù. 
		if (strSearchMethod == "KWRD")
		{
			for (i=1;2*i<arrData.length;i++)
			{
				strSplitData = arrData[2*i-1];
				if (strSplitData.length > 0) 	
				{	
					if (2*i<arrData.length-2)
						strAnd = " AND ";
					else
						strAnd = "";
								
					strSearchQuery = strSearchQuery + "(" + getSearchQuery(strInitialSysKey, strInitialSysDiv, strSplitData, strSearch, "") + ")" + strAnd;
					strViewQuery = strViewQuery + strSplitData + strAnd;
				}
			}
			strViewQuery = strViewQuery + "]";
		}
		// Àü¹æÀÏÄ¡ °Ë»öÀÎ °æ¿ì "['°Ë»öÇ×¸ñ+°Ë»öÇ×¸ñ2', ...]" Çü½ÄÀ¸·Î Äõ¸®¸¦ ±¸¼ºÇÑ´Ù. 
		else
		{
			//for (i=1;2*i<arrData.length;i++)
			//{
				//strSplitData = arrData[2*i-1];
				strSplitData = arrData[1].replace(".","");

				if (strSplitData.length > 0) 	
				{	
					//if (2*i<arrData.length-2)
					//	strAnd = " ";
					//else
						strAnd = "";
//alert("±¸ºÐÀÚ·Î ÆÄ½ÌµÈ °ª: \n" + strSplitData);			
					strSearchQuery = strSearchQuery + strSplitData;
					strViewQuery = strViewQuery + strSplitData + strAnd;
				}
			//}
//alert(strInitialSysKey + " " + strInitialSysDiv + " " + strSearchQuery + " " + strSearch);
			strSearchQuery = getSearchQuery(strInitialSysKey, strInitialSysDiv, strSearchQuery, strSearch, "");
			strViewQuery = strViewQuery + "]";
		}	
//alert("Ã³¸®°¡ ¿Ï·áµÈ Äõ¸®: \n" + strSearchQuery);
//alert('<%=Request("mainmenuno")%>');
		self.location.href = "TOTWSearchList.asp?MainMenuNo=" + strMainMenuNo + "&SysKey=" + strInitialSysKey + "&SysDiv=" + strInitialSysDiv 
								+ "&SearchQuery=" + strSearchQuery + "&ViewQuery=" + strViewQuery + "&SearchMethod="
								 + strSearchMethod + "&" + getStrAboutHistory();  
	}

	//return;
	// °ü·Ã Á¤º¸ÀÇ »ó¼¼ È­¸éÀ» º»´Ù. 
	else if (strLinkType == "FullView")
	{
		objTD = eval(strTDID + intRowIndex + "_" + intElementIndex);	
		strSysDiv = objTD.getAttribute("SysDiv");
		strControlNo = objTD.getAttribute("ControlNo");		
		FullViewIdRef(strSysDiv, strControlNo);
	}
	
	// URL¿¡ ´ëÇÑ ¸µÅ©¸¦ Ã³¸®ÇÑ´Ù.
	else if (strLinkType == "URL")
	{
		objTD = eval(strTDID + intRowIndex + "_" + intElementIndex);	
		strURL = objTD.getAttribute("URL");

		// [20090501] ´Ù»êÁö¾ØÁö ·Î±×ÀÎ ¿¬µ¿
		if (strURL.indexOf("210.125.93.14:8033") > -1)
		{
			strURL = "/dlsearch/portal_api/tg_xspider_dasan.asp?URL=" + strURL
		}
		else if (strURL.indexOf("ebook.sungshin.ac.kr:8033") > 0 || strURL.indexOf("210.125.93.14:8033") > 0)
		{
			strURL = "/dlsearch/portal_api/ebook/tg_xspider_dasan.asp?URL=" + strURL;
		}
		else if (strURL.indexOf("ebook.sungshin.ac.kr:8081") > 0 || strURL.indexOf("210.125.93.14:8081") > 0)
		{
			strURL = "/dlsearch/portal_api/ebook/tg_xspider_kyobo.asp?URL=" + strURL;
		}
		else if (strURL.indexOf("://") < 0)
		{
			strURL = "http://" + strURL;
		}

		window.open(strURL, "URL"); 
	}
	// Delemeter Ã³¸®°¡ µÈ URL¿¡ ´ëÇÑ ¸µÅ©¸¦ Ã³¸®ÇÑ´Ù.
	else if (strLinkType == "DelemeterURL")
	{
		objTD = eval(strTDID + intRowIndex + "_" + intElementIndex);	
		
		//strURL = strData;
		//URL ÀÌ¶ó´Â attribute°¡ ÀÖÀ»¶§´Â URL·Î ¸µÅ© ¾Æ´Ò¶§´Â NameÀ¸·Î Link  20011120 È«¼ºÁø ¼öÁ¤
		strURL = objTD.getAttribute("URL");
		//alert(strURL);
		if(strURL == null)
			strURL = strData;
			
		if (strURL.indexOf("://") < 0)
			strURL = "http://" + strURL;
		window.open(strURL, "URL"); 
	}
	// EMail¿¡ ´ëÇÑ ¸µÅ©¸¦ Ã³¸®ÇÑ´Ù.
	else if (strLinkType == "EMail")
	{
		objTD = eval(strTDID + intRowIndex + "_" + intElementIndex);	
		strEMail = objTD.getAttribute("EMail");
		self.location.href = "mailto:" + strEMail;
	}
	// ¼ÒÀåÃ³¿¡ ´ëÇÑ ¸µÅ©¸¦ Ã³¸®ÇÑ´Ù. 
	else if (strLinkType == "Holding")
	{
		objTD = eval(strTDID + intRowIndex + "_" + intElementIndex);	
		strLink = objTD.getAttribute("Link");
		strLink = "../Common/CommonWRedirectByLng.asp?URL=Location/" + strLink;
		wndWidth = "600";
		wndHeight = "600";
		window.open (strLink, "Holding", "toolbar=no,width=" + wndWidth + ",height=" + wndHeight + ",scrollbars=yes,location=no,status=no,directory=no,menubar=no");
		//window.open (strLink, "Holding");
	}
	// ¿¹¾à °¡´É¿¡ ´ëÇÑ ¸µÅ©
	else if (strLinkType == "Reserve")
	{
		with (document.forms[0])
		{
			var strFullViewSysDiv = FullViewSysDiv.value;
			var strFullViewControlNo = FullViewControlNo.value;
			var strFullViewDataNo = FullViewDataNo.value;
		}
		objTD = eval(strTDID + intRowIndex + "_" + intElementIndex);	
		//20010813 È«¼ºÁø ¼öÁ¤ main_no ³Ñ±è
		strMain_No = objTD.getAttribute("Main_No");
		strLocation = objTD.getAttribute("Location");
		//strAccession_No = objTD.getAttribute("AccessionNo");
		
		if (window.confirm('¿¹¾à ÇÏ½Ã°Ú½À´Ï±î?')) {
//2005/12/05 FutureWin Modify by mhlee : 1¹ÙÀÌÆ® Æ÷ÇÔ URL ¿À·ù ¶§¹®¿¡ POST¹æ½ÄÀ¸·Î º¯°æ
			window.open("", "ReserveWaitDate", "height=280,width=320,top=280,left=400,status=no,resizible=no,toolbar=no,menubar=no");
			document.forms[0].target = "ReserveWaitDate";
			document.forms[0].action = "LegWReserveWaitDateSetting.asp?ShowType=ReserveBook&Main_No=" + strMain_No + "&Location=" + strLocation + "&" + getStrAboutHistory();
			document.forms[0].submit();
//		window.open("LegWReserveWaitDateSetting.asp?ShowType=ReserveBook&Main_No=" + strMain_No + "&Location=" + strLocation
//								+ "&FullViewSysDiv=" + strFullViewSysDiv + "&FullViewControlNo=" + strFullViewControlNo 
//								+ "&FullViewDataNo=" + strFullViewDataNo + "&" + getStrAboutHistory(),"ReserveWaitDate",
//								"height=220,width=320,top=280,left=400,status=no,resizible=no,toolbar=no,menubar=no");
								
		//self.location.href = "ComButtonProcess.asp?ShowType=ReserveBook&Main_No=" + strMain_No + "&Location=" + strLocation
								+ "&FullViewSysDiv=" + strFullViewSysDiv + "&FullViewControlNo=" + strFullViewControlNo 
								+ "&FullViewDataNo=" + strFullViewDataNo + "&" + getStrAboutHistory();  
		}
		//self.location.href = "ComButtonProcess.asp?ShowType=ReserveBook&Accession_No=" + strAccession_No 
								+ "&FullViewSysDiv=" + strFullViewSysDiv + "&FullViewControlNo=" + strFullViewControlNo 
								+ "&FullViewDataNo=" + strFullViewDataNo + "&" + getStrAboutHistory();  
	}
	// Á¦º»Á¤º¸¿Í ±ÇÈ£ Á¤º¸¿¡ ´ëÇÑ ¸µÅ©
	else if (strLinkType == "FullCheckin" || strLinkType == "FullBind")
	{
		objTD = eval(strTDID + intRowIndex + "_" + intElementIndex);	
		strControlNo = objTD.getAttribute("ControlNo");
		strHref = getLinkASPName(strLinkType) + "?SysDiv=CAT&ControlNo=" + strControlNo + "&" + getStrAboutHistory();
		self.location.href = strHref;
	}
	//È«¼ºÁø Ãß°¡ 20010531 NewLas ¿ë Á¦º»Á¤º¸¿Í ±ÇÈ£ Á¤º¸¿¡ ´ëÇÑ ¸µÅ©
	else if (strLinkType == "NlsCheckin")
	{
		objTD = eval(strTDID + intRowIndex + "_" + intElementIndex);	
		strControlNo = objTD.getAttribute("ControlNo");
		strLocation = objTD.getAttribute("Location");
		strSubLocation = objTD.getAttribute("Sub_location");
		//alert(strLinkType + strControlNo + strSubLocation + strLocation);
		strHref = getLinkASPName(strLinkType) + "?SysDiv=CAT&ControlNo=" + strControlNo + "&Location=" + strLocation + "&Sub_location=" + strSubLocation + "&ReserveBookRequest=" + strReserveBookRequest + "&" + getStrAboutHistory();
		self.location.href = strHref;
	}
	else if ( strLinkType == "NlsBind"){
		objTD = eval(strTDID + intRowIndex + "_" + intElementIndex);	
		strControlNo = objTD.getAttribute("ControlNo");
		strLocation = objTD.getAttribute("Location");
		strSubLocation = objTD.getAttribute("Sub_location");
		strHoldNo = objTD.getAttribute("HoldNo");
		//alert(strLinkType + strControlNo + strSubLocation + strLocation);
		strHref = getLinkASPName(strLinkType) + "?SysDiv=CAT&ControlNo=" + strControlNo + "&HoldNo=" + strHoldNo + "&Location=" + strLocation + "&Sub_location=" + strSubLocation + "&ReserveBookRequest=" + strReserveBookRequest + "&"  + getStrAboutHistory();
		self.location.href = strHref;
	}
	else if (strLinkType == "Location")  //È«¼ºÁø Ãß°¡ 20010529   ¼ÒÀåº» Á¤º¸ ¸µÅ© Ãß°¡
	{
		objTD = eval(strTDID + intRowIndex + "_" + intElementIndex);	
		strControlNo = objTD.getAttribute("ControlNo");
		strLocation = objTD.getAttribute("Location");
		strSubLocation = objTD.getAttribute("Sub_location");
		strHoldNo = objTD.getAttribute("HoldNo");
		
		//LegWHoldingInfo.asp·Î ÀÌµ¿.
		//strHref = getLinkASPName(strLinkType) + "?ControlNo=" + strControlNo +  "&HoldNo=" + strHoldNo + "&Location=" + strLocation +  "&Sub_location=" + strSubLocation + "&" + getStrAboutHistory() ;
		//self.location.href = strHref;
		document.form1.HoldControlNo.value = strControlNo;
		document.form1.HoldLocation.value = strLocation;
		document.form1.HoldSubLocation.value = strSubLocation;
		document.form1.HoldHoldNo.value = strHoldNo;
		document.form1.submit();
		
	}
	else if (strLinkType == "BranchLoan")  //È«¼ºÁø Ãß°¡ 20010731   ºÐ°ü´ëÃâ ¸µÅ© Ãß°¡
	{
		objTD = eval(strTDID + intRowIndex + "_" + intElementIndex);	
		strAccession = objTD.getAttribute("accession_no");
		window.open("../DLService/BranchLoan/LegWBranchLoanForm.asp?accession_no=" + strAccession ,"BranchLoanWin","toolbar=no,width=400,height=300,top=50,left=200,scrollbars=no,location=no,status=no,directory=no,menubar=no"); 
	}	
	else
		return;

}

//strSystemKey: SysKey
//strSystemDiv: SysDiv
//strOriKeyword: ²¿¸® °Ë»ö ´ë»ó µ¥ÀÌÅÍ
//strSearch: °Ë»ö ´ë»ó  ¿¹)FRNT01, KEYW05, ...
//strSearchType: °Ë»ö Å¸ÀÔ: ¸¸¾à "Exact"ÀÌ¸é, ¿ÏÀü ÀÏÄ¡ °Ë»öÀ» ÇÑ´Ù. 
function getSearchQuery(strSystemKey, strSystemDiv, strOriKeyword, strSearch, strSearchType)
{
	// ¿ÏÀü ÀÏÄ¡ Ç×¸ñÀÏ ¶§´Â ÀÎÁ¢¾î Ã³¸®¸¦ ÇÑ´Ù. 
	if (strSearchType == "Exact")
		strAdjacency = "Y";
	else
		strAdjacency = "";

	var strKeyword = filterText_TailSearch(strOriKeyword, strSearch.substr(0, 4).toUpperCase(), strAdjacency);
	var strSysDisc = (strSystemKey == "SYSTOT")	? "TOT00" : strSystemDiv+strSystemKey.substr(strSystemKey.length-2, 2);
	var strSearchItem = parseInt(strSearch.substr(strSearch.length-2, 2), 10);

	if (strSearchType == "Exact")
		return ("(["+strKeyword+","+strSysDisc+",1,"+strSearchItem+",8])");
	else
	{
		// Àü¹æÀÏÄ¡ÀÌ¸é, 1 Å°¿öµåÀÌ¸é 2
		var strSearchMethod = (strSearch.substr(0, 4).toUpperCase() == "KEYW") ? "2" : "1";		
		return ("(["+strKeyword+","+strSysDisc+","+strSearchMethod+","+strSearchItem+",3"+"])");
	}
}

function getLinkASPName(strLinkType)
{
	switch (strLinkType)
	{
		case "FullCheckin"	: return "LEGWSearchCheckin.asp";
		case "FullBind"		: return "LEGWSearchBinding.asp";
		case "NlsCheckin"	: return "LEGWSearchCheckin.asp";
		case "NlsBind"		: return "LEGWSearchBinding.asp";
		case "Location"		: return "LEGWHoldingInfo.asp";
	}
}
function FullViewIdRef(strSysDiv, strControlNo)
{
	var strHref = "TOTWSearchFullView.asp?FullViewSysDiv=" + strSysDiv + "&FullViewControlNo=" 
				+ strControlNo + "&ReserveBookRequest=" + strReserveBookRequest + "&" + getStrAboutHistory();  
	//window.open(strHref, "IdRef");	
	self.location.href = strHref;

}

function getStrAboutHistory()
{
	var StrAboutHistory;
	with (document.forms[0])
	{
		// SearchMainHisToGoÇ×¸ñÀÌ ÀÖÀ» ¶§¿¡¸¸ Á¤º¸¸¦ ³Ñ±ä´Ù. 
		if (document.getElementsByName("SearchMainHisToGo").length > 0)
			strSearchMainHisToGoVal = "&SearchMainHisToGo=" + SearchMainHisToGo.value;
		else
			strSearchMainHisToGoVal = "";
		
		StrAboutHistory = "SearchListHisToGo=" + SearchListHisToGo.value + strSearchMainHisToGoVal;
	}
	return StrAboutHistory;
}
// ¿ì¼± Á¤¸® ¿äÃ»
function processImmediately(strTitle, strAccession_no)
{
	self.location.href = "ComButtonProcess.asp?ShowType=ProcessImmediately&Title=" + strTitle 
								+ "&Accession_no=" + strAccession_no;  
}
// ¿ø¹® º¹»ç ½ÅÃ»
function RequestImagePrint(strSysDiv, strControlNo)
{
//2005/01/21 TGWin Modify by mhlee
	if (strSysDiv == "MON" || strSysDiv == "SAT" || strSysDiv == "CAT")
	{
//		var strHref = "../dlService/dds/SerWDdsCatForm.asp?FormKind=insert";
		var strHref = "../dlService/dds/SerWDdsCatFormFromSearch.asp?SysDiv=" + strSysDiv + "&ControlNo=" + strControlNo;
	}
	else
	{
		var strHref = "../dlService/dds/SerWDdsArtFormFromSearch.asp?SysDiv=" + strSysDiv + "&ControlNo=" + strControlNo ;
//		var strHref = "../dlService/dds/SerWDdsArtForm.asp?FormKind=insert";
	}
				  
	//window.open(strHref, "IdRef");	
	self.location.href = strHref;

}
// SDI ¼­ºñ½º ½ÅÃ»
function BuildSDIProfile()
{
	if (intLogon == 0)
	{
		self.parent.frames[0].login("Y");
		return;
	}
	with (document.forms[0])
	{
		var index = parseInt(FullViewDataNo.value, 10) - (parseInt(FullViewPageNo.value, 10)-1)*parseInt(ResultPerPage.value, 10) - 1;
		var strSysDiv = FullViewSysDiv.value.split("")[index];
		var strControlNo = FullViewControlNo.value.split("")[index];
	}
	self.location.href = "ComButtonProcess.asp?ShowType=BuildSDIProfile&ControlNo=" + strControlNo;
}

function linkRefURL(strData)
{
	strURL = strData;
	if (strURL.indexOf("http://") < 0)
		strURL = "http://" + strURL;
	window.open(strURL, "URL"); 

}

function handleLink_OneLineTable(strBasicLinkType, intElementIndex)
{
	var objTD = eval("OneLineTD_" + strBasicLinkType + "_" + intElementIndex);
	if (strBasicLinkType == "linkRefURL")
	{
		strURL = objTD.getAttribute("URL");
		linkRefURL(strURL);
	}
	else if (strBasicLinkType == "EjournalInfo")
	{
		strSysDiv = objTD.getAttribute("SysDiv");
		strControlNo = objTD.getAttribute("ControlNo");
		FullViewIdRef(strSysDiv, strControlNo);
	}	

}

function AddBasket(){
	document.forms[0].action = "TOTWSearchFullViewBasketPut.asp"
	document.forms[0].submit();
}


function handleMultiLink(strAnchorId, strLinkType){
	var objA;
	var strFullViewControlNo, strFullViewSysDiv, arraySysDiv;
	strText = "";
	objA = eval(strAnchorId);

	if (strLinkType == "MultiFulView"){
		strFullViewControlNo = objA.getAttribute("ControlNo");
		strFullViewSysDiv = objA.getAttribute("SysDiv");
		arraySysDiv = strFullViewSysDiv.split("");

		var strHref = "TOTWSearchFullView.asp?FullViewSysDiv=" + strFullViewSysDiv + "&FullViewControlNo=" 
					+ strFullViewControlNo + "&" + getStrAboutHistory();  				
		self.location.href = strHref;
	}

	if (strLinkType == "MultiURL"){
		strURL = objA.getAttribute("URL");
		window.open(strURL);
	}


}

///////////////////////////////////////////////////////////////////////////////////////////////// 
// 2004.04.27, ±è»óÈ£, »ó¼¼Á¤º¸È­¸é¿¡¼­ ¹Ù±¸´Ï, ÀúÀå, ¸ÞÀÏ, Ãâ·Â±â´ÉÀ» »ç¿ëÇÏ±â À§ÇØ Ãß°¡ÇÔ
/////////////////////////////////////////////////////////////////////////////////////////////////
var strWebProjectName = "dlsearch";
var strWebProjectPath = "/" + strWebProjectName + "/";

//¹Ù±¸´Ï º¸±â. 
function ViewServiceBasket2()
{
	with (document.BasketForm)
	{
		action = "TOTWServiceBasket.asp";
		target = self.name;
		submit();
	}
}
//¹Ù±¸´Ï¿¡ ÀúÀå 
function PutServiceBasket2()
{
	with (document.BasketForm)
	{
		action = "TOTWServiceBasketPut.asp";
		target = self.name;
		submit();
	}
}

// ÀúÀå, ¸ÞÀÏ, Ãâ·Â
function handleSaving2(strServiceType)
{
	with (document.BasketForm)
	{
		ServiceType.value = strServiceType;
		target = self.name;
		action = strWebProjectPath + "DLSearch/TOTWServiceSave.asp";
		submit();
	}
}

// ÀúÀÚÁ¤º¸ º¸¿©ÁÖ±â
function AuthorInfo(strAuthor)
{
	if (strAuthor == null || strAuthor == "")
	{
		return;
	}

	var strHeight;
	var strURL;
	var strLeft;
	var strHeight = "300";
	var strWidth = "550";

	strLeft = (screen.width - strWidth) / 2;
	strTop = (screen.height - strHeight) / 2;
	strURL = "/dlsearch/dlsearch/TOTWServiceAuthorInfo.asp?author=" + strAuthor

	var temp = window.open(strURL, "ÀúÀÚÁ¤º¸", "toolbar=no,width=" + strWidth + ",height=" + strHeight + ", left=" + strLeft + ",top=" + strTop + ",resizable=yes,scrollbars=yes,location=no,status=no,directory=no,menubar=no");
}

// ÁöÁ¤ÀÚ·á ½ÅÃ»
function RequestClassReserved(strSysDiv, strControlNo)
{
	var strUrl = "/dlsearch/dlservice/ReserveBook/LegWGetBookInfo.asp?SysDiv=" + strSysDiv + "&ControlNo=" + strControlNo;
	self.location.href = strUrl;
}

// Ã£Áö¸øÇÑ ÀÚ·á½Å°í, º¸Á¸¼­°í½ÅÃ», À¥´ëÃâ½ÅÃ»
function handleReport(strReportType)
{
	var strURL;
	var strWinSize;
	var strName;
	var strServiceId; // Service Id

	// ·Î±×ÀÎ Ã¼Å© ÇÔ¼ö : By ÀÓÁøÈ¯
	if (intLogon == 0)
	{
		alert ("Need Login");
		return;
	}

	with (document.BasketForm)
	{
		if (strReportType == "Missing") // ºÐ½Çµµ¼­ Ã£±â
		{
			strServiceId = "MBS0003";
			strURL = "/DLSearch/DLService/MissingBook/ComWMBServiceForm.asp";
//			strWinSize = "width=1000,height=440,";
			strWinSize = "width=600,height=450,";	//2006/01/17 FutureWin Modify by mhlee : ÆË¾÷Ã¢ ÁÙÀÓ.
			strName = "missing";
		}
		else if(strReportType == "Storage")	{	//º¸Á¸¼­°í ÀÚ·á½ÅÃ»
			strServiceId = "MBS0002";
			strURL = "/DLSearch/DLService/StorageRequest/ComWSBRequestForm.asp";
			strWinSize = "width=600,height=450,";	//2006/01/17 FutureWin Modify by mhlee : ÆË¾÷Ã¢ ÁÙÀÓ.
			strName = "storage";
		}
		else if(strReportType == "WebLoan")	{	//À¥´ëÃâ½ÅÃ»(2ºÎ»ý Only)
			strServiceId = "MBS0004";
			strURL = "/DLSearch/DLService/WebLoan/ComWWLRequestForm.asp";
			strWinSize = "width=600,height=450,";	//2006/01/17 FutureWin Modify by mhlee : ÆË¾÷Ã¢ ÁÙÀÓ.
			strName = "webloan";
		}
		else	// ºÐ½Çµµ¼­ Ã£±â, º¸Á¸¼­°í ÀÚ·á¿­¶÷, ¿ø¹®¾Èº¸ÀÌ´Â ÀÚ·á½Å°í µîÀÌ ¾Æ´Ò¶§ ¸®ÅÏ
			return;
			
		strURL += "?ServiceId=" + strServiceId + "&pSysDiv=" + pSysDiv.value + "&pControlNo=" + pControlNo.value + "&ServiceType=" + strReportType;
		window.open(strURL, strName, strWinSize + "scrollbars=yes,left=50,top=50,resizable=no");
	}
}


