// »ó¼¼ °Ë»ö Àç°Ë»ö
//alert("load");
function goCondSearch()
{
    alert("goCondSearch")
	var sKeyword = document.searchCond.vPcondReKeyWord.value;
	var sSearch = document.searchCond.vPcondReSearch.value;

	if (sKeyword == "")
	{
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		document.searchCond.vPcondReKeyWord.focus();
		return ;
	}

	// °Ë»ö¾î ¹ÙÀÌÆ® Ã¼Å©
	var thisStrLen = getMsgSize(sKeyword);
	if(2 > thisStrLen){
		alert("¿µ¹®Àº 2±ÛÀÚ ÀÌ»ó ÀÔ·ÂÇÏ¼¼¿ä!");
		document.searchCond.vPcondReKeyWord.focus();
		return;
	}

	if (document.searchFrm.vPstrCategory.value == "MUC" && document.searchFrm.vPclassicYN.value == "t")
	{	
		document.searchFrm.vPclassicClass.value = document.searchCond.vPclassicClass.value;
	}

	document.searchFrm.vPcondReKeyWord.value = document.searchCond.vPcondReKeyWord.value;	// Àç°Ë»ö¾î
	document.searchFrm.vPcondReSearch.value = document.searchCond.vPcondReSearch.value;		// °Ë»öÇÊµå
	document.searchFrm.vPcondition.value = "2";
	document.searchFrm.vPstartno.value =  "0";
	document.searchFrm.vPnoReSearch.value = "";
	document.searchFrm.submit();
}

// ¸®½ºÆ® °³¼ö º¯°æ
function chgViewCount(val)
{
  var searchFrm = document.searchFrm ;
	var sViewCount = val;
	searchFrm.vPviewCount.value = sViewCount;
	searchFrm.vPplace.value = "list";

	// Àç °Ë»ö ¹æÁö
	if (searchFrm.vPreSearch.value == "2")
	{
		searchFrm.vPnoReSearch.value = "1";
	} else {
		searchFrm.vPnoReSearch.value = "3";
	}

	// ÇöÀç ÆäÀÌÁö°¡ ±¹³»µµ¼­, ¿Ü±¹µµ¼­, À½¹Ý, DVD, GIFT ÀÏ °æ¿ì Ä«Å×°í¸®º° ÀüÃ¼ °³¼ö À¯Áö
	var sCategory = searchFrm.vPstrCategory.value ;
	if (sCategory == "KOR" || sCategory == "ENG" || sCategory == "MUC" || sCategory == "DVD" || sCategory == "GFT"){
	/*	searchFrm.vPkorBookTotcnt.value =  document.searchGroup.KorbookTotCnt.value;
		searchFrm.vPengBookTotcnt.value =  document.searchGroup.EngbookTotCnt.value;
		searchFrm.vPmusicTotcnt.value =  document.searchGroup.MusicTotCnt.value;
		searchFrm.vPdvdTotcnt.value =  document.searchGroup.DvdTotCnt.value;
		searchFrm.vPgiftTotcnt.value =  document.searchGroup.GiftTotCnt.value; */
	}
	
	searchFrm.vPstartno.value =  "0";
	searchFrm.submit();
}

// º¸±â¿É¼Ç º¯°æ
function chgViewOption(val)
{
  var searchFrm = document.searchFrm ;
	var sViewOption = val;
	searchFrm.vPviewOption.value = sViewOption;
	//searchFrm.vPviewSearch.value = sViewOption;
	searchFrm.vPplace.value = "list";

	// Àç °Ë»ö ¹æÁö
	if (searchFrm.vPreSearch.value == "2")
	{
		searchFrm.vPnoReSearch.value = "1";
	} else {
		searchFrm.vPnoReSearch.value = "3";
	}

	// ÇöÀç ÆäÀÌÁö°¡ ±¹³»µµ¼­, ¿Ü±¹µµ¼­, À½¹Ý, DVD, GIFT ÀÏ °æ¿ì Ä«Å×°í¸®º° ÀüÃ¼ °³¼ö À¯Áö
	var sCategory = searchFrm.vPstrCategory.value ;
	if (sCategory == "KOR" || sCategory == "ENG" || sCategory == "MUC" || sCategory == "DVD" || sCategory == "GFT"){
	/*	searchFrm.vPkorBookTotcnt.value =  document.searchGroup.KorbookTotCnt.value;
		searchFrm.vPengBookTotcnt.value =  document.searchGroup.EngbookTotCnt.value;
		searchFrm.vPmusicTotcnt.value =  document.searchGroup.MusicTotCnt.value;
		searchFrm.vPdvdTotcnt.value =  document.searchGroup.DvdTotCnt.value;
		searchFrm.vPgiftTotcnt.value =  document.searchGroup.GiftTotCnt.value; */
	}
	
	searchFrm.vPstartno.value =  "0";
	searchFrm.submit();
}

// Ç°Àý/ÀýÆÇ º¯°æ
function chgViewSearch(val)
{
  var searchFrm = document.searchFrm ;
	var sViewSearch = val;
	searchFrm.vPviewSearch.value = sViewSearch;
	searchFrm.vPplace.value = "list";

	// Àç °Ë»ö ¹æÁö
	if (searchFrm.vPreSearch.value == "2")
	{
		searchFrm.vPnoReSearch.value = "1";
	} else {
		searchFrm.vPnoReSearch.value = "3";
	}

	// ÇöÀç ÆäÀÌÁö°¡ ±¹³»µµ¼­, ¿Ü±¹µµ¼­, À½¹Ý, DVD, GIFT ÀÏ °æ¿ì Ä«Å×°í¸®º° ÀüÃ¼ °³¼ö À¯Áö
	var sCategory = searchFrm.vPstrCategory.value ;
	if (sCategory == "KOR" || sCategory == "ENG" || sCategory == "MUC" || sCategory == "DVD" || sCategory == "GFT"){
	/*	searchFrm.vPkorBookTotcnt.value =  document.searchGroup.KorbookTotCnt.value;
		searchFrm.vPengBookTotcnt.value =  document.searchGroup.EngbookTotCnt.value;
		searchFrm.vPmusicTotcnt.value =  document.searchGroup.MusicTotCnt.value;
		searchFrm.vPdvdTotcnt.value =  document.searchGroup.DvdTotCnt.value;
		searchFrm.vPgiftTotcnt.value =  document.searchGroup.GiftTotCnt.value; */
	}
	
	searchFrm.vPstartno.value =  "0";
	searchFrm.submit();
}


// Á¤·Ä
function goSort(sort, sortid)
{
	var searchFrm = document.searchFrm;
	searchFrm.vPsort.value=sort;
	searchFrm.vPsortid.value=sortid;
	searchFrm.vPplace.value = "list";

	// Àç °Ë»öÀÏ¶§¸¸
	if (searchFrm.vPreSearch.value == "2")
	{
		searchFrm.vPnoReSearch.value = "1";
	} else {
		searchFrm.vPnoReSearch.value = "3";
	}

	// ÇöÀç ÆäÀÌÁö°¡ ±¹³»µµ¼­, ¿Ü±¹µµ¼­, À½¹Ý, DVD, GIFT ÀÏ °æ¿ì Ä«Å×°í¸®º° ÀüÃ¼ °³¼ö À¯Áö
	var sCategory = document.searchFrm.vPstrCategory.value ;
	if (sCategory == "KOR" || sCategory == "ENG" || sCategory == "MUC" || sCategory == "DVD" || sCategory == "GFT"){
		/*searchFrm.vPkorBookTotcnt.value =  document.searchGroup.KorbookTotCnt.value;
		searchFrm.vPengBookTotcnt.value =  document.searchGroup.EngbookTotCnt.value;
		searchFrm.vPmusicTotcnt.value =  document.searchGroup.MusicTotCnt.value;
		searchFrm.vPdvdTotcnt.value =  document.searchGroup.DvdTotCnt.value;
		searchFrm.vPgiftTotcnt.value =  document.searchGroup.GiftTotCnt.value;*/
	}

	searchFrm.vPstartno.value =  "0";
	searchFrm.submit();
}

// ÆäÀÌÂ¡
// 20101013 ÇÑ½Â¿ë - orderclick Ãß°¡
function golist(num, orderClick)
{
	var searchFrm = document.searchFrm;
	searchFrm.vPstartno.value =  num;
	searchFrm.vPplace.value = "list";

	// Àç °Ë»ö ¹æÁö
	if (searchFrm.vPreSearch.value == "2")
	{
			if(searchFrm.vPstrKeyWord.value != searchFrm.vPcommentKeyword.value){
			
			//searchFrm.vPstrKeyWord.value = searchFrm.vPcommentKeyword.value;
			
			if(searchFrm.vAgainSearchPretab.value == ""){
				searchFrm.vPreKeyWord.value = searchFrm.vPstrKeyWord.value;
				searchFrm.vPreSearch.value = "1"
			}
			
		}
		searchFrm.vPnoReSearch.value = "1";
	} else {
		searchFrm.vPnoReSearch.value = "3";
	}

	// ÇöÀç ÆäÀÌÁö°¡ ±¹³»µµ¼­, ¿Ü±¹µµ¼­, À½¹Ý, DVD, GIFT ÀÏ °æ¿ì Ä«Å×°í¸®º° ÀüÃ¼ °³¼ö À¯Áö
	var sCategory = document.searchFrm.vPstrCategory.value ;
	if (sCategory == "KOR" || sCategory == "ENG" || sCategory == "MUC" || sCategory == "DVD" || sCategory == "GFT"){
		}
	
	// ¿À´õÅ¬¸¯ Ã¼Å©
	if(typeof(orderClick) != "undefined") {
		searchFrm.orderClick.value = orderClick;
		searchFrm.vPorderClick.value = orderClick;
	}
	
	searchFrm.submit();
}

