Commits

Anonymous committed 5d22472

new version for prod.

Comments (0)

Files changed (8)

static/css/screen.css

 aside#sidebar {display:block;width:22%;float:right;}
 aside ul {list-style:none;margin:0;padding:0;}
 aside.hidden {display:none;}
+.hidden {display:none;}
 header h1,header h2 {padding:0px;}
 header h1 {padding-top:5px;}
 header h2 {padding-bottom:10px;}
 .window .window_title {margin-top:-7px;margin-left:15px;margin-bottom:7px;cursor:move;}
 .window form {position:relative;}
 .window .close {display:block;position:absolute;top:4px;left:5px;height:13px;width:13px;background-image:url(../img/window_close.gif);cursor:pointer;cursor:hand;}
-#snippet_window form table {width:100%;margin:5px 0 5px 0;}
-#snippet_window th, td {padding:5px 10px 5px 10px;vertical-align:top;}
+#link_window textarea {width:350px;}
+#snippet_window form table,#link_window form table {width:100%;margin:5px 0 5px 0;}
+#snippet_window th, #snippet_window td,#link_window th, #link_window td {padding:5px 10px 5px 10px;vertical-align:top;}
+tr.rlink_type {border-bottom:1px solid;}
+#link_window input[type="text"] {width:350px;}
 #snippet_window textarea {width:450px;height:200px;}
-#snippet_window p {line-height:15px;vertical-align:middle;margin-top:5px;}
+#snippet_window p,#link_window p {line-height:15px;vertical-align:middle;margin-top:5px;}
 input, textarea {border-style:solid solid solid solid;border-width:1px 1px 1px 1px;margin:4px 4px 0 0;padding:2px;}
-#snippet_window input[type="submit"] {border:1px solid;}
+#snippet_window input[type="submit"],#link_window {border:1px solid;}
 #snippet_url {width:450px;}
 div.resizable_handle {height:5px;width:16px;position:absolute;right:-14px;bottom:-4px;background-image:url(../img/layout_sprite.png );background-repeat:no-repeat;background-position:-22px -62px;}
 a#doCreate {display:block;line-height:18px;height:18px;}

