function getCookie(name) {
	var nameOfCookie = name + "=";
	var x = 0
	while ( x <= document.cookie.length ) {
		var y = (x+nameOfCookie.length);
		if ( document.cookie.substring( x, y ) == nameOfCookie ) {
			if ( (endOfCookie=document.cookie.indexOf( ";",y )) == -1 )
				endOfCookie = document.cookie.length;
			return unescape( document.cookie.substring(y, endOfCookie ) );
		}
		x = document.cookie.indexOf( " ", x ) + 1;
		if ( x == 0 )
			break;
	}
	return "";
}
function setCookie(name, value){
	var argv = setCookie.arguments;
	var argc = setCookie.arguments.length;
	var expires = (2 < argc) ? argv[2] : null;
	var path = (3 < argc) ? argv[3] : null;
	var domain = (4 < argc) ? argv[4] : null;
	var secure = (5 < argc) ? argv[5] : false;

	document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : "");
}

var flg2 = 0;
function moreDispMenu()
{
	if (flg2 == 0)
	{
		document.getElementById('apDiv1').className='block';
//		document.getElementById('ClkCateOpn').className='none';
//		document.getElementById('ClkCateCls').className='block';
		flg2 = 1;
	}
	else
	{
		document.getElementById('apDiv1').className='none';
//		document.getElementById('ClkCateOpn').className='block';
//		document.getElementById('ClkCateCls').className='none';
		flg2 = 0;
	}
}
function viewSubLayer(div1,div2,mx,no)
{
	for (i=1;i<=mx ;i++)
	{
		if(mx<3){
			document.getElementById(div1+''+i).className =(i==no) ? 'small1-1' : 'small1-2';
		}else{
			document.getElementById(div1+''+i).className =(i==no) ? 'tab1_on01' : 'tab1_off01';
		}
		document.getElementById(div2+''+i).className =(i==no) ? 'block' : 'none';
	}

}

function viewSubLayer1(div1,div2,mx,no)
{
	for (i=1;i<=mx ;i++)
	{
		document.getElementById(div1+''+i).className =(i==no) ? 'mtab_on01' : 'mtab_off01';
		document.getElementById(div2+''+i).className =(i==no) ? 'block' : 'none';
	}

}



