
function add_favorite(){
	window.external.AddFavorite('http://promurim.barobook.com/main.asp','¿Â¶óÀÎ ¹«Çù¼Ò¼³ÀÇ ¸ÞÄ«! ÇÁ·Î¹«¸²')
}

function goMemberJoin(){
	location.href = '/my/member_join.asp';
}

function goFindIdPw(){
	location.href = '/my/find_idpasswd.asp';
}


function goLogin(){
	location.href = "/my/login.asp?rtnUrl="+getPageUrl();
}

function goHelp(){
	location.href = "/help/customer.asp";
}

function goLogout(){
	location.href = "/common/inc/logout.asp";
}

function goMylibrary(){
	location.href = "/my/my_library.asp";
}

function goReadHistory(page_code){
	location.href = "/my/my_read_history.asp?page_code="+page_code;
}

function goReview(){
	location.href = "/recommend/recomm_reply.asp";
}

function goCustomCenter(){
	location.href = "/bbs/board.asp";
}

function goMySellList(){
	location.href='/my/my_pay_novel.asp';
}

function goBaroMoney(){
	location.href = "/pay/pay_baromoney.asp";
}

function goSellTicket(good_code){

	var a_href = "/pay/pay_choice.ticket.asp?good_code="+good_code;
	open_flag = "toolbar=no,scrollbars=no,status=no,resizeable=no,height=190,width=356";
	window.open(a_href,"popup_pay", open_flag);
}

function goPremium(class_name)
{
	// muhyup, fantasy, mystery, sf, horror, book
	if(class_name == null){
		class_name = 'muhyup';
	}

	location.href = '/book/premium_list.asp?class_name='+class_name;
}

function goNovel(class_name)
{
	// muhyup, fantasy, mystery, sf, horror, book
	if(class_name == null){
		class_name = 'muhyup';
	}

	location.href = '/book/novel_list.asp?class_name='+class_name;
}

function goCartoon(class_name)
{
	// muhyup, fantasy, comic, action, sports
	if(class_name == null){
		class_name = 'muhyup';
	}

	location.href = '/book/cartoon_list.asp?class_name='+class_name;
}

function goEnjoy(page_code)
{
	// fun, waryong, secret
	if(page_code == null){
		page_code = 'FUN';
	}

	if(page_code == 'secret'){
		goSecret('adult');
	}else{
		location.href = '/enjoy/main.asp?page_code='+page_code.toUpperCase();
	}
}

function goFun(class_name, serial)
{
	if(serial == 'Y'){
		goEnjoySerialList('FUN', class_name);
	}else{
		location.href = '/enjoy/novel_list.asp?page_code=FUN&class_name='+class_name;
	}
}

function goWaryong(class_name, serial)
{
	if(serial == 'Y'){
		goEnjoySerialList('WARYONG', class_name);
	}else{
		location.href = '/enjoy/novel_list.asp?page_code=WARYONG&class_name='+class_name;
	}
}

function goSecret(class_name, serial)
{
	if(serial == 'Y'){
		goEnjoySerialList('SECRET', class_name);
	}else{
		location.href = '/enjoy/novel_list.asp?page_code=SECRET&class_name='+class_name;
	}
}

function goEnjoySerialList(page_code, class_name){
	location.href = '/enjoy/serial_list.asp?page_code='+page_code+'&class_name='+class_name;
}

function detailEnjoySerial(page_code, book_num){
	location.href = '/enjoy/serial_detail.asp?page_code='+page_code+'&book_num='+book_num
}

function goSeries(class_name)
{
	// monopoly, author, rookie
	if(class_name == null){
		location.href = '/serial/main.asp';
	}else if(class_name == 'monopoly'){
		location.href = '/serial/serial_list_mono.asp';
	}else if(class_name == 'author'){
		location.href = '/serial/serial_list_author.asp';
	}else if(class_name == 'rookie'){
		location.href = '/serial/serial_list_ijakga.asp';
	}
}

function goFree(class_name)
{
	// novel, cartoon, premium
	if(class_name == null){
		class_name = 'novel';
	}

	location.href = '/book/free_novel.asp?class_name='+class_name.toUpperCase();
}

function goRecomm(class_name)
{
	// reply, manager, theme, author
	if(class_name == null){
		class_name = 'reply';
	}
	location.href = '/recommend/recomm_'+class_name+'.asp';
}

function goRecommMenagerDetail(num)
{
	location.href = '/recommend/recomm_manager_detail.asp?num='+num;
}

function goRecommThemeDetail(theme_num)
{
	location.href = '/recommend/recomm_theme_detail.asp?theme_num='+theme_num;
}

function goRecommThemeAuthor(theme_num)
{
	location.href = '/recommend/recomm_author_detail.asp?theme_num='+theme_num;
}

function goBbs(class_name)
{
	// murim, fantasy, news, classic, box, market
	if(class_name == null){
		class_name = 'murim';
	}

	if(class_name == "murim" || class_name == "fantasy"){
		goDictionary(class_name+'_dic', '');
	}else if(class_name == "market"){
		location.href = '/bbs/murim_market.asp';
	}else if(class_name == "news"){
		location.href = '/bbs/murim_news.asp';
	}else{
		alert('/bbs/?class_name='+class_name);
		return;

		location.href = '/bbs/?class_name='+class_name;
	}
}