// ÀÌ¹ÌÁö ¿¡·¯
function scImgErr(val,imgName)
{
	val.src = "http://image.kyobobook.co.kr/newimages/apps/common/"+imgName;
}

// ÃßÃµÅ°¿öµå °Ë»ö
function goRecommend()
{
	var sKeyword = "";
	var searchRecomm = document.searchRecomm;
	var recommCnt = 0;

	if (searchRecomm.vPsKeyword.length){
		for(i=0;i<searchRecomm.vPsKeyword.length;i++)
		{
			if (searchRecomm.vPsKeyword[i].checked == true) {
				sKeyword = sKeyword +"|"+searchRecomm.vPsKeyword[i].value;
				recommCnt++;
			}
		}

		if (sKeyword.length > 1)
		{
			sKeyword = sKeyword.substring(1,sKeyword.length);
		}
	} else {
		if (searchRecomm.vPsKeyword.checked == true) {
			sKeyword = searchRecomm.vPsKeyword.value;
			recommCnt++;
		}
	}

	if (recommCnt > 0) {
		document.searchFrm.vPrecommKeyword.value =  sKeyword;
		document.searchFrm.submit();
	} else {
		alert("ÃßÃµ Å°¿öµå¸¦ ¼±ÅÃÇÏ¼¼¿ä.");
		searchRecomm.vPsKeyword[0].focus();
		return;
	}

}


// ±×·ìµÈ ¸®½ºÆ® ¿­±â
function viewGroupOpen(sCategory)
{
	document.getElementById("group_"+sCategory).style.display = "block";
	document.getElementById("classclose_"+sCategory).style.display = "none";
	document.getElementById("classopen_"+sCategory).style.display = "block";
}

// ±×·ìµÈ ¸®½ºÆ® ´Ý±â
function viewGroupClose(sCategory)
{
	document.getElementById("group_"+sCategory).style.display = "none";
	document.getElementById("classclose_"+sCategory).style.display = "block";
	document.getElementById("classopen_"+sCategory).style.display = "none";
}

// ´õº¸±â / ´Ý±â ¸ðµÎ Àû¿ë 
function changeTabLast(obj1, obj2){
	 if(document.getElementById(obj1).style.display == "block"){
		 document.getElementById(obj1).style.display = "none";
		 document.getElementById(obj2).style.display = "block";
	 }else{
		 document.getElementById(obj1).style.display = "block";
		 document.getElementById(obj2).style.display = "none";
	 }
}

// ºÐ·ù(Ä«Å×°í¸®)  - 2007.07.27 ±è´ö±Ô Ãß°¡
function goCateLink(val, orderclass, cateName, multiCode)
{
	var sMainurl = "";
	var searchFrm = document.searchFrm;
	var strCategory = searchFrm.vPstrCategory.value ;
	var strSearchType = searchFrm.vPsearchType.value;	
	
	if(typeof(multiCode) == "undefined")	{
		multiCode = "";
	}
	
	searchFrm.vPlinkClassID.value =  val;
	searchFrm.vPsort.value="";
	searchFrm.vPsortid.value="1";
	searchFrm.vPplace.value="cate";
	
	// Àç °Ë»ö ¹æÁö
	if (searchFrm.vPreSearch.value == "2")
	{
		searchFrm.vPnoReSearch.value = "1";
	} else {
		searchFrm.vPnoReSearch.value = "3";
	}
 
	// ¸µÅ©¿À´õ
	var sorderClick = "";
	if (orderclass == "1") {
		sorderClick = "LAA";
		searchFrm.vUCateFirstName.value = cateName;
		searchFrm.vUCateSecondName.value = "";
		searchFrm.cateClassCode1.value = val;
	} else {
		sorderClick = "LAB";
		searchFrm.vUCateSecondName.value = cateName;
		searchFrm.cateClassCode2.value = val;
	}
	if(val == ""){
		searchFrm.vUCateFirstName.value = "";
		searchFrm.vUCateSecondName.value = "";
		searchFrm.cateClassCode1.value = "";
		searchFrm.cateClassCode2.value = "";
	}
	// history.back Ã³¸®¸¦ À§ÇÑ ÃßÃµ ÄÚµå Àç¼³Á¤ - ÇÑ½Â¿ë 
	searchFrm.vUMultilinkClassID.value = multiCode;

	if (strCategory == "KOR") {
		sMainurl = "./SearchKorbookMain.jsp";
	} else if (strCategory == "ENG") {	
		sMainurl = "./SearchEngbookMain.jsp";
	} else if (strCategory == "MUC") {
		sMainurl = "./SearchMusicMain.jsp";
	} else if (strCategory == "DVD") {
		sMainurl = "./SearchDvdMain.jsp";
	} else if (strCategory == "GFT") {
		sMainurl = "./SearchGiftMain.jsp";
	}else if  (strCategory == "TOT") {
		if(strSearchType == "image") {
			sMainurl = "./SearchCommonImageMain.jsp?Kc=SETLCAcatefiltersearch";
		}else {
			sMainurl = "./SearchCommonMain.jsp?Kc=SETLCAcatefiltersearch";
		}
	}

	searchFrm.orderClick.value = sorderClick;
	searchFrm.vPorderClick.value = sorderClick;
	searchFrm.vPstartno.value =  "0";
	searchFrm.action = sMainurl;
	searchFrm.submit();
}


// ºÐ¾ßº° ´õº¸±â  - 2007.07.25 ±è´ö±Ô Ãß°¡
var groupmore = 0;
function goCateMore()
{
	// ´õº¸±â
	if (groupmore == 0) {
		document.getElementById("group_more").style.display = "block";
    document.getElementById("cateopen").style.display = "none";
    document.getElementById("cateclose").style.display = "block";     
		groupmore = 1;
	} else {
		document.getElementById("group_more").style.display = "none";
		document.getElementById("cateopen").style.display = "block";
    document.getElementById("cateclose").style.display = "none";
		groupmore = 0;
	}
}

//ÀÛ°¡ ´õº¸±â
var authormore =0;
function goAuthorMore()
{
	if(authormore ==0){
	 document.getElementById("author_more").style.display = "block";
	 document.getElementById("author_more_line").style.display =  "none";
   document.getElementById("authoropen").style.display ="none";
   document.getElementById("authorclose").style.display ="block";
	 authormore =1;
	} else { 
	 document.getElementById("author_more").style.display = "none";
	 document.getElementById("author_more_line").style.display="block";
   document.getElementById("authoropen").style.display ="block";
   document.getElementById("authorclose").style.display ="none";
	 authormore =0;	
	}
}
// °ü·ÃºÐ¾ß ¹Ù·Î°¡±â - ´õº¸±â
var classmore = 0;

function goClass()
{
	// ´õº¸±â
	if (classmore == 0) {
		document.getElementById("classlist").style.display = "block";
		document.getElementById("classopen").style.display = "none";
		document.getElementById("classclose").style.display = "block";
		classmore = 1;
	// ´Ý±â
	} else {
		document.getElementById("classlist").style.display = "none";
		document.getElementById("classopen").style.display = "block";
		document.getElementById("classclose").style.display = "none";
		classmore = 0;
	}
}

// ¸®ºä - ÀüÃ¼º¸±â
function goBookDetailText(listnum,booklogid) {
	hframe.location.href="/booklog/searchReviewContents.laf?booklogId="+booklogid+"&listnum="+listnum;
	document.getElementById("briefview_"+listnum).style.display = "none";
	document.getElementById("detailview_"+listnum).style.display = "block";
	document.getElementById("briefBtn_"+listnum).style.display = "block";
}

// ¸®ºä - °£·«ÇÏ°Ôº¸±â
function goBookBriefText(listnum) {
	document.getElementById("briefview_"+listnum).style.display = "block";
	document.getElementById("detailview_"+listnum).style.display = "none";
	document.getElementById("briefBtn_"+listnum).style.display = "none";
}

// º¸°üÇÔ¿¡ ´ã±â - ¸¶¿ì½º¿À¹ö
function goStorageBoxOver(listnum)
{
	document.getElementById("storagebox_"+listnum).style.display = "block";
}

// º¸°üÇÔ¿¡ ´ã±â - ¸¶¿ì½º¾Æ¿ô
function goStorageBoxOut(listnum)
{
	document.getElementById("storagebox_"+listnum).style.display = "none";
}

