//--------------------------------------------------------------
//	filename		: TOTWSearchMain.js
//	description		: °Ë»ö¸ÞÀÎ°ú °ü·ÃµÈ ÀÚ¹Ù ½ºÅ©¸³Æ®
//						´Ù±¹¾î Àû¿ë°ú °ü·ÃµÈ º¯¼ö´Â TOTWSearchMain.asp¿¡¼­ Á¤ÀÇµÈ º¯¼ö¸¦ »ç¿ë
//	creator			: Sam-Yeon Jung :syjung@tginfonet.com
//	date			: 2001.1.28
//	Dept.			: TriGem InfoNet, Inc. Information Technology Research Center
//	Copyright(C)2000,TGInfonet All rights Reserved
//---------------------------------------------------------------		

//-- »ç¿ëÇÏ´Â ±Û·Î¹ú º¯¼ö ----
//lngAlertCheckSearchTerm

cntGubun =":";
cntTotal ="TOTAL";

//µÎ¹ø submit µÇÁö ¾Êµµ·Ï Ãß°¡ 20011105 È«¼ºÁø
var SubmitStatus;
SubmitStatus = false;

//-----------------------------------------------
// checkbox¿¡¼­ ÀüÃ¼¿Í ±×¿Ü°Í ¼±ÅÃ½ÃÀÇ ¹ÝÀü°ü°è  
//-----------------------------------------------
function toggleCBox_MS(intFormIndex , strName, strIndex)
{
	var objCBox, i

	//ÇöÀçÀÇ checkbox
	objCBox = eval("document.forms[intFormIndex]."+strName);

	if (strIndex == 'TOTAL') //ÀüÃ¼ ¼±ÅÃ
	{
		for (i=1; i < objCBox.length ; i++)
		{
			if (objCBox[0].checked == true)	//ÀüÃ¼°¡ true
				objCBox[i].checked = false
		}
	}			
	else	//ÀüÃ¼ ÀÌ¿Ü¿¡ ÇÏ³ª¶óµµ ¼±ÅØµÇ¸é ÀüÃ¼¸¦ ÇØÁ¦ 
	{
		for (i=1; i < objCBox.length ; i++)
		{
			if (objCBox[i].checked == true)
				objCBox[0].checked = false
		}
	}
}


//-----------------------------------------------
// È¯°æ¼³Á¤ È­¸é popup
//-----------------------------------------------
function PopUp_SarchMainEnv()
{
	strHref = "../dlsearch/ComSearchMainEnv.asp";
	wndWidth = "400";
	wndHeight = "300";
	window.open(strHref, "ComSearchMainEnv", "toolbar=no,width=" + wndWidth + ",height=" + wndHeight + ",scrollbars=yes,location=no,status=no,directory=no,menubar=no");
}


//-----------------------------------------------
// °Ë»ö ¸ÞÀÎ È­¸é reset
//-----------------------------------------------
function Reset_SearchMain()
{
	document.forms[0].reset();
	document.forms[1].reset();
}


//-----------------------------------------------
// °Ë»ö¹æ¹ý¿¡ µû¶ó °Ë»ö ¸ÞÀÎ È­¸é reload
//-----------------------------------------------
function Reload_SelectedBySearchMethod(strSearchMethod)
{
	var strSysDiv ="";
	var strSysKey = "";
	var strViewSysDiv = "";
	
	strSysDiv = document.forms[1].SysDiv.value;
	strSysKey = document.forms[1].SysKey.value;
	strViewSysDiv = document.forms[1].ViewType.value;

	self.location.href = 
			"TOTWSearchMain.asp?SysKey="+strSysKey+"&SysDiv="+strSysDiv+"&SearchMethod="+strSearchMethod+"&ViewSysDiv="+strViewSysDiv;
}

function ReloadMain_SelectedBySearchMethod(strSearchMethod)
{
	with (document.SearchMain)
	{
		SearchMethod.value = strSearchMethod ;
//		if (strSearchMethod=="SUBJ")
//		{
//			GroupTitleSerialNo.value="000000000089"
//		}
		action = "./TOTWSearchMain.asp"	
		submit();
	}
}


//-----------------------------------------------
// ÀÌ·Â°Ë»öÈ­¸é º¸ÀÌ±â 
//-----------------------------------------------
function View_SearchHistory()
{
	var strResultPerPage, strMaxResult;
	//var objSelect;
	sTime = new Date();
	strTime = sTime.getTime();

	strResultPerPage = document.forms[1].ResultPerPage.value;
	strMaxResult = document.forms[1].MaxResult.value;

	self.location.href = "TOTWSearchHistory.asp?ResultPerPage="+strResultPerPage+"&MaxResult="+strMaxResult+"&sTime="+strTime;
}


//-----------------------------------------------
// DDC ÁÖÁ¦ºÐ·ù °Ë»ö Äõ¸® »ý¼º
// 2004.05.25 by Sangho Kim
//-----------------------------------------------
function getSearchQuery_DDC(strSearchQuery)
{
	var strDDCSearchQuery = "";
	var strDDCSysDiv = "";
	var strDDCSysKey = "";
	var strDDCSystem = "";

	with (document.forms[1])
	{
		if (txtSubject.value != "")
		{
			strDDCSysDiv = SysDiv.value;
			strDDCSysKey = SysKey.value;
			
			if (strDDCSysDiv == "TOT")
				strDDCSystem = strDDCSysDiv + "00";
			else
				strDDCSystem = strDDCSysDiv + strDDCSysKey.substr(3,2);

			if (strSearchQuery.length != 0)
				strDDCSearchQuery = "and";
			else
				strDDCSearchQuery = "";
			strDDCSearchQuery = strDDCSearchQuery + "[" + txtSubject.value + "," + strDDCSystem + ",1,12,3]"
		}
	}

	return strDDCSearchQuery;
}

//-----------------------------------------------
// Type01: SubmitÃ³¸® : TOTWSearchList.asp
//-----------------------------------------------
function Submit_SearchListType01()
{
	var strViewQuery = "";
	var strSearchQuery ="";

	//-- °Ë»ö¾î°¡ nullÀÎÁö¸¦ È®ÀÎ 
	if (checkNullSearchTerm_Type01() == false )
		return;

	if (checkSearchString_SearchMain() == false )
	{
		self.location.href = "TOTWSearchList_Help.asp";
		return;
	}

	// µî·Ï¹øÈ£ °Ë»öÀÎÁö °Ë»ç
	var strSearchMethod = document.forms[1].SearchMethod.value;
	var strSysDiv = document.forms[1].SysDiv.value;
	var strSysKey = document.forms[1].SysKey.value;	
	var strSystem;
	var intInxCnt = parseInt(document.forms[1].InxCnt.value,10);
	var objText;
	var objSelect;
	var intFound = 0;
	var strtmpText = "";
	var strFilteredText;
	var arrValue = new Array();

	if (strSysDiv == "TOT" )
		strSystem = strSysDiv+"00"; 
	else
		strSystem = strSysDiv + strSysKey.substr(3,2); 


	if (strSearchMethod == "FRNT")
	{
		for (i = 1; i<=intInxCnt ; i++)  
		{
			objText = document.getElementById("SearchTerm_" + i);
			objSelect = document.getElementById("MethodKey_" + i);

			if (CheckTextNull(objText.value) == true)
			{
				if (objSelect.options[objSelect.selectedIndex].value == "FRNT27") 
				{
					intFound = 1;

					//Æ¯¼ö¹®ÀÚ Ã³¸® :added 20010306
					strFilteredText = filterText_SearchMain(objText.value,strSearchMethod);
					//strFilteredText = objText.value;
			
					arrValue = new Array(strFilteredText);
					for ( j = 0 ; j<arrValue.length ; j++)
					{
						if (arrValue[j] != " ")
						{
							strtmpText = strtmpText + arrValue[j];
						}
					}
					strSearchQuery = "[" + strtmpText + "," + strSystem + ",1,27,3] AND NOT [1,TOT00,3,25,3]";
					strViewQuery = "[Àü¹æÀÏÄ¡/ µî·Ï¹øÈ£:" + strtmpText + "]";
					break;
				}
			}
		}
	}

	if (intFound == 0)
	{
		//-- get strSearchQuery
		strSearchQuery = getSearchQuery_Type01(true,true);
		//alert("[SearchQuery] " + strSearchQuery);
		//-- get strViewQuery
		strViewQuery = getViewQuery_Type01(true,true);
		//alert("[ViewQuery] " + strViewQuery);
	}


	//´Ù±¹¾î or ÇÐ°úÄÚµå Ã¢ÀÌ ¿­·Á ÀÖÀ¸¸é ´Ý±â
	CloseJapan();
	CloseClassCode();

	if (intFound == 0)
	{
		// DDC 10 ±¸ºÐ ÁÖÁ¦ °Ë»öÄõ¸®¿¡ Ãß°¡
		if (document.forms[1].SysDiv.value != 'SAT' && document.forms[1].SysDiv.value != 'ELN')
		{
			strSearchQuery = strSearchQuery + getSearchQuery_DDC(strSearchQuery);
		}
	}
	
	//20011105 È«¼ºÁø Ãß°¡ µÎ¹ø submit¾ÈµÇ°Ô Ã³¸®.	º¯¼ö¼±¾ðÀº ÀÌ ÆÄÀÏÀÇ À­ºÎºÐ¿¡¼­...
	if(!SubmitStatus)
		SubmitStatus = true;
	else
		return;
	//-- parameter setting--
	with (document.forms[1])
	{
		SearchQuery.value = strSearchQuery ;
		ViewQuery.value = strViewQuery ;
		SearchLocation.value = "TOTWSearchMain" ;
		action = "./TOTWSearchList.asp"	
		submit();
	}
}


//-----------------------------------------------
// Type02: SubmitÃ³¸® : TOTWSearchList.asp
//-----------------------------------------------
function Submit_SearchListType02()
{
	var strViewQuery = "";
	var strSearchQuery ="";
		
	//-- °Ë»ö¾î°¡ nullÀÎÁö¸¦ È®ÀÎ 
	if (checkNullSearchTerm_Type02() == false )
		return;

	if (checkSearchString_SearchMain() == false )
	{
		self.location.href = "TOTWSearchList_Help.asp";
		return;
	}

	//-- get strSearchQuery
	strSearchQuery = getSearchQuery_Type02(true,true);
	//alert("[SearchQuery] " + strSearchQuery);

	//-- get strViewQuery
	strViewQuery = getViewQuery_Type02(true,true);
	//alert("[ViewQuery] " + strViewQuery);
	
	//´Ù±¹¾î ÆÄÀÏÀÌ ¿­·Á ÀÖÀ¸¸é ´Ý±â
	CloseJapan();
	CloseClassCode();

	//20011105 È«¼ºÁø Ãß°¡ µÎ¹ø submit¾ÈµÇ°Ô Ã³¸®.	º¯¼ö¼±¾ðÀº ÀÌ ÆÄÀÏÀÇ À­ºÎºÐ¿¡¼­...
	if(!SubmitStatus)
		SubmitStatus = true;
	else
		return;
	
	//-- parameter setting--

	with (document.forms[1])
	{
		SearchQuery.value = strSearchQuery ;
		ViewQuery.value = strViewQuery ;
		SearchLocation.value = "TOTWSearchMain" ;
		action = "./TOTWSearchList.asp"	
		submit();
	}
}