function goDictionary(page_code, forum_id)
{
	location.href = '/bbs/murim_dictionary.asp?page_code='+page_code.toUpperCase()+'&forum_id='+forum_id;
}

function goDictionaryDetail(page_code, forum_id, num)
{
	location.href = '/bbs/murim_dictionary_detail.asp?page_code='+page_code+'&forum_id='+forum_id+'&num='+num;
}

function goRedseries()
{
	location.href = '/redseries.asp';
}

/* °Ë»ö ÆäÀÌÁö¿¡¼­ »ç¿ë */
function searchTotal(searchType){
	location.href='/search/search_total.asp?searchType='+searchType;
}
function searchTotalByChar(start_chr, end_chr){
	var frm = document.frm_total;
	frm.start_chr.value = start_chr;
	frm.end_chr.value = end_chr;
	frm.submit();
}
/* °Ë»ö ÆäÀÌÁö¿¡¼­ »ç¿ë End */

function showDetailInfo(series_num, main_class)
{
	location.href = '/book/novel_detail.asp?main_class='+main_class+'&series_num='+series_num;
}

function searchDetailInfo(series_num, class_num)
{
	if(class_num == '0401'){
		detailEnjoySerial('WARYONG', series_num);
	}else if(class_num == '0501'){
		detailEnjoySerial('FUN',series_num);
	}else{
		showDetailInfo(series_num, class_num.substring(0,2));
	}
}

function showMonoSerialDetail(book_num)
{
	location.href = '/serial/serial_detail_mono.asp?book_num='+book_num;
}

function showAuthorSerialDetail(list_num, page)
{
	if(page == null){
		page = 1;
	}
	location.href = '/serial/serial_detail_author.asp?list_num='+list_num+'&page='+page;
}

function showAuthorSerialView(num, page)
{
	if(page == null){
		page = 1;
	}
	location.href = '/serial/serial_view_author.asp?num='+num+'&page='+page;
}

function showIjakgaSerialDetail(series_id)
{
	location.href = '/serial/serial_detail_ijakga.asp?series_id='+series_id;
}

function showIjakgaSerialView(install_id, page)
{
	if(page == null){
		page = 1;
	}
	location.href = '/serial/serial_view_ijakga.asp?install_id='+install_id+'&page='+page;
}

function searchBookBYAuthor(user_num)
{
	location.href = '/search/search.author.asp?author_num='+user_num;
}

function searchBookBYPublisher(publisher)
{
	location.href = '/search/search.publisher.asp?publisher='+publisher;
}

function goNotice(){
	location.href = '/bbs/notice.asp';
}

function showNoticeDetail(num)
{
	location.href='/bbs/notice.read.asp?num='+num;
}

function open_preview(series_num)
{
	var a_href = "/book/ebook_preview.asp?book_num="+series_num;
	open_flag = "toolbar=no,scrollbars=no,status=no,resizeable=no,height=190,width=356";
	window.open(a_href,"ebookPreViewer", open_flag);
}

function open_book(series_num, series_order, page_code)
{
	var a_href = "/book/ebook_viewer.asp?page_code="+page_code+"&series_num="+series_num+"&series_order="+series_order;
	open_flag = "toolbar=no,scrollbars=no,status=no,resizeable=no,height=190,width=356";
	window.open(a_href,"ebookViewer", open_flag);
}

function open_part(series_num, part_num, page_code)
{
	var a_href = "/book/ebook_viewer.asp?page_code="+page_code+"&series_num="+series_num+"&series_order=1&part_num="+part_num;
	open_flag = "toolbar=no,scrollbars=no,status=no,resizeable=no,height=190,width=356";
	window.open(a_href,"ebookViewer", open_flag);
}

function alertSaveID() 
{
	if (login_form.saveID.checked==true)
	alert("°³ÀÎ ÄÄÇ»ÅÍ°¡ ¾Æ´Ò °æ¿ì¿¡´Â ±ÇÀåÇÏÁö ¾Ê½À´Ï´Ù.\n\nÃ¼Å©½Ã Å¸ÀÎ¿¡°Ô Á¤º¸°¡ °ø°³ µÉ ¼ö ÀÖ½À´Ï´Ù.");
}


function show_help_bonus()
{
	var a_href = "/help/help_bonus.asp";
	open_flag = "toolbar=no,scrollbars=no,status=no,resizeable=no,height=190,width=356";
	window.open(a_href,"help", open_flag);
}

function show_help_premium()
{
	var a_href = "/help/help_premium.asp";
	open_flag = "toolbar=no,scrollbars=no,status=no,resizeable=no,height=190,width=356";
	window.open(a_href,"help", open_flag);
}

function show_help_new_promurim()
{
	var a_href = "/help/help_new_promurim.asp";
	open_flag = "toolbar=no,scrollbars=no,status=no,resizeable=no,height=190,width=356";
	window.open(a_href,"help", open_flag);
}


