
var msie4=0
if(navigator.userAgent.indexOf("MSIE 4") != -1) msie4=1
var menu_layers = new Array ("photo","gossip");
var menu_objs = new Array (menu_layers.length);
var menu_objsPhoto, menu_objsGossip;

function fnResizePopup(nWidth, nHeight)
{
	var listBody =  document.body;
	var strAgent = navigator.userAgent.toLowerCase();
	var bIE = (strAgent.indexOf("msie") != -1);
	var bXP = (strAgent.indexOf("nt 5.1") != -1);
	var bIE7 = (strAgent.indexOf("msie 7.0") != -1);
	var bSafari = (strAgent.indexOf("konqueror") != -1 || strAgent.indexOf("safari") != -1);
	var bFirefox = (strAgent.indexOf("firefox")!= -1);
	// »çÀÌÁî°¡ ÁöÁ¤µÇÁö ¾ÊÀº °æ¿ì(0)´Â body »çÀÌÁî·Î
	if ( nWidth == 0) {
		nWidth = listBody.scrollWidth;
	}

	if ( nHeight == 0) {
		nHeight = listBody.scrollHeight + 30;
	}
	window.resizeTo(nWidth, nHeight + (bXP ? (bIE7 ? 50: 20) : 0));
}

function getEl(id)
{
	if (document.getElementById)  {
		return document.getElementById(id);
	} else if (document.all)  {
		return document.all[id];
	} else if (document.layers)  {
		return document.layers[id];
	}
}

function $(id){
	return getEl(id);
}
//div º¸¿©ÁÖ±â
function hDisplayShow(lname){
	getEl(lname).style.display = "block";
}

//div º¸¿©ÁÖ±â
function hDisplayShowL(lname){
	getEl(lname).style.display = "inline";
}

//div ¼û±â±â
function hDisplayHide(lname){
	getEl(lname).style.display = "none";
}

function addEventListenerFn(obj, eventName, eventFn){
	try {
		if (window.attachEvent) {
			obj.attachEvent(eventName, eventFn);
			return true;
		} else if (window.addEventListener){
			obj.addEventListener(eventName.substring(2), eventFn , true)
			return true;
		}
	} catch(ex){}
	return false;
}

function addBrowseLayerEvent(i){
	var sFn = function(){ try{ hDisplayShow('category'+i+'Layer');  }catch(ex){} };
	var hFn = function(){ try{ hDisplayHide( 'category'+i+'Layer'); }catch(ex){} };

	addEventListenerFn($('category'+i), 'onmouseover', sFn);
	addEventListenerFn($('category'+i), 'onmouseout',  hFn);
	addEventListenerFn($('category'+i+'Layer'), 'onmouseover', sFn);
	addEventListenerFn($('category'+i+'Layer'), 'onmouseout',  hFn);
}

function setUpBrowseLayerEvent(){
	for(var i=1; i<25; i++){
		try{
			addBrowseLayerEvent(i);
		}catch(ex){}
	}
}

function addZimm(catalogid,url){
	window.open("/popup/zzim.php?sbid="+catalogid+"&returnurl="+url, "zzim", "left=300, top=300, width=400, height=357, scrollbars=no, resizable=no");
}

function redirect_login (returnurl) {
	if (confirm("º» ¼­ºñ½º´Â ·Î±×ÀÎÀ» ÇØ¾ß ÀÌ¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.\n\n·Î±×ÀÎ ÇÏ½Ã°Ú½À´Ï±î ?")) {
		document.location.href =  "http://xo.nate.com/login.jsp?redirect=" + returnurl;
	}else{
		history.back(-1);
	}
}

function redirect_login2 (returnurl) {
	if (confirm("º» ¼­ºñ½º´Â ·Î±×ÀÎÀ» ÇØ¾ß ÀÌ¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.\n\n·Î±×ÀÎ ÇÏ½Ã°Ú½À´Ï±î ?")) {
		document.location.href =  "http://xo.nate.com/login.jsp?redirect=" + escape(returnurl);
	}
}

function redirect_login_encode (returnurl) {
	if (confirm("º» ¼­ºñ½º´Â ·Î±×ÀÎÀ» ÇØ¾ß ÀÌ¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.\n\n·Î±×ÀÎ ÇÏ½Ã°Ú½À´Ï±î ?")) {
		//alert("http://xo.nate.com/login.jsp?redirect=" + returnurl);
		document.location.href =  "http://xo.nate.com/login.jsp?redirect=" + returnurl;
	}
}