function MultiAct(ACT,ff,nm)
{
	var chk = 0;var rItem = '';
	var item = new Array();
	for (var i=0;i<ff.elements.length;i++)
	{
		if (ff.elements[i].name == nm && ff.elements[i].checked)
		{
			item[chk] = ff.elements[i].value;
			chk++;
		}
	}
	if (chk < 1)
	{
		alert('¼±ÅÃµÈ Ç×¸ñÀÌ ¾ø½À´Ï´Ù.');
		return ;
	}
	// Àå¹Ù±¸´Ï ´ã±â
	if (ACT == 'ADD')
	{
		ff.method = 'POST';
		ff.action = '/mypage/cart_post.php';
		ff.target = '';
		ff.MD.value = 'MADD';
		ff.submit();
		return;
	}
	// º¸°üÇÔ ´ã±â
	else if (ACT == 'WISH')
	{
		ff.method = 'POST';
		ff.action = '/mypage/cart_post.php';
		ff.target = '';
		ff.MD.value = 'MWISH';
		ff.submit();
		return;
	}
	// ±¸¸ÅÇÏ±â
	else if (ACT == 'BNOW')
	{
		rItem = item.join(',');
		var pop = window.open("/pay/buynow.html?rItem="+rItem,"","width=600,height=700,scrollbars=0");
		pop.focus();
		return;
	}
	else if (ACT == 'SCRP')
	{
		rItem = item.join(',');
		var pop = window.open("/part/popscrap.html?rItem="+rItem,"","width=760,height=700,scrollbars=1");
		pop.focus();
		return;
	}
	// ÀÌ¸ÞÀÏ ÆË¾÷
	else if (ACT == 'MAIL')
	{
		window.newAjax = new Ajax;
		newAjax.Method	='POST';
		newAjax.Action	=	'/part/popmail.html';
		newAjax.addParam("cnt", chk);

		newAjax.onComplete		= function(strText){
			if(strText.indexOf("Error:") == 0){alert(strText.replace(/Error:/, ''));}
			else{
				document.getElementById('divMailForm').innerHTML=strText;
				showLayer('divMailForm')
			}
		}
		newAjax.submit();
	}

}
function SingleAct(ACT,ff)
{
	var rItem = ff.elements['rpIDs[]'].value;
	// Àå¹Ù±¸´Ï ´ã±â
	if (ACT == 'ADD')
	{
		ff.method = 'POST';
		ff.action = '/mypage/cart_post.php';
		ff.target = '';
		ff.MD.value = 'MADD';
		ff.submit();
		return;
	}
	// º¸°üÇÔ ´ã±â
	else if (ACT == 'WISH')
	{
		ff.method = 'POST';
		ff.action = '/mypage/cart_post.php';
		ff.target = '';
		ff.MD.value = 'MWISH';
		ff.submit();
		return;
	}
	// ±¸¸ÅÇÏ±â
	else if (ACT == 'BNOW')
	{
		var pop = window.open("/pay/buynow.html?rItem="+rItem,"","width=600,height=700,scrollbars=0");
		pop.focus();
		return;
	}
/*
	// ½ºÅ©·¦ÇÏ±â
	else if (ACT == 'SCRP')
	{
		var pop = window.open("/part/popscrap.html?rItem="+rItem,"","width=760,height=700,scrollbars=1");
		pop.focus();
		return;
	}
*/
	// ÀÌ¸ÞÀÏ ÆË¾÷
	else if (ACT == 'MAIL')
	{
		window.newAjax = new Ajax;
		newAjax.Method	='POST';
		newAjax.Action	=	'/part/popmail.html';
		newAjax.addParam("cnt", 1);
		newAjax.addParam("opt", 1);

		newAjax.onComplete		= function(strText){
			if(strText.indexOf("Error:") == 0){alert(strText.replace(/Error:/, ''));}
			else{
				document.getElementById('divMailForm').innerHTML=strText;
				showLayer('divMailForm')
			}
		}
		newAjax.submit();
	}
}
function sendEmail(ff)
{
//	var argv = sendEmail.arguments;
//	var argc = sendEmail.arguments.length;

	if (ff)
	{
		ff = document.viewFrm;
	}
	else
	{
		ff = document.ffList;
	}
//	ff.mailName.value = document.getElementById('idMailName').value;
	ff.mailAddr.value = document.getElementById('idMailAddr').value;

	ff.method = 'POST';
	ff.action = '/part/popmail.html';
	ff.target = 'hide_ifr';
	ff.MD.value = 'SEND';
	ff.submit();
	hideLayer('divMailForm')
}
function setDivList(opt,len)
{
	if (opt == 'A')
	{
		document.getElementById('divFpfl1').className='ss';
		document.getElementById('divFpfl2').className='st';
	}
	else
	{
		document.getElementById('divFpfl1').className='st';
		document.getElementById('divFpfl2').className='ss';
	}
	for (i=1;i<=len ;i++ )
	{
		document.getElementById('trASUT'+i).className=(opt == 'A') ? 'block' : 'none';
		document.getElementById('trAUTH'+i).className=(opt == 'A') ? 'none' : 'block';
		document.getElementById('trDSCP'+i).className=(opt == 'A') ? 'none' : 'block';;
	}

}
function Frsh(key,val)
{
	HRF = location.href.split('?');
//	alert(HRF[1]);
	qStr = (typeof(HRF[1]) != 'undefined') ? HRF[1] : '';

	if (key =='ORDBY')
	{
		qStr = qStr.replace(/&ORDBY=([a-zA-Z]+)/g,'');
	}
	else if (key =='SRT')
	{
		qStr = qStr.replace(/&SRT=([a-zA-Z]+)/g,'');
	}
	else if (key =='TP')
	{
		qStr = qStr.replace(/&TP=([0-9]+)/g,'');
	}
	else 
	{
		qStr = qStr.replace(/&SCL=([0-9]+)/g,'');
	}

	location.href = '?' + qStr + '&'+key+'='+val;
}
function goLink(div,vv)
{
	var obj = document.getElementById(div+vv);

	location.href = obj.href;
}
function AllCheck(chk,ff,nm)
{
	for (i=0;i<ff.elements.length;i++)
	{
		if (ff.elements[i].name == nm) 
		{
		ff.elements[i].checked = chk;
		}
	}
}
function chgCode2(val)
{
	selBox = document.getElementById('selCode2');
	selBox.options.length = 0; //ÃÊ±âÈ­

	for (i=0;i<arCategory[val].length;i++)
	{
		newItem=new Option();
		selBox.options[i]=newItem;
		selBox.options[i].text = arCategory[val][i][1];
		selBox.options[i].value = arCategory[val][i][0];
	}
	// ³ª¸ÓÁö ¼¿·ºÆ® ¹Ú½º´Â ¸ðµÎ ÃÊ±âÈ­
	document.getElementById('selIn').options.length = 1;
	document.getElementById('selPb').options.length = 1;
	document.getElementById('selYr').options.length = 1;
	document.getElementById('selVl').options.length = 1;
}
function chgCode3(val)
{
	selBox = document.getElementById('selCode2');
	selBox.options.length = 0; //ÃÊ±âÈ­

	for (i=0;i<arCategory[val].length;i++)
	{
		newItem=new Option();
		selBox.options[i]=newItem;
		selBox.options[i].text = arCategory[val][i][1];
		selBox.options[i].value = arCategory[val][i][0];
	}
}
function chgInst(cd1,code2)
{
	if (code2 == '')
	{
		return;
	}
	var optVal = new Array();
	var obj = '';

	CD1 = document.getElementById(cd1);
	code1 = CD1.options[CD1.selectedIndex].value;

	chgInst2(code1,code2)
}

