// Minified
$('.site-sections img').show();$('.collapse_control_images').show();$(".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");$.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+")");}}});});$("#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").click(function(event){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(($.browser.msie)&&(parseInt($.browser.version)==6)&&($.cookie("show_msie_6_message")!="0")){$("#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").click(function(event){message=$(this).attr("message");if(message=="")message="Function Disabled";reason=$(this).attr("reason");if(reason!="")message+="<br /><br /><strong>Reason:</strong> "+reason;MakeADialogMessage("Function Disabled",message);});$(".theme_changer").click(function(event){var newstyle=$(this).attr("theme");$.ajax({url:"/style",data:{"style":newstyle,"ajax":"true"},dataType:'text',type:"post",async:false,error:function(XMLHttpRequest,textStatus,errorThrown){MakeADialogMessage("Theme Changer","Error changing theme, please try again.");},success:function(data,textStatus){data=$.json.decode(data);if(data.result=="done"){MakeADialogMessage("Please wait...","Please wait while the theme is changed from \""+data.from+"\" to \""+data.to+"\".<br /><br /><strong>Note:</strong> This dialog will close automatically in three seconds.");oldstyle=$("#stylesheet").attr("href").replace(".css","").replace("/","");$("#style_control_"+oldstyle).show();$("#style_control_"+newstyle).hide();if(newstyle=="coldstar")$("#extra_ui_css").attr("href","/uithemes/base/ui.theme.coldstar.css");else $("#extra_ui_css").attr("href","/blank.css");$("#stylesheet").attr("href","/"+newstyle+".css");setTimeout("$('#dialogmessage').dialog('close'); $('#dialogmessage').dialog('destroy');",3000);}
else if(data.result=="bad_style")MakeADialogMessage("Theme Changer","Error changing theme, please try again.");}});});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();});$("#deleteselectedbookmarks").live('click',function(){var bookmarksToBeDeleted=[];$('.bookmark_checkbox').each(function(){if(this.checked)bookmarksToBeDeleted.push(this.value);});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.checked=false;});$("#deletebutton").hide();$("#clearselectedbookmarks").hide();$("#selectallbookmarks").show();});$("#selectallbookmarks_button").live('click',function(){$('.bookmark_checkbox').each(function(){this.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;});$("#writingcontest").click(function(){MakeADialogMessage("What is a Writing Contest?","Darkscribes is hosting a series of contests that authors can include their stories in and have people vote on them.  Winners of those contests can win items or trinkets.");});function MakeADialogMessage(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 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>");}
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];}
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";}}});}});