//20090421 ÇÑ½Â¿ë ²Ù·¯¹Ì URL Ãß°¡
// °£·«Á¤º¸ º¸±â
function goSummary(listnum, cate, docid, mallgb)
{
	var sSrc = "";
	if (document.getElementById("txtSummary_"+listnum).value != "1")
	{
		var subBarcode = docid.substring(0, 2);
		
		if(subBarcode == '29'){
			sSrc = domain+"/product/innerDetailViewPackage.laf";
		}else{			
			if (cate == "KOR")
			{
				sSrc = "/product/innerDetailViewKor.laf" ;
			} else if (cate == "ENG")
			{
				sSrc = "/product/innerDetailViewEng.laf" ;
			} else if (cate == "MUC")
			{
				sSrc = "/product/innerDetailViewMuc.laf" ;
			} else if (cate == "DVD")
			{
				sSrc = "/product/innerDetailViewDvd.laf" ;
			}
		}
		sSrc = sSrc + "?ejkGb="+mallgb+"&barcode="+docid;
	} else {
		sSrc = "about:blank"
	}
	
	document.getElementById("ifrmSummary_"+listnum).src = sSrc;

	if (document.getElementById("txtSummary_"+listnum).value == "1") {
		document.getElementById("summary_"+listnum).style.display = "none";
		document.getElementById("txtSummary_"+listnum).value = "0"
	} else {
		document.getElementById("summary_"+listnum).style.display = "block";
		document.getElementById("txtSummary_"+listnum).value = "1"
	}

}

function goSummaryPop(listnum, cate, docid, mallgb, viewtype)
{
	var sSrc = "";

	if (document.getElementById("txtSummary_"+listnum).value != "1")
	{
		var subBarcode = docid.substring(0, 2);
		
		if(subBarcode == '29'){
			sSrc = domain+"/product/innerDetailViewPackage.laf";
		}else{			
			if (cate == "KOR")
			{
				sSrc = "/product/innerDetailViewKor.laf" ;
			} else if (cate == "ENG" || cate == "JAP" || cate == "BNT" || cate == "JNT")
			{
				sSrc = "/product/innerDetailViewEng.laf" ;
			} else if (cate == "MUC")
			{
				sSrc = "/product/innerDetailViewMuc.laf" ;
			} else if (cate == "DVD")
			{
				sSrc = "/product/innerDetailViewDvd.laf" ;
			}
		}
		sSrc = sSrc + "?ejkGb="+mallgb+"&barcode="+docid+"&listnum=" + listnum + "&type=" + viewtype + "&orderClick=LAS";
	} else {
		sSrc = "about:blank"
	}
	
	document.getElementById("ifrmSummary_"+listnum).src = sSrc;

	if (document.getElementById("txtSummary_"+listnum).value == "1") {
		document.getElementById("summaryPop_"+listnum).style.display = "none";
		document.getElementById("txtSummary_"+listnum).value = "0"
	} else {
		document.getElementById("summaryPop_"+listnum).style.display = "block";
		document.getElementById("txtSummary_"+listnum).value = "1"
	}

}

// °£·«Á¤º¸ »çÀÌÁîº¯°æ
function goSummarySize(listnum,wid,hei,tblID)
{
	if (tblID == "1") {		// Å©°Ô º¸±â
		document.getElementById("tblSmall_"+listnum).style.display = "none";
		document.getElementById("tblLarge_"+listnum).style.display = "block";
	} else {				// ÀÛ°Ô º¸±â
		document.getElementById("tblSmall_"+listnum).style.display = "block";
		document.getElementById("tblLarge_"+listnum).style.display = "none";
	}
	document.getElementById("summaryTable_"+listnum).style.width = wid+"px";
	document.getElementById("summaryTable_"+listnum).style.height = hei+"px";
	
}

// ¾ÆÆ¼½ºÆ® °Ë»ö °á°ú ´õº¸±â
function goArtist(artist)
{
	if (artist == "0") {	// ´õº¸±â
		document.getElementById("artistmore").style.display = "block";
		document.getElementById("artistopen").style.display = "none";
		document.getElementById("artistclose").style.display = "block";
	} else {				// ´Ý±â		
		document.getElementById("artistmore").style.display = "none";
		document.getElementById("artistopen").style.display = "block";
		document.getElementById("artistclose").style.display = "none";
	}

}

// ¾ÆÆ¼½ºÆ® °Ë»ö
function goArtistDetail(artist_name)
{
	document.searchFrm.vPmusicMedia.value = "1";
	document.searchFrm.vPmusicArtist.value = artist_name;
	document.searchFrm.vPmusicLabel.value = "";
	document.searchFrm.vPstrKeyWord.value = artist_name;
	document.searchFrm.vPlinkClassID.value =  "";
	document.searchFrm.vPstrCategory.value = "MUC";
	document.searchFrm.vPorderClick.value ="LCB"
	document.searchFrm.orderClick.value ="LCB"
	document.searchFrm.vPplace.value =  "top";
	document.searchFrm.action="./SearchMusicMain.jsp";
	document.searchFrm.submit();
}

// ·¹ÀÌºí °Ë»ö °á°ú ´õº¸±â
function goLabel(val)
{
	if (val == "0") {	// ´õº¸±â
		document.getElementById("labelmore").style.display = "block";
		document.getElementById("labelopen").style.display = "none";
		document.getElementById("labelclose").style.display = "block";
	} else {			// ´Ý±â		
		document.getElementById("labelmore").style.display = "none";
		document.getElementById("labelopen").style.display = "block";
		document.getElementById("labelclose").style.display = "none";
	}

}

// ·¹ÀÌºí °Ë»ö
function goLabelDetail(label_cd,label_name)
{
	document.searchFrm.vPmusicMedia.value = "2";
	document.searchFrm.vPmusicArtist.value = "";
	document.searchFrm.vPmusicLabel.value = label_cd;
	document.searchFrm.vPstrKeyWord.value = label_name;
	document.searchFrm.submit();
}

// ¹Ìµð¾î ±¸ºÐ °Ë»ö
function goMediaCD(val)
{
	
	document.searchFrm.vPmusicMediaCD.value = val;
	document.searchFrm.submit();
}

// Ã¥ º»¹® ÆË¾÷
function openBody(docid, query, freeyn, barcode)
{
	window.open("/product/searchDetailViewKor.laf?docId="+docid+"&query="+query+"&freeYn="+freeyn+"&barcode="+barcode+"&orderClick=QDa","body_kyobo","width=790px,scrollbars=yes");
}

function viewGroup()
{
	var sCategory =  document.searchTop.vPstrCategory.value ; 

	// ±¹³»µµ¼­, ¿Ü±¹µµ¼­, À½¹Ý, DVD ±×·ìÇÎ - °Ë»öÀÏ °æ¿ì
	if (sCategory == "KOR" || sCategory == "ENG" || sCategory == "MUC" || sCategory == "DVD" || sCategory == "GFT") {
		document.getElementById("group_"+sCategory).style.display = "block";
		document.getElementById("classopen_"+sCategory).style.display = "block";
		document.getElementById("classclose_"+sCategory).style.display = "none";
	}
}

// º¸°üÇÑ´ã±â ÇÏ´Ü(Select Box À§·Î º¸¿©ÁÖ±â)
function wishShowHide()
{

	if(document.all.ifrmWish.style.visibility == "hidden")
	{
		document.all.ifrmWish.style.visibility = "visible";
		
	}
	else
	{
		document.all.ifrmWish.style.visibility = "hidden";
		
	}
	
}

// ±³º¸ÃßÃµ Ã¼Å©
function checkRecommend()
{
	if ( document.searchFrm4.chkRecommend.checked == true)	{
		document.searchFrm.vPsrRecommend.value = 1;
	} else {
		document.searchFrm.vPsrRecommend.value = 0;
	}
}

// Å×¸¶ Ã¼Å©
function checkThema()
{	
	if ( document.searchFrm4.chkThema.checked == true)	{
		document.searchFrm.vPsrThema.value = 1;
	} else {
		document.searchFrm.vPsrThema.value = 0;
	}
}


function goBooklogReviewDetailWindow(memid,booklogId) {
	window.open(domain+"/booklog/myBooklog.laf?memid="+memid+"&booklogId="+booklogId);
}
function searchInResult()
{
   //alert(document.searchTop.searchKeyword.value);
   var lastquery =  document.searchFrm.vPstrKeyWord.value;   
   var nowquery  =  document.searchTop.searchKeyword.value;

   lastquery =trim(lastquery);  nowquery =trim(nowquery);
   // alert(nowquery+":"+lastquery);
    if(document.searchTop.vPreSearch.checked)
	{
	   
		//document.searchFrm.vPreKeyWord.value = document.searchTop.searchKeyword.value;
		if(lastquery == nowquery){
          document.searchTop.searchKeyword.value = " ";
          
        }
		document.searchTop.searchKeyword.focus();
	}else	{
	  
		//document.searchTop.searchKeyword.value = document.searchFrm.vPreKeyWord.value;
		if(lastquery == nowquery){
          document.searchTop.searchKeyword.value = " ";
           
        }
		document.searchTop.searchKeyword.focus();
		
	}
   
    //alert(document.searchFrm.vPreKeyWord.value);
}
function trim (str) {
        str = this != window? this : str;
        return str.replace(/^\s+/, '').replace(/\s+$/, '');
    }


//*************************** µðÁöÅÐ ½ºÅ©¸³Æ® ½ÃÀÛ ****************************//