/* ¿¥ÆÄ½º ±èÁÖÈ« Ãß°¡ url encode S */
function encodeURL(str){
	var s0, i, s, u;
	s0 = "";							// encoded str
	for (i = 0; i < str.length; i++){	// scan the source
		s = str.charAt(i);
		u = str.charCodeAt(i);			// get unicode of the char
		if (s == " "){s0 += "+";}		// SP should be converted to "+"
		else {
			if ( u == 0x2a || u == 0x2d || u == 0x2e || u == 0x5f || ((u >= 0x30) && (u <= 0x39)) || ((u >= 0x41) && (u <= 0x5a)) || ((u >= 0x61) && (u <= 0x7a))){       // check for escape
				s0 = s0 + s;			// don't escape
			}
			else {						// escape
				if ((u >= 0x0) && (u <= 0x7f)){		// single byte format
					s = "0"+u.toString(16);
					s0 += "%"+ s.substr(s.length-2);
				}
				else if (u > 0x1fffff){				// quaternary byte format (extended)
					s0 += "%" + (oxf0 + ((u & 0x1c0000) >> 18)).toString(16);
					s0 += "%" + (0x80 + ((u & 0x3f000) >> 12)).toString(16);
					s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
					s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
				}
				else if (u > 0x7ff){				// triple byte format
					s0 += "%" + (0xe0 + ((u & 0xf000) >> 12)).toString(16);
					s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
					s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
				}
				else {								// double byte format
					s0 += "%" + (0xc0 + ((u & 0x7c0) >> 6)).toString(16);
					s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
				}
			}
		}
	}
	return s0;
}
/* ¿¥ÆÄ½º ±èÁÖÈ« Ãß°¡ url encode E */
/* ¿¥ÆÄ½º ±èÁÖÈ« Ãß°¡ ¿ìÃø ¹è³Ê ºÎºÐ S */
function moveLayer(objName, objHeight, position) {
	var strAgent = navigator.userAgent.toLowerCase();
	var bIE7 = (strAgent.indexOf("msie 7.0") != -1);
	var bFirefox = (strAgent.indexOf("firefox")!= -1);
	var classname = "";
	
	var itm = document.getElementById(objName);
	itm.style.top = objHeight;
	
	if(objName=="book_backet"){
		itm.style.top = "136px";
	}
	
	if(bIE7!="")
		classname = "book_backet2";
	else if(bFirefox!="")
		classname = "book_backet1";
	else
		classname = "book_backet2";

	if (objHeight == 0) maxHeight = 700;
	else maxHeight = objHeight;

	//var max = document.body.scrollHeight + itm.scrollHeight - maxHeight;
	var max = document.documentElement.scrollHeight + itm.scrollHeight - maxHeight;

	switch (position) {
		case "R" :	// ¿ìÃø¹è³Ê
			getPosition(objName, objHeight, max);
			break;
		case "C" :	// ¼¼ºÎÆäÀÌÁö Áß°£ TOP ÇÇÄ¿
			getPositionPicker(objName, objHeight, max);
			break;
		default :
			getPosition(objName, objHeight, max);
	}
	return true;
}

function getPosition(objName, objHeight, max) {
	var start, end, scale, interval, newHeight;
	var itm = document.getElementById(objName);
	var addPoint = 50;

	start = parseInt (itm.style.top, 10);
	end = document.documentElement.scrollTop;

	if ( end > 146 ) {
		end = document.documentElement.scrollTop - 146;
	} else end = 0;

	interval = 100;

	if (start > max) start = max + addPoint;
	if (end > max) end = max + addPoint;

	if ( start != end ) {
		scale = Math.ceil( Math.abs( end - start ) / 3 );

		if ( end < start ) scale = -scale;
		if (end == 0) {
			if(objName=="book_backet")
				newHeight = "136";
			else
				newHeight = 0;		
		}
		else newHeight = start + scale + addPoint;

		itm.style.top = newHeight + "px";

		interval = 80;
	}
	setTimeout("getPosition('"+objName+"',"+objHeight+","+max+")", interval);
}