function chgInst2(code1,code2)
{
	var argv = chgInst2.arguments;
	var argc = chgInst2.arguments.length;

	var inst = '';
	if (argc > 2)
	{
		inst = argv[2];
	}

	window.newAjax = new Ajax;
	newAjax.Method	='POST';
	newAjax.addParam("MD", "selInst");
	newAjax.addParam("code1", code1);
	newAjax.addParam("code2", code2);
	newAjax.Action	=	'/inc/post.php';

	newAjax.onComplete		= function(strText){
		if(strText.indexOf("Error:") == 0){alert(strText.replace(/Error:/, ''));}
		else{
//			alert(strText);
			optVal = strText.split('|');

			if (optVal.length ==1)
			{
				AA = optVal[0].split('=');
				location.href = '/part/list.html?in='+AA[0];
				return;
			}
			else
			{
				obj = document.getElementById('selIn');
				obj.options.length = 1;

				for (i=0;i<optVal.length;i++)
				{
					AA = optVal[i].split('=');
					newItem=new Option();
					obj.options[i+1]=newItem;
					obj.options[i+1].text = AA[1];
					obj.options[i+1].value = AA[0];

					if (inst == AA[0])
					{
						obj.options[i+1].selected = true;
					}
				}
				// ³ª¸ÓÁö ¼¿·ºÆ® ¹Ú½º ÃÊ±âÈ­
				document.getElementById('selPb').options.length = 1;
				document.getElementById('selYr').options.length = 1;
				document.getElementById('selVl').options.length = 1;

			}
		}
	}
	newAjax.submit();
}
function chgPubl(INST)
{
	if (INST == '')
	{
		return;
	}

	var optVal = new Array();
	var obj = '';

	window.newAjax = new Ajax;
	newAjax.Method	='POST';
	newAjax.addParam("MD", "selPubl");
	newAjax.addParam("INST", INST);
	newAjax.Action	=	'/inc/post.php';

	newAjax.onComplete		= function(strText){
		if(strText.indexOf("Error:") == 0){alert(strText.replace(/Error:/, ''));}
		else{
//			alert(strText);
			optVal = strText.split('|');

			if (optVal.length ==1)
			{
				AA = optVal[0].split('=');
				location.href = '/part/list.html?in='+INST+'&pb='+AA[0];
				return;
			}
			else
			{
				obj = document.getElementById('selPb');
				obj.options.length = 1;

				for (i=0;i<optVal.length;i++)
				{
					AA = optVal[i].split('=');
					newItem=new Option();
					obj.options[i+1]=newItem;
					obj.options[i+1].text = AA[1];
					obj.options[i+1].value = AA[0];
				}
				// ³ª¸ÓÁö ¼¿·ºÆ® ¹Ú½º ÃÊ±âÈ­
				document.getElementById('selYr').options.length = 1;
				document.getElementById('selVl').options.length = 1;
			}
		}
	}
	newAjax.submit();

}
function chgYear(in1,PUBL)
{
	if (PUBL == '')
	{
		return;
	}
	var optVal = new Array();
	var obj = '';

	IN = document.getElementById(in1);
	INST = IN.options[IN.selectedIndex].value;

	window.newAjax = new Ajax;
	newAjax.Method	='POST';
	newAjax.addParam("MD", "selYear");
	newAjax.addParam("INST", INST);
	newAjax.addParam("PUBL", PUBL);
	newAjax.Action	=	'/inc/post.php';

	newAjax.onComplete		= function(strText){
		if(strText.indexOf("Error:") == 0){alert(strText.replace(/Error:/, ''));}
		else{
//			alert(strText);
			optVal = strText.split('|');
			if (optVal.length ==1)
			{
				AA = optVal[0].split('=');
				location.href = '/part/list.html?in='+INST+'&pb='+PUBL+'&yr='+AA[0];
				return;
			}
			else
			{
				obj = document.getElementById('selYr');
				obj.options.length = 1;

				for (i=0;i<optVal.length;i++)
				{
					newItem=new Option();

					obj.options[i+1]=newItem;
					obj.options[i+1].text = optVal[i];
					obj.options[i+1].value = optVal[i];
				}

				// ³ª¸ÓÁö ¼¿·ºÆ® ¹Ú½º ÃÊ±âÈ­
				document.getElementById('selVl').options.length = 1;
			}
		}
	}
	newAjax.submit();
}
function chgVolm(in1,pb1,YEAR)
{
	if (YEAR == '')
	{
		return;
	}

	IN = document.getElementById(in1);
	INST = IN.options[IN.selectedIndex].value;

	PB = document.getElementById(pb1);
	PUBL = PB.options[PB.selectedIndex].value;

	var optVal = new Array();
	var obj = '';
	window.newAjax = new Ajax;
	newAjax.Method	='POST';
	newAjax.addParam("MD", "selVolume");
	newAjax.addParam("INST", INST);
	newAjax.addParam("PUBL", PUBL);
	newAjax.addParam("YEAR", YEAR);
	newAjax.Action	=	'/inc/post.php';

	newAjax.onComplete		= function(strText){
		if(strText.indexOf("Error:") == 0){alert(strText.replace(/Error:/, ''));}
		else{
			optVal = strText.split('|');

			if (optVal.length ==1)
			{
				AA = optVal[0].split('=');
				location.href = '/part/list.html?in='+INST+'&pb='+PUBL+'&yr='+YEAR+'&vl='+AA[0];
				return;
			}
			else
			{
				obj = document.getElementById('selVl');
				obj.options.length = 1;

				for (i=0;i<optVal.length;i++)
				{
					AA = optVal[i].split('=');

					newItem=new Option();
					obj.options[i+1]=newItem;
					obj.options[i+1].text = AA[1];
					obj.options[i+1].value = AA[0];
				}
			}
		}
	}
	newAjax.submit();
}
function searchInst(keyword,pg)
{
	if (keyword == '')
	{
		return;
	}

	var argv = searchInst.arguments;
	var argc = searchInst.arguments.length;

	window.newAjax = new Ajax;
	newAjax.Method	='POST';
	newAjax.addParam("INSNM", keyword);
	newAjax.addParam("PG", pg);
	if (argc > 2)
	{
	newAjax.addParam("opt", argv[2]);
	}
	newAjax.Action	=	'/inc/popinst.php';

	newAjax.onComplete		= function(strText){
		if(strText.indexOf("Error:") == 0){alert(strText.replace(/Error:/, ''));}
		else{
			document.getElementById('divPopInstResult').innerHTML = strText;
		}
	}
	newAjax.submit();
}
function goPageInst(pg)
{
	keyword = document.getElementById('srchINSNM').value;
	searchInst(keyword,pg);
}
function goPageInst2(pg)
{
	keyword = document.getElementById('srchINSNM').value;
	searchInst(keyword,pg,1);
}
function interInst(inst)
{
	if (confirm('¼±ÅÃÇÏ½Å ¹ßÇà±â°üÀ» °ü½É¹ßÇà±â°üÀ¸·Î µî·ÏÇÏ½Ã°Ú½À´Ï±î?'))
	{
		window.newAjax = new Ajax;
		newAjax.Method	='POST';
		newAjax.addParam("MD", 'ADD');
		newAjax.addParam("INST", inst);
		newAjax.Action	=	'/inc/popinst.php';

		newAjax.onComplete		= function(strText){
			if(strText.indexOf("Error:") == 0){alert(strText.replace(/Error:/, ''));}
			else{
				if (strText == '1')
				{
					alert('°ü½É ¹ßÇà±â°üÀ¸·Î µî·ÏµÇ¾ú½À´Ï´Ù.');
					location.reload();
				}
			}
		}
		newAjax.submit();		
	}
}
function setInst(code1,code2,inst)
{
	
	CD1 = document.getElementById('selCode1');
	
	for (i=0;i<CD1.options.length;i++)
	{
		if (code1 == CD1.options[i].value)
		{
			CD1.options[i].selected = true;
		}
	}
	// ºÐ¾ß 2
	chgCode2(code1);
	
	CD2 = document.getElementById('selCode2');
	
	for (i=0;i<CD2.options.length;i++)
	{
		if (code2 == CD2.options[i].value)
		{
			CD2.options[i].selected = true;
		}
	}	
	// ¹ßÇà±â°ü
	chgInst2(code1,code2,inst)

	// ¹ßÇà±â°ü¿¡ ÇØ´çÇÏ´Â  °£Çà¹° 
	setTimeout("chgPubl('"+inst+"')",1000);
	
}