function goBuy ( productCd, cartType, cartBarcode ){

    //if (!isLogin){
        loginPop();
        return;
    //}
/*
    var frm = document.cartForm;

    frm.productCd.value = productCd;
    frm.cartType.value = cartType;
    frm.preUrl.value = location.href;
    frm.orderType.value = "quickBuy";
    frm.cartBarcode.value = "\'" + cartBarcode + "\'";
    frm.action = httpsUrl+"orderMain.laf";
    frm.target = "_self";
    frm.submit();
*/
}

function loginPop(){
    
    winOpen( 'http://www.genomad.co.kr/loginPopup.laf', 430, 366, 'LoginP');
}

function winOpen( url, w, h , name, scroll){

    var x = Math.floor( ( screen.availWidth-(w+12) ) / 2 ); 
    var y = Math.floor( ( screen.availHeight-(h+30) ) / 2 );

    var popTop = window.open( url, name, 'height='+h+', width='+w+', top='+y+', left='+x+', scrollbars='+scroll+', resizable=no');

    if (popTop != null ){
        popTop.focus();
        return;
    }else{
        webblasare = navigator.appVersion;
        if ( (webblasare.indexOf("Windows NT 5.1") != -1 )&& (webblasare.indexOf("SV1")!=-1) ){
            alert("\n ÆË¾÷Ã¢À» ¿ÀÇÂÇÒ ¼ö ¾ø½À´Ï´Ù. \n\n ºê¶ó¿ìÀúÀÇ »ó´Ü ³ë¶õ»ö [¾Ë¸² Ç¥½ÃÁÙ]À» Å¬¸¯ÇÏ½Å ÈÄ \n\n [ÇöÀç »çÀÌÆ®ÀÇ ÆË¾÷À» Ç×»ó Çã¿ë]À¸·Î ¼³Á¤ÇÏ¿© ÁÖ¼¼¿ä. \n");
        } else {
            alert("\n ÆË¾÷Ã¢À» ¿ÀÇÂÇÒ ¼ö ¾ø½À´Ï´Ù. \n");
        }
        return false;
    }
    
}

function goPreview( barcode, docid, freeYn ){
    var urls = "http://www.genomad.co.kr/ebook/eBookPreview.jsp?barcode=" + barcode + "&docid=" + docid + "&freeYn=" + freeYn ;
    window.open(urls,'ibrowser','top=0 , left=0 ,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=1016,height=741');  //»çÀÌÁî ´õ ´Ã·Áº¸±â
}

function goMoreSearchNewwindow(cate){
	if (cate == "KOR") {
			sMainUrl = "SearchKorbookMain.jsp";
		} else if (cate == "ENG") {
			sMainUrl = "SearchEngbookMain.jsp";
		} else if (cate == "MUC") {
			sMainUrl = "SearchMusicMain.jsp";
		} else if (cate == "DVD") {
			sMainUrl = "SearchDvdMain.jsp";
		} else if (cate == "GFT") {
			sMainUrl = "SearchGiftMain.jsp";
		} else if (cate == "DIG") {
			sMainUrl = "SearchDigitoryMain.jsp";
		}else if(cate == "BLG") {
			sMainUrl = "SearchBlogMain.jsp";
		}else if(cate == "REV") {
			sMainUrl = "SearchReviewMain.jsp";
		}else if(cate == "MYL") {
			sMainUrl = "SearchMylistMain.jsp";
		}else if(cate == "KPA") {
			sMainUrl = "SearchKorpaperMain.jsp";
		}else if(cate == "CON") {
			sMainUrl = "SearchContentMain.jsp";
		}else {
			sMainUrl = "SearchCommonMain.jsp";
		}
		
  var query =  document.searchTop.vPstrKeyWord.value;
  var urlm ="/search/"+sMainUrl+"?vPstrKeyWord="+query;
  window.open(urlm);
}

/**
 * »ó¼¼º¸±â
 */
function DetailView(docid, category, detailpage){
	document.bForm.category.value=category ;
	goPage('bForm',detailpage, 'barcode', docid) ;
}

function goPage( form_nm, laf, obj1, value1, obj2, value2, obj3, value3 ){
    var frm = document.all[form_nm];

    frm.action = "http://www.genomad.co.kr/"+laf;

    if ( obj1 != null && obj1 != '' ){
        frm.all[obj1].value = value1
    }



    if ( obj2 != null && obj2 != '' ){
        frm.all[obj2].value = value2
    }

    if ( obj3 != null && obj3 != '' ){
        frm.all[obj3].value = value3
    }
    
    frm.target ="_blank";
    frm.submit();
}

function goBuyProduct(arg){

    if (!isLogin){
        loginPop();
    }else{
        if (arg == "1"){
            location.href = "/customerBuyTicket.laf?imgOn=12";
        }else if (arg == "2"){
            location.href = "/customerBuyGCash.laf?imgOn=11";
        }else if (arg == "3"){
            location.href = "/myQnAList.laf?imgOn=15";
        }
    }
}


// ¹Ì¸®º¸±â ½Å±Ô»ý¼º Ãß°¡
// bKind : ³»¿Ü¼­ ±¸ºÐ, barcode : ¹ÙÄÚµå
function goPreviewYn( barcode, bKind ){
    var urls = "http://view.genomad.co.kr/preview_ikb/theme/uk0011/action/viewer.jsp?barcode=" + barcode + "&bKind=" + bKind  ;
    window.open(urls,'ibrowser','top=0 , left=0 ,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=1016,height=741');  //»çÀÌÁî ´õ ´Ã·Áº¸±â
}

// ¹Ì¸®º¸±â ½Å±Ô»ý¼º Ãß°¡
// bKind : ³»¿Ü¼­ ±¸ºÐ, barcode : ¹ÙÄÚµå
	function goPreviewEbookYn(barcode,loginyn){
    var urls = "http://view.genomad.co.kr/preview_ikb/theme/uk0011/action/viewer.jsp?barcode=" + barcode + "&bKind=KOR&bookType=2&loginyn=" + loginyn;
    window.open(urls,'ibrowser','top=0 , left=0 ,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=1016,height=741');  //»çÀÌÁî ´õ ´Ã·Áº¸±â
}

// ÀÌºÏ º»¹®°Ë»ö ½ºÅ©¸³Æ®
//±Ç±ÙÈ£
function goSearchText(idx)
{
	
	var frm = document.searchFrm5;
	var domain = "http://digital.kyobobook.co.kr";
	var searchUrl = "/kyobobook/searchResultBook.laf";
	
	var barcode;
	var query;
	var docId;
	
	if ( typeof(frm.searchTextBarcode[idx-1]) == "undefined")
	{
		barcode = frm.searchTextBarcode.value;
		query = frm.searchTextQuery.value.trim();
		docId = frm.searchTextDocId.value;
	}
	else
	{
		barcode = frm.searchTextBarcode[idx-1].value;
		query = frm.searchTextQuery[idx-1].value.trim();
		docId = frm.searchTextDocId[idx-1].value;
	}
	
	if ( query.trim() == "") 
	{
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		return;
	}
	
	temp = domain + searchUrl + "?category=001" + "&barcode=" + barcode + "&docId=" + docId + "&query=" + query;
	
	//alert(location.href);
	
	location.href = temp;
	
	//alert(temp);
	//alert(location.href);
}

/**
 * ¿£ÅÍ ÀÔ·Â½Ã Á¶È¸ ½ÇÇà
 */
function SearchTextKey( obj,idx){
		if( event.keyCode == 13 ){
				goSearchText(idx);
		}
}