//-----------------------------------------------
// Result: SubmitÃ³¸® : TOTWSearchList.asp
//-----------------------------------------------
function Submit_SearchListResult()
{
	var strViewQuery = "";
	var strSearchQuery ="";
	var strOriViewQuery = "";
	var strOriSearchQuery = "";	
	var strNewViewQuery = "";
	var strNewSearchQuery ="";
	var intViewQuery = 400;
	
	if (checkSearchString_SearchMain() == false )
	{
		self.location.href = "TOTWSearchList_Help.asp";
		return;
	}

	//Àç°Ë»öÀÎ °æ¿ì 
	strOriViewQuery = document.forms[1].OriViewQuery.value;
	strOriSearchQuery = document.forms[1].OriSearchQuery.value;	

	//-- get strSearchQuery
	strNewSearchQuery = getSearchQuery_Type01(true,true);
	strSearchQuery = strOriSearchQuery;
	if (strSearchQuery.length > 0 && strNewSearchQuery.length >0 ) 	
//		strSearchQuery = "("+ strSearchQuery + ")and(" + strNewSearchQuery + ")";
		strSearchQuery = strSearchQuery + "and" + strNewSearchQuery;

//alert("[strOriSearchQuery] " + strOriSearchQuery);
//alert("[strNewSearchQuery] " + strNewSearchQuery);
	//alert("[SearchQuery] " + strSearchQuery);

	//-- get strViewQuery
	strNewViewQuery = getViewQuery_Type01(true,true);
	strViewQuery = strOriViewQuery;
	if( (strViewQuery.length + strNewViewQuery.length) < intViewQuery && strNewViewQuery.length>0)
		strViewQuery = strViewQuery + "and" + getViewQuery_Type01(true,true);
	
	//alert("[ViewQuery] " + strViewQuery);
	//-- parameter setting--
	//with (document.forms[0])
	with (window.opener.document.forms[0])
	{
		//MakeQuery.value = "Y"
		SearchQuery.value = strSearchQuery ;
		ViewQuery.value = strViewQuery ;
		//OriginSearchQuery.value = strSearchQuery;
		//SearchLocation.value = "TOTWSearchResult" ;
                SearchLocation.value = "TOTWSearchMain" ;
		PageNo.value = "";
		RetdMaxResultNo.value = "";
		TotalResultNo.value = "";
		//target = "down";
                target = window.opener.top.frames("down").name;
		action = "./TOTWSearchList.asp"
		submit();
	}
	window.close();
}		



//-----------------------------------------------
// Type36(NEW): SubmitÃ³¸® : TOTWSearchList.asp
//-----------------------------------------------
function Submit_SearchListType36()
{
	//Submit_SearchListType01¿¡¼­ °Ë»ö¹æ¹ý ºÎºÐÀ» Á¦¿Ü 
	
	var strViewQuery = "";
	var strSearchQuery ="";
	var	strForm = "document.forms[1]";
		
	//-- get strSearchQuery
	strSearchQuery = getSearchQuery_Type01(false,true);
	//alert("[SearchQuery] " + strSearchQuery);

	//-- get strViewQuery
	strViewQuery = getViewQuery_Type01(false,true);
	//alert("[ViewQuery] " + strViewQuery);
	
	// -- ½ÅÂøÀÚ·áÀÎ ºÎºÐÀ» Ã·°¡ : ³¯Â¥ºÎºÐ °¡Á®¿À±â 
	var strDate=""
	objSelect = eval(strForm + ".SelectDate");
	strDate = objSelect.options[objSelect.selectedIndex].value;
	
	if (strSearchQuery.length>0)
		strSearchQuery = strSearchQuery + "and"
	strSearchQuery = strSearchQuery + "[" + strDate + ",TOT00,4,3,4]";

	strViewQuery = document.forms[1].ViewSearchMethod.value + "-" + document.forms[1].lngLatest.value +
				      objSelect.options[objSelect.selectedIndex].innerHTML + document.forms[1].lngDay.value ; 
	//strSearchQuery = "(" + strSearchQuery + ") AND NOT [1,CAT01,3,25,3]";

	//alert("strSearchQuery=" + strSearchQuery);	


	//-- parameter setting--
	with (document.forms[1])
	{
		SearchQuery.value = strSearchQuery ;
		ViewQuery.value = strViewQuery ;
		SearchLocation.value = "TOTWSearchMain" ;
		action = "./TOTWSearchList.asp"
		submit();
	}

}		


//-----------------------------------------------
// Type37(NEW): SubmitÃ³¸® : TOTWSearchList.asp
//-----------------------------------------------
function Submit_SearchListType37()
{
	var strViewQuery = "";
	var strSearchQuery ="";
	var	strForm = "document.forms[1]";
		
	//-- get strSearchQuery
	strSearchQuery = getSearchQuery_Type01(true,true);
	//alert("[SearchQuery] " + strSearchQuery);

	//-- get strViewQuery
	strViewQuery = getViewQuery_Type01(false,true);
	//alert("[ViewQuery] " + strViewQuery);
	
	// -- ½ÅÂøÀÚ·áÀÎ ºÎºÐÀ» Ã·°¡ : ³¯Â¥ºÎºÐ °¡Á®¿À±â 
	var strDate=""
	objSelect = eval(strForm + ".SelectDate");
	strDate = objSelect.options[objSelect.selectedIndex].value;
	
	if (strSearchQuery.length>0)
		strSearchQuery = strSearchQuery + "and"
	strSearchQuery = strSearchQuery + "[" + strDate + ",TOT00,4,3,4]";

	//alert("strSearchQuery=" + strSearchQuery);	


	//-- parameter setting--
	with (document.forms[1])
	{
		SearchQuery.value = strSearchQuery ;
		ViewQuery.value = strViewQuery ;
		SearchLocation.value = "TOTWSearchMain" ;
		action = "./TOTWSearchList.asp"
		submit();
	}

}		

//-----------------------------------------------
// Type38(NEW): SubmitÃ³¸® : TOTWSearchList.asp (¼­°­´ë Ãß°¡)
// ±âÁ¸ÀÇ ½ÅÂøÀÚ·á°Ë»ö¿¡¼­ ¹üÀ§°Ë»ö(ÃÖ±Ù±â°£)ÀÌ Ãß°¡µÊ
//-----------------------------------------------
function Submit_SearchListType38()
{
	var strViewQuery = "";
	var strSearchQuery ="";
	var	strForm = "document.forms[1]";
	var strStartDate = "";
	var strEndDate = "";
		
	//-- get strSearchQuery
	strSearchQuery = getSearchQuery_TypeNB(true,true);
  //alert("[SearchQuery] " + strSearchQuery);

	//-- get strViewQuery
	strViewQuery = getViewQuery_Type01(false,true);
	//alert("[ViewQuery] " + strViewQuery);

	// -- ½ÅÂøÀÚ·áÀÎ ºÎºÐÀ» Ã·°¡ : ³¯Â¥ºÎºÐ °¡Á®¿À±â 
	with (document.forms[1])
	{
		if (TermType[0].checked == true)
		{
			var strDate = ""
			objSelect = eval(strForm + ".SelectDate");
			strDate = objSelect.options[objSelect.selectedIndex].value;
	
			if (strSearchQuery.length>0)
				strSearchQuery = strSearchQuery + "and";
			strSearchQuery = strSearchQuery + "[" + strDate + ",TOT00,4,3,4]";
		} 
		else
		{
			strStartDate = StartDate.value;
			strEndDate = EndDate.value;

			if (strStartDate == "" || strStartDate.length != 8)
			{
				alert("±â°£À» ÀÔ·ÂÇÏ½Ê½Ã¿À");
				return;
			}

			if (strEndDate == "" || strEndDate.length != 8)
			{
				alert("±â°£À» ÀÔ·ÂÇÏ½Ê½Ã¿À");
				return;
			}
			if (strSearchQuery.length>0)
				strSearchQuery = strSearchQuery + "and";
			strSearchQuery = strSearchQuery + "([" + strStartDate + ",TOT00,4,3,4]";
			strSearchQuery = strSearchQuery + "and[" + strEndDate + ",TOT00,4,3,2])";
		}
	}

	//alert("strSearchQuery=" + strSearchQuery);	

	// DDC 10 ±¸ºÐ ÁÖÁ¦ °Ë»öÄõ¸®¿¡ Ãß°¡
	strSearchQuery = strSearchQuery + getSearchQuery_DDC(strSearchQuery);

	//-- parameter setting--
	with (document.forms[1])
	{
		SearchQuery.value = strSearchQuery ;
		ViewQuery.value = strViewQuery ;
		SearchLocation.value = "TOTWSearchMain" ;
		action = "./TOTWSearchList.asp"
		submit();
	}

}		


//-----------------------------------------------
// Type01: make parameter : SearchQuery
//-----------------------------------------------
/*
function getSearchQuery_Type01(booGetSearchTerm, booGetLimit)
{
	var strSearchQuery = "";
	var strText, strSelect, strSelect1, strCheckBox, strName;
	var	intSearchMethod;
	var strSystem= "";
	
	var strForm="";
	var strSysDiv = "";
	var strSysKey = "";
	var strSearchMethod = "";
	var intInxCnt, intMSCnt, intSSCnt, intUseCnt, intCCCnt;

	strForm = "document.forms[1]";
	strSysDiv = document.forms[1].SysDiv.value;
	strSysKey = document.forms[1].SysKey.value;	
	strSearchMethod = document.forms[1].SearchMethod.value;
	
	if (strSysDiv == "TOT" )
		strSystem = strSysDiv+"00" 
	else
		strSystem = strSysDiv+strSysKey.substr(3,2) 

	// °Ë»ö¹æ¹ý ºÎºÐ 
	if(booGetSearchTerm == true)
	{
		intInxCnt = parseInt(document.forms[1].InxCnt.value,10);
		
		// get SearchMethod
		if (strSearchMethod == "FRNT" )
			intSearchMethod = 1;
		else if (strSearchMethod == "KWRD" )
			intSearchMethod = 2;	  	
		else
			if (strDefaultSearchMethod == "FRNT" )
				intSearchMethod = 1;
			else if (strDefaultSearchMethod == "KWRD" )
				intSearchMethod = 2;	  	


		//strText = strForm + ".SearchTerm_";
		//strSelect = strForm + ".MethodKey_";
		//strSelect1= strForm + ".SearchCondition_";
		//strSearchQuery = MakeSearchQuery_Index(intInxCnt, intSearchMethod, strText, strSelect, strSelect1, strSystem);
		strSearchQuery = MakeSearchQuery_Index(intInxCnt, intSearchMethod, "SearchTerm_", "MethodKey_", "SearchCondition_", strSystem);
		//alert(intSearchMethod);
		//alert("°Ë»ö¹æ¹ý : strSearchQuery =" + strSearchQuery);	
	}

	
	// Á¦ÇÑ°Ë»ö/¼ö·ÏÁ¤º¸/¹üÀ§°Ë»ö ºÎºÐ 
	if(booGetLimit == true)
	{
		intMSCnt = parseInt(document.forms[1].MSCnt.value,10);
		intSSCnt = parseInt(document.forms[1].SSCnt.value,10);
		intUseCnt = parseInt(document.forms[1].UseCnt.value,10);
		intCCCnt = parseInt(document.forms[1].CCCnt.value,10);	

		// Á¦ÇÑ °Ë»ö ºÎºÐ  : MSÇü
		intSearchMethod = 3;	
		strCheckBox = strForm + ".LimitTitleMS_";
		strName = "LimitTitleMS_";
		strSearchQuery = strSearchQuery + MakeSearchQuery_LimitTitleMS(intMSCnt, intSearchMethod, strCheckBox, strName, strSystem);
		if (strSearchQuery.length>0 && strSearchQuery.substr(0,3) =="and" )
			strSearchQuery = strSearchQuery.substr(3, strSearchQuery.length-3);
		//alert("Á¦ÇÑ°Ë»ötype=[MS] strSearchQuery=" + strSearchQuery);	

		// Á¦ÇÑ °Ë»ö ºÎºÐ  : MSÇü(¼ö·ÏÁ¤º¸)
		//if( strSysDiv == "TOT")	--> modified 20010218
		//{
			intSearchMethod = 6;	
			strCheckBox = strForm + ".LimitTitleCC_";
			strName = "LimitTitleCC_";
			strSearchQuery = strSearchQuery + MakeSearchQuery_LimitTitleCC(intCCCnt, intSearchMethod, strCheckBox, strName, strSystem);
			if (strSearchQuery.length>0 && strSearchQuery.substr(0,3) =="and" )
				strSearchQuery = strSearchQuery.substr(3, strSearchQuery.length-3);
			//alert("¼ö·ÏÁ¤º¸ Á¦ÇÑ°Ë»ötype=[MS] strSearchQuery=" + strSearchQuery);	
		//}
	
		// Á¦ÇÑ °Ë»ö ºÎºÐ  : SSÇü
		intSearchMethod = 3;	
		strSelect = strForm + ".LimitTitleSS_";
		strSearchQuery = strSearchQuery + MakeSearchQuery_LimitTitleSS(intSSCnt, intSearchMethod, strSelect, strSystem);
		if (strSearchQuery.length>0 && strSearchQuery.substr(0,3) =="and" )
			strSearchQuery = strSearchQuery.substr(3, strSearchQuery.length-3);
		//alert("Á¦ÇÑ°Ë»ötype=[SS] strSearchQuery=" + strSearchQuery);	


		// ¹üÀ§ °Ë»öÀÚ 
		intSearchMethod = 3;	
		strText = strForm + ".LimitUse_";
		strSearchQuery = strSearchQuery + MakeSearchQuery_LimitUse(intUseCnt, intSearchMethod, strText,strSystem);
		if (strSearchQuery.length>0 && strSearchQuery.substr(0,3) =="and" )
			strSearchQuery = strSearchQuery.substr(3, strSearchQuery.length-3);
		//alert("¹üÀ§ °Ë»ö strSearchQuery=" + strSearchQuery);	
	}	
	
	//alert("strSearchQuery=" + strSearchQuery);
	
	return strSearchQuery;	
}
*/

