// Minified
$('#site-sections img').show();$(".MakeNonPrivate").click(function(event){var cid=$(this).attr("cid");$.get("/makecommentnonprivate",{"commentid":cid},function(data){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.");}});});$(".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');$.get("/reportcomment",{commentid:cid},function(data){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.");else if(data=="not_authed")MakeADialogMessage("Abuse Report","You aren't logged in, you can't report comment abuse.");else if(data=="no_own")MakeADialogMessage("Abuse Report","You don't own this content, you can't report comment abuse.");});},No:function(){$(this).dialog('close');$(this).dialog('destroy');MakeADialogMessage("Report Comment for Abuse","The comment has not been reported.");}}});});$("#expandall").click(function(event){expandDIV("admincp");expandDIV("usercp");expandDIV("blogs");expandDIV("ds");expandDIV("storybrowse");expandDIV("archives");expandDIV("browseby");expandDIV("poweredby");expandDIV("associations");expandDIV("corelinks");expandDIV("bookmarks");expandDIV("style");$.get("/divcontrols/expandall");});$("#collapseall").click(function(event){collapseDIV("admincp");collapseDIV("usercp");collapseDIV("blogs");collapseDIV("ds");collapseDIV("storybrowse");collapseDIV("archives");collapseDIV("browseby");collapseDIV("poweredby");collapseDIV("associations");collapseDIV("corelinks");collapseDIV("bookmarks");collapseDIV("style");$.get("/divcontrols/collapseall");});$("#associations a").click(function(event){var rawID=this.id;var linkID=this.id.replace("association_","");var linkTitle=$("#"+rawID).attr("lt");var type=$("#"+rawID).attr("type");$.post("/RegisterLinkClick",{"type":"association","id":linkID},function(result){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");$.post("/iptranslate",{ip:ip},function(data){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');}}});}});});$("#site-sections h2").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>, or <a href=\"http://www.opera.com\">Opera 10</a>.  Those are four 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");}}});}
$("#style a").click(function(event){var newstyle=this.id;$.ajax({url:"/style",data:{"style":newstyle,"ajax":"true"},dataType:'text',type:"post",async:false,error:function(XMLHttpRequest,textStatus,errorThrown){MakeADialogMessage("Style Changer","Error Changing Style.");},success:function(data,textStatus){if(data=="done"){MakeADialogMessage("Please wait...","Please wait while the theme is changing.<br /><br /><strong>Note:</strong> This dialog will close automatically in two 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');",2000);}
else if(data=="bad_style")MakeADialogMessage("Style Changer","Error Changing Style.");else if(data=="no_style")MakeADialogMessage("Style Changer","Error Changing Style.");}});});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;});$("#bookmarks input:checkbox").live('click',function(){$("#deletebutton").hide();$("#clearselectedbookmarks").hide();$("#selectallbookmarks").show();var numberOfBookmarksSelected=0;$('#bookmarks input:checkbox').each(function(){if(this.checked){numberOfBookmarksSelected+=1;$("#deletebutton").show();$("#clearselectedbookmarks").show();}});if(numberOfBookmarksSelected==totalNumberOfBookmarks)$("#selectallbookmarks").hide();});$("#deleteselectedbookmarks").live('click',function(){var bookmarksToBeDeleted=[];$('#bookmarks input: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 \""+$('#bookmarks input: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;$('#bookmarks input: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(){$('#bookmarks input:checkbox').each(function(){this.checked=false;});$("#deletebutton").hide();$("#clearselectedbookmarks").hide();$("#selectallbookmarks").show();});$("#selectallbookmarks_button").live('click',function(){$('#bookmarks input: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.");}}});});$("#refreshbookmarks").live('click',function(){$("#bookmarks").html("<li>Refreshing Bookmarks... <img style='background-color: #FFFFFF' src='ajaxstatus.gif' /></li>");$.ajax({url:"/bookmarks/ajaxget",dataType:'text',async:false,error:function(XMLHttpRequest,textStatus,errorThrown){$("#bookmarks").html("<li><strong>Error loading story bookmarks, please try refreshing the bookmarks.</strong></li>");$("#bookmarks").append('<li><a href="javascript:void(0);" id="refreshbookmarks">Refresh Bookmarks</a></li>');$("#bookmarks").append("<li>&nbsp;</li>");},success:function(data,textStatus){$("#bookmarks").html(data);}});});$(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;});function WritingContest(){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 IsCheckBoxChecked(checkboxid){return $('#'+checkboxid).is(':checked');}
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 ProcessBookmark(sid,chapter){document.location="/story/"+sid+"/"+chapter;}
function addslashes(str){return(str+'').replace(/([\\"'])/g,"\\$1").replace(/\0/g,"\\0");}
function AddListBoxItem(listbox,name,value){$("#"+listbox).append("<option value=\""+addslashes(value)+"\">"+name+"</option>");}
function popUp(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 TranslateIPAddressToHostName(ip){var ip;$.post("/iptranslate",{"ip":ip},function(data){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');}}});}});}
function trim(str){return $.trim(str);}
function collapseWithOutAJAX(id){target=document.getElementById(id);if(target!=null){collapse_control_image=$("#collapse_control_"+id);if(target.style.display=="none"){collapse_control_image.attr('src','/images/minus.jpg');collapse_control_image.attr('alt','Collapse');collapse_control_image.attr('title','Collapse');$("#"+id).show();}
else{collapse_control_image.attr('src','/images/plus.jpg');collapse_control_image.attr('alt','Expand');collapse_control_image.attr('title','Expand');$("#"+id).hide();}}}
function collapseDIV(id){target=document.getElementById(id);if(target!=null){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');$("#"+id).hide();}}
function expandDIV(id){target=document.getElementById(id);if(target!=null){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');$("#"+id).show();}}
function SimpleCollapse(id){$("#"+id).hide();}
function SimpleExpand(id){$("#"+id).show();}
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);}
Array.prototype.count=function(){return this.length;};