function goSearchDetailPage(ejkGb, barcode, orderClick, linkClass, notAge, memId, isAdult){
	
	if( memId == null || memId == '' ){
		alert("¼±ÅÃÇÏ½Å ¼­ºñ½º´Â 19¼¼(¿¬19¼¼) ÀÌ»ó ÀÌ¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.");
		openLogin();
		return;
	}
	
	if( notAge != null && notAge == "19" && isAdult == "N" ){
		alert("¼±ÅÃÇÏ½Å ¼­ºñ½º´Â 19¼¼(¿¬19¼¼) ÀÌ»ó ÀÌ¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.");
		return;
	}
	if( (notAge != null && notAge != "19") || ( notAge != null && notAge == "19" && isAdult == "Y")  ){
		var sUrl = "";
		var linkUrl = "";

	    if (ejkGb == 'KOR') {
	        linkUrl = domain+"/product/detailViewKor.laf?mallGb=KOR";
	    } else if (ejkGb == 'ENG' || ejkGb == 'BNT') {
	        linkUrl = domain+"/product/detailViewEng.laf?mallGb=ENG";
	    } else if (ejkGb == 'JAP' || ejkGb == 'JNT') {
	        linkUrl = domain+"/product/detailViewEng.laf?mallGb=JAP";
	    } else if (ejkGb == 'MUC') {
	        linkUrl = domain+"/product/detailViewMuc.laf?mallGb=MUC";
	    } else if (ejkGb == 'DVD') {
	        linkUrl = domain+"/product/detailViewDvd.laf?mallGb=DVD";
	    } else if (ejkGb == 'GFT') {
	        linkUrl = domain+"/gift/goInfo.laf?mallGb=GFT&ejkGb=GFT";
	    } else if (ejkGb == 'EBK') {
	        linkUrl = "http://digital.kyobobook.co.kr/kyobobook/eBookDetail.laf?category=001";
	    } else if (ejkGb == 'AUD') {
	        linkUrl = "http://digital.kyobobook.co.kr/kyobobook/audioDetail.laf?category=002";
	    } else if (ejkGb == 'VOD') {
	        linkUrl = "http://digital.kyobobook.co.kr/kyobobook/vodDetail.laf?category=003";
	    } else if (ejkGb == 'KDS') {
	        linkUrl = "http://digital.kyobobook.co.kr/kyobobook/kidsDetail.laf?category=004";
	    } else if (ejkGb == 'DUM') {
	        linkUrl = "http://digital.kyobobook.co.kr/kyobobook/articleDetail.laf?category=006";
	    } else if (ejkGb == 'DSE') {
	        linkUrl = "http://digital.kyobobook.co.kr/kyobobook/setDetail.laf?category=007";
	    } else if (ejkGb == 'DMA') {
	        linkUrl = "http://digital.kyobobook.co.kr/kyobobook/eMagazineDetail.laf?category=008";
	    } 
	
	    if(ejkGb == 'GFT') {
	        sUrl = linkUrl + '&rtn_url=/app.product.GoodDetail.top?comm=usr.detail|good_id=' + barcode;
	    }else if (linkUrl != '') {
	    	var clickstr = "";
	
	      if(event != null) {
	         var curTag = event.srcElement;
	         var i=0;
	
	         while(curTag.parentElement && i<40) {
	             if((curTag.tagName == "SPAN" || curTag.tagName == "span") && curTag.name == "orderclick") {
	                clickstr = "&clickOrder=" + curTag.value;
	             		break;
	             }
	             curTag = curTag.parentElement;
	             i++;
	         }
	       }
	       sUrl = linkUrl + "&ejkGb=" + ejkGb +  "&barcode=" +barcode + clickstr;
	    }
	
	   	if(typeof(orderClick) != "undefined") {
	       sUrl = sUrl + "&orderClick=" + orderClick;
	    }
	   	if(linkClass != null){
	   		sUrl = sUrl + "&linkClass=" + linkClass;
	   	}
	
	    self.location.href = sUrl;
	    return;
	}
}

// ±ÛÀÚ ¹ÙÀÌÆ®¼ö °è»ê
function getStringByByte(str, limit_length) {
	if (str == "") {
        return  str;
    }
    var len = 0;
    for (var i = 0; i < str.length; i++) {
        if (str.charCodeAt(i) > 128) {
            len++;
        }
        len++;
        if(len >= limit_length) {
        	return (str.substring(0,(i+1))+"..");
        } 
    }

    return  str;
}

// div ¼³Á¤
function viewSelectList(objName){
	if(document.getElementById(objName).style.display == 'none'){
		document.getElementById(objName).style.display = 'block';
	}else{
		document.getElementById(objName).style.display = 'none';
	}
}

// div ¼³Á¤
function viewSelectListOn(objName){
		document.getElementById(objName).style.display = 'block';
}

// div ¼³Á¤
function viewSelectListOff(objName){
		document.getElementById(objName).style.display = 'none';
}

// div ¼³Á¤
function viewMoreList(objName1, objName2 ){
	document.getElementById(objName1).style.display = 'block';
	document.getElementById(objName2).style.display = 'none';
}


function goKeywordSearch(keyword){
	var searchFrm = parent.document.searchInfo;
	
	searchFrm.vPstrKeyWord.value = "";
	searchFrm.vPpubNM.value = keyword;
	searchFrm.vPsubject.value = "";
	searchFrm.vPsemester.value = "";
	searchFrm.vPdifficulty.value = "";
	searchFrm.vPtheme.value = "";
	searchFrm.vPsection.value = "";
	searchFrm.secondKeyWord.value = "";
	searchFrm.cateKeyWord.value = "";
	
	if(searchFrm.range.value == 'element'){
		searchFrm.vPgrade.value = "70 71 72 73 74 75 76";
	}else if(searchFrm.range.value == 'middle'){
		searchFrm.vPgrade.value = "80 81 82 83";
	}else if(searchFrm.range.value == 'high'){
		searchFrm.vPgrade.value = "90 91 92 93";
	}

	searchFrm.target = "bodyfr";
	searchFrm.submit();
		
}

// ¸ÞÀÎÅ°¿öµå °Ë»ö
function goMainKeywordSearch(Keyword, orderClick)
{
	var searchFrm = document.searchFrm;
	// ÅÂ±×°Ë»ö Ã¼Å©
	searchFrm.vPtagSearch.value = "Y";
	searchFrm.vPstrKeyWord.value = Keyword;
	searchFrm.vPoutSearch.value = "";
	searchFrm.vPcondition.value = "";
	searchFrm.vPorderClick.value = orderClick;
	searchFrm.vPstrCategory.value = "TOT";
	
	searchFrm.action="/search/SearchCommonMain.jsp";

	searchFrm.submit();
}

// ¸ÞÀÎÅ°¿öµå °Ë»ö
function goMainKeywordSearch2(Keyword, orderClick)
{
	var searchFrm = document.searchFrm;
	// ÅÂ±×°Ë»ö Ã¼Å©
	searchFrm.vPtagSearch.value = "Y";
	searchFrm.vPstrKeyWord.value = Keyword;
	searchFrm.vPoutSearch.value = "";
	searchFrm.vPcondition.value = "";
	searchFrm.vPorderClick.value = orderClick;
	searchFrm.vPstrCategory.value = "TOT";
	searchFrm.vUMultilinkClassID.value = "";
	searchFrm.vUTempMultiID.value = "";
	
	searchFrm.action="/search/SearchCommonMain.jsp?Kc=SETLETrelkeyword";
	searchFrm.submit();
}

// Å×¸¶Å°¿öµå °Ë»ö
function goThemeKeywordSearch(Keyword, orderClick)
{
	var searchFrm = document.searchFrm;
	// ÅÂ±×°Ë»ö Ã¼Å©
	searchFrm.vPtagSearch.value = "N";
	searchFrm.vPstrKeyWord.value = Keyword;
	searchFrm.vPoutSearch.value = "";
	searchFrm.vPcondition.value = "";
	searchFrm.vPorderClick.value = orderClick;
	searchFrm.vPstrCategory.value = "TOT";
	
	
	searchFrm.action="/search/SearchCommonMain.jsp";
	searchFrm.submit();
}

/*
*	¼ýÀÚ¸¸ ÀÔ·Â °¡´É
*/
function numberValidate(field){
	var inText = field;
	var ret;
	var temp = "";

	for (var i = 0; i < inText.length; i++){
		ret = inText.charCodeAt(i);	
		if ((ret < 48) || (ret > 57)) {
			return temp;
		}
		temp = temp + field.substring(i, i+1);

	}

return temp;
}

/*
*	comma ÀÚµ¿ »ý¼º 
*/ 
function addComma(obj){

	var pri = obj.value;

	pri = getValue(pri);
	pri = numberValidate(pri);

	if(pri == '') pri='';
	var re = /,|\s+/g;
	pri = pri.replace(re, "");

	re = /(-?\d+)(\d{3})/;
	while (re.test(pri)) {
		pri = pri.replace(re, "$1,$2");
	}
	obj.value = pri;

}

/*
*	°ø¹é, ",", "-", "/" ¸¦ Á¦°ÅÇÏ¿© °ªÀ» ¹ÝÈ¯ÇÑ´Ù. 
*/
function getValue(value){
	if(value == '') value='';
	var re = /,|-|\/|\s+/g;   // \s ==>°ø¹é  ',' '-' '/' Á¦°Å
	value = value.replace(re, "");
	return value;
}

/*
*	°ø¹é, ",", "-", "/" ¸¦ Á¦°ÅÇÏ¿© °ªÀ» ¹ÝÈ¯ÇÑ´Ù. 
*/
function getValueInt(value){
	if(value == '') value='';
	var re = /,|-|\/|\s+/g;   // \s ==>°ø¹é  ',' '-' '/' Á¦°Å
	value = value.replace(re, "");
	value *= value;
	return value;
}

/*
*	³¯Â¥¿¡ '/' »ý¼º¤·	
*/
function addDate(obj){ 
	
	var data = getValue(obj.value);
	var returnValue = "";
	var chDate = "";

	chDate = numberValidate(data);

	if(chDate != ''){
		if(chDate.length == 8){
			returnValue += chDate.substr(0,4)+"/";
			returnValue += chDate.substr(4,2)+"/";
			returnValue += chDate.substr(6,2);
		}else{
			returnValue = chDate;
		}
	}
	obj.value =  returnValue;
}

//ÆäÀÌÁö ÀÌµ¿°ªÀ» ÀÔ·ÂÇÏ°í ÆäÀÌÁö¸¦ ÀÌµ¿ÇÒ¶§
function goPageList(viewCount, totalCountPage){
	var pageing = document.searchFrm6.pageing.value;

	if( pageing == 0 ) pageing = 1;
	if(eval(pageing) > eval(totalCountPage)){
		alert("ÀÔ·ÂÇÏ½Å ÆäÀÌÁö°¡ ÃÖ´ë ÆäÀÌÁöº¸´Ù Å®´Ï´Ù.");
		document.searchFrm6.pageing.focus();
		return;
	}
	
	var pageNo = (pageing - 1) * viewCount;

	golist(pageNo, 'LAm');
}

