function edShowExtraCookie(){var a=document.cookie.split(";");for(var b=0;b<a.length;b++){var c=a[b];while(c.charAt(0)==" "){c=c.substring(1,c.length)}if(c.indexOf("js_quicktags_extra")==0){if(c.substring(19,c.length)=="show"){return true}else{return false}}}return false}function edSetCookie(a,b,c,d,e){document.cookie=a+"="+escape(b)+(c?"; expires="+c.toGMTString():"")+(d?"; path="+d:"")+(e?"; domain="+e:"")}function edInsertVia(a){myField=document.getElementById(a);var b=prompt("Enter the URL of the source link","http://");if(b){b='(Thanks <a href="'+b+'" rel="external">'+prompt("Enter the name of the source","")+"</a>)";edInsertContent(a,b)}}function countInstances(a,b){var c=a.split(b);return c.length-1}function edInsertFootnote(a){myField=document.getElementById(a);var b=prompt("Enter the footnote:","");if(!b||b==""){return false}var c=new Date;var d="fn"+c.getTime();var e=myField.value.indexOf('<ol class="footnotes">');if(e!=-1){var f=myField.value.substring(0,e);var g=myField.value.substring(e,myField.value.length);var h=countInstances(g,'<li id="')+1}else{var h=1}var h='<sup><a href="#'+d+'n" id="'+d+'" class="footnote">'+h+"</a></sup>";edInsertContent(a,h);if(e!=-1){f=myField.value.substring(0,e+h.length);g=myField.value.substring(e+h.length,myField.value.length)}else{var f=myField.value;var g="\n\n"+'<ol class="footnotes">'+"\n"+"</ol>"+"\n"}var i='\t<li id="'+d+'n">'+b+' [<a href="#'+d+'">back</a>]</li>'+"\n"+"</ol>";myField.value=f+g.replace("</ol>",i)}function edInsertImage(a){myField=document.getElementById(a);var b=prompt("Enter the URL of the image","http://");if(b){b='<img src="'+b+'" alt="'+prompt("Enter a description of the image","")+'" />';edInsertContent(a,b)}}function edInsertExtLink(a,b,c){myField=document.getElementById(a);if(!c){c="http://"}if(!edCheckOpenTags(a,b)){var d=prompt("Enter the URL",c);if(d){edButtons[b].tagStart='<a href="'+d+'" rel="external">';edInsertTag(a,b)}}else{edInsertTag(a,b)}}function edInsertLink(a,b,c){myField=document.getElementById(a);if(!c){c="http://"}if(!edCheckOpenTags(a,b)){var d=prompt("Enter the URL",c);if(d){edButtons[b].tagStart='<a href="'+d+'">';edInsertTag(a,b)}}else{edInsertTag(a,b)}}function edInsertContent(a,b){myField=document.getElementById(a);if(document.selection){myField.focus();sel=document.selection.createRange();sel.text=b;myField.focus()}else if(myField.selectionStart||myField.selectionStart=="0"){var c=myField.selectionStart;var d=myField.selectionEnd;var e=myField.scrollTop;myField.value=myField.value.substring(0,c)+b+myField.value.substring(d,myField.value.length);myField.focus();myField.selectionStart=c+b.length;myField.selectionEnd=c+b.length;myField.scrollTop=e}else{myField.value+=b;myField.focus()}}function edInsertTag(a,b){myField=document.getElementById(a);if(document.selection){myField.focus();sel=document.selection.createRange();if(sel.text.length>0){sel.text=edButtons[b].tagStart+sel.text+edButtons[b].tagEnd}else{if(!edCheckOpenTags(a,b)||edButtons[b].tagEnd==""){sel.text=edButtons[b].tagStart;edAddTag(a,b)}else{sel.text=edButtons[b].tagEnd;edRemoveTag(a,b)}}myField.focus()}else if(myField.selectionStart||myField.selectionStart=="0"){var c=myField.selectionStart;var d=myField.selectionEnd;var e=d;var f=myField.scrollTop;if(c!=d){myField.value=myField.value.substring(0,c)+edButtons[b].tagStart+myField.value.substring(c,d)+edButtons[b].tagEnd+myField.value.substring(d,myField.value.length);e+=edButtons[b].tagStart.length+edButtons[b].tagEnd.length}else{if(!edCheckOpenTags(a,b)||edButtons[b].tagEnd==""){myField.value=myField.value.substring(0,c)+edButtons[b].tagStart+myField.value.substring(d,myField.value.length);edAddTag(a,b);e=c+edButtons[b].tagStart.length}else{myField.value=myField.value.substring(0,c)+edButtons[b].tagEnd+myField.value.substring(d,myField.value.length);edRemoveTag(a,b);e=c+edButtons[b].tagEnd.length}}myField.focus();myField.selectionStart=e;myField.selectionEnd=e;myField.scrollTop=f}else{if(!edCheckOpenTags(a,b)||edButtons[b].tagEnd==""){myField.value+=edButtons[b].tagStart;edAddTag(a,b)}else{myField.value+=edButtons[b].tagEnd;edRemoveTag(a,b)}myField.focus()}}function edHideExtra(a){document.getElementById("ed_extra_buttons_"+a).style.display="none";document.getElementById("ed_extra_show_"+a).style.visibility="visible";edSetCookie("js_quicktags_extra","hide",new Date("December 31, 2100"))}function edShowExtra(a){document.getElementById("ed_extra_show_"+a).style.visibility="hidden";document.getElementById("ed_extra_buttons_"+a).style.display="block";edSetCookie("js_quicktags_extra","show",new Date("December 31, 2100"))}function edToolbar(a){document.write('<div id="ed_toolbar_'+a+'"><span>');for(i=0;i<extendedStart;i++){edShowButton(a,edButtons[i],i)}if(edShowExtraCookie()){document.write('<input type="button" id="ed_close_'+a+'" class="ed_button ed_closetags" onclick="edCloseAllTags(\''+a+'\');" value="Close Tags" />'+'<input type="button" id="ed_spell_'+a+'" class="ed_button ed_spell" onclick="edSpell(\''+a+'\');" value="Lookup" />')}else{document.write('<input type="button" id="ed_close_'+a+'" class="ed_button ed_closetags" onclick="edCloseAllTags(\''+a+'\');" value="Close Tags" />'+'<input type="button" id="ed_spell_'+a+'" class="ed_button ed_spell" onclick="edSpell(\''+a+'\');" value="Lookup" />')}for(i=extendedStart;i<edButtons.length;i++){}document.write("</span>");document.write("</div>");edOpenTags[a]=new Array}function edSpell(a){myField=document.getElementById(a);var b="";if(document.selection){myField.focus();var c=document.selection.createRange();if(c.text.length>0){b=c.text}}else if(myField.selectionStart||myField.selectionStart=="0"){var d=myField.selectionStart;var e=myField.selectionEnd;if(d!=e){b=myField.value.substring(d,e)}}if(b==""){b=prompt("Enter a word to look up:","")}if(b!=""){window.open(dictionaryUrl+escape(b))}}function edQuickLink(a,b){if(a>-1){var c="";if(edLinks[a].newWin==1){c=' target="_blank"'}var d='<a href="'+edLinks[a].URL+'"'+c+">"+edLinks[a].display+"</a>";b.selectedIndex=0;edInsertContent(edCanvas,d)}else{b.selectedIndex=0}}function edCloseAllTags(a){var b=edOpenTags[a].length;for(o=0;o<b;o++){edInsertTag(a,edOpenTags[a][edOpenTags[a].length-1])}}function edCheckOpenTags(a,b){var c=0;for(i=0;i<edOpenTags[a].length;i++){if(edOpenTags[a][i]==b){c++}}if(c>0){return true}else{return false}}function edRemoveTag(a,b){for(i=0;i<edOpenTags[a].length;i++){if(edOpenTags[a][i]==b){edOpenTags[a].splice(i,1);document.getElementById(edButtons[b].id+"_"+a).value=document.getElementById(edButtons[b].id+"_"+a).value.replace("/","")}}}function edAddTag(a,b){if(edButtons[b].tagEnd!=""){edOpenTags[a][edOpenTags[a].length]=b;document.getElementById(edButtons[b].id+"_"+a).value="/"+document.getElementById(edButtons[b].id+"_"+a).value}}function edShowLinks(){var a='<select onchange="edQuickLink(this.options[this.selectedIndex].value, this);"><option value="-1" selected>(Quick Links)</option>';for(i=0;i<edLinks.length;i++){a+='<option value="'+i+'">'+edLinks[i].display+"</option>"}a+="</select>";document.write(a)}function edShowButton(a,b,c){if(b.access){var d=' accesskey = "'+b.access+'"'}else{var d=""}switch(b.id){case"ed_img":document.write('<input type="button" id="'+b.id+"_"+a+'" '+d+' class="ed_button '+b.id+'" onclick="edInsertImage(\''+a+'\');" value="'+b.display+'" />');break;case"ed_link":document.write('<input type="button" id="'+b.id+"_"+a+'" '+d+' class="ed_button '+b.id+'" onclick="edInsertLink(\''+a+"', "+c+');" value="'+b.display+'" />');break;case"ed_ext_link":document.write('<input type="button" id="'+b.id+"_"+a+'" '+d+' class="ed_button '+b.id+'" onclick="edInsertExtLink(\''+a+"', "+c+');" value="'+b.display+'" />');break;case"ed_footnote":document.write('<input type="button" id="'+b.id+"_"+a+'" '+d+' class="ed_button '+b.id+'" onclick="edInsertFootnote(\''+a+'\');" value="'+b.display+'" />');break;case"ed_via":document.write('<input type="button" id="'+b.id+"_"+a+'" '+d+' class="ed_button '+b.id+'" onclick="edInsertVia(\''+a+'\');" value="'+b.display+'" />');break;default:document.write('<input type="button" id="'+b.id+"_"+a+'" '+d+' class="ed_button '+b.id+'" onclick="edInsertTag(\''+a+"', "+c+');" value="'+b.display+'"  />');break}}function edLink(a,b,c){this.display=a;this.URL=b;if(!c){c=0}this.newWin=c}function edButton(a,b,c,d,e,f){this.id=a;this.display=b;this.tagStart=c;this.tagEnd=d;this.access=e;this.open=f}var dictionaryUrl="http://www.ninjawords.com/";var edButtons=new Array;var edLinks=new Array;var edOpenTags=new Array;edButtons.push(new edButton("ed_bold","B","<strong>","</strong>","b"));edButtons.push(new edButton("ed_italic","I","<em>","</em>","i"));edButtons.push(new edButton("ed_link","Link","","</a>","a"));edButtons.push(new edButton("ed_block","B-QUOTE","<blockquote>","</blockquote>","q"));edButtons.push(new edButton("ed_img","IMG","","","m",-1));edButtons.push(new edButton("ed_ul","UL","<ul>\n","</ul>\n\n","u"));edButtons.push(new edButton("ed_ol","OL","<ol>\n","</ol>\n\n","o"));edButtons.push(new edButton("ed_li","LI","\t<li>","</li>\n","l"));edButtons.push(new edButton("ed_code","CODE","<code>","</code>","c"));var extendedStart=edButtons.length;edLinks[edLinks.length]=new edLink("alexking.org","http://www.alexking.org/")
