").attr("id","wd-ed-dialogs").hide().html(d.body||"");$j("body").append(e)}var c=$(WIKIDOT.Editor.toolbarPanelId);if(c){$j(c).html($j("#wd-ed-toolbar").html());var b=$j("a",c);OZONE.dialog.hovertip.makeTip(b,{style:{width:"auto"},delay:200});WIKIDOT.page.fixers.fixMenu(c)}if(WIKIDOT.page.vars.draft){jQuery("body").scrollTo(".owindow",0,{offset:-window.innerHeight/2})}};WIKIDOT.Editor.buttons={bold:function(b){WIKIDOT.Editor.utils.insertTags("**","**","bold text",WIKIDOT.Editor.utils.trimSelection)},italic:function(b){WIKIDOT.Editor.utils.insertTags("//","//","italic text",WIKIDOT.Editor.utils.trimSelection)},underline:function(b){WIKIDOT.Editor.utils.insertTags("__","__","underline text",WIKIDOT.Editor.utils.trimSelection)},strikethrough:function(b){WIKIDOT.Editor.utils.insertTags("--","--","strikethrough text",WIKIDOT.Editor.utils.trimSelection)},teletype:function(b){WIKIDOT.Editor.utils.insertTags("{{","}}","teletype text",WIKIDOT.Editor.utils.trimSelection)},superscript:function(b){WIKIDOT.Editor.utils.insertTags("^^","^^","superscript",WIKIDOT.Editor.utils.trimSelection)},subscript:function(b){WIKIDOT.Editor.utils.insertTags(",,",",,","subscript",WIKIDOT.Editor.utils.trimSelection)},raw:function(b){WIKIDOT.Editor.utils.insertTags("@@","@@","raw text",WIKIDOT.Editor.utils.trimSelection)},heading:function(d,f){var b="";for(var c=0;c
","","quoted text",WIKIDOT.Editor.utils.processQuoteText,WIKIDOT.Editor.utils.endWithAtLeast1NewLine,WIKIDOT.Editor.utils.startWithAtLeast1NewLine)},hr:function(b){WIKIDOT.Editor.utils.insertText("------",WIKIDOT.Editor.utils.endWithAtLeast2NewLine,WIKIDOT.Editor.utils.startWithAtLeast2NewLine)},clearFloat:function(c,b){var d="~~~~";if(b){d+=b}WIKIDOT.Editor.utils.insertText(d,WIKIDOT.Editor.utils.endWithAtLeast2NewLine,WIKIDOT.Editor.utils.startWithAtLeast2NewLine)},toc:function(b){WIKIDOT.Editor.utils.insertText("[[toc]]",WIKIDOT.Editor.utils.endWithAtLeast1NewLine,WIKIDOT.Editor.utils.startWithAtLeast1NewLine)},uri:function(b){WIKIDOT.Editor.utils.insertTags("[http://www.example.com ","]","describe link",WIKIDOT.Editor.utils.trimSelection)},pageLink:function(b){WIKIDOT.Editor.utils.insertTags("[[[","]]]","page name",WIKIDOT.Editor.utils.trimSelection)},math:function(b){WIKIDOT.Editor.utils.insertTags("[[math]]"+INSERT_NEWLINE,INSERT_NEWLINE+"[[/math]]","insert LaTeX equation here",WIKIDOT.Editor.utils.trimSelection,WIKIDOT.Editor.utils.endWithAtLeast2NewLine,WIKIDOT.Editor.utils.startWithAtLeast2NewLine)},numberedList:function(b){WIKIDOT.Editor.utils.insertTags("# ","","list item",WIKIDOT.Editor.utils.processNumberedList,WIKIDOT.Editor.utils.endWithAtLeast1NewLine,WIKIDOT.Editor.utils.startWithAtLeast1NewLine)},bulletedList:function(b){WIKIDOT.Editor.utils.insertTags("* ","","list item",WIKIDOT.Editor.utils.processBulletedList,WIKIDOT.Editor.utils.endWithAtLeast1NewLine,WIKIDOT.Editor.utils.startWithAtLeast1NewLine)},definitionList:function(b){WIKIDOT.Editor.utils.insertTags(": "," : definition","item",WIKIDOT.Editor.utils.processBulletedList,WIKIDOT.Editor.utils.endWithAtLeast1NewLine,WIKIDOT.Editor.utils.startWithAtLeast1NewLine)},increaseListIndent:function(b){WIKIDOT.Editor.utils.insertText("",WIKIDOT.Editor.utils.increaseListIndent)},decreaseListIndent:function(b){WIKIDOT.Editor.utils.insertText("",WIKIDOT.Editor.utils.decreaseListIndent)},footnote:function(b){WIKIDOT.Editor.utils.insertTags("[[footnote]] "," [[/footnote]]","footnote text",WIKIDOT.Editor.utils.trimSelection)},inlineMath:function(b){WIKIDOT.Editor.utils.insertTags("[[$ "," $]]","insert LaTeX equation here",WIKIDOT.Editor.utils.trimSelection)},code:function(b){WIKIDOT.Editor.utils.insertTags("[[code]]"+INSERT_NEWLINE,INSERT_NEWLINE+"[[/code]]","insert the code here",WIKIDOT.Editor.utils.trimSelection,WIKIDOT.Editor.utils.endWithAtLeast2NewLine,WIKIDOT.Editor.utils.startWithAtLeast2NewLine)},html:function(b){WIKIDOT.Editor.utils.insertTags("[[html]]"+INSERT_NEWLINE,INSERT_NEWLINE+"[[/html]]","Insert any HTML code, including widgets and video or audio players",WIKIDOT.Editor.utils.trimSelection,WIKIDOT.Editor.utils.endWithAtLeast2NewLine,WIKIDOT.Editor.utils.startWithAtLeast2NewLine)},image:function(b){WIKIDOT.Editor.utils.insertTags("[[image ","]]","source",WIKIDOT.Editor.utils.trimSelection)},div:function(b){WIKIDOT.Editor.utils.insertTags("[[div]]"+INSERT_NEWLINE,INSERT_NEWLINE+"[[/div]]","block contents",WIKIDOT.Editor.utils.trimSelection,WIKIDOT.Editor.utils.endWithAtLeast2NewLine,WIKIDOT.Editor.utils.startWithAtLeast2NewLine)},bibliography:function(b){WIKIDOT.Editor.utils.insertTags("[[bibliography]]"+INSERT_NEWLINE+": "," : full source reference"+INSERT_NEWLINE+"[[/bibliography]]","label",WIKIDOT.Editor.utils.trimSelection,WIKIDOT.Editor.utils.endWithAtLeast2NewLine,WIKIDOT.Editor.utils.startWithAtLeast2NewLine)},bibliographycitation:function(b){WIKIDOT.Editor.utils.insertTags("[((bibcite ","))]","label",WIKIDOT.Editor.utils.trimSelection)},imageWizard:function(b){WIKIDOT.Editor.currentPos=WIKIDOT.Editor.ranger.getSelectionRange()[0];var c=new OZONE.dialogs.Dialog();c.style.width="70%";c.title=ogettext("Image wizard");c.buttons=["cancel","insert code"];c.addButtonListener("cancel",c.close);c.addButtonListener("insert code",WIKIDOT.Editor.imageWizard.insertCode);c.content=$("wd-ed-imagewizard-dialog").innerHTML.replace(/\-template/g,"");c.show();$j("#342type1").focus();if($("np-title")){$j(".image-wizard-source-attached").hide();$j(".image-wizard-source-attached input").attr("disabled","disabled")}else{$j(".image-wizard-source-attached").show();$j(".image-wizard-source-attached input").removeAttr("disabled")}WIKIDOT.Editor.imageWizard.updateSourceBlock()},tableWizard:function(b){WIKIDOT.Editor.currentPos=WIKIDOT.Editor.ranger.getSelectionRange()[0];var c=new OZONE.dialogs.Dialog();c.title=ogettext("Table wizard");c.buttons=["cancel","insert code"];c.addButtonListener("cancel",c.close);c.addButtonListener("insert code",WIKIDOT.Editor.listeners.tableWizardInsert);c.content=$("wd-ed-tablewizard-dialog").innerHTML.replace(/\-template/g,"");c.show();$j("#wd-ed-tablewizard-rows").focus()},uriWizard:function(b){WIKIDOT.Editor.currentPos=WIKIDOT.Editor.ranger.getSelectionRange()[0];var c=new OZONE.dialogs.Dialog();c.title=ogettext("URL link wizard");c.buttons=["cancel","insert code"];c.addButtonListener("cancel",c.close);c.addButtonListener("insert code",WIKIDOT.Editor.listeners.uriWizardInsert);c.content=$("wd-ed-uriwizard-dialog").innerHTML.replace(/\-template/g,"");c.show();$j("#wd-ed-uriwizard-uri").focus()},pageLinkWizard:function(f){WIKIDOT.Editor.currentPos=WIKIDOT.Editor.ranger.getSelectionRange()[0];var g=new OZONE.dialogs.Dialog();g.title=ogettext("Page link wizard");g.buttons=["cancel","insert code"];g.addButtonListener("cancel",g.close);g.addButtonListener("insert code",WIKIDOT.Editor.listeners.pageLinkWizardInsert);g.content=$("wd-ed-pagelinkwizard-dialog").innerHTML.replace(/\-template/g,"");g.show();var b=new YAHOO.util.XHRDataSource("/quickmodule.php");b.responseType=YAHOO.util.XHRDataSource.TYPE_JSON;b.responseSchema={resultsList:"pages",fields:["unix_name","title"]};var c=new YAHOO.widget.AutoComplete("wd-ed-pagelinkwizard-page","autocomplete3432",b);c.generateRequest=function(d){return"?s="+WIKIREQUEST.info.siteId+"&module=PageLookupQModule&q="+d};c.formatResult=function(d,j){var h=d[1];var e=d[0];if(e!=null){return""+e+'
('+h+")
"}else{return""}};c.minQueryLength=2;c.queryDelay=0.5;c.forceSelection=false;c.autoHighlight=false;$j("#wd-ed-pagelinkwizard-page").focus()},codeWizard:function(b){WIKIDOT.Editor.currentRange=WIKIDOT.Editor.ranger.getSelectionRange();var c=new OZONE.dialogs.Dialog();c.title=ogettext("Code block wizard");c.buttons=["cancel","insert code"];c.addButtonListener("cancel",c.close);c.addButtonListener("insert code",WIKIDOT.Editor.listeners.codeWizardInsert);c.content=$("wd-ed-codewizard-dialog").innerHTML.replace(/\-template/g,"");c.show();$j("#wd-ed-codewizard-type").focus()},erefWizard:function(f){WIKIDOT.Editor.currentPos=WIKIDOT.Editor.ranger.getSelectionRange()[0];var g=new OZONE.dialogs.Dialog();g.title=ogettext("Equation reference wizard");g.buttons=["cancel","insert code"];g.addButtonListener("cancel",g.close);g.addButtonListener("insert code",WIKIDOT.Editor.erefWizard.insertCode);g.content=$("wd-ed-erefwizard-dialog").innerHTML.replace(/\-template/g,"");g.show();var m=$(WIKIDOT.Editor.editElementId).value;var h=m.match(/^\[\[math\s([a-zA-Z0-9]+)\]\](\r?\n.*)*?\r?\n\[\[\/math\]\]/mg);if(h==null||h.length==0){var l=new OZONE.dialogs.ErrorDialog();l.content="Sorry, no labelled equations found.";l.show();return}var j="";if(h.length==0){j="no equations with labels available"}else{j='"}$j("#wd-ed-erefwizard-options").html(j);OZONE.dialog.factory.boxcontainer().centerContent();WIKIDOT.Editor.erefWizard.changeRef(null);YAHOO.util.Event.addListener("wd-ed-erefwizard-ref","change",WIKIDOT.Editor.erefWizard.changeRef);$j("#wd-ed-erefwizart-weq").focus()}};WIKIDOT.Editor.erefWizard={};WIKIDOT.Editor.erefWizard.changeRef=function(f){var d=$("wd-ed-erefwizard-preview");var b=d.childNodes;for(var c=0;cNot a valid input for the flickr.com image." ;return}g.flickr_id="d;OZONE.ajax.requestModule("editor/FlickrCheckModule",g,WIKIDOT.Editor.imageWizard.checkFlickrImageCallback)};WIKIDOT.Editor.imageWizard.checkFlickrImageCallback=function(c){var">Checking image... If you see the image below - that means the location of the image you have entered is ok.

close this window
');var c=f.document.getElementById("check-image");YAHOO.util.Event.addListener(c,"load",WIKIDOT.Editor.imageWizard.checkUriImageResize,f)};WIKIDOT.Editor.imageWizard.checkUriImageResize=function(g,f){var d=Math.min(this.width+200,screen.availWidth-100);var b=Math.min(this.height+200,screen.availHeight-100);var c=(screen.availWidth-d)*0.5;var h=(screen.availHeight-b)*0.5;f.resizeTo(d,b);f.moveTo(c,h)};WIKIDOT.Editor.imageWizard.insertCode=function(h){var k=WIKIDOT.Editor.imageWizard.source;var b;if(k=="uri"){b=$("wd-ed-imagewizard-uri").value}else{if(k=="file"){b=$("wd-ed-imagewizard-byfile-filename").value}else{if(k=="flickr"){var l=$("wd-ed-imagewizard-flickr").value;var m=l.replace(/^http:\/\/(?:www\.)?flickr\.com\/.*?\/([0-9]+)(?:\/.*)?$/,"$1");var f=null;if(l.match(/^http:\/\/static\.flickr\.com\/[0-9]+\/([0-9]+)_([0-9a-z]+).*$/)){m=l.replace(/^http:\/\/static\.flickr\.com\/[0-9]+\/([0-9]+)_([0-9a-z]+).*$/,"$1");f=l.replace(/^http:\/\/static\.flickr\.com\/[0-9]+\/([0-9]+)_([0-9a-z]+).*$/,"$2")}if(!m.match(/^([0-9]+)$/)){var j=$("wd-ed-imagewizard-checkresult");j.innerHTML='Not a valid input for the flickr.com image.
';return}b="flickr:"+m;if(f){b+="_"+f}}}}var n="";var d=$("wd-ed-imagewizard-size");if(d){n=d.value}if(n!=""){n=' size="'+n+'"'}var g=$("wd-ed-imagewizard-position").value.replace(/l/,"<").replace(/r/,">").replace(/c/,"=");var c="[["+g+"image "+b+n+"]]";WIKIDOT.Editor.ranger.setSelectionRange(WIKIDOT.Editor.currentPos,WIKIDOT.Editor.currentPos);WIKIDOT.Editor.utils.insertText(c);OZONE.dialog.cleanAll()};WIKIDOT.Editor.listeners={tableWizardInsert:function(h){var g=$("wd-ed-tablewizard-rows").value;var f=$("wd-ed-tablewizard-columns").value;var k=$("wd-ed-tablewizard-headers").checked;var c="";for(var d=0;d ");return b};WIKIDOT.Editor.utils.processNumberedList=function(b){var b=b.replace(/^\s+/,"").replace(/\s+$/,"");b=b.replace(/\r?\n/g,INSERT_NEWLINE+"# ");return b};WIKIDOT.Editor.utils.processBulletedList=function(b){var b=b.replace(/^\s+/,"").replace(/\s+$/,"");b=b.replace(/\r?\n/g,INSERT_NEWLINE+"* ");return b};WIKIDOT.Editor.utils.increaseListIndent=function(b){if(b.match(/\r?\n(\s*)[\*#].*\r?\n(\1)\s+[\*#].*$/)){return b}return b.replace(/(\r?\n\s*[\*#].*)(\r?\n\s*)([\*#].*)$/,"$1$2 $3")};WIKIDOT.Editor.utils.decreaseListIndent=function(b){return b.replace(/(\r?\n\s*) ([\*#].*)$/,"$1$2")};TextElementProxyUtil=function(b,c){this.field=$(b);this.detectBrowser(c)};TextElementProxyUtil.prototype.detectBrowser=function(d){if(YAHOO.env.ua.gecko||((this.field.selectionStart||this.field.selectionStart==0)&&(!YAHOO.env.ua.ie||YAHOO.env.ua.ie>=10))){this.browserType="gecko"}else{var c,b;if(d){c=document.createElement("textarea");c.style.position="absolute";c.style.top="0";c.style.left="-1000px";b=document.getElementsByTagName("body").item(0);b.appendChild(c)}else{c=this.field}c.focus();if(document.selection.createRange){this.browserType="ie";INSERT_NEWLINE="\r\n"}if(d){b.removeChild(c)}}};TextElementProxyUtil.prototype.getCursorPosition=function(){var b=this.getSelectionRange();return b[1]};TextElementProxyUtil.prototype.getSelectionRange=function(){var d;var c;this.field.focus();if(this.browserType=="gecko"){d=this.field.selectionStart;c=this.field.selectionEnd}if(this.browserType=="ie"){if(document.selection){var b=document.selection.createRange();var e=b.duplicate();e.moveToElementText(this.field);e.setEndPoint("StartToStart",b);d=this.field.value.length-e.text.length;c=d+b.text.length}}this.field.focus();return[d,c]};TextElementProxyUtil.prototype.setSelectionRange=function(d,c){this.field.focus();if(this.browserType=="gecko"){this.field.setSelectionRange(d,c)}if(this.browserType=="ie"){var e=this.field.value.substring(0,d);var f=this.field.value.substring(d,c);d=e.replace(/\r\n/g,"\n").length;c=d+f.replace(/\r\n/g,"\n").length;var b=this.field.createTextRange();b.collapse(true);b.moveEnd("character",c);b.moveStart("character",d);b.select()}this.field.focus()};TextElementProxyUtil.prototype.trimSelection=function(){var c=this.getSelectionRange();var e=this.field.value.substring(c[0],c[1]);var d=e.length-e.replace(/^\s+/,"").length;var b=e.length-e.replace(/\s+$/,"").length;this.setSelectionRange(c[0]+d,c[1]-b)};jQuery(document).ready(function(){jQuery(document).unbind("keydown").bind("keydown","ctrl+e",function(b){WIKIDOT.page.listeners.editClick(b);return false})});function keyBindSavePage(){jQuery(document).unbind("keydown").bind("keydown","backspace",function(b){if(/textarea|input/i.test(b.target.nodeName)==false){return false}});jQuery(document).unbind("keydown").bind("keydown","ctrl+s",function(b){WIKIDOT.modules.PageEditModule.listeners.save(b);return false})}function keyBindNewPost(){jQuery("form#new-post-form").unbind("keydown").bind("keydown","ctrl+s",function(b){WIKIDOT.modules.ForumNewPostFormModule.listeners.save(b);return false})}function keyBindEditPost(){jQuery("form#edit-post-form").unbind("keydown").bind("keydown","ctrl+s",function(b){WIKIDOT.modules.ForumEditPostFormModule.listeners.save(b);return false})}function keyBindNewThread(){jQuery("form#new-thread-form").unbind("keydown").bind("keydown","ctrl+s",function(b){WIKIDOT.modules.ForumNewThreadModule.listeners.post(b);return false})}function keyBindEditThread(){jQuery("form#thread-meta-form").unbind("keydown").bind("keydown","ctrl+s",function(b){WIKIDOT.modules.ForumEditThreadMetaModule.listeners.save(b);return false})}function keyBindSendPM(){jQuery("form#new-pm-form").unbind("keydown").bind("keydown","ctrl+s",function(b){WIKIDOT.modules.DMNewMessageModule.listeners.send(b);return false})};