//-----------------------------------------------
// Type01: make parameter : SearchQuery
//-----------------------------------------------
function getSearchQuery_Type01(booGetSearchTerm, booGetLimit)
{
	var strSearchQuery = "";
	var strText, strSelect, strSelect1, strCheckBox, strName;
	var	intSearchMethod;
	var strSystem= "";
	
	var strForm="";
	var strSysDiv = "";
	var strSysKey = "";
	var strSearchMethod = "";
	var intInxCnt, intMSCnt, intSSCnt, intUseCnt, intCCCnt;

	strForm = "document.forms[1]";
	strSysDiv = document.forms[1].SysDiv.value;
	strSysKey = document.forms[1].SysKey.value;	
	strSearchMethod = document.forms[1].SearchMethod.value;
	
//	if (strSearchMethod == "NEWBLIST")
//	  strSearchMethod = "KWRD";
	
	if (strSysDiv == "TOT" )
		strSystem = strSysDiv+"00" 
	else
		strSystem = strSysDiv+strSysKey.substr(3,2) 

	// °Ë»ö¹æ¹ý ºÎºÐ 
	if(booGetSearchTerm == true)
	{
		intInxCnt = parseInt(document.forms[1].InxCnt.value,10);
	
		// get SearchMethod
		if (strSearchMethod == "FRNT" )
			intSearchMethod = 1;
		else if (strSearchMethod == "KWRD" )
			intSearchMethod = 2;	  	
		else
			intSearchMethod = parseInt(strDefaultSearchMethod,10);

		//jwheoÃß°¡ : SUBJ°Ë»öÀÏ °æ¿ì Å°¿öµå °Ë»öÀ¸·Î ³õ´Â´Ù(20030520)
		if (strSearchMethod == "SUBJ" )
			intSearchMethod = 2;

		if (strSearchMethod == "FRNT" ){
  		strSearchQuery = MakeSearchQuery_Index_Type02(intInxCnt, intSearchMethod, "SearchTerm_", "MethodKey_", "SearchCondition_", strSystem);}
		else{
		strSearchQuery = MakeSearchQuery_Index(intInxCnt, intSearchMethod, "SearchTerm_", "MethodKey_", "SearchCondition_", strSystem);}

	}

	
	// Á¦ÇÑ°Ë»ö/¼ö·ÏÁ¤º¸/¹üÀ§°Ë»ö ºÎºÐ 
	if(booGetLimit == true)
	{
		intMSCnt = parseInt(document.forms[1].MSCnt.value,10);
		intSSCnt = parseInt(document.forms[1].SSCnt.value,10);
		intUseCnt = parseInt(document.forms[1].UseCnt.value,10);
		intCCCnt = parseInt(document.forms[1].CCCnt.value,10);	

		// Á¦ÇÑ °Ë»ö ºÎºÐ  : MSÇü
		intSearchMethod = 3;	
		strCheckBox = strForm + ".LimitTitleMS_";
		strName = "LimitTitleMS_";
		strSearchQuery = strSearchQuery + MakeSearchQuery_LimitTitleMS(intMSCnt, intSearchMethod, strCheckBox, strName, strSystem);
		if (strSearchQuery.length>0 && strSearchQuery.substr(0,3) =="and" )
			strSearchQuery = strSearchQuery.substr(3, strSearchQuery.length-3);
		//alert("Á¦ÇÑ°Ë»ötype=[MS] strSearchQuery=" + strSearchQuery);	

		// Á¦ÇÑ °Ë»ö ºÎºÐ  : MSÇü(¼ö·ÏÁ¤º¸)
		//if( strSysDiv == "TOT")	--> modified 20010218
		//{
			intSearchMethod = 6;	
			strCheckBox = strForm + ".LimitTitleCC_";
			strName = "LimitTitleCC_";
			strSearchQuery = strSearchQuery + MakeSearchQuery_LimitTitleCC(intCCCnt, intSearchMethod, strCheckBox, strName, strSystem);
			if (strSearchQuery.length>0 && strSearchQuery.substr(0,3) =="and" )
				strSearchQuery = strSearchQuery.substr(3, strSearchQuery.length-3);
			//alert("¼ö·ÏÁ¤º¸ Á¦ÇÑ°Ë»ötype=[MS] strSearchQuery=" + strSearchQuery);	
		//}
	
		// Á¦ÇÑ °Ë»ö ºÎºÐ  : SSÇü
		intSearchMethod = 3;	
		strSelect = strForm + ".LimitTitleSS_";
		strSearchQuery = strSearchQuery + MakeSearchQuery_LimitTitleSS(intSSCnt, intSearchMethod, strSelect, strSystem);
		if (strSearchQuery.length>0 && strSearchQuery.substr(0,3) =="and" )
			strSearchQuery = strSearchQuery.substr(3, strSearchQuery.length-3);
		//alert("Á¦ÇÑ°Ë»ötype=[SS] strSearchQuery=" + strSearchQuery);	


		// ¹üÀ§ °Ë»öÀÚ 
		intSearchMethod = 3;	
		strText = strForm + ".LimitUse_";
		strSearchQuery = strSearchQuery + MakeSearchQuery_LimitUse(intUseCnt, intSearchMethod, strText,strSystem);
		if (strSearchQuery.length>0 && strSearchQuery.substr(0,3) =="and" )
			strSearchQuery = strSearchQuery.substr(3, strSearchQuery.length-3);
		//alert("¹üÀ§ °Ë»ö strSearchQuery=" + strSearchQuery);	
	}	
	
	if ((strSysDiv == "TOT" || strSysDiv == "CAT") && strSearchQuery.length > 12){
		if(strSysDiv == "TOT")
			strSearchQuery = "(" + strSearchQuery + ") AND NOT [1," + strSysDiv + "00,3,25,3]";
			//strSearchQuery = "(" + strSearchQuery + ") ";
		else
			strSearchQuery = "(" + strSearchQuery + ") AND NOT [1," + strSysDiv + "01,3,25,3]";
			//strSearchQuery = "(" + strSearchQuery + ") ";
	}
	else if(strSearchQuery.length > 0)
		//strSearchQuery = "(" + strSearchQuery + ")";
		strSearchQuery = "(" + strSearchQuery + ") AND NOT [1," + strSystem + ",3,25,3]"; 
	
	//alert("strSearchQuery=" + strSearchQuery);
	if(strSearchMethod == "KWRD")
		strSearchQuery = strSearchQuery.replace("¡Ú","");  //apostrophe Ã³¸® in FilterText()
	else
		strSearchQuery = strSearchQuery.replace("¡Ú","");		
		//alert(strSearchQuery);
		
	return strSearchQuery;	
}