function getPositionPicker(objName, objHeight, max) {
	var start, end, scale, interval, newHeight;
	var itm = document.getElementById(objName);

	start = parseInt(itm.style.top, 10);
	if (isNaN(start))
		start = 0;
	end = document.documentElement.scrollTop;

	interval = 100;

	if (start > max) start = max;
	if (end > max) end = max;

	if ( end != start ) {
		scale = Math.ceil( Math.abs( end - start ) / 3 );

		if (end < start) scale = -scale;
		if (end < objHeight) end = objHeight + end;

		if ((start + scale) < objHeight) newHeight = objHeight;
		else newHeight = start + scale + 50;

		itm.style.top = newHeight + "px";
		interval = 50;
	}

	setTimeout("getPositionPicker('"+objName+"',"+objHeight+","+max+")", interval);
}
/* ¿¥ÆÄ½º ±èÁÖÈ« Ãß°¡ ¿ìÃø ¹è³Ê ºÎºÐ E */

function toggleLayer(id) {
	try {
		var obj = document.getElementById(id);
		obj.style.display = (obj.style.display == "none") ? "block" : "none";
	} catch (e) {

	}
	return true;
}

function selectLayerboxY(s_code, s_word, id) {
	document.bestsellerfrm.bestyear.value = s_code;
	document.getElementById(id).innerHTML = s_word;
}

function selectLayerboxM(s_code, s_word, id) {
	document.bestsellerfrm.bestmonth.value = s_code;
	document.getElementById(id).innerHTML = s_word;
}

function selectLayerboxW(s_code, s_word, id) {
	document.bestsellerfrm.bestweek.value = s_code;
	document.getElementById(id).innerHTML = s_word;
}

//º°Á¡ Á¤º¸
function star_info(arg) {
	var half_flag = false;
	var on_count = 0;
	var star_count = "";

	if(arg%2==1){
		arg--;
		half_flag = true;
	}
	on_count = arg/2;

	for(i=1; i<=on_count; i++){
		star_count = star_count + "<img src=\"http://book.nate.com/images/common/ico/ico_star_on.gif\" width=\"13\" height=\"12\" alt=\"\" style=\"vertical-align:top;\" />";
	}

	if(half_flag){
		star_count = star_count + "<img src=\"http://book.nate.com/images/common/ico/ico_star_half.gif\" width=\"13\" height=\"12\" alt=\"\" style=\"vertical-align:top;\" />";
		i++;
	}

	while(i<=5){
		star_count = star_count + "<img src=\"http://book.nate.com/images/common/ico/ico_star_off.gif\" width=\"13\" height=\"12\" alt=\"\" style=\"vertical-align:top;\" />";
		i++;
	}

	return star_count;
}

function change_starpoint(s_code) {
	var starpoint = "";
	document.reviewWrite.srpoint.value = s_code;
	starpoint = star_info(s_code);
	document.getElementById('srpointn').innerHTML = starpoint;
}
function change_starpoint_click(s_code) {
	var starpoint = "";
	document.reviewWrite.srpoint.value = s_code;
	starpoint = star_info(s_code);
	document.getElementById('srpointn').innerHTML = starpoint;
}

function deletereview(arg, arg1){
	if(confirm("»èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?")){
		location.href="/include/review_action.php?sbid="+arg1+"&sBinfo=action&sMode=delete&nRviewSn=" + arg;
	}
}

function deletereviewblog(arg, arg1, arg2){
	var param;
	param = "sbid="+arg+"&sMode=delete&nRviewSn="+arg1+"&blsn="+arg2;
	window.open("/popup/review_delete.php?"+param,"reblogdel","width=300,height=250,status=yes");
}

function recommendreview(arg, arg1){
	if(confirm("¸®ºäÃßÃµ ÇÏ½Ã°Ú½À´Ï±î?")){
		location.href="/include/review_action.php/detail.html?sbid="+arg1+"&sBinfo=action&sMode=recommend&nRviewSn=" + arg;
		// /detail.html?sbid="+arg1+"&sBinfo=action&sMode=recommend&nRviewSn=" + arg;
	}
}

function bestchkfrm(frm) {		
}

function sizeview(ssize) {
	var frm;
	frm = document.bestsellerfrm;
	frm.action = "/best.html?spage=best";
	frm.sbooks.value = ssize;
	frm.submit();
}

function shopbestview(shopid) {
	var frm;
	frm = document.bestsellerfrm;

	//frm.action = "/best.html?spage=best";
	
	//frm.srankorder.value = "1";
	//frm.sshopnm.value = shopid;
	//frm.submit();
	
	document.location = "/best.html?spage=best&srankorder=1&sshopnm="+shopid;
}

function rankbestview(rank) {
	var frm;
	frm = document.bestsellerfrm;
	frm.action = "/best.html?spage=best";
	frm.srankorder.value = rank;
	frm.submit();
}