function goTotPageList() {
	var view_count1 = document.searchFrm6.viewtotcount.value;
	var totalCountPage1 = document.searchFrm6.totaltotpage.value;
	
	goPageList(view_count1, totalCountPage1);
}

//½æ³×ÀÏ È®Àå
/*
function viewrelProduct(no){

	var viewYn = document.getElementById("viewYn_"+no).value;

	if(viewYn == 0){
		document.getElementById("relProduct_"+no).style.display = "none";
		document.getElementById("viewYn_"+no).value = "1";

	}else{
		document.getElementById("relProduct_"+no).style.display = "block";
		document.getElementById("viewYn_"+no).value = "0";

		var tempX=100;
		var tempY=100;

		//tempX=event.clientX + document.getElementById("images").scrollLeft ;
		//tempY=event.clientY + document.getElementById("images").scrollTop ;		

		document.getElementById("relProduct_"+no).style.left=tempX;
		document.getElementById("relProduct_"+no).style.top=tempY;

		var str = ""; 
		str +=	"<h3>ÀÌ »óÇ°°ú ÇÔ²² ±¸¸ÅÇÑ »óÇ°</h3>";
		str += '<div class="book_box">';
		str += '<table cellspacing="0" cellpadding="0" border="0" align="center">';
		str += '<tr>';
		str += '<td><a href="#"><img src="images/con_simage_bookimg.gif" /></a></td>';
		str += '<td><a href="#"><img src="images/con_simage_bookimg.gif" /></a></td>';
		str += '<td><a href="#"><img src="images/con_simage_bookimg.gif" /></a></td>';
		str += '<td><a href="#"><img src="images/con_simage_bookimg.gif" /></a></td>';
		str += '<td><a href="#"><img src="images/con_simage_bookimg.gif" /></a></td>';
		str += '</tr>';
		str += '</table>';
		str += '</div>';

		document.getElementById("relProduct_"+no).innerHTML=str;

		 

		//var wi=document.getElementById('popup_img').clientWidth;
		//var he=document.getElementById('popup_img').clientHeight;

		 

		//document.getElementById('popup_img').style.height=he;
		//document.getElementById('popup_div').style.height=he;
	}
}
*/

//°á°ú³» Àç°Ë»ö °á°ú Á¶È¸ 
function goAgainSearch2(val){
	var frm;
	var searchMain ;
	var searchTop = document.searchTop;
	var searchFrm = document.searchFrm;
	var searchFrm4 = document.searchFrm4;
	var searchAgain = document.searchAgain;
	var sCategory = searchTop.vPstrCategory.value ;			// ÇöÀç ÆäÀÌÁö Ä«Å×°í¸®
	var sReSearch = "" ;
	var sStatus = "" ;
	var sRead = "" ;
	var sRecommend = "" ;
	var sThema = "" ;
	var sOrderClick = "";
	var sMainUrl = "";
	var place = "";

	var searchAgainKeyword = searchAgain.searchAgainKeyword;
		
	if(searchAgainKeyword.value == ""){
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		searchAgainKeyword.focus();
		return ;
	}
	
	frm = document.searchTop ;

	var sExeFrm = frm.searchCategory.value ;			// ¼±ÅÃµÈ Ä«Å×°í¸®
	var sKeyword ="";
	
	 sKeyword = searchAgainKeyword.value ;


	// °Ë»ö¾î ¹ÙÀÌÆ® Ã¼Å©
	var thisStrLen = getMsgSize(sKeyword);
	if(searchAgainKeyword.value != ""){
		if( 2 > thisStrLen){
			
			if( sKeyword >= "0" && sKeyword <= "9"){
				alert("¼ýÀÚ´Â 2±ÛÀÚ ÀÌ»ó ÀÔ·ÂÇÏ¼¼¿ä!");
			}else if( sKeyword >= "A" && sKeyword <= "z"){
				alert("¿µ¹®Àº 2±ÛÀÚ ÀÌ»ó ÀÔ·ÂÇÏ¼¼¿ä!");
			}else{
				alert("Æ¯¼ö¹®ÀÚ´Â 2±ÛÀÚ ÀÌ»ó ÀÔ·ÂÇÏ¼¼¿ä!");
			}
			
			searchAgainKeyword.focus();
			return;
		}
	}
	

	var keyWordYn = "";
	for(js = 0; js < searchAgain.keywordYn.length ; js++){
		if(searchAgain.keywordYn[js].checked == true){
			keyWordYn = searchAgain.keywordYn[js].value;
		}
	}
	
	if (sKeyword != "" && document.searchTopChk.vPsch.value == "1") {
	// °Ë»öÁ¶°Ç ÃÊ±âÈ­
		place = document.searchFrm.vPplace.value;
		searchFrm.vPviewOption.value = "";
		searchFrm.vPviewSearch.value = "";
	} else {		
		place = "top";
	}
	
	
	if(sExeFrm == "TRA") {
		sMainUrl = "/search/SearchTracksongMain.jsp"; 
	}else if(sExeFrm == "AGN") {
		sMainUrl = "/search/SearchAgendaMain.jsp"; 
	}

	searchMain = document.searchFrm;

	
	sReSearch = "2";

	var vAgainSearchKeyWordAdd = searchMain.vAgainSearchKeyWordAdd.value;
	var vAgainSearchKeyWordDel = searchMain.vAgainSearchKeyWordDel.value;
	// °á°ú³» °Ë»ö	
	if(keyWordYn == "Y" && val == 't'){			
		 
		 searchMain.vPreKeyWord.value = searchFrm.vPreKeyWord.value +" " + sKeyword;

		if(vAgainSearchKeyWordAdd == ""){
			searchMain.vAgainSearchKeyWordAdd.value = sKeyword;
		}else{
			searchMain.vAgainSearchKeyWordAdd.value = vAgainSearchKeyWordAdd + "," + sKeyword;
		}

	} else {
		
		searchMain.vPreKeyWord.value = searchFrm.vPreKeyWord.value +" !" + sKeyword;

		if(vAgainSearchKeyWordDel == ""){
			searchMain.vAgainSearchKeyWordDel.value = sKeyword;
		}else{
			searchMain.vAgainSearchKeyWordDel.value = vAgainSearchKeyWordDel + "," + sKeyword;
		}

	}

	searchMain.vPstrCategory.value = sExeFrm;
	searchMain.vPreSearch.value = sReSearch;
	searchMain.vPstrStatus.value = sStatus;
	searchMain.vPstrRead.value = sRead;


	searchMain.vPorderClick.value = "";

	// °Ë»ö ÆäÀÌÁöÀÏ °æ¿ì
	if(sKeyword != "" && document.searchTopChk.vPsch.value == "1"){
		searchMain.vPnoReSearch.value = "";
		searchMain.vPsort.value = "";
		searchMain.vPviewCount.value = "20";
		searchMain.vPstartno.value = "0";
		searchMain.vPlinkClassID.value = "";
		searchMain.vPlinkClassName.value = "";
		searchMain.vPstrFilter.value = "";
		searchMain.vPclassicYN.value = "";
		searchMain.vPcondReSearch.value = "";
		searchMain.vPcondReKeyWord.value = "";
		searchMain.vPsearchGB.value = "";
		searchMain.vPcondition.value = "";
		searchMain.vPconditionQuery.value = "";
		searchMain.vPoutSearch.value = "";
		searchMain.vPlinkClassClassicID.value = "";
		searchMain.vPmusicArtist.value = "";
		searchMain.vPsKeywordInfo.value = "";
		searchMain.vPrecommKeyword.value = "";
		searchMain.vPejkGB.value = "";
		searchMain.vPrecommonQuery.value = "";
		searchMain.vPmusicMedia.value = "";
	}  

	searchTop.vPcateGb.value = "" ;
	searchTop.vPsch.value = "1" ;
	
	//alert ( location.href );
	var mainHttp = location.href;

	if (val == 'b'){
		sMainUrl  = sMainUrl + "?orderClick=" + sOrderClick;
	}
	
	searchMain.action = sMainUrl;
	searchMain.submit();
}

function changePageAll(type, pageVal){
	document.searchFrm.vPejkGB.value = "";
	document.searchFrm.vPsearchType.value = type;
	//document.searchFrm.action = "./SearchCommonImageMain.jsp";
	//document.searchFrm.action = pageVal;
	
	if(pageVal == 'subject') {
		if(type == 'image') {
			document.searchFrm.action = "./SearchSubjectImageMain.jsp";
		}else {
			document.searchFrm.action = "./SearchSubjectMain.jsp";
		}
	}else if(pageVal == 'SUB') {
		if(type == 'image') {
			document.searchFrm.action = "./SearchSubjectImageMain.jsp";
		}else {
			document.searchFrm.action = "./SearchSubjectMain.jsp";
		}
	}else {
		if(type == 'image') {
			document.searchFrm.action = "./SearchCommonImageMain.jsp";
		}else {
			document.searchFrm.action = "./SearchCommonMain.jsp";
		}
	}
	document.searchFrm.submit();	
}