//-----------------------------------------------
// Type01: make parameter : SearchQuery
//-----------------------------------------------
function getSearchQuery_Type02(booGetSearchTerm, booGetLimit)
{
	var strSearchQuery = "";
	var strText, strSelect, strSelect1, strCheckBox, strName;
	var	intSearchMethod;
	var strSystem= "";
	
	var strForm="";
	var strSysDiv = "";
	var strSysKey = "";
	var strSearchMethod = "";
	var intInxCnt, intMSCnt, intSSCnt, intUseCnt, intCCCnt;

	strForm = "document.forms[1]";
	strSysDiv = document.forms[1].SysDiv.value;
	strSysKey = document.forms[1].SysKey.value;	
	strSearchMethod = document.forms[1].SearchMethod.value;
	
	if (strSysDiv == "TOT" )
		strSystem = strSysDiv+"00" 
	else
		strSystem = strSysDiv+strSysKey.substr(3,2) 

	// °Ë»ö¹æ¹ý ºÎºÐ 
	if(booGetSearchTerm == true)
	{
		intInxCnt = parseInt(document.forms[1].InxCnt.value,10);
		
		// get SearchMethod
		if (strSearchMethod == "FRNT" )
			intSearchMethod = 1;
		else if (strSearchMethod == "KWRD" )
			intSearchMethod = 2;	  	
		else
			//intSearchMethod = parseInt(strDefaultSearchMethod,10);
			if (strDefaultSearchMethod == "FRNT" )
				intSearchMethod = 1;
			else if (strDefaultSearchMethod == "KWRD" )
				intSearchMethod = 2;	  	


		strSearchQuery = MakeSearchQuery_Index_Type02(intInxCnt, intSearchMethod, "SearchTerm_", "MethodKey_", "SearchCondition_", strSystem);
		//alert("°Ë»ö¹æ¹ý : strSearchQuery =" + strSearchQuery);	
	}

	
	// Á¦ÇÑ°Ë»ö/¼ö·ÏÁ¤º¸/¹üÀ§°Ë»ö ºÎºÐ 
	if(booGetLimit == true)
	{
		intMSCnt = parseInt(document.forms[1].MSCnt.value,10);
		intSSCnt = parseInt(document.forms[1].SSCnt.value,10);
		intUseCnt = parseInt(document.forms[1].UseCnt.value,10);
		intCCCnt = parseInt(document.forms[1].CCCnt.value,10);	

		// Á¦ÇÑ °Ë»ö ºÎºÐ  : MSÇü
		intSearchMethod = 3;	
		strCheckBox = strForm + ".LimitTitleMS_";
		strName = "LimitTitleMS_";
		strSearchQuery = strSearchQuery + MakeSearchQuery_LimitTitleMS(intMSCnt, intSearchMethod, strCheckBox, strName, strSystem);
		if (strSearchQuery.length>0 && strSearchQuery.substr(0,3) =="and" )
			strSearchQuery = strSearchQuery.substr(3, strSearchQuery.length-3);
		//alert("Á¦ÇÑ°Ë»ötype=[MS] strSearchQuery=" + strSearchQuery);	

		// Á¦ÇÑ °Ë»ö ºÎºÐ  : MSÇü(¼ö·ÏÁ¤º¸)
		//if( strSysDiv == "TOT")	--> modified 20010218
		//{
			intSearchMethod = 6;	
			strCheckBox = strForm + ".LimitTitleCC_";
			strName = "LimitTitleCC_";
			strSearchQuery = strSearchQuery + MakeSearchQuery_LimitTitleCC(intCCCnt, intSearchMethod, strCheckBox, strName, strSystem);
			if (strSearchQuery.length>0 && strSearchQuery.substr(0,3) =="and" )
				strSearchQuery = strSearchQuery.substr(3, strSearchQuery.length-3);
			//alert("¼ö·ÏÁ¤º¸ Á¦ÇÑ°Ë»ötype=[MS] strSearchQuery=" + strSearchQuery);	
		//}
	
		// Á¦ÇÑ °Ë»ö ºÎºÐ  : SSÇü
		intSearchMethod = 3;	
		strSelect = strForm + ".LimitTitleSS_";
		strSearchQuery = strSearchQuery + MakeSearchQuery_LimitTitleSS(intSSCnt, intSearchMethod, strSelect, strSystem);
		if (strSearchQuery.length>0 && strSearchQuery.substr(0,3) =="and" )
			strSearchQuery = strSearchQuery.substr(3, strSearchQuery.length-3);
		//alert("Á¦ÇÑ°Ë»ötype=[SS] strSearchQuery=" + strSearchQuery);	


		// ¹üÀ§ °Ë»öÀÚ 
		intSearchMethod = 3;	
		strText = strForm + ".LimitUse_";
		strSearchQuery = strSearchQuery + MakeSearchQuery_LimitUse(intUseCnt, intSearchMethod, strText,strSystem);
		if (strSearchQuery.length>0 && strSearchQuery.substr(0,3) =="and" )
			strSearchQuery = strSearchQuery.substr(3, strSearchQuery.length-3);
		//alert("¹üÀ§ °Ë»ö strSearchQuery=" + strSearchQuery);	
	}	

	if (strSysDiv == "TOT" || strSysDiv == "CAT")
		if(strSysDiv == "TOT")
			strSearchQuery = "(" + strSearchQuery + ") AND NOT [1," + strSysDiv + "00,3,25,3]";
		else
			strSearchQuery = "(" + strSearchQuery + ") AND NOT [1," + strSysDiv + "01,3,25,3]";
		
	if(strSearchMethod == "KWRD")
		strSearchQuery = strSearchQuery.replace("¡Ú","''");  //apostrophe Ã³¸® in FilterText()
	else
		strSearchQuery = strSearchQuery.replace("¡Ú","");
		
	
	//alert("strSearchQuery=" + strSearchQuery);
	
	return strSearchQuery;	
}


//-----------------------------------------------
// Type01: °Ë»ö¾î°¡ nullÀÎÁö¸¦ È®ÀÎ 
//-----------------------------------------------
function checkNullSearchTerm_Type01()
{
	var strSearchTerm= "";	
	var intInxCnt = parseInt(document.forms[1].InxCnt.value,10);	
	// get SearchTerm 
	strSearchTerm = MakeSearchTerm(intInxCnt, "SearchTerm_", "MethodKey_", "SearchCondition_");
	//strSearchTerm = MakeSearchTerm(1, "SearchTerm_", "MethodKey_", "SearchCondition_");

	if (strSearchTerm == "" || strSearchTerm == null)
	{
		alert(lngAlertCheckSearchTerm);
		return false;
	}
	
	return true;
}

//-----------------------------------------------
// Type02: °Ë»ö¾î°¡ nullÀÎÁö¸¦ È®ÀÎ 
//-----------------------------------------------
function checkNullSearchTerm_Type02()
{
	var strSearchTerm= "";	
	var intInxCnt = parseInt(document.forms[1].InxCnt.value,10);	
	
	// get SearchTerm 
	strSearchTerm = MakeSearchTerm_Type02(intInxCnt, "SearchTerm_", "MethodKey_", "SearchCondition_");
	if (strSearchTerm == "" || strSearchTerm == null)
	{
		alert(lngAlertCheckSearchTerm);
		return false;
	}
	
	return true;
}


//-----------------------------------------------
// InPutBox Å¬¸®¾î
//-----------------------------------------------

	function WordClear(oSearchTxt){
		if (oSearchTxt.value == "ÀúÀÚ¸íÀº '¼º','ÀÌ¸§'¼øÀ¸·Î ÀÔ·ÂÇÏ¼¼¿ä."){
			oSearchTxt.value = "";
		}
	}


//-----------------------------------------------
// Type01: make parameter : ViewQuery 
//-----------------------------------------------
function getViewQuery_Type01(booGetSearchTerm, booGetLimit)
{
	var strViewQuery = "";
	var strSearchTerm= "";	
	var strViewSearchMethod = "";
	var strSearchMethod = "";
	var strSysDiv = "";
	var strSysKey = "";	
	var intInxCnt, intMSCnt, intSSCnt, intUseCnt, intCCCnt;
	
	var objTD, objCBox, objText, objText1, objText2;	
	var strText=""; 
	var chkIndex, intIndex;	
	var strFormat="";
	var strForm="";
	var intViewQuery = 50;
	
	strForm = "document.forms[1]";
	strSysDiv = document.forms[1].SysDiv.value;	
	strSysKey = document.forms[1].SysDiv.value;		
	strSearchMethod = document.forms[1].SearchMethod.value;
	
	// °Ë»ö¹æ¹ý ºÎºÐ 
	if(booGetSearchTerm == true)
	{
		intInxCnt = parseInt(document.forms[1].InxCnt.value,10);	
	
		// get SearchTerm 
		strSearchTerm = MakeSearchTerm(intInxCnt, "SearchTerm_", "MethodKey_", "SearchCondition_");

		// get ViewSearchMethod
		if (strSearchMethod == "FRNT" )
			strViewSearchMethod = document.forms[1].ViewSearchMethod.value;
		else if (strSearchMethod == "KWRD" )
			strViewSearchMethod = document.forms[1].ViewSearchMethod.value;
		else
			strViewSearchMethod = strDefaultViewSearchMethod;
	
		if (strViewSearchMethod.length > 0)
			strViewSearchMethod = strViewSearchMethod + "/ ";
			
		// searchTerm 
		if( strViewQuery.length < intViewQuery && strSearchTerm.length > 0  )
			strViewQuery = "[" + strViewSearchMethod + strSearchTerm+"]";
	}

	// Á¦ÇÑ°Ë»ö/¼ö·ÏÁ¤º¸/¹üÀ§°Ë»ö ºÎºÐ 
	if(booGetLimit == true)
	{
		intMSCnt = parseInt(document.forms[1].MSCnt.value,10);
		intSSCnt = parseInt(document.forms[1].SSCnt.value,10);
		intUseCnt = parseInt(document.forms[1].UseCnt.value,10);
		intCCCnt = parseInt(document.forms[1].CCCnt.value,10);

		// LimitTitle : MS 
		for ( intIndex=1; intIndex <= intMSCnt ; intIndex++)
		{
			objTD = document.getElementById("TDMS_" + intIndex);
			//objCBox = document.getElementById("LimitTitleMS_"+intIndex); 
			objCBox = eval(strForm + ".LimitTitleMS_"+intIndex);

			if ( CheckSelectNothing(1,"LimitTitleMS_"+intIndex) == false ) 
				if (objCBox[0].checked == false )
					for (chkIndex=1; chkIndex<objCBox.length; chkIndex++)				
					{	
						objText = eval(strForm + ".LimitTitleMS_"+ intIndex + "_" + chkIndex);

						if (objCBox[chkIndex].checked == true )		
						{
							if (strFormat.length > 0 )
								strFormat = strFormat + ",";
							else 
								strFormat = objTD.outerText + cntGubun;
								
							strFormat = strFormat + objText.value;
						}	
					}
		}
		if(strFormat != "" && strFormat != null && strFormat != " ")
			if( strViewQuery.length < intViewQuery  )
				strViewQuery = strViewQuery + " [" + strFormat + "]";

		// MS  : ¼ö·Ï Á¤º¸ :ÅëÇÕÀÎ°æ¿ì¸¸ 
		//if( strSysDiv == "TOT") --> modified 20010218
		//{
			strFormat = "";
			for ( intIndex=1; intIndex <= intCCCnt ; intIndex++)
			{
				objTD = document.getElementById("TDCC_" + intIndex);
				//objCBox = document.getElementById("LimitTitleCC_"+intIndex); 
				objCBox = eval(strForm + ".LimitTitleCC_"+intIndex);

				// modified  20010627
				if ( CheckSelectNothing(1,"LimitTitleCC_"+intIndex) == false ) 
				{
					if(objCBox.length > 1)
					{
						if (objCBox[0].checked == false )
						{
							for (chkIndex=1; chkIndex<objCBox.length; chkIndex++)				
							{	
								objText = eval(strForm + ".LimitTitleCC_"+ intIndex + "_" + chkIndex);

								if (objCBox[chkIndex].checked == true )		
								{
									if (strFormat.length > 0 )
										strFormat = strFormat + ",";
									else 
										strFormat = objTD.outerText + cntGubun;
										
									strFormat = strFormat + objText.value;
								}	
							}
						}
					}
					else
					{
						objText = eval(strForm + ".LimitTitleCC_"+ intIndex + "_0");
						if (objCBox.checked == true )		
						{
							if (strFormat.length > 0 )
								strFormat = strFormat + ",";
							else 
								strFormat = objTD.outerText + cntGubun;
								
							strFormat = strFormat + objText.value;
						}	
					}
				}
			}
			if(strFormat != "" && strFormat != null && strFormat != " ")
				if( strViewQuery.length < intViewQuery  )
					strViewQuery = strViewQuery + " [" + strFormat + "]";
		//}

		// LimitTitle : SS
		for ( intIndex=1; intIndex <= intSSCnt ; intIndex++)
		{
			objSelect = document.getElementById("LimitTitleSS_"+intIndex);	
			objTD = document.getElementById("TDSS_" + intIndex);
			
			if ( objSelect.options[objSelect.selectedIndex].value != cntTotal )
			{
				if( strViewQuery.length < intViewQuery  )
					strViewQuery = strViewQuery + " [" + objTD.outerText + cntGubun +
								objSelect.options[objSelect.selectedIndex].text +"]";
			}		
		}

		// LimitUse : ¹üÀ§ °Ë»öÀÚ 
		for ( intIndex=1; intIndex <= intUseCnt ; intIndex++)
		{ 
			if( strViewQuery.length < intViewQuery  )
			{
				objTD = document.getElementById("TDUse_" + intIndex);
				objText1 = eval(strForm + ".LimitUse_"+intIndex+"_1"); 
				objText2 = eval(strForm + ".LimitUse_"+intIndex+"_2"); 

				if((objText1.value != "") && (objText1.value != null) )
				{
					strViewQuery = strViewQuery + " [" + objTD.outerText + cntGubun + 
									objText1.value + "~";
						
					if((objText2.value != "") && (objText2.value != null) )
						strViewQuery = strViewQuery + objText2.value;

					strViewQuery = strViewQuery + " ]";
				}
				else
				{
					if((objText2.value != "") && (objText2.value != null) )
						strViewQuery = strViewQuery + " [" + objTD.outerText + cntGubun + 
										"~"+objText2.value +"]";
				}
			}
		}	
	}
	//alert("ViewQuery="+strViewQuery);

	return strViewQuery;	
}