function myzimmdel() {
	var frm;
	frm = document.bookzzim;
	frm.action = "/include/zzim_action.php";
	frm.actype.value = "delete";
	frm.submit();
}


var checkflag = "false";
var checkdisabled = "false";

function checkreviewbox(){
	var chkcnt = document.myreviewfrm.nRviewSn.length;
	if(isNaN(parseInt(document.myreviewfrm.nRviewSn.length))){
		if(!document.myreviewfrm.nRviewSn.checked){
			document.myreviewfrm.nRviewSn.checked = true;	
		}else{
			document.myreviewfrm.nRviewSn.checked = false;
		}
	}
	if (checkflag == "false"){
		for (i = 0; i < chkcnt; i++){
			if(!document.myreviewfrm.nRviewSn[i].disabled){
				document.myreviewfrm.nRviewSn[i].checked = true;						
			}else{
				document.myreviewfrm.nRviewSn[i].checked = false;
			}
		}
		checkflag = "true";
	}else{
		for (i=0; i<chkcnt; i++) {
			document.myreviewfrm.nRviewSn[i].checked = false;
		}
		checkflag = "false";
	}
}

function verify_chkbox(frm){
	if(isNaN(parseInt(document.myreviewfrm.nRviewSn.length))){
		if(!document.myreviewfrm.nRviewSn.checked){
			alert("ÇÏ³ª ÀÌ»óÀÇ ¼­ÀûÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä");
			return false;
		}else{
			return true;
		}

		var chkcnt = document.myreviewfrm.nRviewSn.length;
		var parity = 0;
		for(i = 0 ; i < chkcnt ; i++){
			if(document.myreviewfrm.nRviewSn[i].checked){
				parity++;
			}
		}

		if(parity==0){
			alert("ÇÏ³ª ÀÌ»óÀÇ ¼­ÀûÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä");
			return false;								
		}else{
			return true;
		}
	}				
}

function goreviewdelete(){
	var frm = document.myreviewfrm;

	var action_url = "/include/review_action.php?sMode=delete&pageflag=mybook&nRviewSn=";
	var strscript = ""
	for(i=0;i<frm.nRviewSn.length;i++){
		if(frm.nRviewSn[i].checked){
			if(strscript.length>0){
				strscript = strscript + ",";
			}
			strscript = strscript + frm.nRviewSn[i].value;
		}
	}
	if(isNaN(parseInt(frm.nRviewSn.length))){
		if(!frm.nRviewSn.checked){
			alert("ÇÏ³ª ÀÌ»óÀÇ ¸®ºä¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä");
		}else{
			strscript = frm.nRviewSn.value;
			window.open(action_url + strscript, 'self_move', 'width=323,height=146,scrollbars=no');
		}
	}else{
		var chkcnt = frm.nRviewSn.length;
		var parity = 0;
		for(i = 0 ; i < chkcnt ; i++){
			if(frm.nRviewSn[i].checked){
				parity++;
			}
		}

		if(parity==0){
			alert("ÇÏ³ª ÀÌ»óÀÇ ¸®ºä¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä");
		}else{
			window.open(action_url + strscript, 'self_move', 'width=323,height=146,scrollbars=no');
		}
	}
}

function reviewNum_check(chk_num, pivot) {
	for(i=0;i<document.myreviewfrm.nRviewSn.length;i++){
		nRviewSn = "";
		if(i!=pivot){
			nRviewSn = document.myreviewfrm.nRviewSn[i].value;
			if(chk_num==nRviewSn){
				if(document.myreviewfrm.nRviewSn[pivot].checked){
					document.myreviewfrm.nRviewSn[i].checked = true;
				}else{
					document.myreviewfrm.nRviewSn[i].checked = false;
				}
			}
		}
	}
}

function zzimitemCheck(frm){
	var form_e = document.myzzimfrm;

	if(isNaN(parseInt(form_e.mybooksn.length))){
		if(!form_e.mybooksn.disabled){
			if(form_e.allcheck.checked){
				form_e.mybooksn.checked = true;
			}else{
				form_e.mybooksn.checked = false;
			}
		}
	}else{
		for(var i=0;i<form_e.mybooksn.length;i++){
			if(!form_e.mybooksn[i].disabled){
				if(form_e.allcheck.checked){
					form_e.mybooksn[i].checked = true;
				}else{
					form_e.mybooksn[i].checked = false;
				}
			}
		}
	}
}