function goList()
{
	ff = document.ff1;
	code1 = ff.code1.value;
	code2 = ff.code2.options[ff.code2.selectedIndex].value;
	code3 = ff.code3.options[ff.code3.selectedIndex].value;

	location.href = '/ksinfo/CL'+code1+'/CL'+code1 +''+ code2+'/'+code3;
}
//ÇÐÈ¸¸í °Ë»ö,°£Çà¹° °Ë»ö

var arFlip = new Array();
function in_array(arr,key)
{
	for (i=0;i<arr.length;i++)
	{
		if (arr[i] == key) return true;
	}
	return false;
}
function add_array(arr,key)
{
	arr[arr.length] = key;
}
function del_array(arr,key)
{
	var arr2 = new Array();
	for (i=0;i<arr.length;i++)
	{
		if (arr[i] == key) arr[i] = '';
	}
	for (i=0;i<arr.length;i++)
	{
		if (arr[i])
		{
			arr2[arr2.length] = arr[i];
		}
	}
	arr = arr2;
	
}
function goSearch(ff)
{
	if (ff.keywd.value == '')
	{
		alert('°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä');
		ff.keywd.focus();
		return false;
	}

}
function getPubl(code3)
{
//	alert(arFlip)

	if (in_array(arFlip,code3))
	{
			document.getElementById('SUB'+code3).innerHTML='';
			document.getElementById('SUB'+code3).style.display='none';
			document.getElementById('IMG'+code3).src='/images/plus.gif';
			del_array(arFlip,code3);
	}
	else
	{
		window.newAjax = new Ajax;
		newAjax.Method	='POST';
		newAjax.addParam("MD", "getPubl");
		newAjax.addParam("code3", code3);
		newAjax.Action	=	'/inc/post.php';

		newAjax.onComplete		= function(strText){
			if(strText.indexOf("Error:") == 0){alert(strText.replace(/Error:/, ''));}
			else{
				document.getElementById('SUB'+code3).innerHTML=strText;
				document.getElementById('SUB'+code3).style.display='';
				document.getElementById('IMG'+code3).src='/images/minus.gif';
				add_array(arFlip,code3);
			}
		}
		newAjax.submit();
	}
}
function getPuYr(code3,CODE4)
{
	key = code3+'_'+CODE4;
	if (in_array(arFlip,key))
	{
		document.getElementById('SUB'+code3+'_'+CODE4).innerHTML='';
		document.getElementById('SUB'+code3+'_'+CODE4).style.display='none';
		document.getElementById('IMG'+code3+'_'+CODE4).src='/images/plus.gif';

		del_array(arFlip,key);
	}
	else
	{
		window.newAjax = new Ajax;
		newAjax.Method	='POST';
		newAjax.addParam("MD", "getPuYr");
		newAjax.addParam("code3", code3);
		newAjax.addParam("CODE4", CODE4);
		newAjax.Action	=	'/inc/post.php';

		newAjax.onComplete		= function(strText){
			if(strText.indexOf("Error:") == 0){alert(strText.replace(/Error:/, ''));}
			else{
//				alert(strText);
				document.getElementById('SUB'+code3+'_'+CODE4).innerHTML=strText;
				document.getElementById('SUB'+code3+'_'+CODE4).style.display='';
				document.getElementById('IMG'+code3+'_'+CODE4).src='/images/minus.gif';
				add_array(arFlip,key);
			}
		}
		newAjax.submit();
	}
}
/*
function getPuYr2(CODE4)
{
//	alert(arFlip)
	key = CODE4;
	if (in_array(arFlip,key))
	{
		document.getElementById('SUB'+CODE4).innerHTML='';
		document.getElementById('SUB'+CODE4).style.display='none';
		document.getElementById('IMG'+CODE4).src='/images/plus.gif';

		del_array(arFlip,key);
	}
	else
	{
		window.newAjax = new Ajax;
		newAjax.Method	='POST';
		newAjax.addParam("MD", "getPuYr2");
		newAjax.addParam("CODE4", CODE4);
		newAjax.Action	=	'/inc/post.php';

		newAjax.onComplete		= function(strText){
			if(strText.indexOf("Error:") == 0){alert(strText.replace(/Error:/, ''));}
			else{
//				alert(strText);
				document.getElementById('SUB'+CODE4).innerHTML=strText;
				document.getElementById('SUB'+CODE4).style.display='';
				document.getElementById('IMG'+CODE4).src='/images/minus.gif';
				add_array(arFlip,key);
			}
		}
		newAjax.submit();
	}
}
*/
function getYrVol(code3,CODE4,CODE5)
{
//	alert(arFlip)
	key = code3+'_'+CODE4+'_'+CODE5;

	if (in_array(arFlip,key))
	{
			document.getElementById('SUB'+code3+'_'+CODE4+'_'+CODE5).innerHTML='';
			document.getElementById('SUB'+code3+'_'+CODE4+'_'+CODE5).style.display='none';
			document.getElementById('IMG'+code3+'_'+CODE4+'_'+CODE5).src='/images/plus.gif';
			del_array(arFlip,key);
	}
	else
	{
		window.newAjax = new Ajax;
		newAjax.Method	='POST';
		newAjax.addParam("MD", "getYrVol");
		newAjax.addParam("code3", code3);
		newAjax.addParam("CODE4", CODE4);
		newAjax.addParam("CODE5", CODE5);
		newAjax.Action	=	'/inc/post.php';

		newAjax.onComplete		= function(strText){
			if(strText.indexOf("Error:") == 0){alert(strText.replace(/Error:/, ''));}
			else{
//				alert(strText);
				document.getElementById('SUB'+code3+'_'+CODE4+'_'+CODE5).innerHTML=strText;
				document.getElementById('SUB'+code3+'_'+CODE4+'_'+CODE5).style.display='';
				document.getElementById('IMG'+code3+'_'+CODE4+'_'+CODE5).src='/images/minus.gif';
				add_array(arFlip,key);
			}
		}
		newAjax.submit();
	}
}
/*
function getYrVol2(CODE4,CODE5)
{
//	alert(arFlip)
	key = CODE4+'_'+CODE5;
	if (in_array(arFlip,key))
	{
		document.getElementById('SUB'+CODE4+'_'+CODE5).innerHTML='';
		document.getElementById('SUB'+CODE4+'_'+CODE5).style.display='none';
		document.getElementById('IMG'+CODE4+'_'+CODE5).src='/images/plus.gif';

		del_array(arFlip,key);
	}
	else
	{
		window.newAjax = new Ajax;
		newAjax.Method	='POST';
		newAjax.addParam("MD", "getYrVol2");
		newAjax.addParam("CODE4", CODE4);
		newAjax.addParam("CODE5", CODE5);
		newAjax.Action	=	'/inc/post.php';

		newAjax.onComplete		= function(strText){
			if(strText.indexOf("Error:") == 0){alert(strText.replace(/Error:/, ''));}
			else{
//				alert(strText);
				document.getElementById('SUB'+CODE4+'_'+CODE5).innerHTML=strText;
				document.getElementById('SUB'+CODE4+'_'+CODE5).style.display='';
				document.getElementById('IMG'+CODE4+'_'+CODE5).src='/images/minus.gif';
				add_array(arFlip,key);
			}
		}
		newAjax.submit();
	}
}
*/
//ºÐ¾ßº°°Ë»ö
function getInst2(code1,code2)
{
	key = code1+'_'+code2;
	if (in_array(arFlip,key))
	{
		document.getElementById('SUB'+code1+'_'+code2).innerHTML='';
		document.getElementById('SUB'+code1+'_'+code2).style.display='none';
		document.getElementById('IMG'+code1+'_'+code2).src='/images/ksinfo/ico_tree_plus1.gif';

		del_array(arFlip,key);
	}
	else
	{
		window.newAjax = new Ajax;
		newAjax.Method	='POST';
		newAjax.addParam("MD", "getInst2");
		newAjax.addParam("code1", code1);
		newAjax.addParam("code2", code2);
		newAjax.Action	=	'/inc/post.php';

		newAjax.onComplete		= function(strText){
			if(strText.indexOf("Error:") == 0){alert(strText.replace(/Error:/, ''));}
			else{
//				alert(strText);
				document.getElementById('SUB'+code1+'_'+code2).innerHTML=strText;
				document.getElementById('SUB'+code1+'_'+code2).style.display='';
				document.getElementById('IMG'+code1+'_'+code2).src='/images/ksinfo/ico_tree_minus1.gif';
				add_array(arFlip,key);

			}
		}
		newAjax.submit();
	}
}

