var popup_type,popup_id,drag_callback="";getUrlEncodedKey=function(e,a){if(!a)a=window.location.search;var b=RegExp("[?|&]"+e+"=(.*?)&").exec(a+"&");if(!b||b.length<2)return"";return decodeURIComponent(b[1].replace("+"," "))};setUrlEncodedKey=function(e,a,b){b=b||window.location.search;b=b+"&";var d=RegExp("[?|&]"+e+"=.*?&");if(d.test(b))b=b.replace(d,"&"+e+"="+encodeURIComponent(a)+"&");else b+=e+"="+encodeURI(a);b=b.trimStart("&").trimEnd("&");return b[0]=="?"?b:"?"+b};
String.prototype.trimEnd=function(e){if(e)return this.replace(RegExp(e.escapeRegExp()+"*$"),"");return this.replace(/\s+$/,"")};String.prototype.trimStart=function(e){if(e)return this.replace(RegExp("^"+e.escapeRegExp()+"*"),"");return this.replace(/^\s+/,"")};String.prototype.escapeRegExp=function(){return this.replace(/[.*+?^${}()|[\]\/\\]/g,"\\$0")};
var drag_board_writeForm={init:function(){var e=$("#content_frame").width();if(board_editor_style=="full")CKEDITOR.replace("content",{language:locale,extraPlugins:"uicolor",uiColor:drag_editor_color,scayt_autoStartup:false,height:drag_editor_height,resize_dir:"vertical",contentsCss:"/css/draghome-0.1.2/draghome-0.1.2.css",enterMode:2,shiftEnterMode:2,toolbar:[["Source","-","NewPage","Preview","Print"],["Find","Replace","-","SelectAll","RemoveFormat"],["Image","Flash","Table","HorizontalRule","Smiley",
"SpecialChar","PageBreak"],["Maximize","ShowBlocks"],"/",["Bold","Italic","Underline","Strike","-","Subscript","Superscript"],["NumberedList","BulletedList","-","Outdent","Indent","Blockquote","CreateDiv"],["JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock"],["Link","Unlink","Anchor"],"/",["Styles","Format","Font","FontSize"],["TextColor","BGColor"]]});else board_editor_style=="mini"&&CKEDITOR.replace("content",{language:locale,extraPlugins:"uicolor",uiColor:drag_editor_color,scayt_autoStartup:false,
height:drag_editor_height,resize_dir:"vertical",contentsCss:"/css/draghome-0.1.2/draghome-0.1.2.css",enterMode:2,shiftEnterMode:2,toolbar:[["Source","-","NewPage","Preview","Print"],["Bold","Italic","Underline","Strike"],["Link","Unlink","Anchor"],["Font","FontSize"],["TextColor","BGColor"]]});$("#excerpt").width(e-22);$("#dialog_send").dialog({bgiframe:true,autoOpen:false,width:300,height:150,modal:true});new AjaxUpload("#fileUploader_btn",{action:"/?pid="+pid+"&mname=board&act=FileUpload&moduleonly=1&context_key=1",
name:"uploadfile",responseType:"json",onSubmit:drag_board_upload_function,onComplete:function(a,b){if(b.is_error==0){$("#uploaded_file_list").append("<option value='"+b.filepath+"' selected='selected'>"+b.filename+" ("+b.filesize+")</option>");$("#preview_uploaded").html("<img src='"+b.filepath+"' width='64' height='64' alt='' />")}else alert(b.msg);$("#dialog_send").dialog("close")}});$("#uploaded_file_list").click(function(){$("#preview_uploaded").html("<img src='"+$(":selected",this).val()+"' width='64' height='64' alt='' />")});
$("#fileEntry_btn").click(function(){var a=CKEDITOR.instances.content;a.mode=="wysiwyg"?$("#uploaded_file_list :selected").each(function(b,d){if($(d).val().toUpperCase().indexOf(".JPG")>=0||$(d).val().toUpperCase().indexOf(".GIF")>=0||$(d).val().toUpperCase().indexOf(".PNG")>=0){var c="<a rel='colorbox' title='"+$(d).val()+"' href='"+$(d).val()+"'><img src='"+$(d).val()+"' alt='' /></a>";a.insertHtml(c)}}):alert(lg("You must be on WYSIWYG mode."))});$("#back_btn").click(function(){history.back()});
$("#autosave_btn").click(function(){if(user_id!="0"){var a=CKEDITOR.instances.content,b=$("#boardForm").formSerialize();b+="&content="+_esc(a.getData());$.post("/?pid="+pid+"&mname=board&act=AutoSave&moduleonly=1",b,function(d){eval("("+d+")").is_error==0?alert(lg("Succeed")):alert(lg("Failed"))})}else alert(lg("Login is required"))});$("#submit_btn").click(function(){if(user_id=="0"){if($("#user_name").val()==""){alert(lg("Please enter your name"));$("#user_name").focus();return false}if($("#password").val()==
""){alert(lg("Please enter a password"));$("#password").focus();return false}}if($("#category").length!=0)if($("#category").val()=="0"){alert(lg("Please choose the category"));return false}if($("#title").val()==""){alert(lg("Input your post title"));$("#title").focus();return false}var a=CKEDITOR.instances.content;if(a.getData()==""){alert(lg("Insert content"));return false}$("#content").val(a.getData());a=$("#boardForm").formSerialize();$("#dialog_send").dialog("open");$.post("/?pid="+pid+"&mname=board&moduleonly=1&act=write",
a,function(b){data=eval("("+b+")");if(data.is_error==0)window.location=$("#viewpath").val()+"&id="+data.id;else data.msg!=null?alert(lg(data.msg)):alert(lg("An error has occured"));$("#dialog_send").dialog("close")})});$("#loadsave_btn").click(function(){confirm("This entry will be removed, ok?")&&$.post("/?pid="+pid+"&mname=board&moduleonly=1",{act:"LoadSave"},function(a){a=eval("("+a+")");if(a.is_error==0){$("#title").val(a.title);CKEDITOR.instances.content.setData(a.content)}else alert(lg("Failed"))})});
$("#fileDelete_btn").click(function(){var a=$("#id").val(),b="";$("#uploaded_file_list :selected").each(function(d,c){b=d==0?$(c).val():b+","+$(c).val()});$.post("/?pid="+pid+"&mname=board&act=FileDelete&moduleonly=1&id="+a,{filelist:b},function(d){d=eval("("+d+")");d.is_error==0?$("#uploaded_file_list :selected").each(function(c,f){$(f).remove()}):alert(lg(d.msg))});$("#preview_uploaded").html("");return false})}},drag_board_deleteEntry={init:function(){$("#back_btn").click(function(){history.back()})}},
drag_board_display={init:function(){$("#category").change(function(){window.location=setUrlEncodedKey("cate",$(this).val())});$("#search_btn").click(function(){var e=$("#SearchForm").formSerialize();window.location="/?"+e})}},drag_board_mypage={init:function(){}},drag_board_view={init:function(){$("#comment_content_frame").width();if(board_comment_editor=="ckeditor"){CKEDITOR.replace("comment_content",{language:locale,extraPlugins:"uicolor",uiColor:drag_editor_color,scayt_autoStartup:false,height:150,
resize_dir:"vertical",contentsCss:"/css/draghome-0.1.2/draghome-0.1.2.css",enterMode:2,shiftEnterMode:2,toolbar:[["Source","-","NewPage","Preview","Print"],["Bold","Italic","Underline","Strike"],["Link","Unlink","Anchor"],["Font","FontSize"],["TextColor","BGColor"]]});CKEDITOR.replace("comment_content2",{language:locale,extraPlugins:"uicolor",uiColor:drag_editor_color,scayt_autoStartup:false,height:150,resize_dir:"vertical",contentsCss:"/css/draghome-0.1.2/draghome-0.1.2.css",enterMode:2,shiftEnterMode:2,
toolbar:[["Source","-","NewPage","Preview","Print"],["Bold","Italic","Underline","Strike"],["Link","Unlink","Anchor"],["Font","FontSize"],["TextColor","BGColor"]]})}$("#dialog_comment").dialog({bgiframe:true,autoOpen:false,width:700,height:450,modal:true});$("#dialog_password").dialog({bgiframe:true,autoOpen:false,width:300,height:150,modal:true});$("#dialog_trackback").dialog({bgiframe:true,autoOpen:false,width:700,height:328,modal:true});$("#dialog_twitter").dialog({bgiframe:true,autoOpen:false,
width:700,height:328,modal:true});$("input","#twitter_option").click(function(){$("input:checked","#twitter_option").val()=="1"?$("#twitter_friend_choice").hide():$("#twitter_friend_choice").show();$(this).blur()});$("#twitter_msg").keypress(function(a){if(a.keyCode<48||a.keycode>57){$("#twitter_text").html($("#twitter_msg").val().length);$("#twitter_msg").val().length>140&&alert(lg("140 character limit"))}});$("#twitter_submit").click(function(){$("#twitter_msg").val().length<=140?$.post("/?pid="+
pid+"&mname=board&moduleonly=1&act=sendTwitter",{twitter_option:$("input:checked","#twitter_option").val(),twitter_id:$("#twitter_id").val(),twitter_password:$("#twitter_password").val(),twitter_friend:$("#twitter_friend").val(),twitter_msg:$("#twitter_msg").val()},function(a){if(eval("("+a+")").is_error==0){$("#dialog_twitter").dialog("close");alert(lg("Sent successfully"))}else alert(lg("Failed"))}):alert(lg("140 character limit"))});$("#twitter_cancel").click(function(){$("#dialog_twitter").dialog("close")});
$("#search_btn").click(function(){var a=$("#SearchForm").formSerialize();window.location="/?"+a});$(".document_popup_menu > a").click(function(a){popup_type="entry";popup_id=entry_id;$(".vote_up,.vote_down,.declare,.scrap,.print,.send_trackback,.ip_filter,.spam_filter","#popup_menu_area").show();var b=a.pageX-40,d=a.pageY+10;if($("#popup_menu_area").is(":hidden")){document._onclick=document.onclick;document.onclick=function(){if($("#popup_menu_area").is(":hidden")){$("#popup_menu_area").css({left:b,
top:d});$("#popup_menu_area").show()}else{$("#popup_menu_area").hide();document.onclick=document._onclick;document._onclick=null}}}});$(".comment_popup_menu > a").click(function(a){popup_type="comment";popup_id=$(this).attr("title");$(".scrap,.print,.send_trackback","#popup_menu_area").hide();$(".vote_up,.vote_down,.declare,.ip_filter,.spam_filter","#popup_menu_area").show();var b=a.pageX-40,d=a.pageY+10;if($("#popup_menu_area").is(":hidden")){document._onclick=document.onclick;document.onclick=function(){if($("#popup_menu_area").is(":hidden")){$("#popup_menu_area").css({left:b,
top:d});$("#popup_menu_area").show()}else{$("#popup_menu_area").hide();document.onclick=document._onclick;document._onclick=null}}}});$(".vote_up","#popup_menu_area").click(function(){if(user_id!="0"){var a="";a=popup_type=="entry"?"act=EntryVote&id="+popup_id+"&point=1":"act=CommentVote&comment_id="+popup_id+"&point=1";$.post("/?pid="+pid+"&mname=board&moduleonly=1",a,function(b){b=eval("("+b+")");alert(lg(b.msg))})}else alert(lg("Login is required"))});$(".vote_down","#popup_menu_area").click(function(){if(user_id!=
"0"){var a="";a=popup_type=="entry"?"act=EntryVote&id="+popup_id+"&point=-1":"act=CommentVote&comment_id="+popup_id+"&point=-1";$.post("/?pid="+pid+"&mname=board&moduleonly=1",a,function(b){b=eval("("+b+")");alert(b.msg)})}else alert(lg("Login is required"))});$(".declare","#popup_menu_area").click(function(){if(user_id!="0"){var a="";a=popup_type=="entry"?"act=EntryDeclare&id="+popup_id:"act=CommentDeclare&comment_id="+popup_id;$.post("/?pid="+pid+"&mname=board&moduleonly=1",a,function(b){b=eval("("+
b+")");alert(lg(b.msg))})}else alert(lg("Login is required"))});$(".scrap","#popup_menu_area").click(function(){user_id!="0"?$.post("/?pid="+pid+"&mname=board&moduleonly=1",{act:"EntryScrap",id:entry_id},function(a){a=eval("("+a+")");alert(lg(a.msg))}):alert(lg("Login is required"))});$(".print","#popup_menu_area").click(function(){window.open("/?pid="+pid+"&mname=board&moduleonly=1&act=EntryPrint&id="+entry_id)});$(".send_twitter","#popup_menu_area").click(function(){$("#dialog_twitter").dialog("open")});
$(".send_trackback","#popup_menu_area").click(function(){$("#dialog_trackback").dialog("open")});$("#trackback_submit").click(function(){$.post("/?pid="+pid+"&mname=board&moduleonly=1&act=checkEntryUser",{id:entry_id},function(a){eval("("+a+")").is_error==0?$.post("/?pid="+pid+"&mname=board&moduleonly=1&act=sendTrackback",{id:entry_id,url:$("#trackback_url").val(),charset:$("#trackback_charset").val(),excerpt:$("#trackback_excerpt").val()},function(b){b=eval("("+b+")");b.is_error==0?alert(lg("Sent successfully")):
alert(lg(b.msg))}):alert(lg("Destination URL is invalid"))})});$("#trackback_cancel").click(function(){$("#dialog_trackback").dialog("close")});$(".ip_filter","#popup_menu_area").click(function(){});$(".spam_filter","#popup_menu_area").click(function(){});$("a","#fileAttached").click(function(){$.post("/?pid="+pid+"&mname=board&moduleonly=1&act=checkFileExist",{id:entry_id,filename:$(this).attr("title")},function(a){a=eval("("+a+")");a.is_error==0?window.open("/?pid="+pid+"&mname=board&moduleonly=1&act=FileDownload&ctype="+
a.content_type+"&filename="+a.filename+"&id="+entry_id):alert(lg("Target could not be found"))})});$(".trackback_delete","#trackbackBox").live("click",function(){$.post("/?pid="+pid+"&mname=board&moduleonly=1&act=checkTrackbackUser",{trackback_id:$(this).attr("title")},function(a){a=eval("("+a+")");if(a.is_error==0)if(a.is_trackback_user==1)confirm("This trackback will be removed, ok?")&&$.post("/?pid="+pid+"&mname=board&moduleonly=1&act=deleteTrackback",{trackback_id:a.trackback_id},function(b){b=
eval("("+b+")");b.is_error==0?$("#trackbackItem_"+b.trackback_id).remove():alert(lg(b.msg))});else alert(lg("Could not be deleted"));else alert(lg("Could not be deleted"))})});$(".homepage","#replyBox").live("click",function(){window.open($(this).attr("title"))});$(".delete_comment","#replyBox").live("click",function(){$.post("/?pid="+pid+"&mname=board&moduleonly=1&act=checkCommentUser",{comment_id:$(this).attr("title")},function(a){a=eval("("+a+")");if(a.is_error==0)if(a.is_comment_user==1)confirm("This comment will be removed, ok?")&&
$.post("/?pid="+pid+"&mname=board&moduleonly=1&act=deleteComment",{comment_id:a.comment_id},function(b){b=eval("("+b+")");b.is_error==0?$("#comment_"+b.comment_id).remove():alert(lg(b.msg))});else $("#dialog_password").dialog("open");else alert(lg("Could not be deleted"))})});$(".modify_comment","#replyBox").live("click",function(){$.post("/?pid="+pid+"&mname=board&moduleonly=1&act=checkCommentUser",{comment_id:$(this).attr("title")},function(a){a=eval("("+a+")");if(a.is_error==0)if(a.is_comment_user==
1){$("#comment_id2").val(a.comment_id);$("#parent_id2").val("0");$("#comment_submit_btn2").hide();$("#comment_modify_btn2").show();$("#dialog_comment").dialog("option","title","\ub313\uae00 \uc218\uc815");$("#dialog_comment").dialog("open");a=$("#comment_content_"+a.comment_id).html();if(board_comment_editor=="ckeditor")CKEDITOR.instances.comment_content2.setData(a);else board_comment_editor=="textarea"&&$("#comment_content2").val(a)}else $("#dialog_password").dialog("open");else alert(lg("Could not be modified"))})});
$(".reply_comment","#replyBox").live("click",function(){$("#comment_id2").val("0");$("#parent_id2").val($(this).attr("title"));$("#comment_modify_btn2").hide();$("#comment_submit_btn2").show();$("#dialog_comment").dialog("option","title","\ub313\uae00 \ub4f1\ub85d");$("#dialog_comment").dialog("open");board_comment_editor=="ckeditor"&&CKEDITOR.instances.comment_content2.setData("<br />")});$("#comment_modify_btn2").click(function(){if(user_id=="0"){if($("#user_name2").val()==""){alert(lg("Please enter your name"));
$("#user_name2").focus();return false}if($("#password2").val()==""){alert(lg("Please enter a password"));$("#password2").focus();return false}}if(board_comment_editor=="ckeditor"){var a=CKEDITOR.instances.comment_content2;if(a.getData()==""){alert(lg("Insert content"));return false}$("#comment_content2").val(a.getData())}var b=$("#commentForm2").formSerialize();$.post("/?pid="+pid+"&mname=board&moduleonly=1&act=insertComment",b,function(d){d=eval("("+d+")");if(d.is_error==0){$("#comment_content_"+
d.comment_id).html($("#comment_content2").val());$("#dialog_comment").dialog("close");board_comment_editor=="ckeditor"&&a.setData("<br />");$("#comment_content2").val("")}else alert(lg("Target could not be found"));drag_callback!=""&&window[drag_callback]()});return false});$("#comment_submit_btn2").click(function(){var a;if(board_comment_editor=="ckeditor"){var b=CKEDITOR.instances.comment_content2;if(b.getData()==""){alert(lg("Insert content"));return false}$("#comment_content2").val(b.getData());
a=b.getData()}else if(board_comment_editor=="textarea"){if($("#comment_content2").val()==""){alert("\ub0b4\uc6a9\uc744 \uc785\ub825\ud574\uc8fc\uc138\uc694.");return false}a=$("#comment_content2").val()}var d=$("#commentForm2").formSerialize();$.post("/?pid="+pid+"&mname=board&moduleonly=1&act=insertComment",d,function(c){c=eval("("+c+")");if(c.is_error==0){var f='<div id="comment_'+c.comment_id+'"class="replyItem reply depth_'+c.depth+'"><div class="replyIndent" style="margin-left: '+c.depth*10+
'px;">\t<a name="comment_a_'+c.comment_id+'"></a>\t<div class="replyOption">\t\t<a title="'+c.comment_id+'" class="delete_comment" href="javascript:void(0);"><img height="13" width="12" src="/skins/board/default/images/common/buttonDeleteX.gif" alt="\uc0ad\uc81c"></a>\t\t<a title="'+c.comment_id+'" class="modify_comment" href="javascript:void(0);"><img height="17" width="20" src="/skins/board/default/images/purple/buttonModifyE.gif" alt="\uc218\uc815"></a>\t\t<a title="'+c.comment_id+'" class="reply_comment" href="javascript:void(0);"><img height="17" width="20" src="/skins/board/default/images/purple/buttonReply.gif" alt="\ub313\uae00"></a>\t</div>\t<div class="date"><strong>'+
c.regdate1+"</strong> "+c.regdate2+" ("+c.ipaddress+')</div>\t<div class="author">\t\t<span class="level level_'+c.level+'"></span>\t\t'+(c.user_id=="0"?'<a title="http://www.naver.com" class="homepage" href="javascript:void(0);">aa</a>':'<a href="javascript:void(0);" class="drag_user_public" rel="'+c.user_id+'">'+c.nick_name+"</a>")+'\t</div>\t<div class="clr"></div>\t<div class="replyContent">\t\t<div class="f_black text12">\t\t\t<p id="comment_content_'+c.comment_id+'">'+a+"</p>";if(user_id!="0")f+=
'\t\t\t<div class="comment_popup_menu">\t\t\t\t<a title="'+c.comment_id+'" href="javascript:void(0);" class="popup_comment">'+lg("board_msg1")+"</a>\t\t\t</div>";f+='\t\t</div>\t\t<div class="clr"></div>\t</div>\t</div></div>';c.prev_comment_id!=null&&$("#comment_"+c.prev_comment_id).after(f);$("#dialog_comment").dialog("close");board_comment_editor=="ckeditor"&&b.setData("<br />");$("#comment_content2").val("")}else alert(lg("Failed"));drag_callback!=""&&window[drag_callback]()});return false});
$("#comment_submit_btn").click(function(){var a="",b;if(board_comment_editor=="ckeditor"){b=CKEDITOR.instances.comment_content;if(b.getData()==""){alert(lg("Insert content"));return false}$("#comment_content").val(b.getData())}else if(board_comment_editor=="textarea")if($("#comment_content").val()==""){alert(lg("Insert content"));return false}a=$("#comment_content").val();var d=$("#commentForm").formSerialize();$.post("/?pid="+pid+"&mname=board&moduleonly=1&act=insertComment",d,function(c){c=eval("("+
c+")");if(c.is_error==0){$("#replyBox").show();var f='<div id="comment_'+c.comment_id+'"class="replyItem depth_'+c.depth+'">\t<a name="comment_a_'+c.comment_id+'"></a>\t<div class="replyOption">\t\t<a title="'+c.comment_id+'" class="delete_comment" href="javascript:void(0);"><img height="13" width="12" src="/skins/board/default/images/common/buttonDeleteX.gif" alt="\uc0ad\uc81c"></a>\t\t<a title="'+c.comment_id+'" class="modify_comment" href="javascript:void(0);"><img height="17" width="20" src="/skins/board/default/images/purple/buttonModifyE.gif" alt="\uc218\uc815"></a>\t\t<a title="'+
c.comment_id+'" class="reply_comment" href="javascript:void(0);"><img height="17" width="20" src="/skins/board/default/images/purple/buttonReply.gif" alt="\ub313\uae00"></a>\t</div>\t<div class="date"><strong>'+c.regdate1+"</strong> "+c.regdate2+" ("+c.ipaddress+')</div>\t<div class="author">\t\t<span class="level level_'+c.level+'"></span>\t\t'+(c.user_id=="0"?'<a title="http://www.naver.com" class="homepage" href="javascript:void(0);">aa</a>':'<a href="javascript:void(0);" class="drag_user_public" rel="'+
c.user_id+'">'+c.nick_name+"</a>")+'\t</div>\t<div class="clr"></div>\t<div class="replyContent">\t\t<div class="f_black text12">\t\t\t<p id="comment_content_'+c.comment_id+'">'+a+"</p>";if(user_id!="0")f+='\t\t\t<div class="comment_popup_menu">\t\t\t\t<a title="'+c.comment_id+'" href="javascript:void(0);" class="popup_comment">'+lg("board_msg1")+"</a>\t\t\t</div>";f+='\t\t</div>\t\t<div class="clr"></div>\t</div></div>';$("#replyBox").append(f);board_comment_editor=="ckeditor"&&b.setData("<br />");
$("#comment_content").val("")}else alert(lg("Failed"));drag_callback!=""&&window[drag_callback]()});return false});var e=$(".module_board").width();$("img","#contentBody").each(function(){if($(this).width()>e){var a=Math.floor(e*$(this).height()/$(this).width());$(this).css("width",e);$(this).css("height",a)}});$("a[rel='colorbox']").colorbox({slideshow:true,width:"100%",height:"100%"});drag_callback!=""&&window[drag_callback]()}};