static/css/theme.css

 .window {background-color:#dedede;color:#bbbbbb;border:#ababab;}
 .window form table {background-color:#2c2c2c;}
 .window form p a, .window a:visited {color:#bbb;}
+tr.rlink_type {border-color:#fff;}
 input, textarea {border-color:#C6C6C6 #EFEFEF #EFEFEF #C6C6C6;}
 .window input[type="submit"] {background-color:#3d3d3d;border-color:#bbb;color:#bbb;}

static/js/couchit-application.js

-if(!document.createElementNS){document.createElement("section");document.createElement("audio");document.createElement("video");document.createElement("article");document.createElement("aside");document.createElement("footer");document.createElement("header");document.createElement("nav");document.createElement("time")}Date.parseRFC3339=function(C){var B=new Date(0);var A=C.match(/(\d{4})-(\d\d)-(\d\d)\s*(?:[\sT]\s*(\d\d):(\d\d)(?::(\d\d))?(\.\d*)?\s*(Z|([-+])(\d\d):(\d\d))?)?/);if(!A){return }if(A[2]){A[2]--}if(A[7]){A[7]=(A[7]+"000").substring(1,4)}var E=[null,"FullYear","Month","Date","Hours","Minutes","Seconds","Milliseconds"];for(var D=1;D<=7;D++){if(A[D]){B["setUTC"+E[D]](A[D])}}if(A[9]){B.setTime(B.getTime()+(A[9]=="-"?1:-1)*(A[10]*3600000+A[11]*60000))}return B.getTime()};function localizeDates(){var B="";var A=new Date();$$("time").each(function(E,D){if(E.getAttribute("title")=="GMT"){var C=new Date(Date.parseRFC3339(E.getAttribute("datetime")));if(!C.getTime()){return }diff=((A.getTime()-C.getTime())/1000),day_diff=Math.floor(diff/86400);if(isNaN(day_diff)||day_diff<0||day_diff>=31){return }var G=C.toLocaleString();var F=C.toLocaleString();if(day_diff==0){G=(diff<60&&"Just Now"||diff<120&&"1 minute ago"||diff<3600&&Math.floor(diff/60)+" minutes ago"||diff<7200&&"1 hour ago"||diff<86400&&Math.floor(diff/3600)+" hours ago");F=C.toLocaleTimeString()}else{hours=C.getHours();minutes=C.getMinutes();hours=(hours<10)&&"0"+hours||hours;minutes=(minutes<10)&&"0"+minutes||minutes;G=(day_diff==1&&"Yesterday at "+hours+":"+minutes||E.textContent);F=C.toLocaleString()}E.setAttribute("title",F);E.textContent="posted "+G}})}var Page={};var Site={url:"",name:""};var FORBIDDEN_PAGES=["site","delete","edit","create","history","changes"];var Create=Class.create({initialize:function(){var A=this;this.Form=$("fnewpage");this.doCreate=$("doCreate");this.Form.addClassName("hidden");Event.observe(this.doCreate,"click",function(B){Event.stop(B);A.show();return false},false);Event.observe($$("a.cancelCreate")[0],"click",function(B){Event.stop(B);A.cancel();return false},false);$("screate").observe("click",function(B){Event.stop(B);A.submit();return false},false)},show:function(){this.doCreate.addClassName("hidden");this.Form.removeClassName("hidden")},cancel:function(){this.Form.addClassName("hidden");this.doCreate.removeClassName("hidden")},submit:function(){var B=$("title");if(!B.value.match(/^[ \w\u00A1-\uFFFF]+$/i)||FORBIDDEN_PAGES.indexOf(B.value)>=0){alert("Page title invalid");return false}var A=B.value.replace(/ /g,"_");document.location.href=Site.url+"/"+A+"#pedit"},});var Compare=Class.create({nb_selected:0,selected:false,initialize:function(){var A=this;this.Form=$("fhistory");$$("input.c").each(function(B){B.observe("click",function(C){A.check(this)},false)})},check:function(A){row=A.parentNode.parentNode;row.toggleClassName("rselected");if(!A.checked){this.nb_selected-=1;A.removeClassName("selected")}else{this.nb_selected+=1;A.addClassName("selected")}if(this.nb_selected==2){$$("input.c").each(function(B){if(!B.hasClassName("selected")){B.disabled="disabled"}});this.selected=true}else{if(this.selected){$$("input.c").each(function(B){if(!B.hasClassName("selected")){B.disabled=null}});this.selected=false}}}});var Diff=Class.create({initialize:function(){var A=this;this.rev_from=$("rev_from");this.rev_to=$("rev_to");$("scompare").observe("click",function(B){Event.stop(B);A.get_diff();return false})},get_diff:function(){var B=this.rev_from.getValue();var A=this.rev_to.getValue();if(B==A){alert("Why would you want compare same version ...");return }url=$("fdiff").action+"?r="+B+"&r="+A;new Ajax.Request(url,{method:"get",contentType:"application/json",requestHeaders:{Accept:"application/json"},onSuccess:function(C){data=C.responseText.evalJSON(true);if(data.ok){Element.remove($("tableDiff"));$("pdiff").insert(data.diff)}}})}});var Settings=Class.create({initialize:function(){var A=this;this.observer=null;this.title=$("site_header").select("h1 a")[0];this.subtitle=$("site_header").select("h2")[0];$$("input").each(function(B){new Form.Element.Observer(B,0.2,function(C,D){if(C.id=="site_title"){A.title.update(D);document.title=D+" - settings"}if(C.id=="site_subtitle"){A.subtitle.update(D)}if(A.observer){clearTimeout(A.observer)}A.observer=setTimeout(A.save.bind(A),400)})})},save:function(){var A={};try{A={title:$("site_title").getValue(),subtitle:$("site_subtitle").getValue(),email:$("email").getValue(),privacy:$$('input:checked[type="radio"][name="privacy"]').pluck("value")[0],allow_javascript:$("allow_javascript").getValue()}}catch(B){A={title:$("site_title").getValue(),subtitle:$("site_subtitle").getValue()}}url=$("fsettings").action;new Ajax.Request(url,{method:"post",postBody:Object.toJSON(A),contentType:"application/json",requestHeaders:{Accept:"application/json"},onSuccess:function(C){A=C.responseText.evalJSON(true)}})}});var SiteAddress=Class.create({initialize:function(){var A=this;if(!$("error").innerHTML){$("error").hide()}new Form.Element.Observer("alias",0.2,function(B,C){if(C.length>3&&!C.match(/^(\w+)$/)){$("error").update("<strong>Error:</strong> "+$("alias").value+" is invalid, only use letters and numbers.");$("error").show()}else{$("error").hide()}});$("faddress").observe("submit",function(D){Event.stop(D);var B=null;var C=$("alias").getValue();if(C.length<=3){B="length < 3"}else{if(!C.match(/^(\w+)$/)){B=C+" is invalid, only use letters and numbers."}}if(B){$("error").update("<strong>Error:</strong> "+B);$("error").show();return false}else{A.valid_name()}},false)},valid_name:function(){url=$("faddress").action;new Ajax.Request(url,{method:"get",contentType:"application/json",parameters:{alias:$("alias").getValue()},requestHeaders:{Accept:"application/json"},onSuccess:function(A){data=A.responseText.evalJSON(true);if(data.ok){$("faddress").submit()}else{$("error").update("<strong>Error:</strong> "+data.error);$("error").show()}}})}});var Claim=Class.create({initialize:function(){var A=this;this.email=$("email");this.password=$("password");$("fclaim").observe("submit",function(B){Event.stop(B);if(A.validate()){this.submit()}},false)},validate:function(){$$(".help_error").each(function(B){B.remove()});$$(".errors").each(function(B){B.removeClassName("errors")});nb_errors=0;if(!this.email.value.match(/(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-011\013\014\016-\177])*")@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}$/i)){var A=new Element("div",{"class":"help_error"}).update("Invalid email address.");this.email.parentNode.insert(A);$("row_email").addClassName("errors");nb_errors+=1}if(this.password.value.length<=0){var A=new Element("div",{"class":"help_error"}).update("You should set a password.");this.password.parentNode.insert(A);$("row_password").addClassName("errors");nb_errors+=1}if(nb_errors>0){return false}return true}});document.observe("dom:loaded",function(){localizeDates()});
+if(!document.createElementNS){document.createElement("section");document.createElement("audio");document.createElement("video");document.createElement("article");document.createElement("aside");document.createElement("footer");document.createElement("header");document.createElement("nav");document.createElement("time")}Date.parseRFC3339=function(C){var B=new Date(0);var A=C.match(/(\d{4})-(\d\d)-(\d\d)\s*(?:[\sT]\s*(\d\d):(\d\d)(?::(\d\d))?(\.\d*)?\s*(Z|([-+])(\d\d):(\d\d))?)?/);if(!A){return }if(A[2]){A[2]--}if(A[7]){A[7]=(A[7]+"000").substring(1,4)}var E=[null,"FullYear","Month","Date","Hours","Minutes","Seconds","Milliseconds"];for(var D=1;D<=7;D++){if(A[D]){B["setUTC"+E[D]](A[D])}}if(A[9]){B.setTime(B.getTime()+(A[9]=="-"?1:-1)*(A[10]*3600000+A[11]*60000))}return B.getTime()};function localizeDates(){var B="";var A=new Date();$$("time").each(function(E,D){if(E.getAttribute("title")=="GMT"){var C=new Date(Date.parseRFC3339(E.getAttribute("datetime")));if(!C.getTime()){return }diff=((A.getTime()-C.getTime())/1000),day_diff=Math.floor(diff/86400);if(isNaN(day_diff)||day_diff<0||day_diff>=31){return }var G=C.toLocaleString();var F=C.toLocaleString();if(day_diff==0){G=(diff<60&&"Just Now"||diff<120&&"1 minute ago"||diff<3600&&Math.floor(diff/60)+" minutes ago"||diff<7200&&"1 hour ago"||diff<86400&&Math.floor(diff/3600)+" hours ago");F=C.toLocaleTimeString()}else{hours=C.getHours();minutes=C.getMinutes();hours=(hours<10)&&"0"+hours||hours;minutes=(minutes<10)&&"0"+minutes||minutes;G=(day_diff==1&&"Yesterday at "+hours+":"+minutes||E.textContent);F=C.toLocaleString()}E.setAttribute("title",F);E.textContent="posted "+G}})}var Page={};var Site={url:"",name:""};var FORBIDDEN_PAGES=["site","delete","edit","create","history","changes"];var Create=Class.create({initialize:function(){var A=this;this.Form=$("fnewpage");this.doCreate=$("doCreate");this.Form.addClassName("hidden");Event.observe(this.doCreate,"click",function(B){Event.stop(B);A.show();return false},false);Event.observe($$("a.cancelCreate")[0],"click",function(B){Event.stop(B);A.cancel();return false},false);$("screate").observe("click",function(B){Event.stop(B);A.submit();return false},false)},show:function(){this.doCreate.addClassName("hidden");this.Form.removeClassName("hidden")},cancel:function(){this.Form.addClassName("hidden");this.doCreate.removeClassName("hidden")},submit:function(){var B=$("title");if(!B.value.match(/^['\-\"\/ \w\u00A1-\uFFFF]+$/i)||FORBIDDEN_PAGES.indexOf(B.value)>=0){alert("Page title invalid");return false}var A=B.value.replace(/ /g,"_");url=Site.url+"/"+A+"#pedit";window.location.href=url;this.Form.addClassName("hidden");this.doCreate.removeClassName("hidden")},});var Compare=Class.create({nb_selected:0,selected:false,initialize:function(){var A=this;this.Form=$("fhistory");$$("input.c").each(function(B){B.observe("click",function(C){A.check(this)},false)})},check:function(A){row=A.parentNode.parentNode;row.toggleClassName("rselected");if(!A.checked){this.nb_selected-=1;A.removeClassName("selected")}else{this.nb_selected+=1;A.addClassName("selected")}if(this.nb_selected==2){$$("input.c").each(function(B){if(!B.hasClassName("selected")){B.disabled="disabled"}});this.selected=true}else{if(this.selected){$$("input.c").each(function(B){if(!B.hasClassName("selected")){B.disabled=null}});this.selected=false}}}});var Diff=Class.create({initialize:function(){var A=this;this.rev_from=$("rev_from");this.rev_to=$("rev_to");$("scompare").observe("click",function(B){Event.stop(B);A.get_diff();return false})},get_diff:function(){var B=this.rev_from.getValue();var A=this.rev_to.getValue();if(B==A){alert("Why would you want compare same version ...");return }url=$("fdiff").action+"?r="+B+"&r="+A;new Ajax.Request(url,{method:"get",contentType:"application/json",requestHeaders:{Accept:"application/json"},onSuccess:function(C){data=C.responseText.evalJSON(true);if(data.ok){Element.remove($("tableDiff"));$("pdiff").insert(data.diff)}}})}});var Settings=Class.create({initialize:function(){var A=this;this.observer=null;this.title=$("site_header").select("h1 a")[0];this.subtitle=$("site_header").select("h2")[0];$$("input").each(function(B){new Form.Element.Observer(B,0.2,function(C,D){if(C.id=="site_title"){A.title.update(D);document.title=D+" - settings"}if(C.id=="site_subtitle"){A.subtitle.update(D)}if(A.observer){clearTimeout(A.observer)}A.observer=setTimeout(A.save.bind(A),400)})})},save:function(){var A={};try{A={title:$("site_title").getValue(),subtitle:$("site_subtitle").getValue(),email:$("email").getValue(),privacy:$$('input:checked[type="radio"][name="privacy"]').pluck("value")[0],allow_javascript:$("allow_javascript").getValue()}}catch(B){A={title:$("site_title").getValue(),subtitle:$("site_subtitle").getValue()}}url=$("fsettings").action;new Ajax.Request(url,{method:"post",postBody:Object.toJSON(A),contentType:"application/json",requestHeaders:{Accept:"application/json"},onSuccess:function(C){A=C.responseText.evalJSON(true)}})}});var SiteAddress=Class.create({initialize:function(){var A=this;if(!$("error").innerHTML){$("error").hide()}new Form.Element.Observer("alias",0.2,function(B,C){if(C.length>3&&!C.match(/^(\w+)$/)){$("error").update("<strong>Error:</strong> "+$("alias").value+" is invalid, only use letters and numbers.");$("error").show()}else{$("error").hide()}});$("faddress").observe("submit",function(D){Event.stop(D);var B=null;var C=$("alias").getValue();if(C.length<=3){B="length < 3"}else{if(!C.match(/^(\w+)$/)){B=C+" is invalid, only use letters and numbers."}}if(B){$("error").update("<strong>Error:</strong> "+B);$("error").show();return false}else{A.valid_name()}},false)},valid_name:function(){url=$("faddress").action;new Ajax.Request(url,{method:"get",contentType:"application/json",parameters:{alias:$("alias").getValue()},requestHeaders:{Accept:"application/json"},onSuccess:function(A){data=A.responseText.evalJSON(true);if(data.ok){$("faddress").submit()}else{$("error").update("<strong>Error:</strong> "+data.error);$("error").show()}}})}});var Claim=Class.create({initialize:function(){var A=this;this.email=$("email");this.password=$("password");$("fclaim").observe("submit",function(B){Event.stop(B);if(A.validate()){this.submit()}},false)},validate:function(){$$(".help_error").each(function(B){B.remove()});$$(".errors").each(function(B){B.removeClassName("errors")});nb_errors=0;if(!this.email.value.match(/(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-011\013\014\016-\177])*")@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}$/i)){var A=new Element("div",{"class":"help_error"}).update("Invalid email address.");this.email.parentNode.insert(A);$("row_email").addClassName("errors");nb_errors+=1}if(this.password.value.length<=0){var A=new Element("div",{"class":"help_error"}).update("You should set a password.");this.password.parentNode.insert(A);$("row_password").addClassName("errors");nb_errors+=1}if(nb_errors>0){return false}return true}});document.observe("dom:loaded",function(){localizeDates()});

static/js/couchit-page.js

-var PageUI=Class.create({initialize:function(){var A=this;this.Sidebar=$("sidebar");this.Page=$("page");this.tabs=new Control.Tabs("tabs_wiki");this.textarea=new Control.TextArea("content");this.toolbar=new Control.TextArea.ToolBar(this.textarea);this.toolbar.container.id="markdown_toolbar";this.converter=new Showdown.converter;this.converter_callback=function(C){$("preview").innerHTML=A.converter.makeHtml(C)};this.converter_callback(this.textarea.getValue());this.textarea.observe("change",A.converter_callback);this.snippet_window=new Control.Window($("snippet_window"),{resizable:true,draggable:$("snippet_window_title"),closeOnClick:$("snippet_window_close")});this.build_toolbar();this.init();this.tabs.observe("beforeChange",function(D,C){if(!Page.created){A.update_tabs(C)}else{var E=window.confirm("Are you sure you want to navigate away from this page?\n\nYou have unsaved changes. Continue and discard those changes?\n\nClick OK to continue, or click Cancel to stay on this page.");if(!E){throw $break}else{history.go(-1)}}});window.onresize=function(D){var C=document.viewport.getHeight()-250;$("content").setStyle({height:C+"px"})};$("cancelEdit").observe("click",function(C){Event.stop(C);A.tabs.setActiveTab("pview");return false});var B=$("page_delete");if(B){B.observe("click",function(C){Event.stop(C);var D=window.confirm("Are you sure you want to delete this page?\n\nClick OK to continue, or click Cancel to stay on this page.");if(!D){return false}document.location.href=this.href},false)}this._renamingPage=false;if(!Page.created&&!Page.home){this.page_title=$("page_title");this.page_title.setStyle({cursor:"pointer"});this.page_title.title="Click to rename";this.createRenameForm();this.page_title.observe("click",function(C){this._renamingPage=true;A.handleRename()},false)}},init:function(){var B=this.tabs.activeContainer;if(Page.created&&B.id!="pedit"){this.tabs.setActiveTab("pedit")}B=this.tabs.activeContainer;if(B){this.update_tabs(B)}var A=document.viewport.getHeight()-250;$("content").setStyle({height:A+"px"})},update_tabs:function(A){if(A.id=="pedit"){this.Sidebar.hide();this.Page.setStyle({width:"99%"});if(this._renamingPage){this.removeRenameForm()}}else{this.Page.setStyle({width:"76%"});this.Sidebar.show()}},build_toolbar:function(){var A=this;this.toolbar.addButton("Italics",function(){this.wrapSelection("*","*")},{id:"markdown_italics_button"});this.toolbar.addButton("Bold",function(){this.wrapSelection("**","**")},{id:"markdown_bold_button"});this.toolbar.addButton("Link",function(){var C=this.getSelection();var B=prompt("Enter Link URL","");if(B==null){return }this.replaceSelection("["+(C==""?"Link Text":C)+"]("+(B==""?"http://link_url/":B).replace(/^(?!(f|ht)tps?:\/\/)/,"http://")+")")},{id:"markdown_link_button"});this.toolbar.addButton("Image",function(){var C=this.getSelection();var B=prompt("Enter Image URL","");if(B==null){return }this.replaceSelection("!["+(C==""?"Image Alt Text":C)+"]("+(B==""?"http://image_url/":B).replace(/^(?!(f|ht)tps?:\/\/)/,"http://")+")")},{id:"markdown_image_button"});this.toolbar.addButton("Heading",function(){var B=this.getSelection();if(B==""){B="Heading"}this.replaceSelection("\n"+B+"\n"+$R(0,Math.max(5,B.length)).collect(function(){}).join("")+"\n")},{id:"markdown_heading_button"});this.toolbar.addButton("Unordered List",function(B){this.collectFromEachSelectedLine(function(C){return B.shiftKey?(C.match(/^\*{2,}/)?C.replace(/^\*/,""):C.replace(/^\*\s/,"")):(C.match(/\*+\s/)?"*":"* ")+C})},{id:"markdown_unordered_list_button"});this.toolbar.addButton("Ordered List",function(C){var B=0;this.collectFromEachSelectedLine(function(D){if(!D.match(/^\s+$/)){++B;return C.shiftKey?D.replace(/^\d+\.\s/,""):(D.match(/\d+\.\s/)?"":B+". ")+D}})},{id:"markdown_ordered_list_button"});this.toolbar.addButton("Block Quote",function(B){this.collectFromEachSelectedLine(function(C){return B.shiftKey?C.replace(/^\> /,""):"> "+C})},{id:"markdown_quote_button"});this.toolbar.addButton("Code Block",function(B){this.collectFromEachSelectedLine(function(C){return B.shiftKey?C.replace(/    /,""):"    "+C})},{id:"markdown_code_button"});this.toolbar.addButton("Snippet",function(E){var C=this.getSelection();if(C){var B=C.split("\n");if(B[0].match(/\s*:::(\w*)/)){var H=B[0].replace(/\s*:::(\w*)/,"$1");B.splice(0,1);if(H){$("snippet_language").select("option").each(function(I){if(I.value==H){I.selected=true}})}}var D=$A(B).collect(function(I){return I.replace(/    /,"")}).join("\n");$("snippet_content").value=D}A.snippet_window.open();var F=this;var G=function(L){Event.stop(L);var K=$("fsnippet").getInputs("radio","snippet_from");if(K[0].checked){var J=$("snippet_content").getValue();J=$A(J.split("\n")).collect(function(M){M="    "+M;return M}).join("\n");D="\n\n    :::"+$("snippet_language").getValue()+"\n"+J;F.replaceSelection(D);A.snippet_window.close();$("snippet_content").value=""}else{var I="/proxy?url="+encodeURIComponent($("snippet_url").getValue());new Ajax.Request(I,{method:"get",contentType:"application/json",requestHeaders:{Accept:"application/json"},onSuccess:function(M){data=M.responseText.evalJSON(true);J=$A(data.snippet.split("\n")).collect(function(N){return"    "+N}).join("\n");D=" \n\n    :::"+data.language+"\n"+J;F.replaceSelection(D);A.snippet_window.close();$("snippet_content").value=""},onFailure:function(){alert("mmm... error while trying to fetch content from friendpaste:(")}})}return false};$("ssnippet").observe("click",G,false);$("cancelSnippet").observe("click",function(I){Event.stop(I);A.snippet_window.close();return false});$("snippet_url","snippet_language","snippet_content").each(function(I){I.observe("focus",function(J){if(this.id=="snippet_url"){$("sfp").checked=true}else{$("si").checked=true}},false)})},{id:"markdown_snippet_button"});this.toolbar.addButton("Help",function(){window.open("http://daringfireball.net/projects/markdown/dingus")},{id:"markdown_help_button"})},createRenameForm:function(){var D=$("fedit").action;this._form=new Element("form",{id:"frename",method:"post",action:D});var A=new Element("input",{type:"text",id:"new_title",name:"new_title",value:$("page_title").innerHTML});var B=new Element("input",{type:"hidden",id:"old_title",name:"old_title",value:$("page_title").innerHTML});var C=new Element("a",{id:"rcancel","class":"cancel",href:"#"}).update("Cancel");this._form.insert(B);this._form.insert(A);this._form.insert(C);this._form.onsubmit=this.renamePage.bind(this)},renamePage:function(C){Event.stop(C);var B=$("new_title").getValue();var A=$("old_title").getValue();if(!B){alert("Page title can't be empty.")}else{if(A==B){this.removeRenameForm()}else{new Ajax.Request(this._form.action,{method:"post",contentType:"application/json",requestHeaders:{Accept:"application/json"},postBody:Object.toJSON(this._form.serialize(true)),onSuccess:function(D){data=D.responseText.evalJSON(true);if(data.ok){this._renamingPage=false;document.location.href=data.redirect_url}else{alert(data.error)}},onFailure:function(){alert("mmm... error while trying rename :(, Please contact administrator")}})}}},createRenameHelp:function(){var A=this;this._help=new Element("div",{"class":"rename hidden",}).update("&#x21E4; Click to rename");this.page_title.insert(this._help);this.page_title.observe("mouseover",function(B){A._help.removeClassName("hidden")},false);this.page_title.observe("mouseout",function(B){A._help.addClassName("hidden")},false)},removeRenameForm:function(){this._form.remove();this.createRenameForm();this.page_title.show();this._renamingPage=false},handleRename:function(){var A=this;this.page_title.hide();this.page_title.parentNode.insertBefore(this._form,$("page_title"));this._form.select(".cancel").each(function(B){B.observe("click",function(C){Event.stop(C);A.removeRenameForm();return false},false)})}});
+var PageUI=Class.create({initialize:function(){this.firstload=true;var A=this;this.Sidebar=$("sidebar");this.Page=$("page");this.tabs=new Control.Tabs("tabs_wiki");this.textarea=new Control.TextArea("content");this.toolbar=new Control.TextArea.ToolBar(this.textarea);this.toolbar.container.id="markdown_toolbar";this.converter=new Showdown.converter;this.converter_callback=function(C){$("preview").innerHTML=A.converter.makeHtml(C)};this.converter_callback(this.textarea.getValue());this.textarea.observe("change",A.converter_callback);this.snippet_window=new Control.Window($("snippet_window"),{resizable:false,draggable:$("snippet_window_title"),closeOnClick:$("snippet_window_close")});this.link_window=new Control.Window($("link_window"),{draggable:$("link_window_title"),closeOnClick:$("link_window_close")});this.link_types_hide={url:"page",page:"url"};this.build_toolbar();this.init();this.tabs.observe("beforeChange",function(D,C){if(!Page.created){A.update_tabs(C)}else{var E=window.confirm("Are you sure you want to navigate away from this page?\n\nYou have unsaved changes. Continue and discard those changes?\n\nClick OK to continue, or click Cancel to stay on this page.");if(!E){throw $break}else{history.go(-1)}}});window.onresize=function(D){var C=document.viewport.getHeight()-250;$("content").setStyle({height:C+"px"})};$("cancelEdit").observe("click",function(C){Event.stop(C);A.tabs.setActiveTab("pview");return false});var B=$("page_delete");if(B){B.observe("click",function(C){Event.stop(C);var D=window.confirm("Are you sure you want to delete this page?\n\nClick OK to continue, or click Cancel to stay on this page.");if(!D){return false}window.location.href=this.href},false)}this._renamingPage=false;if(!Page.created&&!Page.home){this.page_title=$("page_title");this.page_title.setStyle({cursor:"pointer"});this.page_title.title="Click to rename";this.createRenameForm();this.page_title.observe("click",function(C){this._renamingPage=true;A.handleRename()},false)}},init:function(){var B=this.tabs.activeContainer;if(Page.created&&B.id!="pedit"){this.tabs.setActiveTab("pedit")}B=this.tabs.activeContainer;if(B){this.update_tabs(B)}var A=document.viewport.getHeight()-250;$("content").setStyle({height:A+"px"})},update_tabs:function(A){if(A.id=="pedit"){this.Sidebar.hide();this.Page.setStyle({width:"99%"});if(this._renamingPage){this.removeRenameForm()}}else{this.Page.setStyle({width:"76%"});this.Sidebar.show()}},build_toolbar:function(){var A=this;this.toolbar.addButton("Italics",function(){this.wrapSelection("*","*")},{id:"markdown_italics_button"});this.toolbar.addButton("Bold",function(){this.wrapSelection("**","**")},{id:"markdown_bold_button"});this.toolbar.addButton("Link",function(){function C(E){$("link_from_"+E).show();$("link_from_"+A.link_types_hide[E]).hide()}insertLinkHandler=function(H){Event.stop(H);var G=$("link_type").getValue();var E=$("link_label").getValue();var I=$("link_page").getValue();var F=$("link_url").getValue();if(I==null||F==null){return }if(G=="page"){B.replaceSelection("["+(E==""?decodeURIComponent(I.replace(Site.url,"").replace(/_/g," ").replace(/\//,"")):E)+"]("+I+")")}else{B.replaceSelection("["+(E==""?"Link Text":E)+"]("+(F==""?"http://link_url/":F)+")")}A.link_window.close();this.stopObserving("click",arguments.callee,false)};A.link_window.open();C($("link_type").getValue());$("cancelLink").observe("click",function(E){Event.stop(E);A.link_window.close();return false});$("link_type").observe("change",function(F){var E=this.getValue();C(E)},false);var B=this;var D=this.getSelection();$("slink").observe("click",insertLinkHandler,false)},{id:"markdown_link_button"});this.toolbar.addButton("Image",function(){var C=this.getSelection();var B=prompt("Enter Image URL","");if(B==null){return }this.replaceSelection("!["+(C==""?"Image Alt Text":C)+"]("+(B==""?"http://image_url/":B).replace(/^(?!(f|ht)tps?:\/\/)/,"http://")+")")},{id:"markdown_image_button"});this.toolbar.addButton("Heading",function(){var B=this.getSelection();if(B==""){B="Heading"}this.replaceSelection("\n"+B+"\n"+$R(0,Math.max(5,B.length)).collect(function(){}).join("")+"\n")},{id:"markdown_heading_button"});this.toolbar.addButton("Unordered List",function(B){this.collectFromEachSelectedLine(function(C){return B.shiftKey?(C.match(/^\*{2,}/)?C.replace(/^\*/,""):C.replace(/^\*\s/,"")):(C.match(/\*+\s/)?"*":"* ")+C})},{id:"markdown_unordered_list_button"});this.toolbar.addButton("Ordered List",function(C){var B=0;this.collectFromEachSelectedLine(function(D){if(!D.match(/^\s+$/)){++B;return C.shiftKey?D.replace(/^\d+\.\s/,""):(D.match(/\d+\.\s/)?"":B+". ")+D}})},{id:"markdown_ordered_list_button"});this.toolbar.addButton("Block Quote",function(B){this.collectFromEachSelectedLine(function(C){return B.shiftKey?C.replace(/^\> /,""):"> "+C})},{id:"markdown_quote_button"});this.toolbar.addButton("Code Block",function(B){this.collectFromEachSelectedLine(function(C){return B.shiftKey?C.replace(/    /,""):"    "+C})},{id:"markdown_code_button"});this.toolbar.addButton("Snippet",function(E){var C=this.getSelection();if(C){var B=C.split("\n");if(B[0].match(/\s*:::(\w*)/)){var H=B[0].replace(/\s*:::(\w*)/,"$1");B.splice(0,1);if(H){$("snippet_language").select("option").each(function(I){if(I.value==H){I.selected=true}})}}var D=$A(B).collect(function(I){return I.replace(/    /,"")}).join("\n");$("snippet_content").value=D}A.snippet_window.open();var F=this;var G=function(L){Event.stop(L);var K=$("fsnippet").getInputs("radio","snippet_from");if(K[0].checked){var J=$("snippet_content").getValue();J=$A(J.split("\n")).collect(function(M){M="    "+M;return M}).join("\n");D="\n\n    :::"+$("snippet_language").getValue()+"\n"+J;F.replaceSelection(D);A.snippet_window.close();$("snippet_content").value=""}else{var I="/proxy?url="+encodeURIComponent($("snippet_url").getValue());new Ajax.Request(I,{method:"get",contentType:"application/json",requestHeaders:{Accept:"application/json"},onSuccess:function(M){data=M.responseText.evalJSON(true);J=$A(data.snippet.split("\n")).collect(function(N){return"    "+N}).join("\n");D=" \n\n    :::"+data.language+"\n"+J;F.replaceSelection(D);A.snippet_window.close();$("snippet_content").value=""},onFailure:function(){alert("mmm... error while trying to fetch content from friendpaste:(")}})}this.stopObserving("click",arguments.callee,false)};$("ssnippet").observe("click",G,false);$("cancelSnippet").observe("click",function(I){Event.stop(I);A.snippet_window.close();return false});$("snippet_url","snippet_language","snippet_content").each(function(I){I.observe("focus",function(J){if(this.id=="snippet_url"){$("sfp").checked=true}else{$("si").checked=true}},false)})},{id:"markdown_snippet_button"});this.toolbar.addButton("Help",function(){window.open("http://daringfireball.net/projects/markdown/dingus")},{id:"markdown_help_button"})},createRenameForm:function(){var D=$("fedit").action;this._form=new Element("form",{id:"frename",method:"post",action:D});var A=new Element("input",{type:"text",id:"new_title",name:"new_title",maxlength:"60",value:$("page_title").innerHTML});var B=new Element("input",{type:"hidden",id:"old_title",name:"old_title",value:$("page_title").innerHTML});var C=new Element("a",{id:"rcancel","class":"cancel",href:"#"}).update("Cancel");this._form.insert(B);this._form.insert(A);this._form.insert(C);this._form.onsubmit=this.renamePage.bind(this)},renamePage:function(C){Event.stop(C);var B=$("new_title").getValue();var A=$("old_title").getValue();if(!B){alert("Page title can't be empty.")}else{if(A==B){this.removeRenameForm()}else{new Ajax.Request(this._form.action,{method:"post",contentType:"application/json",requestHeaders:{Accept:"application/json"},postBody:Object.toJSON(this._form.serialize(true)),onSuccess:function(D){data=D.responseText.evalJSON(true);if(data.ok){this._renamingPage=false;document.location.href=data.redirect_url}else{alert(data.error)}},onFailure:function(){alert("mmm... error while trying rename :(, Please contact administrator")}})}}},createRenameHelp:function(){var A=this;this._help=new Element("div",{"class":"rename hidden",}).update("&#x21E4; Click to rename");this.page_title.insert(this._help);this.page_title.observe("mouseover",function(B){A._help.removeClassName("hidden")},false);this.page_title.observe("mouseout",function(B){A._help.addClassName("hidden")},false)},removeRenameForm:function(){this._form.remove();this.createRenameForm();this.page_title.show();this._renamingPage=false},handleRename:function(){var A=this;this.page_title.hide();this.page_title.parentNode.insertBefore(this._form,$("page_title"));this._form.select(".cancel").each(function(B){B.observe("click",function(C){Event.stop(C);A.removeRenameForm();return false},false)})}});

static/js/livepipe.js

-if(typeof (Control)=="undefined"){Control={}}var $proc=function(A){return typeof (A)=="function"?A:function(){return A}};var $value=function(A){return typeof (A)=="function"?A():A};Object.Event={extend:function(A){A._objectEventSetup=function(B){this._observers=this._observers||{};this._observers[B]=this._observers[B]||[]};A.observe=function(D,B){if(typeof (D)=="string"&&typeof (B)!="undefined"){this._objectEventSetup(D);if(!this._observers[D].include(B)){this._observers[D].push(B)}}else{for(var C in D){this.observe(C,D[C])}}};A.stopObserving=function(C,B){this._objectEventSetup(C);if(C&&B){this._observers[C]=this._observers[C].without(B)}else{if(C){this._observers[C]=[]}else{this._observers={}}}};A.observeOnce=function(D,C){var B=function(){C.apply(this,arguments);this.stopObserving(D,B)}.bind(this);this._objectEventSetup(D);this._observers[D].push(B)};A.notify=function(F){this._objectEventSetup(F);var D=[];var B=$A(arguments).slice(1);try{for(var C=0;C<this._observers[F].length;++C){D.push(this._observers[F][C].apply(this._observers[F][C],B)||null)}}catch(E){if(E==$break){return false}else{throw E}}return D};if(A.prototype){A.prototype._objectEventSetup=A._objectEventSetup;A.prototype.observe=A.observe;A.prototype.stopObserving=A.stopObserving;A.prototype.observeOnce=A.observeOnce;A.prototype.notify=function(F){if(A.notify){var B=$A(arguments).slice(1);B.unshift(this);B.unshift(F);A.notify.apply(A,B)}this._objectEventSetup(F);var B=$A(arguments).slice(1);var D=[];try{if(this.options&&this.options[F]&&typeof (this.options[F])=="function"){D.push(this.options[F].apply(this,B)||null)}for(var C=0;C<this._observers[F].length;++C){D.push(this._observers[F][C].apply(this._observers[F][C],B)||null)}}catch(E){if(E==$break){return false}else{throw E}}return D}}}};Element.addMethods({observeOnce:function(C,D,B){var A=function(){B.apply(this,arguments);Element.stopObserving(C,D,A)};Element.observe(C,D,A)}});Object.extend(Event,(function(){var B=Event.cache;function C(J){if(J._prototypeEventID){return J._prototypeEventID[0]}arguments.callee.id=arguments.callee.id||1;return J._prototypeEventID=[++arguments.callee.id]}function G(J){if(J&&J.include(":")){return"dataavailable"}if(!Prototype.Browser.IE){J={mouseenter:"mouseover",mouseleave:"mouseout"}[J]||J}return J}function A(J){return B[J]=B[J]||{}}function F(L,J){var K=A(L);return K[J]=K[J]||[]}function H(K,J,L){var O=C(K);var N=F(O,J);if(N.pluck("handler").include(L)){return false}var M=function(P){if(!Event||!Event.extend||(P.eventName&&P.eventName!=J)){return false}Event.extend(P);L.call(K,P)};if(!(Prototype.Browser.IE)&&["mouseenter","mouseleave"].include(J)){M=M.wrap(function(R,Q){var P=Q.relatedTarget;var S=Q.currentTarget;if(P&&P.nodeType==Node.TEXT_NODE){P=P.parentNode}if(P&&P!=S&&!P.descendantOf(S)){return R(Q)}})}M.handler=L;N.push(M);return M}function I(M,J,K){var L=F(M,J);return L.find(function(N){return N.handler==K})}function D(M,J,K){var L=A(M);if(!L[J]){return false}L[J]=L[J].without(I(M,J,K))}function E(){for(var K in B){for(var J in B[K]){B[K][J]=null}}}if(window.attachEvent){window.attachEvent("onunload",E)}return{observe:function(L,J,M){L=$(L);var K=G(J);var N=H(L,J,M);if(!N){return L}if(L.addEventListener){L.addEventListener(K,N,false)}else{L.attachEvent("on"+K,N)}return L},stopObserving:function(L,J,M){L=$(L);var O=C(L),K=G(J);if(!M&&J){F(O,J).each(function(P){L.stopObserving(J,P.handler)});return L}else{if(!J){Object.keys(A(O)).each(function(P){L.stopObserving(P)});return L}}var N=I(O,J,M);if(!N){return L}if(L.removeEventListener){L.removeEventListener(K,N,false)}else{L.detachEvent("on"+K,N)}D(O,J,M);return L},fire:function(L,K,J){L=$(L);if(L==document&&document.createEvent&&!L.dispatchEvent){L=document.documentElement}var M;if(document.createEvent){M=document.createEvent("HTMLEvents");M.initEvent("dataavailable",true,true)}else{M=document.createEventObject();M.eventType="ondataavailable"}M.eventName=K;M.memo=J||{};if(document.createEvent){L.dispatchEvent(M)}else{L.fireEvent(M.eventType,M)}return Event.extend(M)}}})());Object.extend(Event,Event.Methods);Element.addMethods({fire:Event.fire,observe:Event.observe,stopObserving:Event.stopObserving});Object.extend(document,{fire:Element.Methods.fire.methodize(),observe:Element.Methods.observe.methodize(),stopObserving:Element.Methods.stopObserving.methodize()});(function(){function A(C){var D;if(C.wheelDelta){D=C.wheelDelta/120}else{if(C.detail){D=-C.detail/3}}if(!D){return }var B=C.element().fire("mouse:wheel",{delta:D});if(B.stopped){C.stop();return false}}document.observe("mousewheel",A);document.observe("DOMMouseScroll",A)})();var IframeShim=Class.create({initialize:function(){this.element=new Element("iframe",{style:"position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);display:none",src:"javascript:void(0);",frameborder:0});$(document.body).insert(this.element)},hide:function(){this.element.hide();return this},show:function(){this.element.show();return this},positionUnder:function(A){var A=$(A);var C=A.cumulativeOffset();var B=A.getDimensions();this.element.setStyle({left:C[0]+"px",top:C[1]+"px",width:B.width+"px",height:B.height+"px",zIndex:A.getStyle("zIndex")-1}).show();return this},setBounds:function(A){for(prop in A){A[prop]+="px"}this.element.setStyle(A);return this},destroy:function(){if(this.element){this.element.remove()}return this}});if(typeof (Prototype)=="undefined"){throw"Control.Tabs requires Prototype to be loaded."}if(typeof (Object.Event)=="undefined"){throw"Control.Tabs requires Object.Event to be loaded."}Control.Tabs=Class.create({initialize:function(C,B){if(!$(C)){throw"Control.Tabs could not find the element: "+C}this.activeContainer=false;this.activeLink=false;this.containers=$H({});this.links=[];Control.Tabs.instances.push(this);this.options={beforeChange:Prototype.emptyFunction,afterChange:Prototype.emptyFunction,hover:false,linkSelector:"li a",setClassOnContainer:false,activeClassName:"active",defaultTab:"first",autoLinkExternal:true,targetRegExp:/#(.+)$/,showFunction:Element.show,hideFunction:Element.hide};Object.extend(this.options,B||{});(typeof (this.options.linkSelector=="string")?$(C).select(this.options.linkSelector):this.options.linkSelector($(C))).findAll(function(E){if(Prototype.Browser.WebKit){var D=decodeURIComponent(E.href)}else{var D=E.href}return(/^#/).exec(D.replace(window.location.href.split("#")[0],""))}).each(function(D){this.addTab(D)}.bind(this));this.containers.values().each(Element.hide);if(this.options.defaultTab=="first"){this.setActiveTab(this.links.first())}else{if(this.options.defaultTab=="last"){this.setActiveTab(this.links.last())}else{this.setActiveTab(this.options.defaultTab)}}var A=this.options.targetRegExp.exec(window.location);if(A&&A[1]){A[1].split(",").each(function(D){this.setActiveTab(this.links.find(function(E){return E.key==D}))}.bind(this))}if(this.options.autoLinkExternal){$A(document.getElementsByTagName("a")).each(function(D){if(!this.links.include(D)){var E=D.href.replace(window.location.href.split("#")[0],"");if(E.substring(0,1)=="#"){if(this.containers.keys().include(E.substring(1))){$(D).observe("click",function(G,F){this.setActiveTab(F.substring(1))}.bindAsEventListener(this,E))}}}}.bind(this))}},addTab:function(B){this.links.push(B);B.key=B.getAttribute("href").replace(window.location.href.split("#")[0],"").split("/").last().replace(/#/,"");var A=$(B.key);if(!A){throw"Control.Tabs: #"+B.key+" was not found on the page."}this.containers.set(B.key,A);B[this.options.hover?"onmouseover":"onclick"]=function(C){if(window.event){Event.stop(window.event)}this.setActiveTab(C);return false}.bind(this,B)},setActiveTab:function(A){if(!A&&typeof (A)=="undefined"){return }if(typeof (A)=="string"){this.setActiveTab(this.links.find(function(B){return B.key==A}))}else{if(typeof (A)=="number"){this.setActiveTab(this.links[A])}else{if(this.notify("beforeChange",this.activeContainer,this.containers.get(A.key))===false){return }if(this.activeContainer){this.options.hideFunction(this.activeContainer)}this.links.each(function(B){(this.options.setClassOnContainer?$(B.parentNode):B).removeClassName(this.options.activeClassName)}.bind(this));(this.options.setClassOnContainer?$(A.parentNode):A).addClassName(this.options.activeClassName);this.activeContainer=this.containers.get(A.key);this.activeLink=A;this.options.showFunction(this.containers.get(A.key));this.notify("afterChange",this.containers.get(A.key))}}},next:function(){this.links.each(function(B,A){if(this.activeLink==B&&this.links[A+1]){this.setActiveTab(this.links[A+1]);throw $break}}.bind(this))},previous:function(){this.links.each(function(B,A){if(this.activeLink==B&&this.links[A-1]){this.setActiveTab(this.links[A-1]);throw $break}}.bind(this))},first:function(){this.setActiveTab(this.links.first())},last:function(){this.setActiveTab(this.links.last())}});Object.extend(Control.Tabs,{instances:[],findByTabId:function(A){return Control.Tabs.instances.find(function(B){return B.links.find(function(C){return C.key==A})})}});Object.Event.extend(Control.Tabs);var Resizables={instances:[],observers:[],register:function(A){if(this.instances.length==0){this.eventMouseUp=this.endResize.bindAsEventListener(this);this.eventMouseMove=this.updateResize.bindAsEventListener(this);Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(document,"mousemove",this.eventMouseMove)}this.instances.push(A)},unregister:function(A){this.instances=this.instances.reject(function(B){return B==A});if(this.instances.length==0){Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove)}},activate:function(A){if(A.options.delay){this._timeout=setTimeout(function(){Resizables._timeout=null;Resizables.activeResizable=A}.bind(this),A.options.delay)}else{this.activeResizable=A}},deactivate:function(){this.activeResizable=null},updateResize:function(A){if(!this.activeResizable){return }var B=[Event.pointerX(A),Event.pointerY(A)];if(this._lastPointer&&(this._lastPointer.inspect()==B.inspect())){return }this._lastPointer=B;this.activeResizable.updateResize(A,B)},endResize:function(A){if(this._timeout){clearTimeout(this._timeout);this._timeout=null}if(!this.activeResizable){return }this._lastPointer=null;this.activeResizable.endResize(A);this.activeResizable=null},addObserver:function(A){this.observers.push(A);this._cacheObserverCallbacks()},removeObserver:function(A){this.observers=this.observers.reject(function(B){return B.element==A});this._cacheObserverCallbacks()},notify:function(A,B,C){if(this[A+"Count"]>0){this.observers.each(function(D){if(D[A]){D[A](A,B,C)}})}if(B.options[A]){B.options[A](B,C)}},_cacheObserverCallbacks:function(){["onStart","onEnd","onResize"].each(function(A){Resizables[A+"Count"]=Resizables.observers.select(function(B){return B[A]}).length})}};var Resizable=Class.create();Resizable._resizing={};Resizable.prototype={initialize:function(B){var C={handle:false,snap:false,delay:0,minHeight:false,minwidth:false,maxHeight:false,maxWidth:false};this.element=$(B);var A=Object.extend(C,arguments[1]||{});if(A.handle&&typeof A.handle=="string"){this.handle=$(A.handle)}else{if(A.handle){this.handle=A.handle}}if(!this.handle){this.handle=this.element}this.options=A;this.dragging=false;this.eventMouseDown=this.initResize.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Resizables.register(this)},destroy:function(){Event.stopObserving(this.handle,"mousedown",this.eventMouseDown)},currentDelta:function(){return([parseInt(Element.getStyle(this.element,"width")||"0"),parseInt(Element.getStyle(this.element,"height")||"0")])},initResize:function(A){if(typeof Resizable._resizing[this.element]!="undefined"&&Resizable._resizing[this.element]){return }if(Event.isLeftClick(A)){var B=Event.element(A);if((tag_name=B.tagName.toUpperCase())&&(tag_name=="INPUT"||tag_name=="SELECT"||tag_name=="OPTION"||tag_name=="BUTTON"||tag_name=="TEXTAREA")){return }this.pointer=[Event.pointerX(A),Event.pointerY(A)];this.size=[parseInt(this.element.getStyle("width"))||0,parseInt(this.element.getStyle("height"))||0];Resizables.activate(this);Event.stop(A)}},startResize:function(A){this.resizing=true;if(this.options.zindex){this.originalZ=parseInt(Element.getStyle(this.element,"z-index")||0);this.element.style.zIndex=this.options.zindex}Resizables.notify("onStart",this,A);Resizable._resizing[this.element]=true},updateResize:function(A,B){if(!this.resizing){this.startResize(A)}Resizables.notify("onResize",this,A);this.draw(B);if(this.options.change){this.options.change(this)}if(Prototype.Browser.WebKit){window.scrollBy(0,0)}Event.stop(A)},finishResize:function(A,B){this.resizing=false;Resizables.notify("onEnd",this,A);if(this.options.zindex){this.element.style.zIndex=this.originalZ}Resizable._resizing[this.element]=false;Resizables.deactivate(this)},endResize:function(A){if(!this.resizing){return }this.finishResize(A,true);Event.stop(A)},draw:function(A){var G=[0,1].map(function(H){return(this.size[H]+A[H]-this.pointer[H])}.bind(this));if(this.options.snap){if(typeof this.options.snap=="function"){G=this.options.snap(G[0],G[1],this)}else{if(this.options.snap instanceof Array){G=G.map(function(H,I){return Math.round(H/this.options.snap[I])*this.options.snap[I]}.bind(this))}else{G=G.map(function(H){return Math.round(H/this.options.snap)*this.options.snap}.bind(this))}}}var C=(typeof (this.options.minWidth)=="function")?this.options.minWidth(this.element):this.options.minWidth;var E=(typeof (this.options.maxWidth)=="function")?this.options.maxWidth(this.element):this.options.maxWidth;var F=(typeof (this.options.minHeight)=="function")?this.options.minHeight(this.element):this.options.minHeight;var D=(typeof (this.options.maxHeight)=="function")?this.options.maxHeight(this.element):this.options.maxHeight;if(C&&G[0]<=C){G[0]=C}if(E&&G[0]>=E){G[0]=E}if(F&&G[1]<=F){G[1]=F}if(D&&G[1]>=D){G[1]=D}var B=this.element.style;if((!this.options.constraint)||(this.options.constraint=="horizontal")){B.width=G[0]+"px"}if((!this.options.constraint)||(this.options.constraint=="vertical")){B.height=G[1]+"px"}if(B.visibility=="hidden"){B.visibility=""}}};if(typeof (Prototype)=="undefined"){throw"Control.TextArea requires Prototype to be loaded."}if(typeof (Object.Event)=="undefined"){throw"Control.TextArea requires Object.Event to be loaded."}Control.TextArea=Class.create({initialize:function(A){this.onChangeTimeout=false;this.element=$(A);$(this.element).observe("keyup",this.doOnChange.bindAsEventListener(this));$(this.element).observe("paste",this.doOnChange.bindAsEventListener(this));$(this.element).observe("input",this.doOnChange.bindAsEventListener(this));if(!!document.selection){$(this.element).observe("mouseup",this.saveRange.bindAsEventListener(this));$(this.element).observe("keyup",this.saveRange.bindAsEventListener(this))}},doOnChange:function(A){if(this.onChangeTimeout){window.clearTimeout(this.onChangeTimeout)}this.onChangeTimeout=window.setTimeout(function(){this.notify("change",this.getValue())}.bind(this),Control.TextArea.onChangeTimeoutLength)},saveRange:function(){this.range=document.selection.createRange()},getValue:function(){return this.element.value},getSelection:function(){if(!!document.selection){return document.selection.createRange().text}else{if(!!this.element.setSelectionRange){return this.element.value.substring(this.element.selectionStart,this.element.selectionEnd)}else{return false}}},replaceSelection:function(C){var B=this.element.scrollTop;if(!!document.selection){this.element.focus();var A=(this.range)?this.range:document.selection.createRange();A.text=C;A.select()}else{if(!!this.element.setSelectionRange){var D=this.element.selectionStart;this.element.value=this.element.value.substring(0,D)+C+this.element.value.substring(this.element.selectionEnd);this.element.setSelectionRange(D+C.length,D+C.length)}}this.doOnChange();this.element.focus();this.element.scrollTop=B},wrapSelection:function(A,B){this.replaceSelection(A+this.getSelection()+B)},insertBeforeSelection:function(A){this.replaceSelection(A+this.getSelection())},insertAfterSelection:function(A){this.replaceSelection(this.getSelection()+A)},collectFromEachSelectedLine:function(C,A,B){this.replaceSelection((A||"")+$A(this.getSelection().split("\n")).collect(C).join("\n")+(B||""))},insertBeforeEachSelectedLine:function(C,A,B){this.collectFromEachSelectedLine(function(D){},A,B)}});Object.extend(Control.TextArea,{onChangeTimeoutLength:500});Object.Event.extend(Control.TextArea);Control.TextArea.ToolBar=Class.create({initialize:function(A,B){this.textarea=A;if(B){this.container=$(B)}else{this.container=$(document.createElement("ul"));this.textarea.element.parentNode.insertBefore(this.container,this.textarea.element)}},attachButton:function(A,B){A.onclick=function(){return false};$(A).observe("click",B.bindAsEventListener(this.textarea))},addButton:function(C,F,D){var A=document.createElement("li");var B=document.createElement("a");B.href="#";this.attachButton(B,F);A.appendChild(B);Object.extend(B,D||{});if(C){var E=document.createElement("span");E.innerHTML=C;B.appendChild(E)}this.container.appendChild(A)}});if(typeof (Draggable)!="undefined"){Draggable.prototype.draw=function(I){var H=Position.cumulativeOffset(this.element);if(this.options.ghosting){var A=Position.realOffset(this.element);H[0]+=A[0]-Position.deltaX;H[1]+=A[1]-Position.deltaY}var G=this.currentDelta();H[0]-=G[0];H[1]-=G[1];if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){H[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;H[1]-=this.options.scroll.scrollTop-this.originalScrollTop}var C=[0,1].map(function(L){return(I[L]-H[L]-this.offset[L])}.bind(this));if(this.options.snap){if(typeof this.options.snap=="function"){C=this.options.snap(C[0],C[1],this)}else{if(this.options.snap instanceof Array){C=C.map(function(L,M){return Math.round(L/this.options.snap[M])*this.options.snap[M]}.bind(this))}else{C=C.map(function(L){return Math.round(L/this.options.snap)*this.options.snap}.bind(this))}}}if(this.options.onDraw){this.options.onDraw.bind(this)(C)}else{var B=this.element.style;if(this.options.constrainToViewport){var K=document.viewport.getDimensions();var E=this.element.getDimensions();var F=parseInt(this.element.getStyle("margin-top"));var J=parseInt(this.element.getStyle("margin-left"));var D=[[0-J,0-F],[(K.width-E.width)-J,(K.height-E.height)-F]];if((!this.options.constraint)||(this.options.constraint=="horizontal")){if((C[0]>=D[0][0])&&(C[0]<=D[1][0])){this.element.style.left=C[0]+"px"}else{this.element.style.left=((C[0]<D[0][0])?D[0][0]:D[1][0])+"px"}}if((!this.options.constraint)||(this.options.constraint=="vertical")){if((C[1]>=D[0][1])&&(C[1]<=D[1][1])){this.element.style.top=C[1]+"px"}else{this.element.style.top=((C[1]<=D[0][1])?D[0][1]:D[1][1])+"px"}}}else{if((!this.options.constraint)||(this.options.constraint=="horizontal")){B.left=C[0]+"px"}if((!this.options.constraint)||(this.options.constraint=="vertical")){B.top=C[1]+"px"}}if(B.visibility=="hidden"){B.visibility=""}}}}if(typeof (Prototype)=="undefined"){throw"Control.Window requires Prototype to be loaded."}if(typeof (IframeShim)=="undefined"){throw"Control.Window requires IframeShim to be loaded."}if(typeof (Object.Event)=="undefined"){throw"Control.Window requires Object.Event to be loaded."}Control.Window=Class.create({initialize:function(B,C){Control.Window.windows.push(this);this.container=false;this.isOpen=false;this.href=false;this.sourceContainer=false;this.ajaxRequest=false;this.remoteContentLoaded=false;this.numberInSequence=Control.Window.windows.length+1;this.indicator=false;this.effects={fade:false,appear:false};this.indicatorEffects={fade:false,appear:false};this.options=Object.extend({beforeOpen:Prototype.emptyFunction,afterOpen:Prototype.emptyFunction,beforeClose:Prototype.emptyFunction,afterClose:Prototype.emptyFunction,height:null,width:null,className:false,position:"center",offsetLeft:0,offsetTop:0,iframe:false,hover:false,indicator:false,closeOnClick:false,iframeshim:true,fade:false,fadeDuration:0.75,draggable:false,onDrag:Prototype.emptyFunction,resizable:false,minHeight:false,minWidth:false,maxHeight:false,maxWidth:false,onResize:Prototype.emptyFunction,constrainToViewport:false,parameters:{},onComplete:Prototype.emptyFunction,onSuccess:Prototype.emptyFunction,onFailure:Prototype.emptyFunction,onException:Prototype.emptyFunction,onRemoteContentLoaded:Prototype.emptyFunction,insertRemoteContentAt:false},C||{});this.indicator=this.options.indicator?$(this.options.indicator):false;if(B){if(typeof (B)=="string"&&B.match(Control.Window.uriRegex)){this.href=B}else{this.container=$(B);this.createDefaultContainer(B);if(this.container&&((this.container.readAttribute("href")&&this.container.readAttribute("href")!="")||(this.options.hover&&this.options.hover!==true))){if(this.options.hover&&this.options.hover!==true){this.sourceContainer=$(this.options.hover)}else{this.sourceContainer=this.container;this.href=this.container.readAttribute("href");var A=this.href.match(/^#(.+)$/);if(A&&A[1]){this.container=$(A[1]);this.href=false}else{this.container=false}}this.sourceContainerOpenHandler=function(E){this.open(E);E.stop();return false}.bindAsEventListener(this);this.sourceContainerCloseHandler=function(E){this.close(E)}.bindAsEventListener(this);this.sourceContainerMouseMoveHandler=function(E){this.position(E)}.bindAsEventListener(this);if(this.options.hover){this.sourceContainer.observe("mouseenter",this.sourceContainerOpenHandler);this.sourceContainer.observe("mouseleave",this.sourceContainerCloseHandler);if(this.options.position=="mouse"){this.sourceContainer.observe("mousemove",this.sourceContainerMouseMoveHandler)}}else{this.sourceContainer.observe("click",this.sourceContainerOpenHandler)}}}}this.createDefaultContainer(B);if(this.options.insertRemoteContentAt===false){this.options.insertRemoteContentAt=this.container}var D={margin:0,position:"absolute",zIndex:Control.Window.initialZIndexForWindow()};if(this.options.width){D.width=$value(this.options.width)+"px"}if(this.options.height){D.height=$value(this.options.height)+"px"}this.container.setStyle(D);if(this.options.className){this.container.addClassName(this.options.className)}this.positionHandler=this.position.bindAsEventListener(this);this.outOfBoundsPositionHandler=this.ensureInBounds.bindAsEventListener(this);this.bringToFrontHandler=this.bringToFront.bindAsEventListener(this);this.container.observe("mousedown",this.bringToFrontHandler);this.container.hide();this.closeHandler=this.close.bindAsEventListener(this);if(this.options.iframeshim){this.iFrameShim=new IframeShim();this.iFrameShim.hide()}this.applyResizable();this.applyDraggable();Event.observe(window,"resize",this.outOfBoundsPositionHandler);this.notify("afterInitialize")},open:function(C){if(this.isOpen){this.bringToFront();return false}if(this.notify("beforeOpen")===false){return false}if(this.options.closeOnClick){if(this.options.closeOnClick===true){this.closeOnClickContainer=$(document.body)}else{if(this.options.closeOnClick=="container"){this.closeOnClickContainer=this.container}else{if(this.options.closeOnClick=="overlay"){Control.Overlay.load();this.closeOnClickContainer=Control.Overlay.container}else{this.closeOnClickContainer=$(this.options.closeOnClick)}}}this.closeOnClickContainer.observe("click",this.closeHandler)}if(this.href&&!this.options.iframe&&!this.remoteContentLoaded){this.remoteContentLoaded=true;if(this.href.match(/\.(jpe?g|gif|png|tiff?)$/i)){var A=new Element("img");A.observe("load",function(D){this.getRemoteContentInsertionTarget().insert(D);this.position();if(this.notify("onRemoteContentLoaded")!==false){if(this.options.indicator){this.hideIndicator()}this.finishOpen()}}.bind(this,A));A.writeAttribute("src",this.href)}else{if(!this.ajaxRequest){if(this.options.indicator){this.showIndicator()}this.ajaxRequest=new Ajax.Request(this.href,{method:"post",parameters:this.options.parameters,onComplete:function(D){this.notify("onComplete",D);this.ajaxRequest=false}.bind(this),onSuccess:function(D){this.getRemoteContentInsertionTarget().insert(D.responseText);this.notify("onSuccess",D);if(this.notify("onRemoteContentLoaded")!==false){if(this.options.indicator){this.hideIndicator()}this.finishOpen()}}.bind(this),onFailure:function(D){this.notify("onFailure",D);if(this.options.indicator){this.hideIndicator()}}.bind(this),onException:function(D,E){this.notify("onException",D,E);if(this.options.indicator){this.hideIndicator()}}.bind(this)})}}return true}else{if(this.options.iframe&&!this.remoteContentLoaded){this.remoteContentLoaded=true;if(this.options.indicator){this.showIndicator()}this.getRemoteContentInsertionTarget().insert(Control.Window.iframeTemplate.evaluate({href:this.href}));var B=this.container.down("iframe");B.onload=function(){this.notify("onRemoteContentLoaded");if(this.options.indicator){this.hideIndicator()}B.onload=null}.bind(this)}}this.finishOpen(C);return true},close:function(A){if(!this.isOpen||this.notify("beforeClose",A)===false){return false}if(this.options.closeOnClick){this.closeOnClickContainer.stopObserving("click",this.closeHandler)}if(this.options.fade){this.effects.fade=new Effect.Fade(this.container,{queue:{position:"front",scope:"Control.Window"+this.numberInSequence},from:1,to:0,duration:this.options.fadeDuration/2,afterFinish:function(){if(this.iFrameShim){this.iFrameShim.hide()}this.isOpen=false;this.notify("afterClose")}.bind(this)})}else{this.container.hide();if(this.iFrameShim){this.iFrameShim.hide()}}if(this.ajaxRequest){this.ajaxRequest.transport.abort()}if(!(this.options.draggable||this.options.resizable)&&this.options.position=="center"){Event.stopObserving(window,"resize",this.positionHandler)}if(!this.options.draggable&&this.options.position=="center"){Event.stopObserving(window,"scroll",this.positionHandler)}if(this.options.indicator){this.hideIndicator()}if(!this.options.fade){this.isOpen=false;this.notify("afterClose")}return true},position:function(D){if(this.options.position=="mouse"){var G=[Event.pointerX(D),Event.pointerY(D)];this.container.setStyle({top:G[1]+$value(this.options.offsetTop)+"px",left:G[0]+$value(this.options.offsetLeft)+"px"});return }var H=this.container.getDimensions();var C=document.viewport.getDimensions();Position.prepare();var B=(Position.deltaX+Math.floor((C.width-H.width)/2));var A=(Position.deltaY+((C.height>H.height)?Math.floor((C.height-H.height)/2):0));if(this.options.position=="center"){this.container.setStyle({top:(H.height<=C.height)?((A!=null&&A>0)?A:0)+"px":0,left:(H.width<=C.width)?((B!=null&&B>0)?B:0)+"px":0})}else{if(this.options.position=="relative"){var G=this.sourceContainer.cumulativeOffset();var F=G[1]+$value(this.options.offsetTop);var E=G[0]+$value(this.options.offsetLeft);this.container.setStyle({top:(H.height<=C.height)?(this.options.constrainToViewport?Math.max(0,Math.min(C.height-(H.height),F)):F)+"px":0,left:(H.width<=C.width)?(this.options.constrainToViewport?Math.max(0,Math.min(C.width-(H.width),E)):E)+"px":0})}else{if(this.options.position.length){var F=$value(this.options.position[1])+$value(this.options.offsetTop);var E=$value(this.options.position[0])+$value(this.options.offsetLeft);this.container.setStyle({top:(H.height<=C.height)?(this.options.constrainToViewport?Math.max(0,Math.min(C.height-(H.height),F)):F)+"px":0,left:(H.width<=C.width)?(this.options.constrainToViewport?Math.max(0,Math.min(C.width-(H.width),E)):E)+"px":0})}}}if(this.iFrameShim){this.updateIFrameShimZIndex()}},ensureInBounds:function(){if(!this.isOpen){return }var A=document.viewport.getDimensions();var C=this.container.cumulativeOffset();var B=this.container.getDimensions();if(C.left+B.width>A.width){this.container.setStyle({left:(Math.max(0,A.width-B.width))+"px"})}if(C.top+B.height>A.height){this.container.setStyle({top:(Math.max(0,A.height-B.height))+"px"})}},bringToFront:function(){Control.Window.bringToFront(this);this.notify("bringToFront")},destroy:function(){this.container.stopObserving("mousedown",this.bringToFrontHandler);if(this.draggable){Resizables.removeObserver(this.container);this.draggable.handle.stopObserving("mousedown",this.bringToFrontHandler);this.draggable.destroy()}if(this.resizable){Resizables.removeObserver(this.container);this.resizable.handle.stopObserving("mousedown",this.bringToFrontHandler);this.resizable.destroy()}if(this.container&&!this.sourceContainer){this.container.remove()}if(this.sourceContainer){if(this.options.hover){this.sourceContainer.stopObserving("mouseenter",this.sourceContainerOpenHandler);this.sourceContainer.stopObserving("mouseleave",this.sourceContainerCloseHandler);if(this.options.position=="mouse"){this.sourceContainer.stopObserving("mousemove",this.sourceContainerMouseMoveHandler)}}else{this.sourceContainer.stopObserving("click",this.sourceContainerOpenHandler)}}if(this.iFrameShim){this.iFrameShim.destroy()}Event.stopObserving(window,"resize",this.outOfBoundsPositionHandler);Control.Window.windows=Control.Window.windows.without(this);this.notify("afterDestroy")},applyResizable:function(){if(this.options.resizable){if(typeof (Resizable)=="undefined"){throw"Control.Window requires resizable.js to be loaded."}var A=null;if(this.options.resizable===true){A=new Element("div",{className:"resizable_handle"});this.container.insert(A)}else{A=$(this.options.resziable)}this.resizable=new Resizable(this.container,{handle:A,minHeight:this.options.minHeight,minWidth:this.options.minWidth,maxHeight:this.options.constrainToViewport?function(B){return(document.viewport.getDimensions().height-parseInt(B.style.top||0))-(B.getHeight()-parseInt(B.style.height||0))}:this.options.maxHeight,maxWidth:this.options.constrainToViewport?function(B){return(document.viewport.getDimensions().width-parseInt(B.style.left||0))-(B.getWidth()-parseInt(B.style.width||0))}:this.options.maxWidth});this.resizable.handle.observe("mousedown",this.bringToFrontHandler);Resizables.addObserver(new Control.Window.LayoutUpdateObserver(this,function(){if(this.iFrameShim){this.updateIFrameShimZIndex()}this.notify("onResize")}.bind(this)))}},applyDraggable:function(){if(this.options.draggable){if(typeof (Draggables)=="undefined"){throw"Control.Window requires dragdrop.js to be loaded."}var A=null;if(this.options.draggable===true){A=new Element("div",{className:"draggable_handle"});this.container.insert(A)}else{A=$(this.options.draggable)}this.draggable=new Draggable(this.container,{handle:A,constrainToViewport:this.options.constrainToViewport,zindex:this.container.getStyle("z-index"),starteffect:function(){if(Prototype.Browser.IE){this.old_onselectstart=document.onselectstart;document.onselectstart=function(){return false}}}.bind(this),endeffect:function(){document.onselectstart=this.old_onselectstart}.bind(this)});this.draggable.handle.observe("mousedown",this.bringToFrontHandler);Draggables.addObserver(new Control.Window.LayoutUpdateObserver(this,function(){if(this.iFrameShim){this.updateIFrameShimZIndex()}this.notify("onDrag")}.bind(this)))}},createDefaultContainer:function(A){if(!this.container){this.container=new Element("div",{id:"control_window_"+this.numberInSequence});$(document.body).insert(this.container);if(typeof (A)=="string"&&$(A)==null&&!A.match(/^#(.+)$/)&&!A.match(Control.Window.uriRegex)){this.container.update(A)}}},finishOpen:function(A){this.bringToFront();if(this.options.fade){if(typeof (Effect)=="undefined"){throw"Control.Window requires effects.js to be loaded."}if(this.effects.fade){this.effects.fade.cancel()}this.effects.appear=new Effect.Appear(this.container,{queue:{position:"end",scope:"Control.Window."+this.numberInSequence},from:0,to:1,duration:this.options.fadeDuration/2,afterFinish:function(){if(this.iFrameShim){this.updateIFrameShimZIndex()}this.isOpen=true;this.notify("afterOpen")}.bind(this)})}else{this.container.show()}this.position(A);if(!(this.options.draggable||this.options.resizable)&&this.options.position=="center"){Event.observe(window,"resize",this.positionHandler,false)}if(!this.options.draggable&&this.options.position=="center"){Event.observe(window,"scroll",this.positionHandler,false)}if(!this.options.fade){this.isOpen=true;this.notify("afterOpen")}return true},showIndicator:function(){this.showIndicatorTimeout=window.setTimeout(function(){if(this.options.fade){this.indicatorEffects.appear=new Effect.Appear(this.indicator,{queue:{position:"front",scope:"Control.Window.indicator."+this.numberInSequence},from:0,to:1,duration:this.options.fadeDuration/2})}else{this.indicator.show()}}.bind(this),Control.Window.indicatorTimeout)},hideIndicator:function(){if(this.showIndicatorTimeout){window.clearTimeout(this.showIndicatorTimeout)}this.indicator.hide()},getRemoteContentInsertionTarget:function(){return typeof (this.options.insertRemoteContentAt)=="string"?this.container.down(this.options.insertRemoteContentAt):$(this.options.insertRemoteContentAt)},updateIFrameShimZIndex:function(){if(this.iFrameShim){this.iFrameShim.positionUnder(this.container)}}});Object.extend(Control.Window,{windows:[],baseZIndex:9999,indicatorTimeout:250,iframeTemplate:new Template('<iframe src="#{href}" width="100%" height="100%" frameborder="0"></iframe>'),uriRegex:/^(\/|\#|https?\:\/\/|[\w]+\/)/,bringToFront:function(A){Control.Window.windows=Control.Window.windows.without(A);Control.Window.windows.push(A);Control.Window.windows.each(function(C,D){var B=Control.Window.baseZIndex+D;C.container.setStyle({zIndex:B});if(C.isOpen){if(C.iFrameShim){C.updateIFrameShimZIndex()}}if(C.options.draggable){C.draggable.options.zindex=B}})},open:function(B,C){var A=new Control.Window(B,C);A.open();return A},initialZIndexForWindow:function(A){return Control.Window.baseZIndex+(Control.Window.windows.length-1)}});Object.Event.extend(Control.Window);Control.Window.LayoutUpdateObserver=Class.create({initialize:function(A,B){this.w=A;this.element=$(A.container);this.observer=B},onStart:Prototype.emptyFunction,onEnd:function(B,A){if(A.element==this.element&&this.iFrameShim){this.w.updateIFrameShimZIndex()}},onResize:function(B,A){if(A.element==this.element){this.observer(this.element)}},onDrag:function(B,A){if(A.element==this.element){this.observer(this.element)}}});Control.Overlay={id:"control_overlay",loaded:false,container:false,lastOpacity:0,styles:{position:"fixed",top:0,left:0,width:"100%",height:"100%",zIndex:9998},ieStyles:{position:"absolute",top:0,left:0,zIndex:9998},effects:{fade:false,appear:false},load:function(){if(Control.Overlay.loaded){return false}Control.Overlay.loaded=true;Control.Overlay.container=new Element("div",{id:Control.Overlay.id});$(document.body).insert(Control.Overlay.container);if(Prototype.Browser.IE){Control.Overlay.container.setStyle(Control.Overlay.ieStyles);Event.observe(window,"scroll",Control.Overlay.positionOverlay);Event.observe(window,"resize",Control.Overlay.positionOverlay);Control.Overlay.observe("beforeShow",Control.Overlay.positionOverlay)}else{Control.Overlay.container.setStyle(Control.Overlay.styles)}Control.Overlay.iFrameShim=new IframeShim();Control.Overlay.iFrameShim.hide();Event.observe(window,"resize",Control.Overlay.positionIFrameShim);Control.Overlay.container.hide();return true},unload:function(){if(!Control.Overlay.loaded){return false}Event.stopObserving(window,"resize",Control.Overlay.positionOverlay);Control.Overlay.stopObserving("beforeShow",Control.Overlay.positionOverlay);Event.stopObserving(window,"resize",Control.Overlay.positionIFrameShim);Control.Overlay.iFrameShim.destroy();Control.Overlay.container.remove();Control.Overlay.loaded=false;return true},show:function(A,B){if(Control.Overlay.notify("beforeShow")===false){return false}Control.Overlay.lastOpacity=A;Control.Overlay.positionIFrameShim();Control.Overlay.iFrameShim.show();if(B){if(typeof (Effect)=="undefined"){throw"Control.Window requires effects.js to be loaded."}if(Control.Overlay.effects.fade){Control.Overlay.effects.fade.cancel()}Control.Overlay.effects.appear=new Effect.Appear(Control.Overlay.container,{queue:{position:"end",scope:"Control.Overlay"},afterFinish:function(){Control.Overlay.notify("afterShow")},from:0,to:Control.Overlay.lastOpacity,duration:(B===true?0.75:B)/2})}else{Control.Overlay.container.setStyle({opacity:A||1});Control.Overlay.container.show();Control.Overlay.notify("afterShow")}return true},hide:function(A){if(Control.Overlay.notify("beforeHide")===false){return false}if(Control.Overlay.effects.appear){Control.Overlay.effects.appear.cancel()}Control.Overlay.iFrameShim.hide();if(A){Control.Overlay.effects.fade=new Effect.Fade(Control.Overlay.container,{queue:{position:"front",scope:"Control.Overlay"},afterFinish:function(){Control.Overlay.notify("afterHide")},from:Control.Overlay.lastOpacity,to:0,duration:(A===true?0.75:A)/2})}else{Control.Overlay.container.hide();Control.Overlay.notify("afterHide")}return true},positionIFrameShim:function(){if(Control.Overlay.container.visible()){Control.Overlay.iFrameShim.positionUnder(Control.Overlay.container)}},positionOverlay:function(){var A=document.viewport.getDimensions();Control.Overlay.container.setStyle({width:A.width+"px",height:A.height+"px"})}};Object.Event.extend(Control.Overlay);Control.ToolTip=Class.create(Control.Window,{initialize:function($super,A,C,B){$super(C,Object.extend(Object.extend(Control.ToolTip.defaultOptions,B||{}),{position:"mouse",hover:A}))}});Object.extend(Control.ToolTip,{defaultOptions:{offsetLeft:10}});Control.Modal=Class.create(Control.Window,{initialize:function($super,A,B){Control.Modal.InstanceMethods.beforeInitialize.bind(this)();$super(A,Object.extend(Control.Modal.defaultOptions,B||{}))}});Object.extend(Control.Modal,{defaultOptions:{overlayOpacity:0.5,closeOnClick:"overlay"},current:false,open:function(A,B){var C=new Control.Modal(A,B);C.open();return C},close:function(){if(Control.Modal.current){Control.Modal.current.close()}},InstanceMethods:{beforeInitialize:function(){Control.Overlay.load();this.overlayFinishedOpening=false;this.observe("beforeOpen",Control.Modal.Observers.beforeOpen.bind(this));this.observe("afterOpen",Control.Modal.Observers.afterOpen.bind(this));this.observe("afterClose",Control.Modal.Observers.afterClose.bind(this))}},Observers:{beforeOpen:function(){if(!this.overlayFinishedOpening){Control.Overlay.observeOnce("afterShow",function(){this.overlayFinishedOpening=true;this.open()}.bind(this));Control.Overlay.show(this.options.overlayOpacity,this.options.fade?this.options.fadeDuration:false);throw $break}else{Control.Window.windows.without(this).invoke("close")}},afterOpen:function(){Control.Modal.current=this},afterClose:function(){Control.Overlay.hide(this.options.fade?this.options.fadeDuration:false);Control.Modal.current=false;this.overlayFinishedOpening=false}}});Control.LightBox=Class.create(Control.Window,{initialize:function($super,A,B){this.allImagesLoaded=false;if(B.modal){var B=Object.extend(Control.LightBox.defaultOptions,B||{});B=Object.extend(Control.Modal.defaultOptions,B);B=Control.Modal.InstanceMethods.beforeInitialize.bind(this)(B);$super(A,B)}else{$super(A,Object.extend(Control.LightBox.defaultOptions,B||{}))}this.hasRemoteContent=this.href&&!this.options.iframe;if(this.hasRemoteContent){this.observe("onRemoteContentLoaded",Control.LightBox.Observers.onRemoteContentLoaded.bind(this))}else{this.applyImageObservers()}this.observe("beforeOpen",Control.LightBox.Observers.beforeOpen.bind(this))},applyImageObservers:function(){var A=this.getImages();this.numberImagesToLoad=A.length;this.numberofImagesLoaded=0;A.each(function(B){B.observe("load",function(C){++this.numberofImagesLoaded;if(this.numberImagesToLoad==this.numberofImagesLoaded){this.allImagesLoaded=true;this.onAllImagesLoaded()}}.bind(this,B));B.hide()}.bind(this))},onAllImagesLoaded:function(){this.getImages().each(function(A){this.showImage(A)}.bind(this));if(this.hasRemoteContent){if(this.options.indicator){this.hideIndicator()}this.finishOpen()}else{this.open()}},getImages:function(){return this.container.select(Control.LightBox.imageSelector)},showImage:function(A){A.show()}});Object.extend(Control.LightBox,{imageSelector:"img",defaultOptions:{},Observers:{beforeOpen:function(){if(!this.hasRemoteContent&&!this.allImagesLoaded){throw $break}},onRemoteContentLoaded:function(){this.applyImageObservers();if(!this.allImagesLoaded){throw $break}}}});var Showdown={};Showdown.converter=function(){var A;var J;var a;var I=0;this.makeHtml=function(h){A=new Array();J=new Array();a=new Array();h=h.replace(/~/g,"~T");h=h.replace(/\$/g,"~D");h=h.replace(/\r\n/g,"\n");h=h.replace(/\r/g,"\n");h="\n\n"+h+"\n\n";h=Z(h);h=h.replace(/^[ \t]+$/mg,"");h=M(h);h=D(h);h=g(h);h=Q(h);h=h.replace(/~D/g,"$$");h=h.replace(/~T/g,"~");return h};var D=function(h){var h=h.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|\Z)/gm,function(k,m,l,j,i){m=m.toLowerCase();A[m]=H(l);if(j){return j+i}else{if(i){J[m]=i.replace(/"/g,"&quot;")}}return""});return h};var M=function(j){j=j.replace(/\n/g,"\n\n");var i="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del";var h="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math";j=j.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,X);j=j.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math)\b[^\r]*?.*<\/\2>[ \t]*(?=\n+)\n)/gm,X);j=j.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,X);j=j.replace(/(\n\n[ ]{0,3}<!(--[^\r]*?--\s*)+>[ \t]*(?=\n{2,}))/g,X);j=j.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,X);j=j.replace(/\n\n/g,"\n");return j};var X=function(h,i){var j=i;j=j.replace(/\n\n/g,"\n");j=j.replace(/^\n/,"");j=j.replace(/\n+$/g,"");j="\n\n~K"+(a.push(j)-1)+"K\n\n";return j};var g=function(i){i=F(i);var h=O("<hr />");i=i.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,h);i=i.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,h);i=i.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,h);i=e(i);i=B(i);i=U(i);i=M(i);i=G(i);return i};var R=function(h){h=c(h);h=L(h);h=E(h);h=f(h);h=Y(h);h=N(h);h=H(h);h=C(h);h=h.replace(/  +\n/g," <br />\n");return h};var L=function(i){var h=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|<!(--.*?--\s*)+>)/gi;i=i.replace(h,function(k){var j=k.replace(/(.)<\/?code>(?=.)/g,"$1`");j=W(j,"\\`*_");return j});return i};var Y=function(h){h=h.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,d);h=h.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?(.*?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,d);h=h.replace(/(\[([^\[\]]+)\])()()()()()/g,d);return h};var d=function(n,t,s,r,q,p,m,l){if(l==undefined){l=""}var k=t;var i=s;var j=r.toLowerCase();var h=q;var o=l;if(h==""){if(j==""){j=i.toLowerCase().replace(/ ?\n/g," ")}h="#"+j;if(A[j]!=undefined){h=A[j];if(J[j]!=undefined){o=J[j]}}else{if(k.search(/\(\s*\)$/m)>-1){h=""}else{return k}}}h=W(h,"*_");var u='<a href="'+h+'"';if(o!=""){o=o.replace(/"/g,"&quot;");o=W(o,"*_");u+=' title="'+o+'"'}u+=">"+i+"</a>";return u};var f=function(h){h=h.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,T);h=h.replace(/(!\[(.*?)\]\s?\([ \t]*()<?(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,T);return h};var T=function(n,t,s,r,q,p,m,l){var k=t;var j=s;var i=r.toLowerCase();var h=q;var o=l;if(!o){o=""}if(h==""){if(i==""){i=j.toLowerCase().replace(/ ?\n/g," ")}h="#"+i;if(A[i]!=undefined){h=A[i];if(J[i]!=undefined){o=J[i]}}else{return k}}j=j.replace(/"/g,"&quot;");h=W(h,"*_");var u='<img src="'+h+'" alt="'+j+'"';o=o.replace(/"/g,"&quot;");o=W(o,"*_");u+=' title="'+o+'"';u+=" />";return u};var F=function(h){h=h.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,function(i,j){return O("<h1>"+R(j)+"</h1>")});h=h.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(j,i){return O("<h2>"+R(i)+"</h2>")});h=h.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(i,l,k){var j=l.length;return O("<h"+j+">"+R(k)+"</h"+j+">")});return h};var P;var e=function(i){i+="~0";var h=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;if(I){i=i.replace(h,function(k,n,m){var o=n;var l=(m.search(/[*+-]/g)>-1)?"ul":"ol";o=o.replace(/\n{2,}/g,"\n\n\n");var j=P(o);j=j.replace(/\s+$/,"");j="<"+l+">"+j+"</"+l+">\n";return j})}else{h=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g;i=i.replace(h,function(l,p,n,k){var o=p;var q=n;var m=(k.search(/[*+-]/g)>-1)?"ul":"ol";var q=q.replace(/\n{2,}/g,"\n\n\n");var j=P(q);j=o+"<"+m+">\n"+j+"</"+m+">\n";return j})}i=i.replace(/~0/,"");return i};P=function(h){I++;h=h.replace(/\n{2,}$/,"\n");h+="~0";h=h.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,function(k,m,l,j,i){var o=i;var n=m;var p=l;if(n||(o.search(/\n{2,}/)>-1)){o=g(S(o))}else{o=e(S(o));o=o.replace(/\n$/,"");o=R(o)}return"<li>"+o+"</li>\n"});h=h.replace(/~0/g,"");I--;return h};var B=function(h){h+="~0";h=h.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(i,k,j){var l=k;var m=j;l=V(S(l));l=Z(l);l=l.replace(/^\n+/g,"");l=l.replace(/\n+$/g,"");l="<pre><code>"+l+"\n</code></pre>";return O(l)+m});h=h.replace(/~0/,"");return h};var O=function(h){h=h.replace(/(^\n+|\n+$)/g,"");return"\n\n~K"+(a.push(h)-1)+"K\n\n"};var c=function(h){h=h.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(k,m,l,j,i){var n=j;n=n.replace(/^([ \t]*)/g,"");n=n.replace(/[ \t]*$/g,"");n=V(n);return m+"<code>"+n+"</code>"});return h};var V=function(h){h=h.replace(/&/g,"&amp;");h=h.replace(/</g,"&lt;");h=h.replace(/>/g,"&gt;");h=W(h,"*_{}[]\\",false);return h};var C=function(h){h=h.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"<strong>$2</strong>");h=h.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"<em>$2</em>");return h};var U=function(h){h=h.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(i,j){var k=j;k=k.replace(/^[ \t]*>[ \t]?/gm,"~0");k=k.replace(/~0/g,"");k=k.replace(/^[ \t]+$/gm,"");k=g(k);k=k.replace(/(^|\n)/g,"$1  ");k=k.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(l,m){var n=m;n=n.replace(/^  /mg,"~0");n=n.replace(/~0/g,"");return n});return O("<blockquote>\n"+k+"\n</blockquote>")});return h};var G=function(o){o=o.replace(/^\n+/g,"");o=o.replace(/\n+$/g,"");var n=o.split(/\n{2,}/g);var k=new Array();var h=n.length;for(var j=0;j<h;j++){var m=n[j];if(m.search(/~K(\d+)K/g)>=0){k.push(m)}else{if(m.search(/\S/)>=0){m=R(m);m=m.replace(/^([ \t]*)/g,"<p>");m+="</p>";k.push(m)}}}h=k.length;for(var j=0;j<h;j++){while(k[j].search(/~K(\d+)K/)>=0){var l=a[RegExp.$1];l=l.replace(/\$/g,"$$$$");k[j]=k[j].replace(/~K\d+K/,l)}}return k.join("\n\n")};var H=function(h){h=h.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&amp;");h=h.replace(/<(?![a-z\/?\$!])/gi,"&lt;");return h};var E=function(h){h=h.replace(/\\(\\)/g,K);h=h.replace(/\\([`*_{}\[\]()>#+-.!])/g,K);return h};var N=function(h){h=h.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,'<a href="$1">$1</a>');h=h.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(i,j){return b(Q(j))});return h};var b=function(j){function i(l){var k="0123456789ABCDEF";var m=l.charCodeAt(0);return(k.charAt(m>>4)+k.charAt(m&15))}var h=[function(k){return"&#"+k.charCodeAt(0)+";"},function(k){return"&#x"+i(k)+";"},function(k){return k}];j="mailto:"+j;j=j.replace(/./g,function(k){if(k=="@"){k=h[Math.floor(Math.random()*2)](k)}else{if(k!=":"){var l=Math.random();k=(l>0.9?h[2](k):l>0.45?h[1](k):h[0](k))}}return k});j='<a href="'+j+'">'+j+"</a>";j=j.replace(/">.+:/g,'">');return j};var Q=function(h){h=h.replace(/~E(\d+)E/g,function(i,k){var j=parseInt(k);return String.fromCharCode(j)});return h};var S=function(h){h=h.replace(/^(\t|[ ]{1,4})/gm,"~0");h=h.replace(/~0/g,"");return h};var Z=function(h){h=h.replace(/\t(?=\t)/g,"    ");h=h.replace(/\t/g,"~A~B");h=h.replace(/~B(.+?)~A/g,function(j,m,l){var o=m;var k=4-o.length%4;for(var n=0;n<k;n++){o+=" "}return o});h=h.replace(/~A/g,"    ");h=h.replace(/~B/g,"");return h};var W=function(l,i,j){var h="(["+i.replace(/([\[\]\\])/g,"\\$1")+"])";if(j){h="\\\\"+h}var k=new RegExp(h,"g");l=l.replace(k,K);return l};var K=function(h,j){var i=j.charCodeAt(0);return"~E"+i+"E"}};
+if(typeof (Control)=="undefined"){Control={}}var $proc=function(A){return typeof (A)=="function"?A:function(){return A}};var $value=function(A){return typeof (A)=="function"?A():A};Object.Event={extend:function(A){A._objectEventSetup=function(B){this._observers=this._observers||{};this._observers[B]=this._observers[B]||[]};A.observe=function(D,B){if(typeof (D)=="string"&&typeof (B)!="undefined"){this._objectEventSetup(D);if(!this._observers[D].include(B)){this._observers[D].push(B)}}else{for(var C in D){this.observe(C,D[C])}}};A.stopObserving=function(C,B){this._objectEventSetup(C);if(C&&B){this._observers[C]=this._observers[C].without(B)}else{if(C){this._observers[C]=[]}else{this._observers={}}}};A.observeOnce=function(D,C){var B=function(){C.apply(this,arguments);this.stopObserving(D,B)}.bind(this);this._objectEventSetup(D);this._observers[D].push(B)};A.notify=function(F){this._objectEventSetup(F);var D=[];var B=$A(arguments).slice(1);try{for(var C=0;C<this._observers[F].length;++C){D.push(this._observers[F][C].apply(this._observers[F][C],B)||null)}}catch(E){if(E==$break){return false}else{throw E}}return D};if(A.prototype){A.prototype._objectEventSetup=A._objectEventSetup;A.prototype.observe=A.observe;A.prototype.stopObserving=A.stopObserving;A.prototype.observeOnce=A.observeOnce;A.prototype.notify=function(F){if(A.notify){var B=$A(arguments).slice(1);B.unshift(this);B.unshift(F);A.notify.apply(A,B)}this._objectEventSetup(F);var B=$A(arguments).slice(1);var D=[];try{if(this.options&&this.options[F]&&typeof (this.options[F])=="function"){D.push(this.options[F].apply(this,B)||null)}for(var C=0;C<this._observers[F].length;++C){D.push(this._observers[F][C].apply(this._observers[F][C],B)||null)}}catch(E){if(E==$break){return false}else{throw E}}return D}}}};Element.addMethods({observeOnce:function(C,D,B){var A=function(){B.apply(this,arguments);Element.stopObserving(C,D,A)};Element.observe(C,D,A)}});Object.extend(Event,(function(){var B=Event.cache;function C(J){if(J._prototypeEventID){return J._prototypeEventID[0]}arguments.callee.id=arguments.callee.id||1;return J._prototypeEventID=[++arguments.callee.id]}function G(J){if(J&&J.include(":")){return"dataavailable"}if(!Prototype.Browser.IE){J={mouseenter:"mouseover",mouseleave:"mouseout"}[J]||J}return J}function A(J){return B[J]=B[J]||{}}function F(L,J){var K=A(L);return K[J]=K[J]||[]}function H(K,J,L){var O=C(K);var N=F(O,J);if(N.pluck("handler").include(L)){return false}var M=function(P){if(!Event||!Event.extend||(P.eventName&&P.eventName!=J)){return false}Event.extend(P);L.call(K,P)};if(!(Prototype.Browser.IE)&&["mouseenter","mouseleave"].include(J)){M=M.wrap(function(R,Q){var P=Q.relatedTarget;var S=Q.currentTarget;if(P&&P.nodeType==Node.TEXT_NODE){P=P.parentNode}if(P&&P!=S&&!P.descendantOf(S)){return R(Q)}})}M.handler=L;N.push(M);return M}function I(M,J,K){var L=F(M,J);return L.find(function(N){return N.handler==K})}function D(M,J,K){var L=A(M);if(!L[J]){return false}L[J]=L[J].without(I(M,J,K))}function E(){for(var K in B){for(var J in B[K]){B[K][J]=null}}}if(window.attachEvent){window.attachEvent("onunload",E)}return{observe:function(L,J,M){L=$(L);var K=G(J);var N=H(L,J,M);if(!N){return L}if(L.addEventListener){L.addEventListener(K,N,false)}else{L.attachEvent("on"+K,N)}return L},stopObserving:function(L,J,M){L=$(L);var O=C(L),K=G(J);if(!M&&J){F(O,J).each(function(P){L.stopObserving(J,P.handler)});return L}else{if(!J){Object.keys(A(O)).each(function(P){L.stopObserving(P)});return L}}var N=I(O,J,M);if(!N){return L}if(L.removeEventListener){L.removeEventListener(K,N,false)}else{L.detachEvent("on"+K,N)}D(O,J,M);return L},fire:function(L,K,J){L=$(L);if(L==document&&document.createEvent&&!L.dispatchEvent){L=document.documentElement}var M;if(document.createEvent){M=document.createEvent("HTMLEvents");M.initEvent("dataavailable",true,true)}else{M=document.createEventObject();M.eventType="ondataavailable"}M.eventName=K;M.memo=J||{};if(document.createEvent){L.dispatchEvent(M)}else{L.fireEvent(M.eventType,M)}return Event.extend(M)}}})());Object.extend(Event,Event.Methods);Element.addMethods({fire:Event.fire,observe:Event.observe,stopObserving:Event.stopObserving});Object.extend(document,{fire:Element.Methods.fire.methodize(),observe:Element.Methods.observe.methodize(),stopObserving:Element.Methods.stopObserving.methodize()});(function(){function A(C){var D;if(C.wheelDelta){D=C.wheelDelta/120}else{if(C.detail){D=-C.detail/3}}if(!D){return }var B=C.element().fire("mouse:wheel",{delta:D});if(B.stopped){C.stop();return false}}document.observe("mousewheel",A);document.observe("DOMMouseScroll",A)})();var IframeShim=Class.create({initialize:function(){this.element=new Element("iframe",{style:"position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);display:none",src:"javascript:void(0);",frameborder:0});$(document.body).insert(this.element)},hide:function(){this.element.hide();return this},show:function(){this.element.show();return this},positionUnder:function(A){var A=$(A);var C=A.cumulativeOffset();var B=A.getDimensions();this.element.setStyle({left:C[0]+"px",top:C[1]+"px",width:B.width+"px",height:B.height+"px",zIndex:A.getStyle("zIndex")-1}).show();return this},setBounds:function(A){for(prop in A){A[prop]+="px"}this.element.setStyle(A);return this},destroy:function(){if(this.element){this.element.remove()}return this}});if(typeof (Prototype)=="undefined"){throw"Control.Tabs requires Prototype to be loaded."}if(typeof (Object.Event)=="undefined"){throw"Control.Tabs requires Object.Event to be loaded."}Control.Tabs=Class.create({initialize:function(C,B){if(!$(C)){throw"Control.Tabs could not find the element: "+C}this.activeContainer=false;this.activeLink=false;this.containers=$H({});this.links=[];Control.Tabs.instances.push(this);this.options={beforeChange:Prototype.emptyFunction,afterChange:Prototype.emptyFunction,hover:false,linkSelector:"li a",setClassOnContainer:false,activeClassName:"active",defaultTab:"first",autoLinkExternal:true,targetRegExp:/#(.+)$/,showFunction:Element.show,hideFunction:Element.hide};Object.extend(this.options,B||{});(typeof (this.options.linkSelector=="string")?$(C).select(this.options.linkSelector):this.options.linkSelector($(C))).findAll(function(E){if(Prototype.Browser.WebKit){var D=decodeURIComponent(E.href)}else{var D=E.href}return(/^#/).exec(D.replace(window.location.href.split("#")[0],""))}).each(function(D){this.addTab(D)}.bind(this));this.containers.values().each(Element.hide);if(this.options.defaultTab=="first"){this.setActiveTab(this.links.first())}else{if(this.options.defaultTab=="last"){this.setActiveTab(this.links.last())}else{this.setActiveTab(this.options.defaultTab)}}var A=this.options.targetRegExp.exec(window.location);if(A&&A[1]){A[1].split(",").each(function(D){this.setActiveTab(this.links.find(function(E){return E.key==D}))}.bind(this))}if(this.options.autoLinkExternal){$A(document.getElementsByTagName("a")).each(function(D){if(!this.links.include(D)){var E=D.href.replace(window.location.href.split("#")[0],"");if(E.substring(0,1)=="#"){if(this.containers.keys().include(E.substring(1))){$(D).observe("click",function(G,F){this.setActiveTab(F.substring(1))}.bindAsEventListener(this,E))}}}}.bind(this))}},addTab:function(B){this.links.push(B);B.key=B.getAttribute("href").replace(window.location.href.split("#")[0],"").split("/").last().replace(/#/,"");var A=$(B.key);if(!A){throw"Control.Tabs: #"+B.key+" was not found on the page."}this.containers.set(B.key,A);B[this.options.hover?"onmouseover":"onclick"]=function(C){if(window.event){Event.stop(window.event)}this.setActiveTab(C);return false}.bind(this,B)},setActiveTab:function(A){if(!A&&typeof (A)=="undefined"){return }if(typeof (A)=="string"){this.setActiveTab(this.links.find(function(B){return B.key==A}))}else{if(typeof (A)=="number"){this.setActiveTab(this.links[A])}else{if(this.notify("beforeChange",this.activeContainer,this.containers.get(A.key))===false){return }if(this.activeContainer){this.options.hideFunction(this.activeContainer)}this.links.each(function(B){(this.options.setClassOnContainer?$(B.parentNode):B).removeClassName(this.options.activeClassName)}.bind(this));(this.options.setClassOnContainer?$(A.parentNode):A).addClassName(this.options.activeClassName);this.activeContainer=this.containers.get(A.key);this.activeLink=A;this.options.showFunction(this.containers.get(A.key));this.notify("afterChange",this.containers.get(A.key))}}},next:function(){this.links.each(function(B,A){if(this.activeLink==B&&this.links[A+1]){this.setActiveTab(this.links[A+1]);throw $break}}.bind(this))},previous:function(){this.links.each(function(B,A){if(this.activeLink==B&&this.links[A-1]){this.setActiveTab(this.links[A-1]);throw $break}}.bind(this))},first:function(){this.setActiveTab(this.links.first())},last:function(){this.setActiveTab(this.links.last())}});Object.extend(Control.Tabs,{instances:[],findByTabId:function(A){return Control.Tabs.instances.find(function(B){return B.links.find(function(C){return C.key==A})})}});Object.Event.extend(Control.Tabs);var Resizables={instances:[],observers:[],register:function(A){if(this.instances.length==0){this.eventMouseUp=this.endResize.bindAsEventListener(this);this.eventMouseMove=this.updateResize.bindAsEventListener(this);Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(document,"mousemove",this.eventMouseMove)}this.instances.push(A)},unregister:function(A){this.instances=this.instances.reject(function(B){return B==A});if(this.instances.length==0){Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove)}},activate:function(A){if(A.options.delay){this._timeout=setTimeout(function(){Resizables._timeout=null;Resizables.activeResizable=A}.bind(this),A.options.delay)}else{this.activeResizable=A}},deactivate:function(){this.activeResizable=null},updateResize:function(A){if(!this.activeResizable){return }var B=[Event.pointerX(A),Event.pointerY(A)];if(this._lastPointer&&(this._lastPointer.inspect()==B.inspect())){return }this._lastPointer=B;this.activeResizable.updateResize(A,B)},endResize:function(A){if(this._timeout){clearTimeout(this._timeout);this._timeout=null}if(!this.activeResizable){return }this._lastPointer=null;this.activeResizable.endResize(A);this.activeResizable=null},addObserver:function(A){this.observers.push(A);this._cacheObserverCallbacks()},removeObserver:function(A){this.observers=this.observers.reject(function(B){return B.element==A});this._cacheObserverCallbacks()},notify:function(A,B,C){if(this[A+"Count"]>0){this.observers.each(function(D){if(D[A]){D[A](A,B,C)}})}if(B.options[A]){B.options[A](B,C)}},_cacheObserverCallbacks:function(){["onStart","onEnd","onResize"].each(function(A){Resizables[A+"Count"]=Resizables.observers.select(function(B){return B[A]}).length})}};var Resizable=Class.create();Resizable._resizing={};Resizable.prototype={initialize:function(B){var C={handle:false,snap:false,delay:0,minHeight:false,minwidth:false,maxHeight:false,maxWidth:false};this.element=$(B);var A=Object.extend(C,arguments[1]||{});if(A.handle&&typeof A.handle=="string"){this.handle=$(A.handle)}else{if(A.handle){this.handle=A.handle}}if(!this.handle){this.handle=this.element}this.options=A;this.dragging=false;this.eventMouseDown=this.initResize.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Resizables.register(this)},destroy:function(){Event.stopObserving(this.handle,"mousedown",this.eventMouseDown)},currentDelta:function(){return([parseInt(Element.getStyle(this.element,"width")||"0"),parseInt(Element.getStyle(this.element,"height")||"0")])},initResize:function(A){if(typeof Resizable._resizing[this.element]!="undefined"&&Resizable._resizing[this.element]){return }if(Event.isLeftClick(A)){var B=Event.element(A);if((tag_name=B.tagName.toUpperCase())&&(tag_name=="INPUT"||tag_name=="SELECT"||tag_name=="OPTION"||tag_name=="BUTTON"||tag_name=="TEXTAREA")){return }this.pointer=[Event.pointerX(A),Event.pointerY(A)];this.size=[parseInt(this.element.getStyle("width"))||0,parseInt(this.element.getStyle("height"))||0];Resizables.activate(this);Event.stop(A)}},startResize:function(A){this.resizing=true;if(this.options.zindex){this.originalZ=parseInt(Element.getStyle(this.element,"z-index")||0);this.element.style.zIndex=this.options.zindex}Resizables.notify("onStart",this,A);Resizable._resizing[this.element]=true},updateResize:function(A,B){if(!this.resizing){this.startResize(A)}Resizables.notify("onResize",this,A);this.draw(B);if(this.options.change){this.options.change(this)}if(Prototype.Browser.WebKit){window.scrollBy(0,0)}Event.stop(A)},finishResize:function(A,B){this.resizing=false;Resizables.notify("onEnd",this,A);if(this.options.zindex){this.element.style.zIndex=this.originalZ}Resizable._resizing[this.element]=false;Resizables.deactivate(this)},endResize:function(A){if(!this.resizing){return }this.finishResize(A,true);Event.stop(A)},draw:function(A){var G=[0,1].map(function(H){return(this.size[H]+A[H]-this.pointer[H])}.bind(this));if(this.options.snap){if(typeof this.options.snap=="function"){G=this.options.snap(G[0],G[1],this)}else{if(this.options.snap instanceof Array){G=G.map(function(H,I){return Math.round(H/this.options.snap[I])*this.options.snap[I]}.bind(this))}else{G=G.map(function(H){return Math.round(H/this.options.snap)*this.options.snap}.bind(this))}}}var C=(typeof (this.options.minWidth)=="function")?this.options.minWidth(this.element):this.options.minWidth;var E=(typeof (this.options.maxWidth)=="function")?this.options.maxWidth(this.element):this.options.maxWidth;var F=(typeof (this.options.minHeight)=="function")?this.options.minHeight(this.element):this.options.minHeight;var D=(typeof (this.options.maxHeight)=="function")?this.options.maxHeight(this.element):this.options.maxHeight;if(C&&G[0]<=C){G[0]=C}if(E&&G[0]>=E){G[0]=E}if(F&&G[1]<=F){G[1]=F}if(D&&G[1]>=D){G[1]=D}var B=this.element.style;if((!this.options.constraint)||(this.options.constraint=="horizontal")){B.width=G[0]+"px"}if((!this.options.constraint)||(this.options.constraint=="vertical")){B.height=G[1]+"px"}if(B.visibility=="hidden"){B.visibility=""}}};if(typeof (Prototype)=="undefined"){throw"Control.TextArea requires Prototype to be loaded."}if(typeof (Object.Event)=="undefined"){throw"Control.TextArea requires Object.Event to be loaded."}Control.TextArea=Class.create({initialize:function(A){this.onChangeTimeout=false;this.element=$(A);$(this.element).observe("keyup",this.doOnChange.bindAsEventListener(this));$(this.element).observe("paste",this.doOnChange.bindAsEventListener(this));$(this.element).observe("input",this.doOnChange.bindAsEventListener(this));if(!!document.selection){$(this.element).observe("mouseup",this.saveRange.bindAsEventListener(this));$(this.element).observe("keyup",this.saveRange.bindAsEventListener(this))}},doOnChange:function(A){if(this.onChangeTimeout){window.clearTimeout(this.onChangeTimeout)}this.onChangeTimeout=window.setTimeout(function(){this.notify("change",this.getValue())}.bind(this),Control.TextArea.onChangeTimeoutLength)},saveRange:function(){this.range=document.selection.createRange()},getValue:function(){return this.element.value},getSelection:function(){if(!!document.selection){return document.selection.createRange().text}else{if(!!this.element.setSelectionRange){return this.element.value.substring(this.element.selectionStart,this.element.selectionEnd)}else{return false}}},replaceSelection:function(C){var B=this.element.scrollTop;if(!!document.selection){this.element.focus();var A=(this.range)?this.range:document.selection.createRange();A.text=C;A.select()}else{if(!!this.element.setSelectionRange){var D=this.element.selectionStart;this.element.value=this.element.value.substring(0,D)+C+this.element.value.substring(this.element.selectionEnd);this.element.setSelectionRange(D+C.length,D+C.length)}}this.doOnChange();this.element.focus();this.element.scrollTop=B},wrapSelection:function(A,B){this.replaceSelection(A+this.getSelection()+B)},insertBeforeSelection:function(A){this.replaceSelection(A+this.getSelection())},insertAfterSelection:function(A){this.replaceSelection(this.getSelection()+A)},collectFromEachSelectedLine:function(C,A,B){this.replaceSelection((A||"")+$A(this.getSelection().split("\n")).collect(C).join("\n")+(B||""))},insertBeforeEachSelectedLine:function(C,A,B){this.collectFromEachSelectedLine(function(D){},A,B)}});Object.extend(Control.TextArea,{onChangeTimeoutLength:500});Object.Event.extend(Control.TextArea);Control.TextArea.ToolBar=Class.create({initialize:function(A,B){this.textarea=A;if(B){this.container=$(B)}else{this.container=$(document.createElement("ul"));this.textarea.element.parentNode.insertBefore(this.container,this.textarea.element)}},attachButton:function(A,B){A.onclick=function(){return false};$(A).observe("click",B.bindAsEventListener(this.textarea))},addButton:function(C,F,D){var A=document.createElement("li");var B=document.createElement("a");B.href="#";this.attachButton(B,F);A.appendChild(B);Object.extend(B,D||{});if(C){var E=document.createElement("span");E.innerHTML=C;B.appendChild(E)}this.container.appendChild(A)}});if(typeof (Draggable)!="undefined"){Draggable.prototype.draw=function(I){var H=Position.cumulativeOffset(this.element);if(this.options.ghosting){var A=Position.realOffset(this.element);H[0]+=A[0]-Position.deltaX;H[1]+=A[1]-Position.deltaY}var G=this.currentDelta();H[0]-=G[0];H[1]-=G[1];if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){H[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;H[1]-=this.options.scroll.scrollTop-this.originalScrollTop}var C=[0,1].map(function(L){return(I[L]-H[L]-this.offset[L])}.bind(this));if(this.options.snap){if(typeof this.options.snap=="function"){C=this.options.snap(C[0],C[1],this)}else{if(this.options.snap instanceof Array){C=C.map(function(L,M){return Math.round(L/this.options.snap[M])*this.options.snap[M]}.bind(this))}else{C=C.map(function(L){return Math.round(L/this.options.snap)*this.options.snap}.bind(this))}}}if(this.options.onDraw){this.options.onDraw.bind(this)(C)}else{var B=this.element.style;if(this.options.constrainToViewport){var K=document.viewport.getDimensions();var E=this.element.getDimensions();var F=parseInt(this.element.getStyle("margin-top"));var J=parseInt(this.element.getStyle("margin-left"));var D=[[0-J,0-F],[(K.width-E.width)-J,(K.height-E.height)-F]];if((!this.options.constraint)||(this.options.constraint=="horizontal")){if((C[0]>=D[0][0])&&(C[0]<=D[1][0])){this.element.style.left=C[0]+"px"}else{this.element.style.left=((C[0]<D[0][0])?D[0][0]:D[1][0])+"px"}}if((!this.options.constraint)||(this.options.constraint=="vertical")){if((C[1]>=D[0][1])&&(C[1]<=D[1][1])){this.element.style.top=C[1]+"px"}else{this.element.style.top=((C[1]<=D[0][1])?D[0][1]:D[1][1])+"px"}}}else{if((!this.options.constraint)||(this.options.constraint=="horizontal")){B.left=C[0]+"px"}if((!this.options.constraint)||(this.options.constraint=="vertical")){B.top=C[1]+"px"}}if(B.visibility=="hidden"){B.visibility=""}}}}if(typeof (Prototype)=="undefined"){throw"Control.Window requires Prototype to be loaded."}if(typeof (IframeShim)=="undefined"){throw"Control.Window requires IframeShim to be loaded."}if(typeof (Object.Event)=="undefined"){throw"Control.Window requires Object.Event to be loaded."}Control.Window=Class.create({initialize:function(B,C){Control.Window.windows.push(this);this.container=false;this.isOpen=false;this.href=false;this.sourceContainer=false;this.ajaxRequest=false;this.remoteContentLoaded=false;this.numberInSequence=Control.Window.windows.length+1;this.indicator=false;this.effects={fade:false,appear:false};this.indicatorEffects={fade:false,appear:false};this.options=Object.extend({beforeOpen:Prototype.emptyFunction,afterOpen:Prototype.emptyFunction,beforeClose:Prototype.emptyFunction,afterClose:Prototype.emptyFunction,height:null,width:null,className:false,position:"center",offsetLeft:0,offsetTop:0,iframe:false,hover:false,indicator:false,closeOnClick:false,iframeshim:true,fade:false,fadeDuration:0.75,draggable:false,onDrag:Prototype.emptyFunction,resizable:false,minHeight:false,minWidth:false,maxHeight:false,maxWidth:false,onResize:Prototype.emptyFunction,constrainToViewport:false,parameters:{},onComplete:Prototype.emptyFunction,onSuccess:Prototype.emptyFunction,onFailure:Prototype.emptyFunction,onException:Prototype.emptyFunction,onRemoteContentLoaded:Prototype.emptyFunction,insertRemoteContentAt:false},C||{});this.indicator=this.options.indicator?$(this.options.indicator):false;if(B){if(typeof (B)=="string"&&B.match(Control.Window.uriRegex)){this.href=B}else{this.container=$(B);this.createDefaultContainer(B);if(this.container&&((this.container.readAttribute("href")&&this.container.readAttribute("href")!="")||(this.options.hover&&this.options.hover!==true))){if(this.options.hover&&this.options.hover!==true){this.sourceContainer=$(this.options.hover)}else{this.sourceContainer=this.container;this.href=this.container.readAttribute("href");var A=this.href.match(/^#(.+)$/);if(A&&A[1]){this.container=$(A[1]);this.href=false}else{this.container=false}}this.sourceContainerOpenHandler=function(E){this.open(E);E.stop();return false}.bindAsEventListener(this);this.sourceContainerCloseHandler=function(E){this.close(E)}.bindAsEventListener(this);this.sourceContainerMouseMoveHandler=function(E){this.position(E)}.bindAsEventListener(this);if(this.options.hover){this.sourceContainer.observe("mouseenter",this.sourceContainerOpenHandler);this.sourceContainer.observe("mouseleave",this.sourceContainerCloseHandler);if(this.options.position=="mouse"){this.sourceContainer.observe("mousemove",this.sourceContainerMouseMoveHandler)}}else{this.sourceContainer.observe("click",this.sourceContainerOpenHandler)}}}}this.createDefaultContainer(B);if(this.options.insertRemoteContentAt===false){this.options.insertRemoteContentAt=this.container}var D={margin:0,position:"absolute",zIndex:Control.Window.initialZIndexForWindow()};if(this.options.width){D.width=$value(this.options.width)+"px"}if(this.options.height){D.height=$value(this.options.height)+"px"}this.container.setStyle(D);if(this.options.className){this.container.addClassName(this.options.className)}this.positionHandler=this.position.bindAsEventListener(this);this.outOfBoundsPositionHandler=this.ensureInBounds.bindAsEventListener(this);this.bringToFrontHandler=this.bringToFront.bindAsEventListener(this);this.container.observe("mousedown",this.bringToFrontHandler);this.container.hide();this.closeHandler=this.close.bindAsEventListener(this);if(this.options.iframeshim){this.iFrameShim=new IframeShim();this.iFrameShim.hide()}this.applyResizable();this.applyDraggable();Event.observe(window,"resize",this.outOfBoundsPositionHandler);this.notify("afterInitialize")},open:function(C){if(this.isOpen){this.bringToFront();return false}if(this.notify("beforeOpen")===false){return false}if(this.options.closeOnClick){if(this.options.closeOnClick===true){this.closeOnClickContainer=$(document.body)}else{if(this.options.closeOnClick=="container"){this.closeOnClickContainer=this.container}else{if(this.options.closeOnClick=="overlay"){Control.Overlay.load();this.closeOnClickContainer=Control.Overlay.container}else{this.closeOnClickContainer=$(this.options.closeOnClick)}}}this.closeOnClickContainer.observe("click",this.closeHandler)}if(this.href&&!this.options.iframe&&!this.remoteContentLoaded){this.remoteContentLoaded=true;if(this.href.match(/\.(jpe?g|gif|png|tiff?)$/i)){var A=new Element("img");A.observe("load",function(D){this.getRemoteContentInsertionTarget().insert(D);this.position();if(this.notify("onRemoteContentLoaded")!==false){if(this.options.indicator){this.hideIndicator()}this.finishOpen()}}.bind(this,A));A.writeAttribute("src",this.href)}else{if(!this.ajaxRequest){if(this.options.indicator){this.showIndicator()}this.ajaxRequest=new Ajax.Request(this.href,{method:"post",parameters:this.options.parameters,onComplete:function(D){this.notify("onComplete",D);this.ajaxRequest=false}.bind(this),onSuccess:function(D){this.getRemoteContentInsertionTarget().insert(D.responseText);this.notify("onSuccess",D);if(this.notify("onRemoteContentLoaded")!==false){if(this.options.indicator){this.hideIndicator()}this.finishOpen()}}.bind(this),onFailure:function(D){this.notify("onFailure",D);if(this.options.indicator){this.hideIndicator()}}.bind(this),onException:function(D,E){this.notify("onException",D,E);if(this.options.indicator){this.hideIndicator()}}.bind(this)})}}return true}else{if(this.options.iframe&&!this.remoteContentLoaded){this.remoteContentLoaded=true;if(this.options.indicator){this.showIndicator()}this.getRemoteContentInsertionTarget().insert(Control.Window.iframeTemplate.evaluate({href:this.href}));var B=this.container.down("iframe");B.onload=function(){this.notify("onRemoteContentLoaded");if(this.options.indicator){this.hideIndicator()}B.onload=null}.bind(this)}}this.finishOpen(C);return true},close:function(A){if(!this.isOpen||this.notify("beforeClose",A)===false){return false}if(this.options.closeOnClick){this.closeOnClickContainer.stopObserving("click",this.closeHandler)}if(this.options.fade){this.effects.fade=new Effect.Fade(this.container,{queue:{position:"front",scope:"Control.Window"+this.numberInSequence},from:1,to:0,duration:this.options.fadeDuration/2,afterFinish:function(){if(this.iFrameShim){this.iFrameShim.hide()}this.isOpen=false;this.notify("afterClose")}.bind(this)})}else{this.container.hide();if(this.iFrameShim){this.iFrameShim.hide()}}if(this.ajaxRequest){this.ajaxRequest.transport.abort()}if(!(this.options.draggable||this.options.resizable)&&this.options.position=="center"){Event.stopObserving(window,"resize",this.positionHandler)}if(!this.options.draggable&&this.options.position=="center"){Event.stopObserving(window,"scroll",this.positionHandler)}if(this.options.indicator){this.hideIndicator()}if(!this.options.fade){this.isOpen=false;this.notify("afterClose")}return true},position:function(D){if(this.options.position=="mouse"){var G=[Event.pointerX(D),Event.pointerY(D)];this.container.setStyle({top:G[1]+$value(this.options.offsetTop)+"px",left:G[0]+$value(this.options.offsetLeft)+"px"});return }var H=this.container.getDimensions();var C=document.viewport.getDimensions();Position.prepare();var B=(Position.deltaX+Math.floor((C.width-H.width)/2));var A=(Position.deltaY+((C.height>H.height)?Math.floor((C.height-H.height)/2):0));if(this.options.position=="center"){this.container.setStyle({top:(H.height<=C.height)?((A!=null&&A>0)?A:0)+"px":0,left:(H.width<=C.width)?((B!=null&&B>0)?B:0)+"px":0})}else{if(this.options.position=="relative"){var G=this.sourceContainer.cumulativeOffset();var F=G[1]+$value(this.options.offsetTop);var E=G[0]+$value(this.options.offsetLeft);this.container.setStyle({top:(H.height<=C.height)?(this.options.constrainToViewport?Math.max(0,Math.min(C.height-(H.height),F)):F)+"px":0,left:(H.width<=C.width)?(this.options.constrainToViewport?Math.max(0,Math.min(C.width-(H.width),E)):E)+"px":0})}else{if(this.options.position.length){var F=$value(this.options.position[1])+$value(this.options.offsetTop);var E=$value(this.options.position[0])+$value(this.options.offsetLeft);this.container.setStyle({top:(H.height<=C.height)?(this.options.constrainToViewport?Math.max(0,Math.min(C.height-(H.height),F)):F)+"px":0,left:(H.width<=C.width)?(this.options.constrainToViewport?Math.max(0,Math.min(C.width-(H.width),E)):E)+"px":0})}}}if(this.iFrameShim){this.updateIFrameShimZIndex()}},ensureInBounds:function(){if(!this.isOpen){return }var A=document.viewport.getDimensions();var C=this.container.cumulativeOffset();var B=this.container.getDimensions();if(C.left+B.width>A.width){this.container.setStyle({left:(Math.max(0,A.width-B.width))+"px"})}if(C.top+B.height>A.height){this.container.setStyle({top:(Math.max(0,A.height-B.height))+"px"})}},bringToFront:function(){Control.Window.bringToFront(this);this.notify("bringToFront")},destroy:function(){this.container.stopObserving("mousedown",this.bringToFrontHandler);if(this.draggable){Resizables.removeObserver(this.container);this.draggable.handle.stopObserving("mousedown",this.bringToFrontHandler);this.draggable.destroy()}if(this.resizable){Resizables.removeObserver(this.container);this.resizable.handle.stopObserving("mousedown",this.bringToFrontHandler);this.resizable.destroy()}if(this.container&&!this.sourceContainer){this.container.remove()}if(this.sourceContainer){if(this.options.hover){this.sourceContainer.stopObserving("mouseenter",this.sourceContainerOpenHandler);this.sourceContainer.stopObserving("mouseleave",this.sourceContainerCloseHandler);if(this.options.position=="mouse"){this.sourceContainer.stopObserving("mousemove",this.sourceContainerMouseMoveHandler)}}else{this.sourceContainer.stopObserving("click",this.sourceContainerOpenHandler)}}if(this.iFrameShim){this.iFrameShim.destroy()}Event.stopObserving(window,"resize",this.outOfBoundsPositionHandler);Control.Window.windows=Control.Window.windows.without(this);this.notify("afterDestroy")},applyResizable:function(){if(this.options.resizable){if(typeof (Resizable)=="undefined"){throw"Control.Window requires resizable.js to be loaded."}var A=null;if(this.options.resizable===true){A=new Element("div",{className:"resizable_handle"});this.container.insert(A)}else{A=$(this.options.resziable)}this.resizable=new Resizable(this.container,{handle:A,minHeight:this.options.minHeight,minWidth:this.options.minWidth,maxHeight:this.options.constrainToViewport?function(B){return(document.viewport.getDimensions().height-parseInt(B.style.top||0))-(B.getHeight()-parseInt(B.style.height||0))}:this.options.maxHeight,maxWidth:this.options.constrainToViewport?function(B){return(document.viewport.getDimensions().width-parseInt(B.style.left||0))-(B.getWidth()-parseInt(B.style.width||0))}:this.options.maxWidth});this.resizable.handle.observe("mousedown",this.bringToFrontHandler);Resizables.addObserver(new Control.Window.LayoutUpdateObserver(this,function(){if(this.iFrameShim){this.updateIFrameShimZIndex()}this.notify("onResize")}.bind(this)))}},applyDraggable:function(){if(this.options.draggable){if(typeof (Draggables)=="undefined"){throw"Control.Window requires dragdrop.js to be loaded."}var A=null;if(this.options.draggable===true){A=new Element("div",{className:"draggable_handle"});this.container.insert(A)}else{A=$(this.options.draggable)}this.draggable=new Draggable(this.container,{handle:A,constrainToViewport:this.options.constrainToViewport,zindex:this.container.getStyle("z-index"),starteffect:function(){if(Prototype.Browser.IE){this.old_onselectstart=document.onselectstart;document.onselectstart=function(){return false}}}.bind(this),endeffect:function(){document.onselectstart=this.old_onselectstart}.bind(this)});this.draggable.handle.observe("mousedown",this.bringToFrontHandler);Draggables.addObserver(new Control.Window.LayoutUpdateObserver(this,function(){if(this.iFrameShim){this.updateIFrameShimZIndex()}this.notify("onDrag")}.bind(this)))}},createDefaultContainer:function(A){if(!this.container){this.container=new Element("div",{id:"control_window_"+this.numberInSequence});$(document.body).insert(this.container);if(typeof (A)=="string"&&$(A)==null&&!A.match(/^#(.+)$/)&&!A.match(Control.Window.uriRegex)){this.container.update(A)}}},finishOpen:function(A){this.bringToFront();if(this.options.fade){if(typeof (Effect)=="undefined"){throw"Control.Window requires effects.js to be loaded."}if(this.effects.fade){this.effects.fade.cancel()}this.effects.appear=new Effect.Appear(this.container,{queue:{position:"end",scope:"Control.Window."+this.numberInSequence},from:0,to:1,duration:this.options.fadeDuration/2,afterFinish:function(){if(this.iFrameShim){this.updateIFrameShimZIndex()}this.isOpen=true;this.notify("afterOpen")}.bind(this)})}else{this.container.show()}this.position(A);if(!(this.options.draggable||this.options.resizable)&&this.options.position=="center"){Event.observe(window,"resize",this.positionHandler,false)}if(!this.options.draggable&&this.options.position=="center"){Event.observe(window,"scroll",this.positionHandler,false)}if(!this.options.fade){this.isOpen=true;this.notify("afterOpen")}return true},showIndicator:function(){this.showIndicatorTimeout=window.setTimeout(function(){if(this.options.fade){this.indicatorEffects.appear=new Effect.Appear(this.indicator,{queue:{position:"front",scope:"Control.Window.indicator."+this.numberInSequence},from:0,to:1,duration:this.options.fadeDuration/2})}else{this.indicator.show()}}.bind(this),Control.Window.indicatorTimeout)},hideIndicator:function(){if(this.showIndicatorTimeout){window.clearTimeout(this.showIndicatorTimeout)}this.indicator.hide()},getRemoteContentInsertionTarget:function(){return typeof (this.options.insertRemoteContentAt)=="string"?this.container.down(this.options.insertRemoteContentAt):$(this.options.insertRemoteContentAt)},updateIFrameShimZIndex:function(){if(this.iFrameShim){this.iFrameShim.positionUnder(this.container)}}});Object.extend(Control.Window,{windows:[],baseZIndex:9999,indicatorTimeout:250,iframeTemplate:new Template('<iframe src="#{href}" width="100%" height="100%" frameborder="0"></iframe>'),uriRegex:/^(\/|\#|https?\:\/\/|[\w]+\/)/,bringToFront:function(A){Control.Window.windows=Control.Window.windows.without(A);Control.Window.windows.push(A);Control.Window.windows.each(function(C,D){var B=Control.Window.baseZIndex+D;C.container.setStyle({zIndex:B});if(C.isOpen){if(C.iFrameShim){C.updateIFrameShimZIndex()}}if(C.options.draggable){C.draggable.options.zindex=B}})},open:function(B,C){var A=new Control.Window(B,C);A.open();return A},initialZIndexForWindow:function(A){return Control.Window.baseZIndex+(Control.Window.windows.length-1)}});Object.Event.extend(Control.Window);Control.Window.LayoutUpdateObserver=Class.create({initialize:function(A,B){this.w=A;this.element=$(A.container);this.observer=B},onStart:Prototype.emptyFunction,onEnd:function(B,A){if(A.element==this.element&&this.iFrameShim){this.w.updateIFrameShimZIndex()}},onResize:function(B,A){if(A.element==this.element){this.observer(this.element)}},onDrag:function(B,A){if(A.element==this.element){this.observer(this.element)}}});Control.Overlay={id:"control_overlay",loaded:false,container:false,lastOpacity:0,styles:{position:"fixed",top:0,left:0,width:"100%",height:"100%",zIndex:9998},ieStyles:{position:"absolute",top:0,left:0,zIndex:9998},effects:{fade:false,appear:false},load:function(){if(Control.Overlay.loaded){return false}Control.Overlay.loaded=true;Control.Overlay.container=new Element("div",{id:Control.Overlay.id});$(document.body).insert(Control.Overlay.container);if(Prototype.Browser.IE){Control.Overlay.container.setStyle(Control.Overlay.ieStyles);Event.observe(window,"scroll",Control.Overlay.positionOverlay);Event.observe(window,"resize",Control.Overlay.positionOverlay);Control.Overlay.observe("beforeShow",Control.Overlay.positionOverlay)}else{Control.Overlay.container.setStyle(Control.Overlay.styles)}Control.Overlay.iFrameShim=new IframeShim();Control.Overlay.iFrameShim.hide();Event.observe(window,"resize",Control.Overlay.positionIFrameShim);Control.Overlay.container.hide();return true},unload:function(){if(!Control.Overlay.loaded){return false}Event.stopObserving(window,"resize",Control.Overlay.positionOverlay);Control.Overlay.stopObserving("beforeShow",Control.Overlay.positionOverlay);Event.stopObserving(window,"resize",Control.Overlay.positionIFrameShim);Control.Overlay.iFrameShim.destroy();Control.Overlay.container.remove();Control.Overlay.loaded=false;return true},show:function(A,B){if(Control.Overlay.notify("beforeShow")===false){return false}Control.Overlay.lastOpacity=A;Control.Overlay.positionIFrameShim();Control.Overlay.iFrameShim.show();if(B){if(typeof (Effect)=="undefined"){throw"Control.Window requires effects.js to be loaded."}if(Control.Overlay.effects.fade){Control.Overlay.effects.fade.cancel()}Control.Overlay.effects.appear=new Effect.Appear(Control.Overlay.container,{queue:{position:"end",scope:"Control.Overlay"},afterFinish:function(){Control.Overlay.notify("afterShow")},from:0,to:Control.Overlay.lastOpacity,duration:(B===true?0.75:B)/2})}else{Control.Overlay.container.setStyle({opacity:A||1});Control.Overlay.container.show();Control.Overlay.notify("afterShow")}return true},hide:function(A){if(Control.Overlay.notify("beforeHide")===false){return false}if(Control.Overlay.effects.appear){Control.Overlay.effects.appear.cancel()}Control.Overlay.iFrameShim.hide();if(A){Control.Overlay.effects.fade=new Effect.Fade(Control.Overlay.container,{queue:{position:"front",scope:"Control.Overlay"},afterFinish:function(){Control.Overlay.notify("afterHide")},from:Control.Overlay.lastOpacity,to:0,duration:(A===true?0.75:A)/2})}else{Control.Overlay.container.hide();Control.Overlay.notify("afterHide")}return true},positionIFrameShim:function(){if(Control.Overlay.container.visible()){Control.Overlay.iFrameShim.positionUnder(Control.Overlay.container)}},positionOverlay:function(){var A=document.viewport.getDimensions();Control.Overlay.container.setStyle({width:A.width+"px",height:A.height+"px"})}};Object.Event.extend(Control.Overlay);Control.ToolTip=Class.create(Control.Window,{initialize:function($super,A,C,B){$super(C,Object.extend(Object.extend(Control.ToolTip.defaultOptions,B||{}),{position:"mouse",hover:A}))}});Object.extend(Control.ToolTip,{defaultOptions:{offsetLeft:10}});Control.Modal=Class.create(Control.Window,{initialize:function($super,A,B){Control.Modal.InstanceMethods.beforeInitialize.bind(this)();$super(A,Object.extend(Control.Modal.defaultOptions,B||{}))}});Object.extend(Control.Modal,{defaultOptions:{overlayOpacity:0.5,closeOnClick:"overlay"},current:false,open:function(A,B){var C=new Control.Modal(A,B);C.open();return C},close:function(){if(Control.Modal.current){Control.Modal.current.close()}},InstanceMethods:{beforeInitialize:function(){Control.Overlay.load();this.overlayFinishedOpening=false;this.observe("beforeOpen",Control.Modal.Observers.beforeOpen.bind(this));this.observe("afterOpen",Control.Modal.Observers.afterOpen.bind(this));this.observe("afterClose",Control.Modal.Observers.afterClose.bind(this))}},Observers:{beforeOpen:function(){if(!this.overlayFinishedOpening){Control.Overlay.observeOnce("afterShow",function(){this.overlayFinishedOpening=true;this.open()}.bind(this));Control.Overlay.show(this.options.overlayOpacity,this.options.fade?this.options.fadeDuration:false);throw $break}else{Control.Window.windows.without(this).invoke("close")}},afterOpen:function(){Control.Modal.current=this},afterClose:function(){Control.Overlay.hide(this.options.fade?this.options.fadeDuration:false);Control.Modal.current=false;this.overlayFinishedOpening=false}}});Control.LightBox=Class.create(Control.Window,{initialize:function($super,A,B){this.allImagesLoaded=false;if(B.modal){var B=Object.extend(Control.LightBox.defaultOptions,B||{});B=Object.extend(Control.Modal.defaultOptions,B);B=Control.Modal.InstanceMethods.beforeInitialize.bind(this)(B);$super(A,B)}else{$super(A,Object.extend(Control.LightBox.defaultOptions,B||{}))}this.hasRemoteContent=this.href&&!this.options.iframe;if(this.hasRemoteContent){this.observe("onRemoteContentLoaded",Control.LightBox.Observers.onRemoteContentLoaded.bind(this))}else{this.applyImageObservers()}this.observe("beforeOpen",Control.LightBox.Observers.beforeOpen.bind(this))},applyImageObservers:function(){var A=this.getImages();this.numberImagesToLoad=A.length;this.numberofImagesLoaded=0;A.each(function(B){B.observe("load",function(C){++this.numberofImagesLoaded;if(this.numberImagesToLoad==this.numberofImagesLoaded){this.allImagesLoaded=true;this.onAllImagesLoaded()}}.bind(this,B));B.hide()}.bind(this))},onAllImagesLoaded:function(){this.getImages().each(function(A){this.showImage(A)}.bind(this));if(this.hasRemoteContent){if(this.options.indicator){this.hideIndicator()}this.finishOpen()}else{this.open()}},getImages:function(){return this.container.select(Control.LightBox.imageSelector)},showImage:function(A){A.show()}});Object.extend(Control.LightBox,{imageSelector:"img",defaultOptions:{},Observers:{beforeOpen:function(){if(!this.hasRemoteContent&&!this.allImagesLoaded){throw $break}},onRemoteContentLoaded:function(){this.applyImageObservers();if(!this.allImagesLoaded){throw $break}}}});var Showdown={};Showdown.converter=function(){var A;var J;var a;var I=0;this.makeHtml=function(h){A=new Array();J=new Array();a=new Array();h=h.replace(/~/g,"~T");h=h.replace(/\$/g,"~D");h=h.replace(/\r\n/g,"\n");h=h.replace(/\r/g,"\n");h="\n\n"+h+"\n\n";h=Z(h);h=h.replace(/^[ \t]+$/mg,"");h=M(h);h=D(h);h=g(h);h=Q(h);h=h.replace(/~D/g,"$$");h=h.replace(/~T/g,"~");return h};var D=function(h){var h=h.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|\Z)/gm,function(k,m,l,j,i){m=m.toLowerCase();A[m]=H(l);if(j){return j+i}else{if(i){J[m]=i.replace(/"/g,"&quot;")}}return""});return h};var M=function(j){j=j.replace(/\n/g,"\n\n");var i="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del";var h="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math";j=j.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,X);j=j.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math)\b[^\r]*?.*<\/\2>[ \t]*(?=\n+)\n)/gm,X);j=j.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,X);j=j.replace(/(\n\n[ ]{0,3}<!(--[^\r]*?--\s*)+>[ \t]*(?=\n{2,}))/g,X);j=j.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,X);j=j.replace(/\n\n/g,"\n");return j};var X=function(h,i){var j=i;j=j.replace(/\n\n/g,"\n");j=j.replace(/^\n/,"");j=j.replace(/\n+$/g,"");j="\n\n~K"+(a.push(j)-1)+"K\n\n";return j};var g=function(i){i=F(i);var h=O("<hr />");i=i.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,h);i=i.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,h);i=i.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,h);i=e(i);i=B(i);i=U(i);i=M(i);i=G(i);return i};var R=function(h){h=c(h);h=L(h);h=E(h);h=f(h);h=Y(h);h=N(h);h=H(h);h=C(h);h=h.replace(/  +\n/g," <br />\n");return h};var L=function(i){var h=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|<!(--.*?--\s*)+>)/gi;i=i.replace(h,function(k){var j=k.replace(/(.)<\/?code>(?=.)/g,"$1`");j=W(j,"\\`*_");return j});return i};var Y=function(h){h=h.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,d);h=h.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?(.*?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,d);h=h.replace(/(\[([^\[\]]+)\])()()()()()/g,d);return h};var d=function(n,t,s,r,q,p,m,l){if(l==undefined){l=""}var k=t;var i=s;var j=r.toLowerCase();var h=q;var o=l;if(h==""){if(j==""){j=i.toLowerCase().replace(/ ?\n/g," ")}h="#"+j;if(A[j]!=undefined){h=A[j];if(J[j]!=undefined){o=J[j]}}else{if(k.search(/\(\s*\)$/m)>-1){h=""}else{return k}}}h=W(h,"*_");var u='<a href="'+h+'"';if(o!=""){o=o.replace(/"/g,"&quot;");o=W(o,"*_");u+=' title="'+o+'"'}u+=">"+i+"</a>";return u};var f=function(h){h=h.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,T);h=h.replace(/(!\[(.*?)\]\s?\([ \t]*()<?(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,T);return h};var T=function(n,t,s,r,q,p,m,l){var k=t;var j=s;var i=r.toLowerCase();var h=q;var o=l;if(!o){o=""}if(h==""){if(i==""){i=j.toLowerCase().replace(/ ?\n/g," ")}h="#"+i;if(A[i]!=undefined){h=A[i];if(J[i]!=undefined){o=J[i]}}else{return k}}j=j.replace(/"/g,"&quot;");h=W(h,"*_");var u='<img src="'+h+'" alt="'+j+'"';o=o.replace(/"/g,"&quot;");o=W(o,"*_");u+=' title="'+o+'"';u+=" />";return u};var F=function(h){h=h.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,function(i,j){return O("<h1>"+R(j)+"</h1>")});h=h.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(j,i){return O("<h2>"+R(i)+"</h2>")});h=h.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(i,l,k){var j=l.length;return O("<h"+j+">"+R(k)+"</h"+j+">")});return h};var P;var e=function(i){i+="~0";var h=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;if(I){i=i.replace(h,function(k,n,m){var o=n;var l=(m.search(/[*+-]/g)>-1)?"ul":"ol";o=o.replace(/\n{2,}/g,"\n\n\n");var j=P(o);j=j.replace(/\s+$/,"");j="<"+l+">"+j+"</"+l+">\n";return j})}else{h=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g;i=i.replace(h,function(l,p,n,k){var o=p;var q=n;var m=(k.search(/[*+-]/g)>-1)?"ul":"ol";var q=q.replace(/\n{2,}/g,"\n\n\n");var j=P(q);j=o+"<"+m+">\n"+j+"</"+m+">\n";return j})}i=i.replace(/~0/,"");return i};P=function(h){I++;h=h.replace(/\n{2,}$/,"\n");h+="~0";h=h.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,function(k,m,l,j,i){var o=i;var n=m;var p=l;if(n||(o.search(/\n{2,}/)>-1)){o=g(S(o))}else{o=e(S(o));o=o.replace(/\n$/,"");o=R(o)}return"<li>"+o+"</li>\n"});h=h.replace(/~0/g,"");I--;return h};var B=function(h){h+="~0";h=h.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(i,k,j){var l=k;var m=j;l=V(S(l));l=Z(l);l=l.replace(/^\n+/g,"");l=l.replace(/\n+$/g,"");l="<pre><code>"+l+"\n</code></pre>";return O(l)+m});h=h.replace(/~0/,"");return h};var O=function(h){h=h.replace(/(^\n+|\n+$)/g,"");return"\n\n~K"+(a.push(h)-1)+"K\n\n"};var c=function(h){h=h.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(k,m,l,j,i){var n=j;n=n.replace(/^([ \t]*)/g,"");n=n.replace(/[ \t]*$/g,"");n=V(n);return m+"<code>"+n+"</code>"});return h};var V=function(h){h=h.replace(/&/g,"&amp;");h=h.replace(/</g,"&lt;");h=h.replace(/>/g,"&gt;");h=W(h,"*_{}[]\\",false);return h};var C=function(h){h=h.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"<strong>$2</strong>");h=h.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"<em>$2</em>");return h};var U=function(h){h=h.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(i,j){var k=j;k=k.replace(/^[ \t]*>[ \t]?/gm,"~0");k=k.replace(/~0/g,"");k=k.replace(/^[ \t]+$/gm,"");k=g(k);k=k.replace(/(^|\n)/g,"$1  ");k=k.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(l,m){var n=m;n=n.replace(/^  /mg,"~0");n=n.replace(/~0/g,"");return n});return O("<blockquote>\n"+k+"\n</blockquote>")});return h};var G=function(o){o=o.replace(/^\n+/g,"");o=o.replace(/\n+$/g,"");var n=o.split(/\n{2,}/g);var k=new Array();var h=n.length;for(var j=0;j<h;j++){var m=n[j];if(m.search(/~K(\d+)K/g)>=0){k.push(m)}else{if(m.search(/\S/)>=0){m=R(m);m=m.replace(/^([ \t]*)/g,"<p>");m+="</p>";k.push(m)}}}h=k.length;for(var j=0;j<h;j++){while(k[j].search(/~K(\d+)K/)>=0){var l=a[RegExp.$1];l=l.replace(/\$/g,"$$$$");k[j]=k[j].replace(/~K\d+K/,l)}}return k.join("\n\n")};var H=function(h){h=h.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&amp;");h=h.replace(/<(?![a-z\/?\$!])/gi,"&lt;");return h};var E=function(h){h=h.replace(/\\(\\)/g,K);h=h.replace(/\\([`*_{}\[\]()>#+-.!])/g,K);return h};var N=function(h){h=h.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,'<a href="$1">$1</a>');h=h.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(i,j){return b(Q(j))});h=h.replace(/(^| )(\b[A-Z][a-z]+[A-Z][\w\u00A1-\uFFFF]+\b)/,'<a href="'+Site.url+'/$1">$1</a>');h=h.replace(/\[\[\s*([^\]]+)\]\]/,'<a href="'+Site.url+'/$1">$1</a>');return h};var b=function(j){function i(l){var k="0123456789ABCDEF";var m=l.charCodeAt(0);return(k.charAt(m>>4)+k.charAt(m&15))}var h=[function(k){return"&#"+k.charCodeAt(0)+";"},function(k){return"&#x"+i(k)+";"},function(k){return k}];j="mailto:"+j;j=j.replace(/./g,function(k){if(k=="@"){k=h[Math.floor(Math.random()*2)](k)}else{if(k!=":"){var l=Math.random();k=(l>0.9?h[2](k):l>0.45?h[1](k):h[0](k))}}return k});j='<a href="'+j+'">'+j+"</a>";j=j.replace(/">.+:/g,'">');return j};var Q=function(h){h=h.replace(/~E(\d+)E/g,function(i,k){var j=parseInt(k);return String.fromCharCode(j)});return h};var S=function(h){h=h.replace(/^(\t|[ ]{1,4})/gm,"~0");h=h.replace(/~0/g,"");return h};var Z=function(h){h=h.replace(/\t(?=\t)/g,"    ");h=h.replace(/\t/g,"~A~B");h=h.replace(/~B(.+?)~A/g,function(j,m,l){var o=m;var k=4-o.length%4;for(var n=0;n<k;n++){o+=" "}return o});h=h.replace(/~A/g,"    ");h=h.replace(/~B/g,"");return h};var W=function(l,i,j){var h="(["+i.replace(/([\[\]\\])/g,"\\$1")+"])";if(j){h="\\\\"+h}var k=new RegExp(h,"g");l=l.replace(k,K);return l};var K=function(h,j){var i=j.charCodeAt(0);return"~E"+i+"E"}};

templates/base.html

     <script src="/static/js/lib/slider.js" type="text/javascript"></script>
     <script src="/static/js/src/application.js" type="text/javascript"></script>
     {% else %}
-    <link rel="stylesheet" href="/static/css/screen.css?20080925" type="text/css" media="screen, projection" />
-    <link rel="stylesheet" href="/static/css/theme.css?20080925" type="text/css" media="screen, projection" />
-    <link rel="stylesheet" href="/static/css/print.css?20080925" type="text/css" media="print" /> 
+    <link rel="stylesheet" href="/static/css/screen.css?20080926" type="text/css" media="screen, projection" />
+    <link rel="stylesheet" href="/static/css/theme.css?20080926" type="text/css" media="screen, projection" />
+    <link rel="stylesheet" href="/static/css/print.css?20080926" type="text/css" media="print" /> 
     <!--[if IE]>
-      <link rel="stylesheet" href="/static/css/ie.css?20080925" type="text/css" media="screen, projection" />
+      <link rel="stylesheet" href="/static/css/ie.css?20080926" type="text/css" media="screen, projection" />
     <![endif]-->
     {% if site %}
 
-    <script src="/static/js/prototype.js?20080925" type="text/javascript"></script>
-    <script src="/static/js/scriptaculous.js?20080925" type="text/javascript"></script>
-    <script src="/static/js/couchit-application.js?20080925" type="text/javascript"></script>
+    <script src="/static/js/prototype.js?20080926" type="text/javascript"></script>
+    <script src="/static/js/scriptaculous.js?20080926" type="text/javascript"></script>
+    <script src="/static/js/couchit-application.js?20080926" type="text/javascript"></script>
     {% endif %}
     
     {% endif %}

templates/page/show.html

 <script src="/static/js/lib/showdown.js" type="text/javascript"></script>
 <script src="/static/js/src/page.js" type="text/javascript"></script>
 {% else %}
-<script src="/static/js/livepipe.js?20080925" type="text/javascript"></script>
-<script src="/static/js/couchit-page.js?20080925" type="text/javascript"></script>
+<script src="/static/js/livepipe.js?20080926" type="text/javascript"></script>
+<script src="/static/js/couchit-page.js?20080926" type="text/javascript"></script>
 {% endif %}
 
 {% endblock %}

templates/site/design.html

 <script src="/static/js/lib/yahoo.color.js" type="text/javascript"></script>
 <script src="/static/js/lib/colorPicker.js" type="text/javascript"></script>
 {% else %}
-<script src="/static/js/colorpicker.js?20080925" type="text/javascript"></script>
+<script src="/static/js/colorpicker.js?20080926" type="text/javascript"></script>
 {% endif %}
 
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.