// »ó¼¼°Ë»ö
function detailSearch(ff)
{
	if (ff.qt1.value == '')
	{
		alert('ÃÖ»óÀ§ °Ë»ö¾î´Â ¹Ýµå½Ã ÇÊ¿äÇÕ´Ï´Ù. ÇÊµå ¼Ó¼ºÀ» ¹Ù²Ù¾î °Ë»öÇØ ÁÖ¼¼¿ä.');
		ff.qt1.focus();
		return false;
	}

}
function topSearch(ff)
{
	if (ff.qt1.value == '')
	{
		alert('°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.');
		ff.KEYWORD1.focus();
		return false;
	}

}
function viewPrvImg(tt)
{
	if (tt == 1)
	{
		document.getElementById('PvTabImg1').className='block';
		document.getElementById('PvTabImg2').className='none';
		document.getElementById('PvImg1').className='block';
		document.getElementById('PvImg2').className='none';
	}
	else
	{
		document.getElementById('PvTabImg1').className='none';
		document.getElementById('PvTabImg2').className='block';
		document.getElementById('PvImg1').className='none';
		document.getElementById('PvImg2').className='block';
	}
}

function popLinkPrev(IMG,ID)
{
	var pop = window.open('/detail/preview.html?fNo='+IMG+'&mbID='+ID,'PopView','menubar=no, toolbar=no, location=0, directory=0, resizable=0, scrollbars=0, status=0, width=600, height=500');
	pop.focus();
}
function goLogin()
{
	alert('·Î±×ÀÎ ÈÄ¿¡ »ç¿ë °¡´ÉÇÕ´Ï´Ù.');
	location.href='/member/register1.html?RETURL='+escape(location.href);
}
function showLayer(div)
{
	document.getElementById(div).className = 'block'
}
function hideLayer(div)
{
	document.getElementById(div).className = 'none'
}

