/**
 * Code Syntax Highlighter.
 * Version 1.5.1
 * Copyright (C) 2004-2007 Alex Gorbatchev
 * http://www.dreamprojections.com/syntaxhighlighter/
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, version 3 of the License.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
var dp={sh:{Toolbar:{},Utils:{},RegexLib:{},Brushes:{},Strings:{AboutDialog:'<html><head><title>About...</title></head><body class="dp-about"><table cellspacing="0"><tr><td class="copy"><p class="title">dp.SyntaxHighlighter</div><div class="para">Version: {V}</p><p><a href="http://www.dreamprojections.com/syntaxhighlighter/?ref=about" target="_blank">http://www.dreamprojections.com/syntaxhighlighter</a></p>&copy;2004-2007 Alex Gorbatchev.</td></tr><tr><td class="footer"><input type="button" class="close" value="OK" onClick="window.close()"/></td></tr></table></body></html>'},ClipboardSwf:null,Version:"1.5.1"}};dp.SyntaxHighlighter=dp.sh;dp.sh.Toolbar.Commands={ExpandSource:{label:"+ expand source",check:function(A){return A.collapse},func:function(B,A){B.parentNode.removeChild(B);A.div.className=A.div.className.replace("collapsed","")}},ViewSource:{label:"view plain",func:function(B,A){var D=dp.sh.Utils.FixForBlogger(A.originalCode).replace(/</g,"&lt;");var C=window.open("","_blank","width=750, height=400, location=0, resizable=1, menubar=0, scrollbars=0");C.document.write('<textarea style="width:99%;height:99%">'+D+"</textarea>");C.document.close()}},CopyToClipboard:{label:"copy to clipboard",check:function(){return window.clipboardData!=null||dp.sh.ClipboardSwf!=null},func:function(B,A){var D=dp.sh.Utils.FixForBlogger(A.originalCode).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");if(window.clipboardData){window.clipboardData.setData("text",D)}else{if(dp.sh.ClipboardSwf!=null){var C=A.flashCopier;if(C===null){C=document.createElement("div");A.flashCopier=C;A.div.appendChild(C)}C.innerHTML='<embed src="'+dp.sh.ClipboardSwf+'" FlashVars="clipboard='+encodeURIComponent(D)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>'}}alert("The code is in your clipboard now")}},PrintSource:{label:"print",func:function(B,A){var C=document.createElement("IFRAME");var D=null;C.style.cssText="position:absolute;width:0px;height:0px;left:-500px;top:-500px;";document.body.appendChild(C);D=C.contentWindow.document;dp.sh.Utils.CopyStyles(D,window.document);D.write('<div class="'+A.div.className.replace("collapsed","")+' printing">'+A.div.innerHTML+"</div>");D.close();C.contentWindow.focus();C.contentWindow.print();alert("Printing...");document.body.removeChild(C)}},About:{label:"?",func:function(A){var B=window.open("","_blank","dialog,width=300,height=150,scrollbars=0");var C=B.document;dp.sh.Utils.CopyStyles(C,window.document);C.write(dp.sh.Strings.AboutDialog.replace("{V}",dp.sh.Version));C.close();B.focus()}}};dp.sh.Toolbar.Create=function(B){var D=document.createElement("DIV");D.className="tools";for(var A in dp.sh.Toolbar.Commands){var C=dp.sh.Toolbar.Commands[A];if(C.check!=null&&!C.check(B)){continue}D.innerHTML+='<a href="#" onclick="dp.sh.Toolbar.Command(\''+A+"',this);return false;\">"+C.label+"</a>"}return D};dp.sh.Toolbar.Command=function(A,B){var C=B;while(C!=null&&C.className.indexOf("dp-highlighter")==-1){C=C.parentNode}if(C!=null){dp.sh.Toolbar.Commands[A].func(B,C.highlighter)}};dp.sh.Utils.CopyStyles=function(A,D){var B=D.getElementsByTagName("link");for(var C=0;C<B.length;C++){if(B[C].rel.toLowerCase()=="stylesheet"){A.write('<link type="text/css" rel="stylesheet" href="'+B[C].href+'"></link>')}}};dp.sh.Utils.FixForBlogger=function(A){return(dp.sh.isBloggerMode==true)?A.replace(/<br\s*\/?>|&lt;br\s*\/?&gt;/gi,"\n"):A};dp.sh.RegexLib={MultiLineCComments:new RegExp("/\\*[\\s\\S]*?\\*/","gm"),SingleLineCComments:new RegExp("//.*$","gm"),SingleLinePerlComments:new RegExp("#.*$","gm"),DoubleQuotedString:new RegExp('"(?:\\.|(\\\\\\")|[^\\""\\n])*"',"g"),SingleQuotedString:new RegExp("'(?:\\.|(\\\\\\')|[^\\''\\n])*'","g")};dp.sh.Match=function(C,A,B){this.value=C;this.index=A;this.length=C.length;this.css=B};dp.sh.Highlighter=function(){this.noGutter=false;this.addControls=true;this.collapse=false;this.tabsToSpaces=true;this.wrapColumn=80;this.showColumns=true};dp.sh.Highlighter.SortCallback=function(B,A){if(B.index<A.index){return -1}else{if(B.index>A.index){return 1}else{if(B.length<A.length){return -1}else{if(B.length>A.length){return 1}}}}return 0};dp.sh.Highlighter.prototype.CreateElement=function(B){var A=document.createElement(B);A.highlighter=this;return A};dp.sh.Highlighter.prototype.GetMatches=function(D,C){var B=0;var A=null;while((A=D.exec(this.code))!=null){this.matches[this.matches.length]=new dp.sh.Match(A[0],A.index,C)}};dp.sh.Highlighter.prototype.AddBit=function(E,C){if(E===null||E.length===0){return }var D=this.CreateElement("SPAN");E=E.replace(/ /g,"&nbsp;");E=E.replace(/</g,"&lt;");E=E.replace(/\n/gm,"&nbsp;<br>");if(C!=null){if((/br/gi).test(E)){var A=E.split("&nbsp;<br>");for(var B=0;B<A.length;B++){D=this.CreateElement("SPAN");D.className=C;D.innerHTML=A[B];this.div.appendChild(D);if(B+1<A.length){this.div.appendChild(this.CreateElement("BR"))}}}else{D.className=C;D.innerHTML=E;this.div.appendChild(D)}}else{D.innerHTML=E;this.div.appendChild(D)}};dp.sh.Highlighter.prototype.IsInside=function(A){if(A===null||A.length===0){return false}for(var B=0;B<this.matches.length;B++){var C=this.matches[B];if(C===null){continue}if((A.index>C.index)&&(A.index<C.index+C.length)){return true}}return false};dp.sh.Highlighter.prototype.ProcessRegexList=function(){for(var A=0;A<this.regexList.length;A++){this.GetMatches(this.regexList[A].regex,this.regexList[A].css)}};dp.sh.Highlighter.prototype.ProcessSmartTabs=function(F){var B=F.split("\n");var A="";var G=4;var D="\t";function H(I,O,M){var N=I.substr(0,O);var L=I.substr(O+1,I.length);var J="";for(var K=0;K<M;K++){J+=" "}return N+J+L}function E(I,K){if(I.indexOf(D)==-1){return I}var L=0;while((L=I.indexOf(D))!=-1){var J=K-L%K;I=H(I,L,J)}return I}for(var C=0;C<B.length;C++){A+=E(B[C],G)+"\n"}return A};dp.sh.Highlighter.prototype.SwitchToList=function(){var E=this.div.innerHTML.replace(/<(br)\/?>/gi,"\n");var I=E.split("\n");if(this.addControls==true){this.bar.appendChild(dp.sh.Toolbar.Create(this))}if(this.showColumns){var A=this.CreateElement("div");var C=this.CreateElement("div");var B=10;var D=1;while(D<=150){if(D%B===0){A.innerHTML+=D;D+=(D+"").length}else{A.innerHTML+="&middot;";D++}}C.className="columns";C.appendChild(A);this.bar.appendChild(C)}for(var D=0,H=this.firstLine;D<I.length-1;D++,H++){var G=this.CreateElement("LI");var F=this.CreateElement("SPAN");G.className=(D%2===0)?"alt":"";F.innerHTML=I[D]+"&nbsp;";G.appendChild(F);this.ol.appendChild(G)}this.div.innerHTML=""};dp.sh.Highlighter.prototype.Highlight=function(D){function F(I){return I.replace(/^\s*(.*?)[\s\n]*$/g,"$1")}function G(I){return I.replace(/\n*$/,"").replace(/^\n*/,"")}function B(O){var I=dp.sh.Utils.FixForBlogger(O).split("\n");var N=new Array();var L=new RegExp("^\\s*","g");var K=1000;for(var J=0;J<I.length&&K>0;J++){if(F(I[J]).length===0){continue}var M=L.exec(I[J]);if(M!=null&&M.length>0){K=Math.min(M[0].length,K)}}if(K>0){for(var J=0;J<I.length;J++){I[J]=I[J].substr(K)}}return I.join("\n")}function E(I,K,J){return I.substr(K,J-K)}var H=0;if(D===null){D=""}this.originalCode=D;this.code=G(B(D));this.div=this.CreateElement("DIV");this.bar=this.CreateElement("DIV");this.ol=this.CreateElement("OL");this.matches=new Array();this.div.className="dp-highlighter";this.div.highlighter=this;this.bar.className="bar";this.ol.start=this.firstLine;if(this.CssClass!=null){this.ol.className=this.CssClass}if(this.collapse){this.div.className+=" collapsed"}if(this.noGutter){this.div.className+=" nogutter"}if(this.tabsToSpaces==true){this.code=this.ProcessSmartTabs(this.code)}this.ProcessRegexList();if(this.matches.length===0){this.AddBit(this.code,null);this.SwitchToList();this.div.appendChild(this.bar);this.div.appendChild(this.ol);return }this.matches=this.matches.sort(dp.sh.Highlighter.SortCallback);for(var C=0;C<this.matches.length;C++){if(this.IsInside(this.matches[C])){this.matches[C]=null}}for(var C=0;C<this.matches.length;C++){var A=this.matches[C];if(A===null||A.length===0){continue}this.AddBit(E(this.code,H,A.index),null);this.AddBit(A.value,A.css);H=A.index+A.length}this.AddBit(this.code.substr(H),null);this.SwitchToList();this.div.appendChild(this.bar);this.div.appendChild(this.ol)};dp.sh.Highlighter.prototype.GetKeywords=function(A){return"\\b"+A.replace(/ /g,"\\b|\\b")+"\\b"};dp.sh.BloggerMode=function(){dp.sh.isBloggerMode=true};dp.sh.HighlightAll=function(W,U,S,O,E,A){function H(){var X=arguments;for(var Y=0;Y<X.length;Y++){if(X[Y]===null){continue}if(typeof (X[Y])=="string"&&X[Y]!=""){return X[Y]+""}if(typeof (X[Y])=="object"&&X[Y].value!=""){return X[Y].value+""}}return null}function Q(Z,Y){for(var X=0;X<Y.length;X++){if(Y[X]==Z){return true}}return false}function J(Y,c,X){var a=new RegExp("^"+Y+"\\[(\\w+)\\]$","gi");var b=null;for(var Z=0;Z<c.length;Z++){if((b=a.exec(c[Z]))!=null){return b[1]}}return X}function L(b,Y,a){var X=document.getElementsByTagName(a);for(var Z=0;Z<X.length;Z++){if(X[Z].getAttribute("name")==Y){b.push(X[Z])}}}var F=[];var V=null;var T={};var G="innerHTML";L(F,W,"pre");L(F,W,"textarea");if(F.length===0){return }for(var C in dp.sh.Brushes){var N=dp.sh.Brushes[C].Aliases;if(N===null){continue}for(var M=0;M<N.length;M++){T[N[M]]=C}}for(var M=0;M<F.length;M++){var B=F[M];var D=H(B.attributes["class"],B.className,B.attributes.language,B.language);var K="";if(D===null){continue}D=D.split(":");K=D[0].toLowerCase();if(T[K]===null){continue}V=new dp.sh.Brushes[T[K]]();B.style.display="none";if(typeof (U)==="undefined"){V.noGutter=Q("nogutter",D)}else{V.noGutter=!U}if(typeof (S)==="undefined"){V.addControls=!Q("nocontrols",D)}else{V.addControls=S}if(typeof (O)==="undefined"){V.collapse=Q("collapse",D)}else{V.collapse=O}if(typeof (A)==="undefined"){V.showColumns=Q("showcolumns",D)}else{V.showColumns=A}var P=document.getElementsByTagName("head")[0];if(V.Style&&P){var R=document.createElement("style");R.setAttribute("type","text/css");if(R.styleSheet){R.styleSheet.cssText=V.Style}else{var I=document.createTextNode(V.Style);R.appendChild(I)}P.appendChild(R)}V.firstLine=(E===null)?parseInt(J("firstline",D,1)):E;V.Highlight(B[G]);V.source=B;B.parentNode.insertBefore(V.div,B)}};dp.sh.Brushes.JScript=function(){var A="abstract boolean break byte case catch char class const continue debugger default delete do double else enum export extends false final finally float for function goto if implements import in instanceof int interface long native new null package private protected public return short static super switch synchronized this throw throws transient true try typeof var void volatile while with";this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:"comment"},{regex:dp.sh.RegexLib.MultiLineCComments,css:"comment"},{regex:dp.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:dp.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp("^\\s*#.*","gm"),css:"preprocessor"},{regex:new RegExp(this.GetKeywords(A),"gm"),css:"keyword"}];this.CssClass="dp-c"};dp.sh.Brushes.JScript.prototype=new dp.sh.Highlighter();dp.sh.Brushes.JScript.Aliases=["js","jscript","javascript"];dp.sh.Brushes.Xml=function(){this.CssClass="dp-xml";this.Style=".dp-xml .cdata { color: #ff1493; }.dp-xml .tag, .dp-xml .tag-name { color: #069; font-weight: bold; }.dp-xml .attribute { color: red; }.dp-xml .attribute-value { color: blue; }"};dp.sh.Brushes.Xml.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Xml.Aliases=["xml","xhtml","xslt","html","xhtml"];dp.sh.Brushes.Xml.prototype.ProcessRegexList=function(){function C(F,E){F[F.length]=E}var B=0;var A=null;var D=null;this.GetMatches(new RegExp("(&lt;|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](&gt;|>)","gm"),"cdata");this.GetMatches(new RegExp("(&lt;|<)!--\\s*.*?\\s*--(&gt;|>)","gm"),"comments");D=new RegExp("([:\\w-.]+)\\s*=\\s*(\".*?\"|'.*?'|\\w+)*|(\\w+)","gm");while((A=D.exec(this.code))!=null){if(A[1]==null){continue}C(this.matches,new dp.sh.Match(A[1],A.index,"attribute"));if(A[2]!=undefined){C(this.matches,new dp.sh.Match(A[2],A.index+A[0].indexOf(A[2]),"attribute-value"))}}this.GetMatches(new RegExp("(&lt;|<)/*\\?*(?!\\!)|/*\\?*(&gt;|>)","gm"),"tag");D=new RegExp("(?:&lt;|<)/*\\?*\\s*([:\\w-.]+)","gm");while((A=D.exec(this.code))!=null){C(this.matches,new dp.sh.Match(A[1],A.index+A[0].indexOf(A[1]),"tag-name"))}};dp.sh.Brushes.Ruby=function(){var A="alias and BEGIN begin break case class def define_method defined do each else elsif END end ensure false for if in module new next nil not or raise redo rescue retry return self super then throw true undef unless until when while yield";var B="Array Bignum Binding Class Continuation Dir Exception FalseClass File::Stat File Fixnum Fload Hash Integer IO MatchData Method Module NilClass Numeric Object Proc Range Regexp String Struct::TMS Symbol ThreadGroup Thread Time TrueClass";this.regexList=[{regex:dp.sh.RegexLib.SingleLinePerlComments,css:"comment"},{regex:dp.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:dp.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp(":[a-z][A-Za-z0-9_]*","g"),css:"symbol"},{regex:new RegExp("(\\$|@@|@)\\w+","g"),css:"variable"},{regex:new RegExp(this.GetKeywords(A),"gm"),css:"keyword"},{regex:new RegExp(this.GetKeywords(B),"gm"),css:"builtin"}];this.CssClass="dp-rb";this.Style=".dp-rb .symbol { color: #a70; }.dp-rb .variable { color: #a70; font-weight: bold; }"};dp.sh.Brushes.Ruby.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Ruby.Aliases=["ruby","rails","ror"];