function submit_login(frm)
{
	if(frm.str_id.value.length == 0) {
		alert('¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä.');
		frm.str_id.focus();
		return false;
	}
	else if(frm.str_pwd.value.length == 0) {
		alert('ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä.');
		frm.str_pwd.focus();
		return false;
	}
	
	if(is_empty(frm.return_url)){
		frm.return_url.value = getPageUrl();
	}

	if (!frm.isSecurity.checked)
	{
		frm.action = "https://login.barobook.com/";
		return true;
	}
}

function submit_search(frm)
{

	if(is_empty(frm.searchString)) {
		alert('°Ë»öÇÒ ³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä');
		frm.searchString.focus();
		return false;
	}else if(frm.searchString.length > 30) {
		alert('°Ë»öÀº 30ÀÚ ÀÌÇÏ·Î ÇØ ÁÖ¼¼¿ä');
		frm.searchString.focus();
		return false;
	}

	frm.action = "/search/search.list.asp";
	return true;
}

function checkPrivate(frm){
	if(frm.passwd.value.length < 4){
		alert('ºñ¹Ð¹øÈ£´Â 4ÀÚ ÀÌ»ó ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.');
		frm.passwd.value = '';
		frm.passwd.focus();
		return;
	}else if(frm.passwd.value.length > 8){
		alert('ºñ¹Ð¹øÈ£´Â 8ÀÚ ÀÌÇÏ·Î ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.');
		frm.passwd.value = '';
		frm.passwd.focus();
		return;
	}else if(frm.passwd.value != frm.passwd_confirm.value){
		alert('ºñ¹Ð¹øÈ£°¡ ¼­·Î ¸ÂÁö ¾Ê½À´Ï´Ù.\nÈ®ÀÎ ÈÄ ´Ù½Ã ÀÔ·ÂÇØ ÁÖ¼¼¿ä');
		frm.passwd.value = frm.passwd_confirm.value = '';
		frm.passwd.focus();
		return;
	}else{
		frm.action = "my_private.process.asp";
		frm.submit();
	}

}

function search_postnum()
{
	var a_href = "/my/search_postnum.asp";
	open_flag = "toolbar=no,scrollbars=no,status=no,resizeable=no,height=190,width=456";
	window.open(a_href,"postnum", open_flag);
}


function resetOrder(page_code, orderString)
{
	location.href = "/book/"+page_code+"_list.asp?class_name="+class_name+"&orderString="+orderString;
}

function enjoyOrder(page_code, orderString)
{
	location.href = "/enjoy/novel_list.asp?page_code="+page_code+"&class_name="+class_name+"&orderString="+orderString;
}

function resetDisplay(show_flag)
{
	set_cookies("showFlag", show_flag, null);

	var pageUrl = location.href;
	if(pageUrl.indexOf('?') < 0){
		location.reload();
		return;
	}

	var queryString = pageUrl.substring(pageUrl.indexOf('?')+1, pageUrl.length);
	var args = queryString.split('#')[0].split('&');
	var hostUrl = pageUrl.substring(0, pageUrl.indexOf('?')+1);
	
	for(i=0;i<args.length;i++){
		if(args[i].indexOf('page=') < 0)
			hostUrl += (args[i]+'&');
	}

	location.href = hostUrl;

//	location.reload();
}

function sell_series_books(frm){
	var len = frm.series_order.length;

	if(len == undefined){
		frm.series_order.checked = true;
	}else{
		for(i = 0; i < len; i++){
			if(!frm.series_order[i].disabled){
				frm.series_order[i].checked = true;
			}
		}
	}
	
	sellPremiumSeries(frm);
}

function sell_choice_books(frm){
	if(frm.series_order == undefined){
		alert('±¸¸ÅÇÒ µµ¼­¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä');
		return;
	}

	var chk_length = frm.series_order.length;
	var chk_choice = false;
	if(chk_length == undefined){
		if(frm.series_order.checked == false){
			alert('±¸¸ÅÇÒ µµ¼­¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä');
			return;
		}
	}else{
		for(i = 0; i < chk_length; i++){
			if(frm.series_order[i].checked == true){
				chk_choice = true;
				break;
			}
		}
		if (!chk_choice){
			alert('±¸¸ÅÇÒ µµ¼­¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä');
			return;
		}
	}

	open_flag = "toolbar=no,scrollbars=no,status=no,resizeable=no,height=190,width=356";
	window.open("/blank.htm","popup_sell", open_flag);

	frm.action = "/pay/pay_choice.premium.asp?total_flag=N";
	frm.target = "popup_sell";
	frm.submit();
}

function sellPremiumSeries(frm){
	open_flag = "toolbar=no,scrollbars=no,status=no,resizeable=no,height=190,width=356";
	window.open("/blank.htm","popup_sell", open_flag);

	frm.action = "/pay/pay_choice.premium.asp?total_flag=Y";
	frm.target = "popup_sell";
	frm.submit();
}
