// Minified
$(document).ready(function(){$('.site-sections img').show();$('.collapse_control_images').show();var BanIPAddressSuccessFunction="";var browserDetailsUnencoded=$.json.decode($.base64.decode(browserDetails));$(".MakeNonPrivate").click(function(event){var cid=$(this).attr("cid");$.ajax({url:"/makecommentnonprivate",data:{"commentid":cid},dataType:'text',type:"post",async:false,error:function(XMLHttpRequest,textStatus,errorThrown){MakeADialogMessage("Error","Error setting comment status.");},success:function(data,textStatus){if(data=="INVALID_COMMENT_ID")MakeADialogMessage("Make Comment Non-Private","Invalid Comment ID!");else if(data=="NO_OWN")MakeADialogMessage("Make Comment Non-Private","You don't own this comment.");else if(data=="NO_ACL")MakeADialogMessage("Make Comment Non-Private","Your ACL privilages don't allow you to edit this comment's private status.");else if(data=="OUTSIDE")MakeADialogMessage("Make Comment Non-Private","Though you are the person who wrote this comment, you are outside the comment editing window; thus you aren't allowed you to edit this comment's private status.");else if(data=="NON_PRIVATE")MakeADialogMessage("Make Comment Non-Private","This comment is already set as non-private.");else if(data=="DONE"){$("makenonprivatelink").empty();MakeADialogMessage("Make Comment Non-Private","The comment has been made non-private.");}}});});$(".ReportCommentAsSpam").click(function(event){var cid=$(this).attr("cid");$("#confirmationdialog").attr("title","Report Comment as Spam -- Are you sure?");$("#confirmationdialog").html("<p>Are you sure you want to report this comment as spam?</p>");$("#confirmationdialog").dialog({bgiframe:true,modal:true,width:600,resizable:false,title:"Report Comment as Spam -- Are you sure?",closeOnEscape:true,close:function(event,ui){$(this).dialog('destroy');},buttons:{'Yes I\'m sure I want to report this comment as spam':function(){$(this).dialog('close');$(this).dialog('destroy');$.ajax({url:"/ReportCommentAsSpam",data:{"commentid":cid},dataType:'text',type:"post",async:false,error:function(XMLHttpRequest,textStatus,errorThrown){MakeADialogMessage("Error","Error reporting comment.");},success:function(data,textStatus){if(data=="reported"){$("reportspam_"+cid).empty();MakeADialogMessage("Spam Report","Your comment spam report has been sent.");}
else if(data=="invalid_comment")MakeADialogMessage("Spam Report","Invalid comment ID!");else if(data=="comment_no_exist")MakeADialogMessage("Spam Report","Comment doesn't exist.");}});},No:function(){$(this).dialog('close');$(this).dialog('destroy');MakeADialogMessage("Report Comment as Spam","The comment has not been reported.");}}});});$(".ReportCommentForAbuse").click(function(event){var cid=$(this).attr("cid");$("#confirmationdialog").attr("title","Report Comment for Abuse -- Are you sure?");$("#confirmationdialog").html("<p>Are you sure you want to report this comment for abuse?</p>");$("#confirmationdialog").dialog({bgiframe:true,modal:true,width:600,resizable:false,title:"Report Comment for Abuse -- Are you sure?",closeOnEscape:true,close:function(event,ui){$(this).dialog('destroy');},buttons:{'Yes I\'m sure I want to report this comment for abuse':function(){$(this).dialog('close');$(this).dialog('destroy');$.ajax({url:"/reportcomment",data:{"commentid":cid},dataType:'text',type:"post",async:false,error:function(XMLHttpRequest,textStatus,errorThrown){MakeADialogMessage("Error","Error reporting comment.");},success:function(data,textStatus){if(data=="reported"){$("reportcommentabuse_"+cid).empty();MakeADialogMessage("Abuse Report","Your comment abuse report has been sent.");}
else if(data=="already_reported")MakeADialogMessage("Abuse Report","This comment has already been reported for abuse.");else if(data=="invalid_comment")MakeADialogMessage("Abuse Report","Invalid comment ID!");else if(data=="comment_no_exist")MakeADialogMessage("Abuse Report","Comment doesn't exist.");else if(data=="turned_off")MakeADialogMessage("Abuse Report","Comment Abuse Reporting has been turned off.");}});},No:function(){$(this).dialog('close');$(this).dialog('destroy');MakeADialogMessage("Report Comment for Abuse","The comment has not been reported.");}}});});jQuery.collapseDIV=function(id){rawid=id;id=id.replace("collapsible_div_","");if($("#"+rawid).length!=0){collapse_control_image=$("#collapse_control_"+id);collapse_control_image.attr('src','/images/plus.jpg');collapse_control_image.attr('alt','Expand');collapse_control_image.attr('title','Expand');$("#"+rawid).hide();}}
jQuery.expandDIV=function(id){rawid=id;id=id.replace("collapsible_div_","");if($("#"+rawid).length!=0){collapse_control_image=$("#collapse_control_"+id);collapse_control_image.attr('src','/images/minus.jpg');collapse_control_image.attr('alt','Collapse');collapse_control_image.attr('title','Collapse');$("#"+rawid).show();}}
$("#expandall").click(function(event){$.expandDIV("collapsible_div_admincp");$.expandDIV("collapsible_div_usercp");$.expandDIV("collapsible_div_blogs");$.expandDIV("collapsible_div_ds");$.expandDIV("collapsible_div_storybrowse");$.expandDIV("collapsible_div_archives");$.expandDIV("collapsible_div_browseby");$.expandDIV("collapsible_div_poweredby");$.expandDIV("collapsible_div_associations");$.expandDIV("collapsible_div_corelinks");$.expandDIV("collapsible_div_bookmarks");$.expandDIV("collapsible_div_style");$.get("/divcontrols/expandall");});$("#collapseall").click(function(event){$.collapseDIV("collapsible_div_admincp");$.collapseDIV("collapsible_div_usercp");$.collapseDIV("collapsible_div_blogs");$.collapseDIV("collapsible_div_ds");$.collapseDIV("collapsible_div_storybrowse");$.collapseDIV("collapsible_div_archives");$.collapseDIV("collapsible_div_browseby");$.collapseDIV("collapsible_div_poweredby");$.collapseDIV("collapsible_div_associations");$.collapseDIV("collapsible_div_corelinks");$.collapseDIV("collapsible_div_bookmarks");$.collapseDIV("collapsible_div_style");$.get("/divcontrols/collapseall");});$(".association_link").click(function(event){var rawID=this.id;var linkID=this.id.replace("association_","");var linkTitle=$("#"+rawID).attr("lt");var type=$("#"+rawID).attr("type");var clickedLink=$(this);event.preventDefault();$("#confirmationdialog").attr("title","Warning!  Outside Link!");$("#confirmationdialog").html("<p>You are about to go to link outside the control of Darkscribes.</p>");$("#confirmationdialog").append("<p>By going there you agree that Darkscribes is not responsible for the content contained within the external link.</p>");$("#confirmationdialog").append("The external link is: "+clickedLink.attr("href"));$("#confirmationdialog").dialog({bgiframe:true,modal:true,width:600,resizable:false,title:"Warning!  Outside Link!",closeOnEscape:true,close:function(event,ui){$(this).dialog('destroy');},buttons:{"I agree, just take me there!":function(){$.ajax({url:"/RegisterLinkClick",data:{"type":"association","id":linkID},dataType:'text',type:"post",async:false,error:function(XMLHttpRequest,textStatus,errorThrown){},success:function(result,textStatus){if(type=="link"){$("#"+rawID).attr("alt",linkTitle+" ("+result+")");$("#"+rawID).attr("title",linkTitle+" ("+result+")");}
else if(type=="image"){$("#"+rawID+"_image").attr("alt",linkTitle+" ("+result+")");$("#"+rawID+"_image").attr("title",linkTitle+" ("+result+")");}}});window.open(clickedLink.attr("href"));$(this).dialog('close');$(this).dialog('destroy');},"I don't want to go there!":function(){$(this).dialog('close');$(this).dialog('destroy');}}});event.stopPropagation();return false;});$("#MakeTinyURL").click(function(event){$.ajax({url:"/tinyurl",dataType:'text',data:{"url":encodeURIComponent(document.location)},async:false,type:"post",error:function(XMLHttpRequest,textStatus,errorThrown){MakeADialogMessage("Make TinyURL","Error creating TinyURL.");},success:function(data,textStatus){$("#dialogmessage").attr("title","Make TinyURL");$("#dialogmessage").html("<p>Your TinyURL is below...</p>");$("#dialogmessage").append("<p><a href='"+data+"'>"+data+"</a></p>");$("#dialogmessage").dialog({bgiframe:true,title:"Make TinyURL",modal:true,width:500,resizable:false,close:function(event,ui){$(this).dialog('destroy');},buttons:{Ok:function(){$(this).dialog('close');$(this).dialog('destroy');}}});}});});$(".translateip").live('click',function(){var ip=$(this).attr("ip");$.ajax({url:"/iptranslate",data:{"ip":ip},dataType:'text',type:"post",async:false,error:function(XMLHttpRequest,textStatus,errorThrown){MakeADialogMessage("Error","Error resolving IP address.");},success:function(data,textStatus){if(data==ip)MakeADialogMessage("IP Address Translation","The IP Address "+ip+" doesn't resolve to a hostname.");else{$("#dialogmessage").attr("title","IP Address Translation");$("#dialogmessage").html("<p>The IP Address Translation Data is below...</p>");$("#dialogmessage").append("<p><strong>IP Address:</strong> "+ip+"</p>");$("#dialogmessage").append("<p><strong>Hostname:</strong> "+data+"</p>");$("#dialogmessage").dialog({bgiframe:true,title:"IP Address Translation",modal:true,closeOnEscape:true,width:500,resizable:false,close:function(event,ui){$(this).dialog('destroy');},buttons:{Ok:function(){$(this).dialog('close');$(this).dialog('destroy');}}});}}});});$(".collapsible_menu_ul").collapsemenu();$('input[example!=""]').example();$('input[hint!=""]').hint();if((browserDetailsUnencoded.name=="Internet Explorer")&&(browserDetailsUnencoded.majorver==6)){$("#dialogmessage").attr("title","Message to Internet Explorer 6 Users");$("#dialogmessage").html("<p><strong>You are using an extremely old version of Internet Explorer, namely Internet Explorer 6.</strong>");$("#dialogmessage").append("<p>Darkscribes uses a lot of new web technologies that Internet Explorer 6 simply doesn't support due to its age.  Internet Explorer 6 was made in 2001 and now it is 2010, <strong>that's nine years ago!</strong>  Nine years may as well be ancient in terms of computer technology.</p>");$("#dialogmessage").append("<p>We at Darkscribes suggest that you upgrade to <a href=\"http://www.microsoft.com/windows/internet-explorer/\">Microsoft Internet Explorer 8</a>, <a href=\"http://www.mozilla.org\">Mozilla FireFox 3.6</a>, <a href=\"http://www.google.org/chrome\">Google Chrome</a>, <a href=\"http://www.apple.com/safari\">Apple Safari</a>, or <a href=\"http://www.opera.com\">Opera 10</a>.  Those are five modern web browsers that support the newer web technologies that are being used at Darkscribes.</p>");$("#dialogmessage").dialog({bgiframe:true,title:"Message to Internet Explorer 6 Users",modal:true,closeOnEscape:true,width:750,resizable:false,close:function(event,ui){$(this).dialog('destroy');},buttons:{"Leave me alone already!":function(){$(this).dialog('close');$(this).dialog('destroy');$.cookie("show_msie_6_message","0");},"OK":function(){$(this).dialog('close');$(this).dialog('destroy');}}});}
$(".functiondisabled").live('click',function(){message=$(this).attr("message");if($.empty(message))message="Function Disabled!";reason=$(this).attr("reason");if(reason!="")message+="<br /><br /><strong>Reason:</strong> "+reason;$("#dialogmessage").dialog('close');$("#dialogmessage").dialog('destroy');MakeADialogMessage("Function Disabled!",message);});if($('#left').hasClass('floatingContent'))$('#navlist').append('<li><a href="javascript:void(0);" title="Hide those menus!" id="menucontroller">Hide Menu</a></li>');else $('#navlist').append('<li><a href="javascript:void(0);" title="I want those menus back!" id="menucontroller">Show Menu</a></li>');$('#menucontroller').click(function(){var $menucontroller=$('#menucontroller');var $right=$('#right');var $left=$('#left');if($left.hasClass('floatingContent')){$right.hide();$left.removeClass('floatingContent');$menucontroller.html('Show Menu');$menucontroller.attr('title','I want those menus back!');$.post('/visitorpreferences',{'showmenu':0});}
else{$left.addClass('floatingContent');$right.show();$menucontroller.html('Hide Menu');$menucontroller.attr('title','Hide those menus!');$.post('/visitorpreferences',{'showmenu':1});}
return false;});$(".bookmark_checkbox").live('click',function(){$("#deletebutton").hide();$("#clearselectedbookmarks").hide();$("#selectallbookmarks").show();var numberOfBookmarksSelected=0;$('.bookmark_checkbox').each(function(){if(this.checked){numberOfBookmarksSelected+=1;$("#deletebutton").show();$("#clearselectedbookmarks").show();}});if(numberOfBookmarksSelected==totalNumberOfBookmarks)$("#selectallbookmarks").hide();});$(".externalLink").live('click',function(event){var clickedLink=$(this);event.preventDefault();$("#confirmationdialog").attr("title","Warning!  Outside Link!");$("#confirmationdialog").html("<p>You are about to go to link outside the control of Darkscribes.</p>");$("#confirmationdialog").append("<p>By going there you agree that Darkscribes is not responsible for the content contained within the external link.</p>");$("#confirmationdialog").append("The external link is: "+clickedLink.attr("href"));$("#confirmationdialog").dialog({bgiframe:true,modal:true,width:600,resizable:false,title:"Warning!  Outside Link!",closeOnEscape:true,close:function(event,ui){$(this).dialog('destroy');},buttons:{"I agree, just take me there!":function(){window.open(clickedLink.attr("href"));$(this).dialog('close');$(this).dialog('destroy');},"I don't want to go there!":function(){$(this).dialog('close');$(this).dialog('destroy');}}});event.stopPropagation();return false;});$("#deleteselectedbookmarks").live('click',function(){var bookmarksToBeDeleted=[];$('.bookmark_checkbox').each(function(){if(this.checked)bookmarksToBeDeleted.push($(this).val());});if(bookmarksToBeDeleted.length==0){MakeADialogMessage("Delete Bookmarks","You haven't selected any bookmarks to delete.");return;}
$("#confirmationdialog").attr("title","Are you sure?");if(bookmarksToBeDeleted.length==1){$("#confirmationdialog").html("<p>The bookmark you have selected for deletion is \""+$('.bookmark_checkbox:checked').attr("bookmarktitle")+"\"</p>");$("#confirmationdialog").append("<p>Are you sure you want to delete the selected story bookmark?</p>");}
else{$("#confirmationdialog").html("<p>You have the following "+bookmarksToBeDeleted.length+" bookmarks selected for deletion...</p><p>");var i=0;$('.bookmark_checkbox').each(function(){if(this.checked){i+=1;$("#confirmationdialog").append("<strong>"+i+".</strong> "+$(this).attr("bookmarktitle")+"<br />");}});$("#confirmationdialog").append("</p>");$("#confirmationdialog").append("<p>Are you sure you want to delete the selected story bookmarks?</p>");}
$("#confirmationdialog").dialog({bgiframe:true,modal:true,width:600,resizable:false,closeOnEscape:true,close:function(event,ui){$(this).dialog('destroy');},title:"Are you sure?",buttons:{'Yes I\'m sure I want to delete the selected story bookmarks':function(){$(this).dialog('close');$(this).dialog('destroy');$.ajax({url:"/bookmarks",data:{"delete":$.json.encode(bookmarksToBeDeleted)},dataType:'text',type:"post",async:false,error:function(XMLHttpRequest,textStatus,errorThrown){if(count(bookmarksToBeDeleted)==1)MakeADialogMessage("Delete Bookmarks","Error deleting bookmark.");else MakeADialogMessage("Delete Bookmarks","Error deleting bookmarks.");},success:function(data,textStatus){if(data=="done"){if(bookmarksToBeDeleted.length==1)MakeADialogMessage("Delete Bookmarks","Bookmark Deleted.");else MakeADialogMessage("Delete Bookmarks","Bookmarks Deleted.");}
$("#refreshbookmarks").trigger("click");}});},No:function(){$(this).dialog('close');$(this).dialog('destroy');if(bookmarksToBeDeleted.length==1)MakeADialogMessage("Bookmarks Not Deleted","Your story bookmark has NOT been deleted.");else MakeADialogMessage("Bookmarks Not Deleted","Your story bookmarks have NOT been deleted.");}}});});$("#deselectallbookmarks").live('click',function(){$('.bookmark_checkbox').each(function(){$(this).attr("checked",false);});$("#deletebutton").hide();$("#clearselectedbookmarks").hide();$("#selectallbookmarks").show();});$("#selectallbookmarks_button").live('click',function(){$('.bookmark_checkbox').each(function(){$(this).attr("checked",true);});$("#deletebutton").show();$("#clearselectedbookmarks").show();$("#selectallbookmarks").hide();});$("#deleteallbookmarks").live('click',function(){$("#confirmationdialog").attr("title","Are you sure?");$("#confirmationdialog").html("<p>Are you sure you want to delete all your story bookmarks?</p>");$("#confirmationdialog").dialog({bgiframe:true,modal:true,width:600,resizable:false,title:"Are you sure?",closeOnEscape:true,close:function(event,ui){$(this).dialog('destroy');},buttons:{'Yes I\'m sure I want to delete all my bookmarks':function(){$(this).dialog('close');$(this).dialog('destroy');$.get("/bookmarks/deleteall",function(data){if(data=="done")MakeADialogMessage("Bookmarks Deleted","All bookmarks have been deleted.");$("#refreshbookmarks").trigger("click");});},No:function(){$(this).dialog('close');$(this).dialog('destroy');MakeADialogMessage("Bookmarks Not Deleted","Your story bookmarks have NOT been deleted.");}}});});$(".make_chapter_a_lemon").click(function(){MakeADialogMessage("What is this?","This sets the 'lemon' bit for a chapter.  This is used in case the chapter you are posting contains lemon content but the rest of the story doesn't.  This make it so that the lemon disclaimer is shown for this chapter.");});$("#refreshbookmarks").live('click',function(){$("#collapsible_div_bookmarks").empty();htmlcode="<ul class=\"navlist\">";htmlcode+="<li>Refreshing Bookmarks... <img style='background-color: #FFFFFF' src='ajaxstatus.gif' /></li>";htmlcode+="</ul>";$("#collapsible_div_bookmarks").html(htmlcode);$.ajax({url:"/bookmarks/ajaxget",dataType:'text',async:false,error:function(XMLHttpRequest,textStatus,errorThrown){$("#collapsible_div_bookmarks").empty();htmlcode="<ul class=\"navlist\">";htmlcode+="<li><strong>Error loading story bookmarks, please try refreshing the bookmarks.</strong></li>";htmlcode+="<li><a href=\"javascript:void(0);\" id=\"refreshbookmarks\">Refresh Bookmarks</a></li>";htmlcode+="<li>&nbsp;</li>";htmlcode+="</ul>";$("#collapsible_div_bookmarks").html(htmlcode);},success:function(data,textStatus){$("#collapsible_div_bookmarks").empty();$("#collapsible_div_bookmarks").html(data);if(story_page){$("#createbookmark").val("Bookmark Story and Chapter");$("#createbookmark").attr("disabled",false);$('.bookmark_checkbox').each(function(){if($(this).val()==combined_story_and_chapter_string){$("#createbookmark").val("Bookmark Already Exists");$("#createbookmark").attr("disabled",true);}});}}});});$(document).bind('keydown','Ctrl+M',function(event){var $menucontroller=$("#menucontroller");var $right=$('#right');var $left=$('#left');if($left.hasClass('floatingContent')){$right.hide();$left.removeClass('floatingContent');$menucontroller.html('Show Menu');$menucontroller.attr('title','I want those menus back!');$.post('/visitorpreferences',{'showmenu':0});}
else{$left.addClass('floatingContent');$right.show();$menucontroller.html('Hide Menu');$menucontroller.attr('title','Hide those menus!');$.post('/visitorpreferences',{'showmenu':1});}
return false;});jQuery.MakeADialogMessage=function(titlemsg,message){$("#dialogmessage").attr("title",titlemsg);$("#dialogmessage").html("<p>"+message+"</p>");$("#dialogmessage").dialog({bgiframe:true,title:titlemsg,modal:true,closeOnEscape:true,width:500,resizable:false,close:function(event,ui){$(this).dialog('destroy');},buttons:{Ok:function(){$(this).dialog('close');$(this).dialog('destroy');}}});}
function MakeADialogMessage(titlemsg,message){$.MakeADialogMessage(titlemsg,message);}
jQuery.MakeADialogMessage2=function(titlemsg,message){$("#confirmationdialog").attr("title",titlemsg);$("#confirmationdialog").html("<p>"+message+"</p>");$("#confirmationdialog").dialog({bgiframe:true,title:titlemsg,modal:true,closeOnEscape:true,width:500,resizable:false,close:function(event,ui){$(this).dialog('destroy');},buttons:{Ok:function(){$(this).dialog('close');$(this).dialog('destroy');}}});}
function MakeADialogMessage2(titlemsg,message){$.MakeADialogMessage2(titlemsg,message);}
function count(mixed_var,mode){var key,cnt=0;if(mixed_var===null){return 0;}
else if(mixed_var.constructor!==Array&&mixed_var.constructor!==Object){return 1;}
if(mode==='COUNT_RECURSIVE'){mode=1;}
if(mode!=1){mode=0;}
for(key in mixed_var){cnt++;if(mode==1&&mixed_var[key]&&(mixed_var[key].constructor===Array||mixed_var[key].constructor===Object)){cnt+=count(mixed_var[key],1);}}
return cnt;}
function addslashes(str){return(str+'').replace(/([\\"'])/g,"\\$1").replace(/\0/g,"\\0");}
function AddListBoxItem(listbox,name,value){$("#"+listbox).append("<option value=\""+value.addslashes()+"\">"+name+"</option>");}
$(".instantBanPopup").live('click',function(){var ip=$(this).attr("ip");var appearsInStopForumSpam=false;var numInStopForumSpam="";if(ip==$.base64.decode(addr)){$("#dialogmessage").dialog('close');$("#dialogmessage").dialog('destroy');MakeADialogMessage("Function Disabled!","Function Disabled!<br /><br /><strong>Reason:</strong> You can't ban your own IP address!");return;}
if($(this).attr("stopspam")!="false"){$.ajax({url:"/managebans?do=checkStopForumSpam",data:{"ip":ip},dataType:'text',type:"post",async:false,error:function(XMLHttpRequest,textStatus,errorThrown){appearsInStopForumSpam=false;},success:function(data,textStatus){data=$.json.decode(data);if(data.appears=="true"){appearsInStopForumSpam=true;numInStopForumSpam=data.howmany;}}});}
var hostname="";if(!mipb){$("#dialogmessage").dialog('close');$("#dialogmessage").dialog('destroy');MakeADialogMessage("Error","You do not have permission to ban IP addresses.");return;}
if($(this).html()=="Ban")$("#dialogmessage").html("");if(($(this).attr("type")!="button")&&($(this).html()!="Ban"))$(this).hide();if(($(this).html()=="Ban")||($(this).attr("type")=="button")){var linkButtonType=true;$("#dialogmessage").dialog('close');$("#dialogmessage").dialog('destroy');MakeADialogMessage("Please Wait","Please wait, system checks are being processed.");}
else{var linkButtonType=false;$("#dialogmessage").append("<p id=\"pleasewaitmessage\">Please wait, system checks are being processed.</p>");}
var camefrom=$(this).attr("camefrom");var validateIPResults=false;var checkForRuleResults="";if(!$.validateIPAddress(ip)){$("#dialogmessage").dialog('close');$("#dialogmessage").dialog('destroy');MakeADialogMessage("Error","Invalid IP Address.");return;}
$.ajax({url:"/managebans?do=checkforrule",data:{"ip":ip},dataType:'text',type:'post',async:false,error:function(XMLHttpRequest,textStatus,errorThrown){MakeADialogMessage("Error","Error sending command.");},success:function(data,textStatus){checkForRuleResults=data;}});checkForRuleResults=$.json.decode(checkForRuleResults);if(checkForRuleResults.rule_exists=="true"){$("#dialogmessage").dialog('close');$("#dialogmessage").dialog('destroy');MakeADialogMessage("IP Address Already Banned","This IP address has already been banned.<br /><br />The existing rule for this ban is...<br /><em>"+checkForRuleResults.rule+"</em>");return;}
if(linkButtonType){$.ajax({url:"/iptranslate",data:{"ip":ip},dataType:'text',type:'post',async:false,error:function(XMLHttpRequest,textStatus,errorThrown){hostname="";},success:function(data,textStatus){if(data==ip)hostname="NO_RESOLVE";else hostname=data;}});}
if(linkButtonType){$("#dialogmessage").html("");}
else $("#pleasewaitmessage").hide();$("#dialogmessage").dialog('close');$("#dialogmessage").dialog('destroy');$("#dialogmessage").attr("title","Ban IP -- Are you sure?");if(linkButtonType){$("#dialogmessage").append("<p><strong>IP Address:</strong> "+ip+"</p>");if(hostname!="NO_RESOLVE")$("#dialogmessage").append("<p><strong>Hostname:</strong> "+hostname+"</p>");}
if($(this).attr("stopspam")!="false"){if(appearsInStopForumSpam)$("#dialogmessage").append("<p>This IP address appears to be in the StopForumSpam.com Database ("+numInStopForumSpam+" Reports). <a href=\"http://www.stopforumspam.com/search.php?q="+ip+"\" target=\"_new_window\">StopForumSpam.com Report</a></p>");else $("#dialogmessage").append("<p>This IP address is <strong>not</strong> in the StopForumSpam.com Database.</p>");}
$("#dialogmessage").append("Reasons or comments can help other administrators know why you banned an IP address.  You no longer have to include your handle as part of your ban comments, the system will include your handle when it adds the ban rule.");$("#dialogmessage").append("<p><strong>Reason for Ban:</strong> <input type='text' id='ipban_reason' size='50' /></p>");$("#dialogmessage").dialog({bgiframe:true,title:"Ban IP -- Are you sure?",modal:true,closeOnEscape:true,width:500,resizable:false,close:function(event,ui){$(this).dialog('destroy');},buttons:{"Ban this IP Address":function(){var reason=$.trim($("#ipban_reason").val());if(reason==""){$("#confirmationdialog").attr("title","No Reason for Ban");$("#confirmationdialog").html("<p>If you are banning this IP address, you have to provide a reason why you are banning it.</p>");$("#confirmationdialog").dialog({bgiframe:true,title:"No Reason for Ban",modal:true,closeOnEscape:true,width:500,resizable:false,close:function(event,ui){$(this).dialog('destroy');},buttons:{Ok:function(){$(this).dialog('close');$(this).dialog('destroy');$("#ipban_reason").focus();}}});return;}
$(this).dialog('close');$(this).dialog('destroy');$.ajax({url:"/managebans?do=instant_ban",data:{"ip":ip,"reason":reason},dataType:'text',type:'post',async:false,error:function(XMLHttpRequest,textStatus,errorThrown){MakeADialogMessage("Error","Error sending command.");},success:function(data,textStatus){data=$.json.decode(data);$(this).dialog('close');$(this).dialog('destroy');if(data.rule_creation_results=="false"){MakeADialogMessage("IP Address Already Banned","This IP address has already been banned.<br /><br />The existing rule for this ban is...<br /><em>"+data.rule+"</em>");}
else if(data.rule_creation_results=="true"){if(camefrom=="managebans"){$(".refresh_ips").trigger("click");}
else if(camefrom=="viewlog"){$(".translateip_viewlog[ip='"+ip+"']").each(function(){if(!(/\(Banned\)/.test($(this).html())))$(this).append(" (Banned)");});}
MakeADialogMessage("IP Address Banned","The IP Address has been banned!<br /><br />The banning of this IP address has resulted in this new rule...<br /><em>"+data.rule+"</em>");}}});},"Cancel":function(){$(this).dialog('close');$(this).dialog('destroy');MakeADialogMessage("Ban IP Address","The IP address has not been banned.");}}});});jQuery.detectAdminReAuthRedirection=function(data){if(/Re-authentication for Administrators/i.test(data))document.location="/reauthadmin";}
jQuery.empty=function(dataVar){if($.trim(dataVar)=="")return true;else return false;}
jQuery.validateIPAddress=function(ip){var myregexp=/([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/;var match=myregexp.exec(ip);if(match!=null){ip1=match[1];ip2=match[2];ip3=match[3];ip4=match[4];if((ip1<1)||(ip1>255))return false;else if((ip2<0)||(ip2>255))return false;else if((ip3<0)||(ip3>255))return false;else if((ip4<0)||(ip4>255))return false;return true;}
else return false;}
jQuery.popUp=function(URL,height,width,scroll){day=new Date();id=day.getTime();if(scroll)eval("page"+id+" = window.open(URL, '"+id+"', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width="+width+",height="+height+"');");else eval("page"+id+" = window.open(URL, '"+id+"', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width="+width+",height="+height+"');");}
function trim(str){return $.trim(str);}
function stripslashes(str){return(str+'').replace(/\\(.?)/g,function(s,n1){switch(n1){case'\\':return'\\';case'0':return'\u0000';case'':return'';default:return n1;}});}
String.prototype.contains=function(str){return(this.match(str)==str)}
String.prototype.endsWith=function(str){return(this.match(str+"$")==str)}
String.prototype.startsWith=function(str){return(this.match("^"+str)==str)}
String.prototype.trim=function(){return $.trim(this);}
String.prototype.addslashes=function(){return(this+'').replace(/([\\"'])/g,"\\$1").replace(/\0/g,"\\0");}
String.prototype.stripslashes=function(){return stripslashes(this);}
Array.prototype.count=function(){return this.length;};function str_replace(search,replace,subject,count){f=[].concat(search),r=[].concat(replace),s=subject,ra=r instanceof Array,sa=s instanceof Array;s=[].concat(s);if(count)this.window[count]=0;for(i=0,sl=s.length;i<sl;i++){if(s[i]==='')continue;for(j=0,fl=f.length;j<fl;j++){temp=s[i]+'';repl=ra?(r[j]!==undefined?r[j]:''):r[0];s[i]=(temp).split(f[j]).join(repl);if(count&&s[i]!==temp)this.window[count]+=(temp.length-s[i].length)/f[j].length;}}
return sa?s:s[0];}
$(".CheckForSpam").click(function(event){var id=$(this).attr("cid");$.ajax({url:"/checkspam",data:{"commentid":id},type:"post",dataType:'text',async:false,error:function(XMLHttpRequest,textStatus,errorThrown){MakeADialogMessage("Check Spam","Error checking for spam.");},success:function(result,textStatus){if(result=="yes_spam")MakeADialogMessage("Check Spam","This comment <strong><u>is</u></strong> spam.");else MakeADialogMessage("Check Spam","This comment <strong><u>is not</u></strong> spam.");}});});jQuery.copyToClipboard=function(text){if(browserDetailsUnencoded.name=="Internet Explorer"){clipboardData.setData("Text",text);MakeADialogMessage2("Clipboard Notification","Copied to Clipboard Successfully.");}
else if(browserDetailsUnencoded.name=="Firefox"){netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');clipboardHelper=Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper);clipboardHelper.copyString(text);MakeADialogMessage2("Clipboard Notification","Copied to Clipboard Successfully.");}}
$("#logout").click(function(event){$("#confirmationdialog").attr("title","Are you sure?");$("#confirmationdialog").html("<p>Are you sure you want to logout of Lemontastica?</p>");$("#confirmationdialog").dialog({bgiframe:true,modal:true,width:700,resizable:false,title:"Are you sure?",closeOnEscape:true,close:function(event,ui){$(this).dialog('destroy');},buttons:{'Yes, log me out':function(){document.location="/logout/"+$.base64.decode(s);},'Don\'t Logout!':function(){$(this).dialog('close');$(this).dialog('destroy');MakeADialogMessage("Not Logged Out","You have not been logged out.");}}});});var state=0,konami=[38,38,40,40,37,39,37,39,66,65];$(document).keydown(function(e){if(e.keyCode==konami[state])state++;else state=0;if(state==10){$("#dialogmessage").attr("title","KONAMI CODE!");$("#dialogmessage").html("<p>You entered the Konami code!  Press the OK button to see your prize!</p>");$("#dialogmessage").dialog({bgiframe:true,title:"KONAMI CODE!",modal:true,closeOnEscape:true,width:500,resizable:false,close:function(event,ui){$(this).dialog('destroy');},buttons:{Ok:function(){window.location="http://bit.ly/aNxOtq";}}});}});});