function goMultiTotLink(val,orderclass ,cateName, linkCode) {
	var sMainurl = "./SearchCommonMain.jsp";
	var searchFrm = document.searchFrm;
	var strCategory = searchFrm.vPstrCategory.value ;
	var strSearchType = searchFrm.vPsearchType.value;
	
	if(typeof(linkCode) == "undefined")	{
		linkCode = "";
	}
	
	searchFrm.vPsort.value="";
	searchFrm.vPsortid.value="1";
	searchFrm.vPplace.value="recomm";
	
	if(strSearchType == "image") {
		sMainurl = "./SearchCommonImageMain.jsp?Kc=SETLRErecofiltersearch";
	}else {
		sMainurl = "./SearchCommonMain.jsp?Kc=SETLRErecofiltersearch";
	}

	if (orderclass == "1"){
		searchFrm.vUMultiCateFirstName.value = cateName;
		searchFrm.vUMultiCateSecondName.value = "";
		searchFrm.vUMultiCateThirdName.value = "";
		searchFrm.CalssCode1.value = val;
		searchFrm.CalssCode2.value = "";
	}else if(orderclass == "2") {
		searchFrm.vUMultiCateSecondName.value = cateName;
		searchFrm.vUMultiCateThirdName.value = "";
		searchFrm.CalssCode2.value = val;
	}else {
		searchFrm.vUMultiCateFirstName.value = "";
		searchFrm.vUMultiCateSecondName.value = "";
		searchFrm.vUMultiCateThirdName.value = "";
		searchFrm.CalssCode1.value = "";
		searchFrm.CalssCode2.value = "";
	}	
	if (searchFrm.vPreSearch.value == "5"){
		searchFrm.vPnoReSearch.value = "1";
	}else {
		searchFrm.vPnoReSearch.value = "3";
	}
	
	// history back Ã³¸®¸¦ À§ÇÑ ºÐ¾ßÄÚµå Ã³¸® ·ÎÁ÷ Ãß°¡ - ÇÑ½Â¿ë
	searchFrm.vPlinkClassID.value = linkCode;

	// ¸µÅ©¿À´õ
	var sorderClick = "";
	if (orderclass == "1") {
		sorderClick = "LAb";
	} else {
		sorderClick = "LAc";
	}

	searchFrm.orderClick.value = sorderClick;
	searchFrm.vPorderClick.value = sorderClick;
	searchFrm.vPstartno.value =  "0";
	searchFrm.vUMultilinkClassID.value = val;
	searchFrm.action = sMainurl;
	searchFrm.submit();
}

	function goMultiLink(val,orderclass ,cateName, linkCode)
	{
		var sMainurl = "./SearchKorbookMain.jsp";
		var searchFrm = document.searchFrm;
		var strCategory = searchFrm.vPstrCategory.value ;
		
		if(typeof(linkCode) == "undefined")	{
			linkCode = "";
		}
		
		searchFrm.vPsort.value="";
		searchFrm.vPsortid.value="1";
		searchFrm.vPplace.value="recomm";

		if (orderclass == "1"){
			searchFrm.vUMultiCateFirstName.value = cateName;
			searchFrm.vUMultiCateSecondName.value = "";
			searchFrm.CalssCode1.value = val;
			searchFrm.CalssCode2.value = "";
		} 
		else if(orderclass == "2"){
			searchFrm.vUMultiCateSecondName.value = cateName;
			searchFrm.vUMultiCateThirdName.value = "";
			searchFrm.CalssCode2.value = val;
		}else{
			searchFrm.vUMultiCateFirstName.value = "";
			searchFrm.vUMultiCateSecondName.value = "";
			searchFrm.vUMultiCateThirdName.value = "";
			searchFrm.CalssCode1.value = "";
			searchFrm.CalssCode2.value = "";
		}
		
		if (searchFrm.vPreSearch.value == "5"){
			searchFrm.vPnoReSearch.value = "1";
		} else {
			searchFrm.vPnoReSearch.value = "3";
		}
		
		// history back Ã³¸®¸¦ À§ÇÑ ºÐ¾ßÄÚµå Ã³¸® ·ÎÁ÷ Ãß°¡ - ÇÑ½Â¿ë
		searchFrm.vPlinkClassID.value = linkCode;

		// ¸µÅ©¿À´õ
		var sorderClick = "";
		if (orderclass == "1") {
			sorderClick = "LAA";
		} else {
			sorderClick = "LAB";
		}

		searchFrm.orderClick.value = sorderClick;
		searchFrm.vPorderClick.value = sorderClick;
		searchFrm.vPstartno.value =  "0";
		searchFrm.vUMultilinkClassID.value = val;
		searchFrm.action = sMainurl;
		searchFrm.submit();
	}


// Å×¸¶ÂÊ ¸µÅ© ¿¬°á
function goNewThemeEvent(button, layer)	{
	if(document.getElementById(layer).style.display == '')	{
		document.getElementById(layer).style.display = 'none';		
		document.getElementById(button).src = "http://image.kyobobook.co.kr/newimages/apps/b2c/search/2009/btn_more02.gif";
		
	}else {
		document.getElementById(layer).style.display = '';
		document.getElementById(button).src = "http://image.kyobobook.co.kr/newimages/apps/b2c/search/2009/btn_close.gif";
	}	
}	

// Å×¸¶ÂÊ ¸µÅ© ¿¬°á
function goAuthor2(val, count){
	var openNum = 1;
	var arrDiv = new Array();
	for( i=1; i <= count; i++) {
		if( document.getElementById("authors"+i).style.display == "block") {
			if(val == "N") {
				openNum = i + 1;
				if(openNum > count) openNum = 1;
			}else {
				openNum = i - 1;
				if(openNum <= 0) openNum = count;
			}
			break;
		}
	}
	for( j=1; j <= count; j++) {
		var strNm = "authors" + j;
		if(openNum == j) {
			document.getElementById(strNm).style.display = "block";
		}else {
			document.getElementById(strNm).style.display = "none";
		}
	}
}

// Å×¸¶ÂÊ ¸µÅ© ¿¬°á
function goPageTot(val){
 document.searchTop.searchCategory.value = "TOT";
 document.searchTop.vPorderClick.value = "LCN";
 document.searchTop.vAuthorId.value = val;
 document.searchTop.submit(); 
}

// Å×¸¶ÂÊ ¸µÅ© ¿¬°á
function goPageTot2(val, keywordPage){
 document.searchTop.searchCategory.value = "TOT";
 document.searchTop.vPstrKeyWord.value = keywordPage;
 document.searchTop.searchKeyword.value = keywordPage;
 document.searchTop.vAuthorId.value = val;
 document.searchTop.submit(); 
}

//Ä«Å×°í¸® 
function changePage2(type){
	document.searchFrm.action = "./SearchCategoryMain.jsp";
	//document.searchFrm.vPstrCategory.value = "CATE";
	document.searchFrm.vPtabType.value = type;
	document.searchFrm.submit();	
}

// »ó¼¼ ÆäÀÌÁö È£Ãâ½Ã ¿À´õÅ¬¸¯ Ãß°¡
	// 20090206 ÇÑ½Â¿ë
function goRelProductDetail(ejkGb, linkClass, barcode, orderClick) {
	var sUrl = "";
	var linkUrl = "";			

	var subBarcode = barcode.substring(0, 2);
		
	if(subBarcode == '29'){
		linkUrl = domain+"/product/detailViewPackage.laf?mallGb=PKG";
	}else if( subBarcode == '14'){
		linkUrl = "http://pod.kyobobook.co.kr/soldOutPODBookList/soldOutPODBookDetailView.ink";
	}else{
		if (ejkGb == 'KOR') {
			linkUrl = domain+"/product/detailViewKor.laf?mallGb=KOR";
		} else if (ejkGb == 'ENG' || ejkGb == 'BNT') {
			linkUrl = domain+"/product/detailViewEng.laf?mallGb=ENG";
		} else if (ejkGb == 'JAP' || ejkGb == 'JNT') {
			linkUrl = domain+"/product/detailViewEng.laf?mallGb=JAP";
		} else if (ejkGb == 'MUC') {
			linkUrl = domain+"/product/detailViewMuc.laf?mallGb=MUC";
		} else if (ejkGb == 'DVD') {
			linkUrl = domain+"/product/detailViewDvd.laf?mallGb=DVD";
		} else if (ejkGb == 'GFT') {
			linkUrl = domain+"/gift/goInfo.laf?mallGb=GFT&ejkGb=GFT";
		} else if (ejkGb == 'EBK') {
			linkUrl = "http://digital.kyobobook.co.kr/kyobobook/eBookDetail.laf?category=001";
		} else if (ejkGb == 'AUD') {
			linkUrl = "http://digital.kyobobook.co.kr/kyobobook/audioDetail.laf?category=002";
		} else if (ejkGb == 'VOD') {
			linkUrl = "http://digital.kyobobook.co.kr/kyobobook/vodDetail.laf?category=003";
		} else if (ejkGb == 'KDS') {
			linkUrl = "http://digital.kyobobook.co.kr/kyobobook/kidsDetail.laf?category=004";
		} else if (ejkGb == 'DUM') {
			linkUrl = "http://digital.kyobobook.co.kr/kyobobook/articleDetail.laf?category=006";
		} else if (ejkGb == 'DSE') {
			linkUrl = "http://digital.kyobobook.co.kr/kyobobook/setDetail.laf?category=007";
		} else if (ejkGb == 'DMA') {
			linkUrl = "http://digital.kyobobook.co.kr/kyobobook/eMagazineDetail.laf?category=008";
		} 
	}
		
	if(ejkGb == 'GFT') {
		sUrl = linkUrl + '&rtn_url=/app.product.GoodDetail.top?comm=usr.detail|good_id=' + barcode;
	}else if (linkUrl != '') {
		var clickstr = "";
		 sUrl = linkUrl + "&ejkGb=" + ejkGb + "&linkClass=" + linkClass + "&barcode=" +barcode + clickstr;
	
	}

	if(typeof(orderClick) != "undefined") {
	   sUrl = sUrl + "&orderClick=" + orderClick;
	}	
	
	window.open(sUrl,'_blank','') ;
	return;
}