//-----------------------------------------------
// Type01: make parameter : ViewQuery 
//-----------------------------------------------
function getViewQuery_Type02(booGetSearchTerm, booGetLimit)
{
	var strViewQuery = "";
	var strSearchTerm= "";	
	var strViewSearchMethod = "";
	var strSearchMethod = "";
	var strSysDiv = "";
	var strSysKey = "";	
	var intInxCnt, intMSCnt, intSSCnt, intUseCnt, intCCCnt;
	
	var objTD, objCBox, objText, objText1, objText2;	
	var strText=""; 
	var chkIndex, intIndex;	
	var strFormat="";
	var strForm="";
	var intViewQuery = 50;
	
	strForm = "document.forms[1]";
	strSysDiv = document.forms[1].SysDiv.value;	
	strSysKey = document.forms[1].SysDiv.value;		
	strSearchMethod = document.forms[1].SearchMethod.value;
	
	// °Ë»ö¹æ¹ý ºÎºÐ 
	if(booGetSearchTerm == true)
	{
		intInxCnt = parseInt(document.forms[1].InxCnt.value,10);	
	
		// get SearchTerm 
		strSearchTerm = MakeSearchTerm_Type02(intInxCnt, "SearchTerm_", "MethodKey_", "SearchCondition_");

		// get ViewSearchMethod
		if (strSearchMethod == "FRNT" )
			strViewSearchMethod = document.forms[1].ViewSearchMethod.value;
		else if (strSearchMethod == "KWRD" )
			strViewSearchMethod = document.forms[1].ViewSearchMethod.value;
		else
			strViewSearchMethod = strDefaultViewSearchMethod;
	
		if (strViewSearchMethod.length > 0)
			strViewSearchMethod = strViewSearchMethod + "/ ";
			
		// searchTerm 
		if( strViewQuery.length < intViewQuery && strSearchTerm.length > 0  )
			strViewQuery = "[" + strViewSearchMethod + strSearchTerm+"]";
	}

	// Á¦ÇÑ°Ë»ö/¼ö·ÏÁ¤º¸/¹üÀ§°Ë»ö ºÎºÐ 
	if(booGetLimit == true)
	{
		intMSCnt = parseInt(document.forms[1].MSCnt.value,10);
		intSSCnt = parseInt(document.forms[1].SSCnt.value,10);
		intUseCnt = parseInt(document.forms[1].UseCnt.value,10);
		intCCCnt = parseInt(document.forms[1].CCCnt.value,10);

		// LimitTitle : MS 
		for ( intIndex=1; intIndex <= intMSCnt ; intIndex++)
		{
			objTD = document.getElementById("TDMS_" + intIndex);
			//objCBox = document.getElementById("LimitTitleMS_"+intIndex); 
			objCBox = eval(strForm + ".LimitTitleMS_"+intIndex);

			if ( CheckSelectNothing(1,"LimitTitleMS_"+intIndex) == false ) 
				if (objCBox[0].checked == false )
					for (chkIndex=1; chkIndex<objCBox.length; chkIndex++)				
					{	
						objText = eval(strForm + ".LimitTitleMS_"+ intIndex + "_" + chkIndex);

						if (objCBox[chkIndex].checked == true )		
						{
							if (strFormat.length > 0 )
								strFormat = strFormat + ",";
							else 
								strFormat = objTD.outerText + cntGubun;
								
							strFormat = strFormat + objText.value;
						}	
					}
		}
		if(strFormat != "" && strFormat != null && strFormat != " ")
			if( strViewQuery.length < intViewQuery  )
				strViewQuery = strViewQuery + " [" + strFormat + "]";

		// MS  : ¼ö·Ï Á¤º¸ :ÅëÇÕÀÎ°æ¿ì¸¸ 
		//if( strSysDiv == "TOT") --> modified 20010218
		//{
			strFormat = "";
			for ( intIndex=1; intIndex <= intCCCnt ; intIndex++)
			{
				objTD = document.getElementById("TDCC_" + intIndex);
				//objCBox = document.getElementById("LimitTitleCC_"+intIndex); 
				objCBox = eval(strForm + ".LimitTitleCC_"+intIndex);

				if ( CheckSelectNothing(1,"LimitTitleCC_"+intIndex) == false ) 
					if (objCBox[0].checked == false )
						for (chkIndex=1; chkIndex<objCBox.length; chkIndex++)				
						{	
							objText = eval(strForm + ".LimitTitleCC_"+ intIndex + "_" + chkIndex);

							if (objCBox[chkIndex].checked == true )		
							{
								if (strFormat.length > 0 )
									strFormat = strFormat + ",";
								else 
									strFormat = objTD.outerText + cntGubun;
									
								strFormat = strFormat + objText.value;
							}	
						}
			}
			if(strFormat != "" && strFormat != null && strFormat != " ")
				if( strViewQuery.length < intViewQuery  )
					strViewQuery = strViewQuery + " [" + strFormat + "]";
		//}

		// LimitTitle : SS
		for ( intIndex=1; intIndex <= intSSCnt ; intIndex++)
		{
			objSelect = document.getElementById("LimitTitleSS_"+intIndex);	
			objTD = document.getElementById("TDSS_" + intIndex);
			
			if ( objSelect.options[objSelect.selectedIndex].value != cntTotal )
			{
				if( strViewQuery.length < intViewQuery  )
					strViewQuery = strViewQuery + " [" + objTD.outerText + cntGubun +
								objSelect.options[objSelect.selectedIndex].text +"]";
			}		
		}

		// LimitUse : ¹üÀ§ °Ë»öÀÚ 
		for ( intIndex=1; intIndex <= intUseCnt ; intIndex++)
		{ 
			if( strViewQuery.length < intViewQuery  )
			{
				objTD = document.getElementById("TDUse_" + intIndex);
				objText1 = eval(strForm + ".LimitUse_"+intIndex+"_1"); 
				objText2 = eval(strForm + ".LimitUse_"+intIndex+"_2"); 

				if((objText1.value != "") && (objText1.value != null) )
				{
					strViewQuery = strViewQuery + " [" + objTD.outerText + cntGubun + 
									objText1.value + "~";
						
					if((objText2.value != "") && (objText2.value != null) )
						strViewQuery = strViewQuery + objText2.value;

					strViewQuery = strViewQuery + " ]";
				}
				else
				{
					if((objText2.value != "") && (objText2.value != null) )
						strViewQuery = strViewQuery + " [" + objTD.outerText + cntGubun + 
										"~"+objText2.value +"]";
				}
			}
		}	
	}
	//alert("ViewQuery="+strViewQuery);

	return strViewQuery;	
}


/*
//===============================================
//-----------------------------------------------
// °Ë»ö¹æ¹ý ºÎºÐ 
//-----------------------------------------------
function MakeSearchQuery_Index(intDisp, intSearchMethod, strText, strSelect, strSelect1, strSysDiv)
{
	var objText, objSelect, objSelect1;
	var i, j, tt;
	var arrValue =new Array();
	var strSearchQuery="";
	var strtmpText="";
	var strFilteredText="";
	
	var strSearchMethod
	if (intSearchMethod==1) 
		strSearchMethod = "FRNT";
	else
		strSearchMethod = "KWRD";
		 
	for (i = 1; i<=intDisp ; i++)  
	{
		//objText = eval(strText + i);
		//objSelect = eval(strSelect + i);
		objText = document.getElementById(strText + i);
		objSelect = document.getElementById(strSelect + i);
		

		//alert(i+"="+objText.value);
		if (CheckTextNull(objText.value) == true)
		{
			//Æ¯¼ö¹®ÀÚ Ã³¸® :added 20010306
			strFilteredText = filterText_SearchMain(objText.value,strSearchMethod);
//alert("["+strFilteredText+"]");
			//strFilteredText = objText.value;
			
			if (strSearchQuery.length > 0 )
			{
				//objSelect1 = eval(strSelect1 + tt);
				objSelect1 = document.getElementById(strSelect1 + tt);

				strSearchQuery = strSearchQuery + objSelect1.options[objSelect1.selectedIndex].value;
			}

			strInx = objSelect.options[objSelect.selectedIndex].value;
			if (strInx == cntTotal)
				strInx = "0";
			else
				strInx = strInx.substr(4,2);

			//arrValue = strFilteredText.split(" ");
			arrValue = new Array(strFilteredText);
			if (intSearchMethod == 2)	//Å°¿öµå °Ë»ö
			{	
				for ( j = 0 ; j<arrValue.length ; j++)
				{
					if (arrValue[j] != " ")
					{
						if (j != 0 )
							strSearchQuery = strSearchQuery + "and";
					
						strSearchQuery = strSearchQuery +  "[" + trim(arrValue[j]) + "," +
								strSysDiv +"," + intSearchMethod + "," + 
								parseInt(strInx,10) + ",3]";
					}
				}
			}
			else if(intSearchMethod == 1) //Àü¹æÀÏÄ¡ °Ë»ö
			{
				strtmpText = "";
				for ( j = 0 ; j<arrValue.length ; j++)
				{
//alert("["+arrValue[j]+"]");
					if (arrValue[j] != " ")
					{
						strtmpText = strtmpText + trim(arrValue[j]);
					}
				}
				strSearchQuery = strSearchQuery + "[" + strtmpText + "," +
								strSysDiv+"," + intSearchMethod + "," + 
								parseInt(strInx,10) + ",3]";
			}
			
			tt=i;
		}
	}
	
	return strSearchQuery;
}
*/