function zimmverify_item(frm)
{
	var form_e = document.myzzimfrm;
	var chk_val;
	var arg = "";

	chk_val = 0;

	if(isNaN(parseInt(form_e.mybooksn.length))){
		if(!form_e.mybooksn.disabled){
			if(form_e.mybooksn.checked){
				arg = arg + form_e.mybooksn.value + ",";
				chk_val++;
			}
		}
	}else{
		for(var i=0;i<form_e.mybooksn.length;i++){
			if(!form_e.mybooksn[i].disabled){
				if(form_e.mybooksn[i].checked){
					arg = arg + form_e.mybooksn[i].value + ",";
					chk_val++;
				}
			}
		}
	}
	
	if(chk_val<1){
		alert("ÇÏ³ª ÀÌ»óÀÇ Ã¥À» ¼±ÅÃÇØÁÖ¼¼¿ä.");
		return false;
	}else{
		return zimmdelconfirm(arg);
	}
}

function zimmdelconfirm(arg)
{
	var form_e = document.myzzimfrm;
	
	form_e.aeid.value = arg;

	var ans = confirm('»èÁ¦ÇÏ½Ã°Ú½À´Ï±î?');
	if (ans) {
		return true;
	}else{
		return false;
	}
}

function zimmdelall()
{
	var form_e = document.myzzimfrm;
	
	form_e.aeid.value = "all";

	var ans = confirm('³»°¡ ÂòÇÑÃ¥ ÀüÃ¼¸¦ »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?');
	if (ans) {
		form_e.submit();
	}
}

function emlayerpop(ar_id, blogflag , ar_name) {
	user_id = ar_id;
	user_name = ar_name;
	
	var atag;
	var bookfri;
	var blogli;
	
	/* ***************************************** */
	/* ºí·Î±× ÀÎÅÍÆäÀÌ½º ¹®Á¦·Î Àá½Ã ÀÌºÎºÐ Ã³¸® */
	try{
		if(blogflag=="")
			blogflag="0";
	}
	catch(e) {
		blogflag="0";
	}
	/* ***************************************** */

	try {
		var strStatus;
		//blogli = "<a href=\"javascript:gouserblog('"+ar_id+"', "+blogflag+");\">ºí·Î±× ¹Ù·Î°¡±â</a>";
		if(user_name == undefined || user_name == "")
			atag = "<a href=\"/theme.html?spage=review&suid="+user_id+"\">"+user_id.substring(1,12)+".. ´ÔÀÇ<br />¸®ºäÀüÃ¼º¸±â</a>";
		else
			atag = "<a href=\"/theme.html?spage=review&suid="+user_id+"\&sname="+user_name+"\">"+user_name+" ´ÔÀÇ<br />¸®ºäÀüÃ¼º¸±â</a>";
		bookfri = "<a href=\"javascript:addbookfriend('"+user_id+"', '"+blogflag+"' ,  '"+user_name+"' );\">Ã¥ Ä£±¸ ¸Î±â</a>";
		//document.getElementById("gouserblog").innerHTML = blogli;
		document.getElementById("addfri").innerHTML = bookfri;
		document.getElementById("useid").innerHTML = atag;
		output.innerHTML = strStatus;
	}
	catch(e) {
	}
}

function gouserblog(ar_id, flag) {
	if(flag==-1){
		alert("»ç¿ëÀÚÀÇ ºí·Î±×´Â Æó¼âµÈ »óÅÂÀÔ´Ï´Ù.");
		return;
	}else if(flag==0){
		alert("»ç¿ëÀÚÀÇ ºí·Î±×´Â ¾ø½À´Ï´Ù.");
		return;
	}

	window.open("http://blog.empas.com/"+ar_id+"/", "blog", "toolbar=yes,status=yes,location=yes,menubar=yes,scrollbars=yes,resizable=yes");
}