// Áß°íÀåÅÍ - ¹Ù·Î±¸¸Å url
function goUsedOrder(form, barcode, index){
	//var url = "https://useddev.kyobobook.co.kr/order/orderDetail.ink?barcode=" + barcode + "&qty=" + form.qty[index-1].value;
	var url = "http://used.kyobobook.co.kr/order/orderDetail.ink?barcode=" + barcode + "&qty=" + form.qty[index-1].value;
	location.href = url;
}


/**
 * @name : goPreview()
 * @description : eBook ¹Ì¸®º¸±â
 * @param : barcode ( ¹ÙÄÚµå )
 * @param : docid ( docid )
 */
function goPreview( barcode, docid, isLogin, freeYn ){

	var loginyn = isLogin;
	
	if ( freeYn == "1" ){
		freeYn = "Y";
	}else if ( freeYn == "0" ){
		freeYn = "N";
	}

	var featureStr = 'fullscreen=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,left=0,top=0,width='+ (1024-8) +',height='+ (768-27);
    var popTop = window.open( 'http://view.genomad.co.kr/preview_ikb/theme/uk0011/action/viewer.jsp?bookType=2&bKind=EBK&barcode='+barcode+'&docid='+docid+'&freeYn='+freeYn+'&loginyn='+loginyn, 'ezPDFWebBook', featureStr );

    if (popTop != null ){
        popTop.focus();
    }else{
        webblasare = navigator.appVersion;
        if ( (webblasare.indexOf("Windows NT 5.1") != -1 )&& (webblasare.indexOf("SV1")!=-1) ){
            alert("\n ÆË¾÷Ã¢À» ¿ÀÇÂÇÒ ¼ö ¾ø½À´Ï´Ù. \n\n ºê¶ó¿ìÀúÀÇ »ó´Ü ³ë¶õ»ö [¾Ë¸² Ç¥½ÃÁÙ]À» Å¬¸¯ÇÏ½Å ÈÄ \n\n [ÇöÀç »çÀÌÆ®ÀÇ ÆË¾÷À» Ç×»ó Çã¿ë]À¸·Î ¼³Á¤ÇÏ¿© ÁÖ¼¼¿ä. \n");
        } else {
            alert("\n ÆË¾÷Ã¢À» ¿ÀÇÂÇÒ ¼ö ¾ø½À´Ï´Ù. \n");
        }
    }
}


function goEventSrcPage(barcode, eventId, ejkGb, targetName, orderClick) {
		if(typeof(targetName) != 'undefined') {
			document.proCartOneForm.target = targetName;
		} 
		
        if(ejkGb == 'ENG' || ejkGb == 'JAP' || ejkGb == 'BNT' || ejkGb == 'JNT') {
		    document.proCartOneForm.action = domain+"/event/eventEngViewByPid.laf?orderClick=" + orderClick;
        } else if (ejkGb == 'MUC') {
            document.proCartOneForm.action = domain+"/event/eventMucViewByPid.laf?orderClick=" + orderClick;
        } else if (ejkGb == 'DVD') {
            document.proCartOneForm.action = domain+"/event/eventDvdViewByPid.laf?orderClick=" + orderClick;
        } else {
            document.proCartOneForm.action = domain+"/event/eventViewByPid.laf?orderClick=" + orderClick;
        }
		document.proCartOneForm.eventId.value = eventId;
		document.proCartOneForm.barcode.value = barcode;
		document.proCartOneForm.ejkGb.value = ejkGb;
		document.proCartOneForm.submit();		
}

// À½¹Ý ¹Ì¸®µè±â
function playAll(barcode, musicCd){
	var playPopup = "playPopup";
	var url = "/hottracks/newPlayer.laf?barcode=" + barcode + "&musicCd=" + musicCd + "&orderClick=LAU";
	var popupOptions = "left=0, top=0, width=702, height=388, toolbar=no, status=no, scrollbars=no, resizable=no, menubar=no";
	window.open(url, playPopup, popupOptions);
}

// À½¿ø µ¥ÀÌÅÍ °ü·Ã ÇÔ¼ö
var aodWebPlayer = null;
var movieWebPlayerName	= "MUSICVIDEO_PLAYER";

function popWin(name, url, width, height, scroll, resizable){
	popWinRet(name, url, width, height, scroll, resizable);
}
function popWinRet(name, url, width, height, scroll, resizable){
	scroll = (scroll == "yes")? "yes" : "no";
	resizable = (resizable == "yes")? "yes" : "no";
	var status = "left=0,top=0,width="+ width +",height="+ height +",scrollbars="+scroll+",resizable="+resizable;
	var p = window.open( url, name, status);
	if ( p ) p.focus();

	return p;
}
	
//	 ÇÑ°î µè±â
function streamSong(songId, orderClick){
	if ( orderClick == undefined || orderClick == "")
		orderClick = "";
	else
		orderClick = "&orderclick="+ orderClick;
	
	var name	= "kyoboWebPlayer";
	var url		= "http://dm.kyobobook.co.kr/player/aodplayer.do?streamlist="+songId+"&type_gubun=2"+ orderClick;
	var scroll	= "no";
	var resizable = "no";
	var width;
	var height;
	if( navigator.appName.indexOf("Microsoft") > -1 ) {
		if(navigator.appVersion.indexOf("MSIE 6") > -1) {
			//ie6
			width	= "580";
			height	= "395";
		}else if(navigator.appVersion.indexOf("MSIE 7") > -1){
			//ie7	
			width	= "580";
			height	= "395";
		}else if((navigator.appVersion.indexOf("MSIE 8") > -1)){
			//ie8			
			width	= "580";
			height	= "397";
		}else{			
			width	= "580";
			height	= "397";
		}			
	}else if(navigator.appName.indexOf("Netscape") > -1){
		//Å©·Ò
		width	= "586";
		height	= "396";
	}else{
		width	= "580";
		height	= "397";		
	}

	try {		
		aodWebPlayer.initSongDataLoad(songId);
	} catch(e) {
		try {			
			aodWebPlayer = popWinRet(name, "", width, height, scroll, resizable);
			aodWebPlayer.initSongDataLoad(songId);
		} catch(e) {			
			aodWebPlayer = popWinRet(name, url, width, height, scroll, resizable);
		}
	}
}
	
//	 °¡»çº¸±â
function viewLyrics(songId, orderClick){
	if ( orderClick == undefined || orderClick == "" )
		orderClick = "";
	else
		orderClick = "&orderclick="+ orderClick;
	
	window.open('http://dm.kyobobook.co.kr/pop/lyrics/viewLyrics.do?songId='+songId+ orderClick,'viewLyrics','width=385,height=440');
	
}
	
//	 ¹Âºñµè±â
function streamMVList(listMV, orderClick){
	if ( orderClick == undefined || orderClick == "" )
		orderClick = "";
	else
		orderClick = "&orderclick="+ orderClick;
	
	
	if ( listMV == undefined || listMV == '') {
		listMV = getCheckBoxId("checkbox");
	}
	
	if ( listMV == '' ) {
		alert("°¨»óÇÏ½Ç ¹ÂÁ÷ºñµð¿À¸¦ ÇÑ°³ ÀÌ»ó ¼±ÅÃÇØÁÖ¼¼¿ä.");
		return;
	}

	var name	= movieWebPlayerName;
	var url		= "http://dm.kyobobook.co.kr/pop/musicvideo/popMvPlayer.do?listMvId="+listMV+ orderClick;
	var width	= "913";
	var height	= "660";
	var scroll	= "no";
	var resizable = "no";

	try {
		movieWebPlayer.goMvPlay(listMV);
	} catch(e) {
		try {
			movieWebPlayer = popWinRet(name, "", width, height, scroll, resizable);
			movieWebPlayer.goMvPlay(listMV);
		} catch(e) {
			movieWebPlayer = popWinRet(name, url, width, height, scroll, resizable);
		}
	}
}

function writeSearchLog(barcode){
	document.SearchLogFrm.barcode.value = barcode;
	document.SearchLogFrm.submit();
}