//===============================================
//-----------------------------------------------
// °Ë»ö¹æ¹ý ºÎºÐ 
//-----------------------------------------------
function MakeSearchQuery_Index(intDisp, intSearchMethod, strText, strSelect, strSelect1, strSysDiv)
{
	var objText, objSelect, objSelect1;
	var i, j, tt;
	var arrValue =new Array();
	var strSearchQuery="";
	var strtmpText="";
	var strFilteredText="";
	
	var strSearchMethod
	if (intSearchMethod==1) 
		strSearchMethod = "FRNT";
	else
		strSearchMethod = "KWRD";

	for (i = 1; i<=intDisp ; i++)  
	{
		//objText = eval(strText + i);
		//objSelect = eval(strSelect + i);
		objText = document.getElementById(strText + i);
		objSelect = document.getElementById(strSelect + i);
		

		//alert(i+"="+objText.value);
		if (CheckTextNull(objText.value) == true)
		{
			//Æ¯¼ö¹®ÀÚ Ã³¸® :added 20010306
			strFilteredText = filterText_SearchMain(objText.value,strSearchMethod);
			//strFilteredText = objText.value;
			
			if (strSearchQuery.length > 0 )
			{
				//objSelect1 = eval(strSelect1 + tt);
				objSelect1 = document.getElementById(strSelect1 + tt);

				strSearchQuery = strSearchQuery + objSelect1.options[objSelect1.selectedIndex].value;
			}

			strInx = objSelect.options[objSelect.selectedIndex].value;
			if (strInx == cntTotal)
				strInx = "0";
			else
				strInx = strInx.substr(4,2);

			//arrValue = strFilteredText.split(" ");
			//alert("strFilterdText = " + strFilteredText);

//È«¼ºÁø ¼öÁ¤ 20010802 and/or/not ÀÔ·ÂÀÌ °¡´ÉÇÏµµ·Ï
			if (intSearchMethod == 2)	//Å°¿öµå °Ë»ö
			{	
				strSearchQuery += getLastQuery(strFilteredText,"," +
								strSysDiv +"," + intSearchMethod + "," + 
								parseInt(strInx,10) + ",3");
			}
			else if(intSearchMethod == 1) //Àü¹æÀÏÄ¡ °Ë»ö
			{
//			  alert(strSearchQuery);
			  
				arrValue = new Array(strFilteredText);
				for ( j = 0 ; j<arrValue.length ; j++)
				{
					if (arrValue[j] != " ")
					{
						strtmpText = strtmpText + arrValue[j];
					}
				}

				var objExactMatch = document.getElementById("chkExactMatch_" + i);
				if (objExactMatch.checked)
				{
				  strtmpText = strtmpText + "jttj";
					strSearchQuery = strSearchQuery + "[" + strtmpText + "," +
									strSysDiv+"," + intSearchMethod + "," + 
									parseInt(strInx,10) + ",3]";

				} else {
					strSearchQuery = strSearchQuery + "[" + strtmpText + "," +
									strSysDiv+"," + intSearchMethod + "," + 
									parseInt(strInx,10) + ",1]";
				}
				strtmpText = "";
			}
//			alert(strSearchQuery);

//			arrValue = new Array(strFilteredText);
//			if (intSearchMethod == 2)	//Å°¿öµå °Ë»ö
//			{	
//				for ( j = 0 ; j<arrValue.length ; j++)
//				{
//					if (arrValue[j] != " ")
//					{
//						if (j != 0 )
//							strSearchQuery = strSearchQuery + "and";
//					
//						strSearchQuery = strSearchQuery +  "[" + arrValue[j] + "," +
//								strSysDiv +"," + intSearchMethod + "," + 
//								parseInt(strInx,10) + ",3]";
//					}
//				}
//			}
//			else if(intSearchMethod == 1) //Àü¹æÀÏÄ¡ °Ë»ö
//			{
//				for ( j = 0 ; j<arrValue.length ; j++)
//				{
//					if (arrValue[j] != " ")
//					{
//						strtmpText = strtmpText + arrValue[j];
//					}
//				}
//				strSearchQuery = strSearchQuery + "[" + strtmpText + "," +
//								strSysDiv+"," + intSearchMethod + "," + 
//								parseInt(strInx,10) + ",3]";
//			}
//			
//			
			
			tt=i;
		}
	}
	//alert(strSearchQuery);	
	return strSearchQuery;
}

function trim (strSource) {
	re = /^\s+|\s+$/g;

	return strSource.replace(re, '');
}

function ltrim (strSource) {
	re = /^\s+/g;

	return strSource.replace(re, '');
}

function rtrim (strSource) {
	re = /\s+$/g;

	return strSource.replace(re, '');
}

//===============================================
//-----------------------------------------------
// °Ë»ö¹æ¹ý ºÎºÐ 
//-----------------------------------------------
function MakeSearchQuery_Index_Type02(intDisp, intSearchMethod, strText, strTD, strSelect, strSysDiv)
{
	var objText, objTD, objSelect;
	var i, j, tt;
	var arrValue =new Array();
	var strSearchQuery="";
	var strtmpText="";
	var strFilteredText="";
	
	var strSearchMethod
	if (intSearchMethod==1) 
		strSearchMethod = "FRNT";
	else
		strSearchMethod = "KWRD";
	for (i = 1; i<=intDisp ; i++)  
	{
		objText = document.getElementById(strText + i);
		objTD = document.getElementById(strTD + i);

		if (CheckTextNull(objText.value) == true)
		{
			//Æ¯¼ö¹®ÀÚ Ã³¸® :added 20010306
			strFilteredText = filterText_SearchMain(objText.value,strSearchMethod );
			//strFilteredText = objText.value;
			
			if (strSearchQuery.length > 0 )
			{
				objSelect = document.getElementById(strSelect + tt);

				strSearchQuery = strSearchQuery + objSelect.options[objSelect.selectedIndex].value;
			}

			strInx = objTD.getAttribute('Value');
			if (strInx == cntTotal)
				strInx = "0";
			else
				strInx = strInx.substr(4,2);

			//arrValue = strFilteredText.split(" ");
			arrValue = new Array(strFilteredText);
			if (intSearchMethod == 2)	//Å°¿öµå °Ë»ö
			{	
				for ( j = 0 ; j<arrValue.length ; j++)
				{
					if (arrValue[j] != " ")
					{
						if (j != 0 )
							strSearchQuery = strSearchQuery + "and";
					
						strSearchQuery = strSearchQuery +  "[" + arrValue[j] + "," +
								strSysDiv +"," + intSearchMethod + "," + 
								parseInt(strInx,10) + ",3]";
					}
				}
			}
			else if(intSearchMethod == 1) //Àü¹æÀÏÄ¡ °Ë»ö
			{
				for ( j = 0 ; j<arrValue.length ; j++)
				{
					if (arrValue[j] != " ")
					{
						strtmpText = strtmpText + arrValue[j];
					}
				}
				strSearchQuery = strSearchQuery + "[" + strtmpText + "," +
								strSysDiv+"," + intSearchMethod + "," + 
								parseInt(strInx,10) + ",3]";
			}
			
			tt=i;
		}
	}
	
	return strSearchQuery;
}


//-----------------------------------------------
// Á¦ÇÑ °Ë»ö ºÎºÐ  : MSÇü
//-----------------------------------------------
function MakeSearchQuery_LimitTitleMS(intMSCnt, intSearchMethod, strCheckBox, strName, strSysDiv)
{
	var objCheckBox, objTD;
	var j, intIndex, chkIndex;
	var arrValue =new Array();
	var strSearchQuery="";
	var strCompare="";
	var bolFlag  = false;
	
	// type °¡ MSÀÎ °æ¿ì
	for ( intIndex=1; intIndex <= intMSCnt ; intIndex++)
	{ 
		objCheckBox = eval(strCheckBox+intIndex);		
		strCheckBoxName = strName+intIndex;

		objTD = document.getElementById("TDMS_" + intIndex);

		// ÀÚ·áÀ¯Çü¿¡¼­ ¼±ÅÃµÈ °ÍÀÌ ¾ø°Å³ª, ÀüÃ¼°¡ ¼±ÅÃµÇ¾î ÀÖÀ¸¸é...skip(query ¹® ±¸¼º¿¡´Â Æ÷ÇÔµÇÁö ¾Ê´Â´Ù)
		if ((CheckSelectNothing(1,strCheckBoxName) == false) && (objCheckBox[0].checked == false ))
		//if ((CheckSelectNothing(1,strCheckBoxName) == false))		
		{
			//group °ª ÆÄ½ÌÀ» ÇØ¼­ strCompare¿¡ ´ã´Â´Ù 
			for (chkIndex=1; chkIndex < objCheckBox.length; chkIndex++)				
			{	
				if (objCheckBox[chkIndex].checked == true )		
				{
					// ÀÚ·áÀ¯Çü¿¡¼­ ¼±ÅÃµÈ °ÍÀÌ ¾ø°Å³ª, ÀüÃ¼°¡ ¼±ÅÃµÇ¾î ÀÖÀ¸¸é...skip(query ¹® ±¸¼º¿¡´Â Æ÷ÇÔµÇÁö ¾Ê´Â´Ù)
					if (objCheckBox[chkIndex].value == cntTotal)
					{
						strSearchQuery = "";
						//alert("tt");
						break;  		
					}

					arrValue = objCheckBox[chkIndex].value.split("");
					for( j = 0 ; j < arrValue.length ; j++)
					{
						if( (strCompare == "") || (strCompare == null) )
							strCompare = arrValue[j];
						else 
						{
							for (k=0 ; k < strCompare.split(",") ; k++)
								if(strCompare.split(",")[k] == arrValue[j]) 
									bolFlag = true;
							
							if (bolFlag == false )
								//if (strCompare.search(arrValue[j]) == -1 )
								strCompare = strCompare + "," + arrValue[j];
						}
					}
				}
			}

			if(	strCompare.length > 0 ) 
			{
				arrValue = strCompare.split(",");
				for (j=0 ; j < arrValue.length ; j++)
				{
					if (j == 0)
						if (strSearchQuery.length ==0 )
							strSearchQuery = "and(";
						else
							strSearchQuery = strSearchQuery + ")and(";
					else
						strSearchQuery = strSearchQuery + "or";
						
					strSearchQuery = strSearchQuery + "[" + arrValue[j] + "," + strSysDiv + "," +
								 intSearchMethod + "," + parseInt(objTD.getAttribute("SerialNo"),10) + ",3]";
				}
			}

		}

	}
	
	if (strSearchQuery.length >0 )
		strSearchQuery = strSearchQuery + ")";
	
	return strSearchQuery;
}


//-----------------------------------------------
// Á¦ÇÑ °Ë»ö ºÎºÐ  : MSÇü(¼ö·ÏÁ¤º¸)
//-----------------------------------------------
function MakeSearchQuery_LimitTitleCC(intCCCnt, intSearchMethod, strCheckBox, strName, strSysDiv)
{
	var objCheckBox;
	var j, intIndex, chkIndex;
	var arrValue =new Array();
	var strSearchQuery="";
	var strCompare="";
	var bolFlag  = false;
	
	// type °¡ MSÀÎ °æ¿ì
	for ( intIndex=1; intIndex <= intCCCnt ; intIndex++)
	{ 
		objCheckBox = eval(strCheckBox+intIndex);		
		strCheckBoxName = strName+intIndex;

		// ÀÚ·áÀ¯Çü¿¡¼­ ¼±ÅÃµÈ °ÍÀÌ ¾ø°Å³ª, ÀüÃ¼°¡ ¼±ÅÃµÇ¾î ÀÖÀ¸¸é...skip(query ¹® ±¸¼º¿¡´Â Æ÷ÇÔµÇÁö ¾Ê´Â´Ù)
		if(objCheckBox.length > 1)
		{
			if ((CheckSelectNothing(1,strCheckBoxName) == false) && (objCheckBox[0].checked == false ))
			{
				//group °ª ÆÄ½ÌÀ» ÇØ¼­ strCompare¿¡ ´ã´Â´Ù 
				for (chkIndex=1; chkIndex < objCheckBox.length; chkIndex++)				
				{	
					if (objCheckBox[chkIndex].checked == true )		
					{
						if(strSearchQuery.length == 0)
							strSearchQuery ="and(";
						else
							strSearchQuery = strSearchQuery + "or";
						
						//¿ø¹®ÀÌ¸é °í¼­À» ÇÔ²¾ Æ÷ÇÔ
						if (objCheckBox[chkIndex].value == "1")
							strSearchQuery = strSearchQuery + "[" + "Y" + "," + strSysDiv + "," +
								 intSearchMethod + "," + parseInt(objCheckBox[chkIndex].value,10) + ",3]" +
								 "or"+ "[" + "Y" + "," + strSysDiv + "," + intSearchMethod + "," + 3 + ",3]";
						else
							strSearchQuery = strSearchQuery + "[" + "Y" + "," + strSysDiv + "," +
								 intSearchMethod + "," + parseInt(objCheckBox[chkIndex].value,10) + ",3]";
					}
				}
			}
		}
		else
		{
			if (CheckSelectNothing(1,strCheckBoxName) == false)
			{
//alert("tt");
				if (objCheckBox.checked == true )		
				{
					if(strSearchQuery.length == 0)
						strSearchQuery ="and(";
					else
						strSearchQuery = strSearchQuery + "or";
						
					//¿ø¹®ÀÌ¸é °í¼­À» ÇÔ²¾ Æ÷ÇÔ
					if (objCheckBox.value == "1")
						strSearchQuery = strSearchQuery + "[" + "Y" + "," + strSysDiv + "," +
							 intSearchMethod + "," + parseInt(objCheckBox.value,10) + ",3]" +
							 "or"+ "[" + "Y" + "," + strSysDiv + "," + intSearchMethod + "," + 3 + ",3]";
					else
						strSearchQuery = strSearchQuery + "[" + "Y" + "," + strSysDiv + "," +
							 intSearchMethod + "," + parseInt(objCheckBox.value,10) + ",3]";
				}
			}
		}		

	}
	if (strSearchQuery.length >0 )
		strSearchQuery = strSearchQuery + ")";

	return strSearchQuery;
}