// HttpRequest
function HttpRequest(url, act){
	var XMLHttp = false;

	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		XMLHttp = new XMLHttpRequest();
		if (XMLHttp.overrideMimeType) {
			XMLHttp.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) { // IE
		try {
			XMLHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				XMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}

	if (!XMLHttp) {
	   alert('ºê¶ó¿ìÀúÀÇ ¹öÀüÀÌ ³·¾Æ ÇØ´ç ±â´ÉÀ» »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù');
	   return false;
	}
	XMLHttp.onreadystatechange = function() {
		if (XMLHttp.readyState == 4) {
			if (XMLHttp.status == 200) {
				eval(act + '(XMLHttp.responseText)');
			} else {
				alert('There was a problem with the request.(Code: ' + XMLHttp.status + ')');
			}
		}
	}
	XMLHttp.open('GET', url, true);
	XMLHttp.setRequestHeader("Accept-Language","ko");
	XMLHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=EUC-KR");

	XMLHttp.send(null);
}

function ajaddbookfriend(fri_id, blogflag , fri_name) {
	form = document.emfrendplus;
	form.sbfrid.value=fri_id;
	form.blflag.value=blogflag;
	form.sbfrname.value=fri_name;
	form.method="post";
	form.action="/include/addbookfriend_act.php?returnurl="+escape(document.location.href);
	form.submit();

	//pageurl = "/include/addbookfriend_act.php";
	//paramlist = "?sbfrid=" + fri_id + "&blflag="+blogflag + "&sbfrname="+fri_name;

	//url = pageurl + paramlist;
	//HttpRequest(url, "addfriResult");
	//location.href = url;
}

function addfriResult(responseText) {
	//document.getElementById("addfriresultid").innerHTML = responseText;
	if(responseText=="login"){
		alert("·Î±×ÀÎ ÈÄ »ç¿ë °¡´ÉÇÕ´Ï´Ù.");
		return;
	}else if(responseText==1){
		alert("¼º°øÀûÀ¸·Î Ã¥ Ä£±¸°¡ µÇ¼Ì½À´Ï´Ù.");
		return;
	}else if(responseText==0){
		alert("Ã¥ Ä£±¸ ¸Î±â¿¡ ½ÇÆÐ Çß½À´Ï´Ù.");
		return;
	}else if(responseText==2){
		alert("Ã¥ Ä£±¸ ¸ÎÀ» ID°¡ ¾ø½À´Ï´Ù.");
		return;
	}else{
		alert(responseText);
		return;
	}
}

function textResultlist(squery, page, skind, booksn) {
	pageurl = "/include/right/textsearch_action.php";
	paramlist = "?squery=" + squery + "&npagenum=" + page + "&skind="+skind + "&booksn=" + booksn;

	url = pageurl + paramlist;
	HttpRequest(url, "searchResultList");
}

function searchResultList(responseText) {
	document.getElementById("searchResultId").innerHTML = responseText;
}

function frmtextsearchs(frm) {
	if(frm.npagenum.value==0) {
		frm.npagenum.value = 1;
	}
	if(frm.squery.value==0){
		alert('°Ë»ö¾î¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä');
		frm.squery.focus ();
		return (false);
	}else{
		textResultlist(frm.squery.value, frm.npagenum.value, frm.skind.value, frm.booksn.value);
		return (false);
	}
}

function userbookviewlink (bid) {
	parent.document.location = "/detail.html?sbid="+bid;
}

function golinkpage(sn, lk, di){
	var gbsn;
	if(di == 0){
		gbsn = "?bsn="+sn+"&golink="+lk+"&di="+di;
	}
	else
	{
		gbsn = "?bsn="+sn+"&golink="+lk;
	}
	window.open("/include/golink.php"+gbsn, "gopage", "toolbar=yes,status=yes,location=yes,menubar=yes,scrollbars=yes,resizable=yes");
	//location.href = "/include/golink.php"+gbsn;
}

function golinkpage_self(sn, lk, di){
	var gbsn;
	if(di == 0){
		gbsn = "?bsn="+sn+"&golink="+lk+"&di="+di;
	}
	else
	{
		gbsn = "?bsn="+sn+"&golink="+lk;
	}
	location.href = "/include/golink.php"+gbsn;
}

function MoveTab ( idname , idx , no) {

	for(var i = 1 ; i <= no ; i++){
		id = idname + i;
		if(i == idx ){
			document.getElementById(id).style.display = "block";
		}else{
			document.getElementById(id).style.display = "none";	
		}
	}
}

function sOpenBookimgSwap(sid, idname, idx, no) {
	var _strAgent = navigator.userAgent.toLowerCase();
	var sbrverIE6 = (_strAgent.indexOf("msie 6.0") != -1);
	var sFlag = "N";
	for(var ir = 1; ir <= 6; ir++) {
		var sidx = sid + ir;

		if(ir == idx) {
			if(document.getElementById(sidx)) {
				document.getElementById(sidx).style.border = "3px solid #FF8A00";
				document.getElementById(sidx).style.marginTop = "0";
			}
		} else {
			if(document.getElementById(sidx)) {
				document.getElementById(sidx).style.border = "1px solid #D9D7D8";
				document.getElementById(sidx).style.marginTop = "2px";
			}
		}
	}
	MoveTab (idname, idx, no);
	if(document.getElementById("todaybook7")) {
		document.getElementById("todaybook7").style.display = "none";
	}
}

function mobilebookbuy(book_num, btit){
	var booksn;
	booksn = "?book_num="+book_num+"&btit="+btit;
	window.open("http://www.booktopia.com/booktopia/nate/mobile_buy.asp"+booksn, "mobilebuy", "left=300, top=300, width=410, height=372, scrollbars=no, resizable=no");
}

function mobilebookpre(book_num){
	var booksn;
	booksn = "?presn="+book_num;
	window.open("http://www.booktopia.com/booktopia/nate/mobile_preview.asp"+booksn, "mobilepreview", "left=300, top=300, width=410, height=372, scrollbars=no, resizable=no");
}

//º»¹®°Ë»ö Æû Ã¼Å©
function verify_frmtextSearch (f) {
	if(f.q.value.length == 0) {
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä!");
		f.q.focus();
		return false;
	}else{
		//f.q.value = escape(f.q.value);
		f.submit();
	}
}

// iframe ³ôÀÌ Á¶Àý
function calcHeight(iframe_id){
	var objIframeBody = document.getElementById(iframe_id);
	var innerBody = objIframeBody.contentWindow.document.body;
	var the_height = innerBody.scrollHeight + (innerBody.offsetHeight - innerBody.clientHeight);
	document.getElementById(iframe_id).height = the_height + 'px';

	if (typeof(parent.MovePage) == 'function') {
		parent.resizeCurrentFrame(null);
	}
}

// ·Î±×ÀÎ Ã¢ ÆË¾÷¶ç¿ì±â. ´ñ±Û ±ÛÀÔ·Â½Ã »ç¿ë 
function openLoginPopup(){
	//var returnurl = "http://book.nate.com/popup/comment_redirect.php?redirect="+document.location.href+"&aname=comment";
	var returnurl = escape(document.location.href+"&aname=comment");
	//alert(returnurl);
	document.location = "http://xo.nate.com/login.jsp?redirect="+returnurl;
	//window.open("http://hrd.empas.com/r/nt_ln_etc/u=login.empas.com/session/login.html?popup=1&es=" + returnurl,"bookmark","width=760,height=460,status=yes");
}

function keyCancel(e){
	var event = window.event?window.event:e;
	var evtCode = window.event?event.keyCode:e.which;

	if(evtCode==13){
		if(event.preventDefault)
			event.preventDefault();
		else
			event.returnValue = false;
		return;
	}
}

// ÇÑ±Û±æÀÌ Ã¼Å©
function textCounter(fvalue,maxChars){ 
	var strCharCounter = 0;
	
	fvalue = fvalue.replace('<P>','');
	fvalue = fvalue.replace('</P>','');
	fvalue = fvalue.replace('&nbsp;',' ');
	var intLength = fvalue.length; 
	
	for (var i = 0; i < intLength; i++){ 
		var charCode = fvalue.charCodeAt(i); 
		//ÇÑ±ÛÀÏ °æ¿ì 
		if (charCode > 128) 
			strCharCounter += 2; 
		else  
			strCharCounter++; 
	}
	
	if(strCharCounter >= maxChars) 
		return true; 
	else
		return false;
}

function RecentMarq(kind) {
	switch(kind) {
		case 1:
			recentNews.stop();
			break;
		case 2:
			recentNews.start();
			break;
	}
}

function menu_getObjs() {
	var nObjCnt = menu_layers.length;
	var i = 0
	if ( msie4 == 1) {
		menu_objsPhoto = document.all.photo;
		menu_objsGossip = document.all.gossip;
	} else {
		for (i = 0 ; i < nObjCnt ; i++) {
			menu_objs[i] = document.getElementById(menu_layers[i]);
		}
	}
}

function showHide(menu) {
	if (msie4 == 1) {
		menu_objsPhoto != null ? "" : menu_getObjs();
		if (menu == menu_objsPhoto.id ) {
			menu_objsPhoto.style.display = "";
			menu_objsGossip.style.display = "none";
		} else {
			menu_objsPhoto.style.display = "none"
			menu_objsGossip.style.display = "";
		}
	} else {
		menu_objs[0] != null ? "" : menu_getObjs();
		if (menu == menu_objs[0].id ) {
			menu_objs[0].style.display = "";
			menu_objs[1].style.display = "none";
		} else {
			menu_objs[0].style.display = "none"
			menu_objs[1].style.display = "";
		}
	}
}

var rLastImg=new Array();
function noImage(imageObj, filename) {
	if ( !rLastImg[imageObj.sourceIndex] ) {
		rLastImg[imageObj.sourceIndex]=filename;
		imageObj.src = filename;
		imageObj.width=100;
	} else {
		imageObj.src="http://img.empas.com/ni/blank.gif";
		imageObj.width=0;
		imageObj.height=0;
	}
}

var banner_1_mouseEvent = 1;
var banner_2_mouseEvent = 1;
var banner_cheer_mouseEvent = 1;
// banner_roll("divÅÂ±× id", ¹è³Ê1°³³ôÀÌ, µô·¹ÀÌ, 1Ä­ÀÌµ¿¼Óµµ, 0);
// »ó´Ü top ¿µ¿ª ¸ðµÎ »ç¿ë
function banner_roll(div_id, banner_height, banner_delay, banner_speed, this_height){
	if (eval(div_id + "_mouseEvent")) {
		var div_tag = document.getElementById(div_id);
		var a_tag, i;
		this_height++;

		if(this_height < banner_height){
			div_tag.style.top = -this_height;
			setTimeout("banner_roll('" + div_id + "', " + banner_height + ", " + banner_delay + ", " + banner_speed + ", " + this_height + ");", banner_speed);
		} else {
			a_tag = div_tag.getElementsByTagName("table");
			//div_tag.appendChild(a_tag[0]);
			//alert(div_tag.innerHTML);
			child=div_tag.removeChild(a_tag[0]);
			div_tag.appendChild(child);
			//alert(div_tag.innerHTML);
			div_tag.style.top = 0;
			setTimeout("banner_roll('" + div_id + "', " + banner_height + ", " + banner_delay + ", " + banner_speed + ", 0);", banner_delay);
		}
	} else {
		setTimeout("banner_roll('" + div_id + "', " + banner_height + ", " + banner_delay + ", " + banner_speed + ", " + this_height + ");", banner_speed);
	}
	return true;
}
// ¿ìÃø ¸¹ÀÌ º»±â»ç, index¿µ¿ª¿¡¼­ »ç¿ë
function DisplayPart(divname,index) {
	if (divname == "news") {
		var cnt = 4;
	} else {
		var cnt = 2;
	}
	for(i = 1; i <= cnt; i++) {
		if(index == i) {
			thisPart = eval(divname + index + ".style");
			thisPart.display = "";
		} else {
			otherPart = eval(divname + i + ".style");
			otherPart.display = "none";
			if (divname == "mythmbarlist" && index == 2) {
				otherPart.display = "";
			}
		}
	}
}

function addbookfriend(ar_id, blogflag , ar_name) {
	var fri_id = "<?=$varCookie['id']?>";

	if(fri_id.length==0){
		redirect_login('<?=$sGlobalReturn_url?>');
		return;
	}

	if(fri_id == ar_id){
		alert("ÀÚ½Å°ú´Â Ã¥ Ä£±¸ ¸Î±â¸¦ ÇÒ ¼ö ¾ø½À´Ï´Ù.");
		return;
	}
	if(confirm("³» Ã¥Ä£±¸·Î µî·ÏÇÏ½Ã°Ú½À´Ï±î?\nMyÃ¥ ¸Þ´º¸¦ ÅëÇØ ³» Ã¥Ä£±¸»õ±Û¼Ò½ÄÀ» º¼ ¼ö ÀÖ½À´Ï´Ù.")){
		ajaddbookfriend(ar_id, blogflag , ar_name);
	}else{
		return;
	}
}

// YES24 ¹Ì¸®º¸±â ÆË¾÷Ã¢
function openPreview(yes24id, sbid){
	var strAgent = navigator.userAgent.toLowerCase();
	var bIE = (strAgent.indexOf("msie") != -1);
	
	if(bIE){
		window.open('http://www.yes24.com/home/openinside/viewer_nate.asp?code='+yes24id+'&sbid='+sbid,'preview','width=1050,height=800,menubar=no,status=no');
	}
	else {
		alert("ÁË¼ÛÇÕ´Ï´Ù.  Microsoft Internet ExplorerÀÌ¿ÜÀÇ ºê¶ó¿ìÀú´Â ¹Ì¸®º¸±â¸¦ Áö¿øÇÏÁö ¾Ê½À´Ï´Ù");	
	}
}