function setTopKeyword(val)
{
	document.getElementById('IdTopKeyword').value = val;
}
function BuyNow(rItem)
{
	var pop = window.open("/pay/buynow.html?rItem="+rItem,"","width=600,height=700,scrollbars=0");
	pop.focus();

}



//var W   =  105; //°¢ ÀÌ¹ÌÁöÀÇ ³ÐÀÌ
var go  =   -5; //¾î´À ¹æÇâÀ¸·Î °¥ °ÍÀÎÁö ÀúÀå.(-1 : ¿ÞÂÊ¹æÇâ 1 pixel ÀÌµ¿, +1 : ¿À¸¥ÂÊ ¹æÇâ 1 pixel ÀÌµ¿)
var stop;       //½ºÅ©·ÑÀ» ÁßÁöÇÏ±â À§ÇÑ setTimeout ÀÇ id °ªÀ» ÀúÀåÇÏ±â À§ÇÑ º¯¼ö.
var stop_time   = 0;    // ÇÏ³ªÀÇ ¾ÆÀÌÅÛÀÌ µ¹¾Æ°¡°í Àá½Ã ¸ØÄ© ÇÏ´Â ½Ã°£ (1ÃÊ = 1000)
var sspeed      =   10;    // ¾ÆÀÌÅÛÀÌ ¿òÁ÷ÀÌ´Â ½Ã°£
var cnt = 0;
var flg = false;
var gobak = 0;
//var set = 6;
function scroll()
{
	len = (typeof(ImaxLen) != 'undefined') ? ImaxLen : 5;

	if (go < 0 && len-cnt == set) flg = false;
	else if (go > 0 && cnt == 0) flg = false;

    if( flg )
    {
        var isStop = false;
        for(var i=0;i<len;i++)
        {
            var temp=document.getElementById("slider_"+i);
            var max = W*len;
            temp.style.left= (max+parseInt(temp.style.left)+go+W)%max-W;
//            temp.style.left= parseInt(temp.style.left)+go;

            if(go < 0 && parseInt(temp.style.left) == 0)
            {
                isStop = true;
				cnt++;
            }
            else if(go > 0 && parseInt(temp.style.left) == 0)
            {
                isStop = true;
				cnt--;
            }

        }
    }

    if(isStop)
    {
		if (cnt%set==0) flg=false;
        stop=setTimeout("scroll()", stop_time);
    }
    else
    {
        stop=setTimeout("scroll()", sspeed);
    }
//	document.getElementById("spnDisplay").innerHTML = temp.style.left;

}