//-----------------------------------------------
// Á¦ÇÑ °Ë»ö ºÎºÐ  : SSÇü
//-----------------------------------------------
function MakeSearchQuery_LimitTitleSS(intSSCnt, intSearchMethod, strSelect, strSysDiv)
{
	var objTD, objSelect;
	var intIndex;
	var strSearchQuery="";

	// type °¡ SSÀÎ °æ¿ì
	for ( intIndex=1; intIndex <= intSSCnt ; intIndex++)
	{ 
		objSelect = eval(strSelect+intIndex);		
		objTD = document.getElementById("TDSS_" + intIndex);

		//ÀüÃ¼°¡ ¼±ÅÃµÇ¾úÀ¸¸é skip 
		if ( objSelect.options[objSelect.selectedIndex].value != cntTotal )
		{
			arrValue = objSelect.options[objSelect.selectedIndex].value.split("");
			for (j=0 ; j < arrValue.length ; j++)
			{
				if (j == 0)
					if (strSearchQuery.length ==0 )
						strSearchQuery = "and(";
					else
						strSearchQuery = strSearchQuery + ")and(";
				else
					strSearchQuery = strSearchQuery + "or";
					
				strSearchQuery = strSearchQuery + "[" + arrValue[j] + "," + strSysDiv + "," +
							 intSearchMethod + "," + parseInt(objTD.getAttribute("SerialNo"),10) + ",3]";
			}
		}
	}
	
	if (strSearchQuery.length > 0 )
		strSearchQuery = strSearchQuery + ")";

	return strSearchQuery;
}


//-----------------------------------------------
// ¹üÀ§ °Ë»öÀÚ 
//-----------------------------------------------
function MakeSearchQuery_LimitUse(intUseCnt, intSearchMethod, strText1, strSysDiv)
{
	var objTD, objText2, objTD;
	var intIndex;
	var strSearchQuery="";

	for ( intIndex=1; intIndex <= intUseCnt ; intIndex++)
	{ 
		objText1 = eval(strText1+intIndex+"_1"); 
		objText2 = eval(strText1+intIndex+"_2"); 
		objTD = document.getElementById("TDUse_" + intIndex);

		if((objText1.value != "") && (objText1.value != null) )
		{
			strSearchQuery = strSearchQuery + "and";
			strSearchQuery = strSearchQuery + "[" + objText1.value + 
						"," + strSysDiv+"," + intSearchMethod + "," + parseInt(objTD.getAttribute("SerialNo").substr(4,2),10) + ",4]";
		}
		if((objText2.value != "") && (objText2.value != null) )
		{
			strSearchQuery = strSearchQuery + "and";
			strSearchQuery = strSearchQuery + "[" + objText2.value + 
						"," + strSysDiv+"," + intSearchMethod + "," +parseInt( objTD.getAttribute("SerialNo").substr(4,2),10) + ",2]";
		}
	}

	return strSearchQuery;
}



//------------------------------------
// make parameter : SearchTerm ; type1, type3, type5
//------------------------------------
function MakeSearchTerm(intInxCnt, strText, strSelect, strSelect1)
{
	var i, tt;
	var objText, objSelect, objSelect1
	var strSearchTerm = "";
	//±Û·Î¹ú º¯¼ö : cntGubun
	
	for (i = 1; i<=intInxCnt ; i++)  
	{
		objText = document.getElementById(strText + i);
		objSelect = document.getElementById(strSelect + i);

		WordClear(objText)
		if (CheckTextNull(objText.value) == true)
		{
			if (strSearchTerm.length > 0 )
			{
				objSelect1 = document.getElementById(strSelect1 + tt);
				strSearchTerm = strSearchTerm + " " + objSelect1.options[objSelect1.selectedIndex].text + " " ;
			}

			strSearchTerm = strSearchTerm +
								 objSelect.options[objSelect.selectedIndex].text +
							  cntGubun + objText.value;
			tt=i;
		}
	}
	
	return strSearchTerm;
	
}


//------------------------------------
// make parameter : SearchTerm ; type2
//------------------------------------
function MakeSearchTerm_Type02(intInxCnt, strText, strTD, strSelect)
{
	var i, tt;
	var objText, objTD, objSelect
	var strSearchTerm = "";
	//±Û·Î¹ú º¯¼ö : cntGubun
	
	for (i = 1; i<=intInxCnt ; i++)  
	{
		objText = document.getElementById(strText + i);
		objTD = document.getElementById(strTD + i);
		WordClear(objText)

		if (CheckTextNull(objText.value) == true)
		{
			if (strSearchTerm.length > 0 )
			{
				objSelect = document.getElementById(strSelect + tt);
				strSearchTerm = strSearchTerm + " " + objSelect.options[objSelect.selectedIndex].text + " " ;
			}

			strSearchTerm = strSearchTerm + objTD.innerText + cntGubun + objText.value;
			tt=i;
		}
	}
	
	return strSearchTerm;
}


//------------------------------------------------
// input°ª¿¡¼­ null°ª È®ÀÎ  
//------------------------------------------------
function CheckTextNull(strElementValue)
{
	if( (strElementValue == "") || (strElementValue == null) )
		return false;
	else 
		return true;
}



var JapanInfoWinFlag;
//------------------------------------------------
// ´Ù±¹¾î ÀÔ·Â 
//------------------------------------------------
function Openjapan() {
        var optstr = "scrollbars=yes,toolbar=no,width=550,height=350,location=no,left=300, top=390, status=no,directory=no,menubar=no,resizable=no";
        JapanInfoWinFlag = window.open("/"+strProjectName+"/com/etc_character.asp","InfoWin",optstr);
}
    
function CloseJapan()
{
	if (JapanInfoWinFlag  && JapanInfoWinFlag.close() == false) JapanInfoWinFlag.close()
	
}

function SetJapanCookie(value)
{
	document.japan.japan.value = value
}

//ÇÐ°ú ÄÚµå 
var ClassCodeWinFlag;
function OpenClassCode(strSysDiv) {
        var optstr = "scrollbars=yes,toolbar=no,width=550,height=350,location=no,left=300, top=390,status=no,directory=no,menubar=no,resizable=no";
        ClassCodeWinFlag = window.open("/"+strProjectName+"/dlsearch/ComSearchMainClass.asp?SysDiv="+strSysDiv,"InfoWin",optstr);
}
 
function CloseClassCode()
{
	if (ClassCodeWinFlag  && ClassCodeWinFlag.close() == false) ClassCodeWinFlag.close()
	
}   
    
//-----------------------------------------------
// DDC 10 ±¸ºÐ ÁÖÁ¦ ¼±ÅÃ
//-----------------------------------------------
function OpenDDC(strSysDiv)
{
	strHref = "/dlsearch/dlsearch/ComWDDC.asp?sysdiv=" + strSysDiv;
	wndWidth = "930";
	wndHeight = "550";
	temp = window.open(strHref, "ComWDDC", "toolbar=no,width=" + wndWidth + ",height=" + wndHeight + ",top=0,left=0,scrollbars=yes,location=no,status=no,directory=no,menubar=no,resizable=yes");
}



//=============================================================================================
//ÇöÀç »ç¿ëÇÏÁö ¾Ê´Â °Íµé : »èÁ¦ÇÏ±â 

//-------------------------------------------
//make parameter : SelectedSortBy
//------------------------------------------
function MakeSelectedSortBy(intDisp, strText, strSelect)
{
	var strSelectedSortBy = "" ;
	var	objText, objSelect;
	var	i;

	for (i = 1; i<=intDisp ; i++)  
	{
		objText = eval(strText + i);
		objSelect = eval(strSelect + i);

		if (strSelectedSortBy == "" || strSelectedSortBy == null)
			if (CheckTextNull(CheckTextNull(objText.value) == true ))
				strSelectedSortBy = objSelect.options[objSelect.selectedIndex].value;
	}
		
	return strSelectedSortBy;
}


//------------------------------------------
//make parameter :Format	ÀÚ·áÀ¯Çü
//------------------------------------------
function MakeFormat( strText, strCheckBoxName)
{
	var strFormat="";
	var objCheckBox;
	var chkIndex;

	objCheckBox = eval(strText);		

	if ( (CheckSelectNothing() == true) || (objCheckBox[0].checked == true ) )
	{
		// ÀÚ·áÀ¯Çü¿¡¼­ ¼±ÅÃµÈ °ÍÀÌ ¾øÀ¸¸é 'ÀüÃ¼'¸¦ default°ªÀ¸·Î,  ÀüÃ¼°¡ ¼±ÅÃµÇ¾î ÀÖÀ¸¸é ÀüÃ¼¸¸...
		strFormat = "ÀüÃ¼";
	}
	else
	{
		for (chkIndex=1; chkIndex<objCheckBox.length; chkIndex++)				
		{	
			objText = eval(strText + "_" + chkIndex);

			if (objCheckBox[chkIndex].checked == true )		
			{
				if (strFormat.length > 0 )
					strFormat = strFormat + ",";
				strFormat = strFormat + objText.value;
			}	
		}
	}
	return strFormat;
}
	
//------------------------------------------
//make parameter :ViewQuery 
//------------------------------------------
function MakeViewQuery( strText, strText1, strCheckBoxName)
{
	var strFormat="";
	var objCheckBox;
	var chkIndex;
	var objText, objText1;

	objCheckBox = eval(strText);		
	objText1 = eval(strText1);

	if ( (CheckSelectNothing() == true) || (objCheckBox[0].checked == true ) )
	{
		// ÀÚ·áÀ¯Çü¿¡¼­ ¼±ÅÃµÈ °ÍÀÌ ¾øÀ¸¸é 'ÀüÃ¼'¸¦ default°ªÀ¸·Î,  ÀüÃ¼°¡ ¼±ÅÃµÇ¾î ÀÖÀ¸¸é ÀüÃ¼¸¸...
		// ¼öÁ¤ : Viewquery ÀÏ °æ¿ì, ÀüÃ¼ÀÌ¸é Ç¥½ÃÇÏÁö ¾Ê´Â´Ù
		//strFormat = objText1.value + "/" + "ÀüÃ¼";
	}
	else
	{
		for (chkIndex=1; chkIndex<objCheckBox.length; chkIndex++)				
		{	
			objText = eval(strText + "_" + chkIndex);

			if (objCheckBox[chkIndex].checked == true )		
			{
				if (strFormat.length > 0 )
					strFormat = strFormat + ",";
				else
					strFormat = strFormat + objText1.value + "/";
					
				strFormat = strFormat + objText.value;
			}	
		}
	}
	return strFormat;
}



function getSearchQuery_TypeNB(booGetSearchTerm, booGetLimit)
{
	var strSearchQuery = "";
	var strText, strSelect, strSelect1, strCheckBox, strName;
	var	intSearchMethod;
	var strSystem= "";
	
	var strForm="";
	var strSysDiv = "";
	var strSysKey = "";
	var strSearchMethod = "";
	var intInxCnt, intMSCnt, intSSCnt, intUseCnt, intCCCnt;

	strForm = "document.forms[1]";
	strSysDiv = document.forms[1].SysDiv.value;
	strSysKey = document.forms[1].SysKey.value;	
	strSearchMethod = document.forms[1].SearchMethod.value;
	
//	alert(strSysDiv);
//	if (strSearchMethod == "NEWBLIST")
//	  strSearchMethod = "KWRD";
	
	if (strSysDiv == "TOT" )
		strSystem = strSysDiv+"00" 
	else
		strSystem = strSysDiv+strSysKey.substr(3,2) 
	
	// °Ë»ö¹æ¹ý ºÎºÐ 
	if(booGetSearchTerm == true)
	{
		intInxCnt = parseInt(document.forms[1].InxCnt.value,10);
		
		// get SearchMethod
		if (strSearchMethod == "FRNT" )
			intSearchMethod = 1;
		else if (strSearchMethod == "KWRD" )
			intSearchMethod = 2;	  	
		else
			intSearchMethod = parseInt(strDefaultSearchMethod,10);

		//jwheoÃß°¡ : SUBJ°Ë»öÀÏ °æ¿ì Å°¿öµå °Ë»öÀ¸·Î ³õ´Â´Ù(20030520)
		if (strSearchMethod == "SUBJ" )
			intSearchMethod = 2;

		//strText = strForm + ".SearchTerm_";
		//strSelect = strForm + ".MethodKey_";
		//strSelect1= strForm + ".SearchCondition_";
		//strSearchQuery = MakeSearchQuery_Index(intInxCnt, intSearchMethod, strText, strSelect, strSelect1, strSystem);
		strSearchQuery = MakeSearchQuery_Index_NB(intInxCnt, intSearchMethod, "SearchTerm_", "MethodKey_", "SearchCondition_", strSystem);
		//alert("°Ë»ö¹æ¹ý : strSearchQuery =" + strSearchQuery);	
	}

	// Á¦ÇÑ°Ë»ö/¼ö·ÏÁ¤º¸/¹üÀ§°Ë»ö ºÎºÐ 
	if(booGetLimit == true)
	{
		intMSCnt = parseInt(document.forms[1].MSCnt.value,10);
		intSSCnt = parseInt(document.forms[1].SSCnt.value,10);
		intUseCnt = parseInt(document.forms[1].UseCnt.value,10);
		intCCCnt = parseInt(document.forms[1].CCCnt.value,10);	

		// Á¦ÇÑ °Ë»ö ºÎºÐ  : MSÇü
		intSearchMethod = 3;	
		strCheckBox = strForm + ".LimitTitleMS_";
		strName = "LimitTitleMS_";
		strSearchQuery = strSearchQuery + MakeSearchQuery_LimitTitleMS(intMSCnt, intSearchMethod, strCheckBox, strName, strSystem);
		if (strSearchQuery.length>0 && strSearchQuery.substr(0,3) =="and" )
			strSearchQuery = strSearchQuery.substr(3, strSearchQuery.length-3);
		//alert("Á¦ÇÑ°Ë»ötype=[MS] strSearchQuery=" + strSearchQuery);	

		// Á¦ÇÑ °Ë»ö ºÎºÐ  : MSÇü(¼ö·ÏÁ¤º¸)
		//if( strSysDiv == "TOT")	--> modified 20010218
		//{
			intSearchMethod = 6;	
			strCheckBox = strForm + ".LimitTitleCC_";
			strName = "LimitTitleCC_";
			strSearchQuery = strSearchQuery + MakeSearchQuery_LimitTitleCC(intCCCnt, intSearchMethod, strCheckBox, strName, strSystem);
			if (strSearchQuery.length>0 && strSearchQuery.substr(0,3) =="and" )
				strSearchQuery = strSearchQuery.substr(3, strSearchQuery.length-3);
			//alert("¼ö·ÏÁ¤º¸ Á¦ÇÑ°Ë»ötype=[MS] strSearchQuery=" + strSearchQuery);	
		//}
	
		// Á¦ÇÑ °Ë»ö ºÎºÐ  : SSÇü
		intSearchMethod = 3;	
		strSelect = strForm + ".LimitTitleSS_";
		strSearchQuery = strSearchQuery + MakeSearchQuery_LimitTitleSS(intSSCnt, intSearchMethod, strSelect, strSystem);
		if (strSearchQuery.length>0 && strSearchQuery.substr(0,3) =="and" )
			strSearchQuery = strSearchQuery.substr(3, strSearchQuery.length-3);
		//alert("Á¦ÇÑ°Ë»ötype=[SS] strSearchQuery=" + strSearchQuery);	


		// ¹üÀ§ °Ë»öÀÚ 
		intSearchMethod = 3;	
		strText = strForm + ".LimitUse_";
		strSearchQuery = strSearchQuery + MakeSearchQuery_LimitUse(intUseCnt, intSearchMethod, strText,strSystem);
		if (strSearchQuery.length>0 && strSearchQuery.substr(0,3) =="and" )
			strSearchQuery = strSearchQuery.substr(3, strSearchQuery.length-3);
		//alert("¹üÀ§ °Ë»ö strSearchQuery=" + strSearchQuery);	
	}	
	
	if ((strSysDiv == "TOT" || strSysDiv == "CAT") && strSearchQuery.length > 12){
		if(strSysDiv == "TOT")
			strSearchQuery = "(" + strSearchQuery + ") AND NOT [1," + strSysDiv + "00,3,25,3]";
			//strSearchQuery = "(" + strSearchQuery + ") ";
		else
			strSearchQuery = "(" + strSearchQuery + ") AND NOT [1," + strSysDiv + "01,3,25,3]";
			//strSearchQuery = "(" + strSearchQuery + ") ";
	}
	else if(strSearchQuery.length > 0)
		//strSearchQuery = "(" + strSearchQuery + ")";
		strSearchQuery = "(" + strSearchQuery + ") AND NOT [1," + strSystem + ",3,25,3]"; 
	
	//alert("strSearchQuery=" + strSearchQuery);
	if(strSearchMethod == "KWRD")
		strSearchQuery = strSearchQuery.replace("¡Ú","''");  //apostrophe Ã³¸® in FilterText()
	else
		strSearchQuery = strSearchQuery.replace("¡Ú","");
		
//		alert(strSearchQuery);
		
	return strSearchQuery;	
}



function MakeSearchQuery_Index_NB(intDisp, intSearchMethod, strText, strSelect, strSelect1, strSysDiv)
{
	var objText, objSelect, objSelect1;
	var i, j, tt;
	var arrValue =new Array();
	var strSearchQuery="";
	var strtmpText="";
	var strFilteredText="";
	
	var strSearchMethod
	if (intSearchMethod==1) 
		strSearchMethod = "FRNT";
	else
		strSearchMethod = "KWRD";

	for (i = 1; i<=intDisp ; i++)  
	{
		//objText = eval(strText + i);
		//objSelect = eval(strSelect + i);
		objText = document.getElementById(strText + i);
		objSelect = document.getElementById(strSelect + i);
		

		//alert(i+"="+objText.value);
		if (CheckTextNull(objText.value) == true)
		{
			//Æ¯¼ö¹®ÀÚ Ã³¸® :added 20010306
			strFilteredText = filterText_SearchMain(objText.value,strSearchMethod);
			//strFilteredText = objText.value;
			
			if (strSearchQuery.length > 0 )
			{
				//objSelect1 = eval(strSelect1 + tt);
				objSelect1 = document.getElementById(strSelect1 + tt);

				strSearchQuery = strSearchQuery + objSelect1.options[objSelect1.selectedIndex].value;
			}

			strInx = objSelect.options[objSelect.selectedIndex].value;
			if (strInx == cntTotal)
				strInx = "0";
			else
				strInx = strInx.substr(4,2);

			//arrValue = strFilteredText.split(" ");
			//alert("strFilterdText = " + strFilteredText);

//È«¼ºÁø ¼öÁ¤ 20010802 and/or/not ÀÔ·ÂÀÌ °¡´ÉÇÏµµ·Ï
			if (intSearchMethod == 2)	//Å°¿öµå °Ë»ö
			{	
				strSearchQuery += getLastQuery(strFilteredText,"," +
								strSysDiv +"," + intSearchMethod + "," + 
								parseInt(strInx,10) + ",3");
			}
			else if(intSearchMethod == 1) //Àü¹æÀÏÄ¡ °Ë»ö
			{
//			  alert(strSearchQuery);
			  
				arrValue = new Array(strFilteredText);
				for ( j = 0 ; j<arrValue.length ; j++)
				{
					if (arrValue[j] != " ")
					{
						strtmpText = strtmpText + arrValue[j];
					}
				}

				var objExactMatch = document.getElementById("chkExactMatch_" + i);
				if (objExactMatch.checked)
				{
				  strtmpText = strtmpText + "jttj";
					strSearchQuery = strSearchQuery + "[" + strtmpText + "," +
									strSysDiv+"," + intSearchMethod + "," + 
									parseInt(strInx,10) + ",3]";

				} else {
					strSearchQuery = strSearchQuery + "[" + strtmpText + "," +
									strSysDiv+"," + intSearchMethod + "," + 
									parseInt(strInx,10) + ",1]";
				}
				strtmpText = "";
			}
//			alert(strSearchQuery);

//			arrValue = new Array(strFilteredText);
//			if (intSearchMethod == 2)	//Å°¿öµå °Ë»ö
//			{	
//				for ( j = 0 ; j<arrValue.length ; j++)
//				{
//					if (arrValue[j] != " ")
//					{
//						if (j != 0 )
//							strSearchQuery = strSearchQuery + "and";
//					
//						strSearchQuery = strSearchQuery +  "[" + arrValue[j] + "," +
//								strSysDiv +"," + intSearchMethod + "," + 
//								parseInt(strInx,10) + ",3]";
//					}
//				}
//			}
//			else if(intSearchMethod == 1) //Àü¹æÀÏÄ¡ °Ë»ö
//			{
//				for ( j = 0 ; j<arrValue.length ; j++)
//				{
//					if (arrValue[j] != " ")
//					{
//						strtmpText = strtmpText + arrValue[j];
//					}
//				}
//				strSearchQuery = strSearchQuery + "[" + strtmpText + "," +
//								strSysDiv+"," + intSearchMethod + "," + 
//								parseInt(strInx,10) + ",3]";
//			}
//			
//			
			
			tt=i;
		}
	}
	//alert(strSearchQuery);	
	return strSearchQuery;
}