function stopImage()
{
    clearTimeout(stop);
}

function gogoXing(n)
{
	flg=true;
    stopImage();
    go = n;
    scroll();
}




function opnPreview(chk,rpID,type,rpTitle)
{
//	len = (typeof(realImgCnt) != 'undefined') ? realImgCnt : 6;
	if (realImgCnt < 5)
	{
		alert('È®´ëº¸±â ÀÌ¹ÌÁö´Â 5Page ÀÌ»ó ÀÌ¹ÌÁö¸¸ Á¦°øÇÕ´Ï´Ù.');
		return;
	}
	if (canView !=1 && chk > 2)
	{
		if (confirm('·Î±×ÀÎ ÇÏ½Ã¸é '+chk+'ÆäÀÌÁö¸¦ È®ÀÎÇÏ½Ç¼ö ÀÖ½À´Ï´Ù.\n\n[È®ÀÎ]À» Å¬¸¯ÇÏ½Ã¸é ·Î±×ÀÎ ÆäÀÌÁö·Î ÀÌµ¿ÇÕ´Ï´Ù.'))
		{
			location.href='/member/register1.html?RETURL='+escape(location.href);
		}
		return;
	}
//	alert(realImgCnt);
	for(var i=0;i<realImgCnt;i++)
	{
		var temp1=document.getElementById("choice_"+i);
		var temp2=document.getElementById("choiceNo_"+i);
		if ((chk-1) == i)
		{
			temp1.className = 'choice2';
			temp2.className = 'choice_no2';
		}
		else
		{
			temp1.className = 'choice1';
			temp2.className = 'choice_no1';
		
		}
	}
//	file = file.replace(/thumb1/,'dprvimg').replace(/\.gif$/,'.jpg');
	window.open("/detail/prev_img.html?rpID="+rpID+"&SEL="+chk+"&type="+type+"&rpTitle="+rpTitle,"","width=629,height=700,scrollbars=1");
}
function opnPreview2(chk,rpID,type,rpTitle)
{
//	len = (typeof(realImgCnt) != 'undefined') ? realImgCnt : 6;
	if (realImgCnt < 5)
	{
		alert('È®´ëº¸±â ÀÌ¹ÌÁö´Â 5Page ÀÌ»ó ÀÌ¹ÌÁö¸¸ Á¦°øÇÕ´Ï´Ù.');
		return;
	}
	if (canView !=1 && chk > 2)
	{
		if (confirm('·Î±×ÀÎ ÇÏ½Ã¸é '+chk+'ÆäÀÌÁö¸¦ È®ÀÎÇÏ½Ç¼ö ÀÖ½À´Ï´Ù.\n\n[È®ÀÎ]À» Å¬¸¯ÇÏ½Ã¸é ·Î±×ÀÎ ÆäÀÌÁö·Î ÀÌµ¿ÇÕ´Ï´Ù.'))
		{
			location.href='/member/register1.html?RETURL='+escape(location.href);
		}
		return;
	}
//	alert(realImgCnt);
	for(var i=0;i<realImgCnt;i++)
	{
		var temp1=document.getElementById("choice_"+i);
		var temp2=document.getElementById("choiceNo_"+i);
		if ((chk-1) == i)
		{
			temp1.className = 'choice12';
			temp2.className = 'choice_no2';
		}
		else
		{
			temp1.className = 'choice11';
			temp2.className = 'choice_no1';
		
		}
	}
//	file = file.replace(/thumb1/,'dprvimg').replace(/\.gif$/,'.jpg');
	window.open("/detail/prev_img.html?rpID="+rpID+"&SEL="+chk+"&type="+type+"&rpTitle="+rpTitle,"","width=629,height=700,scrollbars=1");
}
function opnPreview3(chk,rpID,type,rpTitle)
{
/*
		if (confirm('·Î±×ÀÎ ÇÏ½Ã¸é '+chk+'ÆäÀÌÁö¸¦ È®ÀÎÇÏ½Ç¼ö ÀÖ½À´Ï´Ù.\n\n[È®ÀÎ]À» Å¬¸¯ÇÏ½Ã¸é ·Î±×ÀÎ ÆäÀÌÁö·Î ÀÌµ¿ÇÕ´Ï´Ù.'))
		{
			location.href='/member/register1.html?RETURL='+escape(location.href);
		}
		return;
*/
	window.open("/detail/prev_img.html?rpID="+rpID+"&SEL="+chk+"&type="+type+"&rpTitle="+rpTitle,"","width=629,height=700,scrollbars=1");

}