/***
|''Name:''|MathSVGPlugin|
|''Description:''|This plugin translates a subset of the LaTeX math notation to MathML with a customisable image fallback when MathML is not supported. It also provides an easy way to produce mathematical SVG graphics with dynamical features and animation.|
|''Version:''|1.1|
|''Date:''|2009-05-05|
|''Source:''|http://www.math.ist.utl.pt/~psoares/mathsvg.html|
|''Author:''|Paulo Soares|
|''License:''|[[GNU Lesser General Public License|http://www.gnu.org/licences/lgpl.html]]|
|''~CoreVersion:''|2.5.0|
!Original copyright notice
{{{
ASCIIMathML.js
==============
Version 2.1 Oct 8, 2008, (c) Peter Jipsen http://www.chapman.edu/~jipsen
This version extends ASCIIMathML.js with LaTeXMathML.js and ASCIIsvg.js.
Latest version at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML.js
If you use it on a webpage, please send the URL to jipsen@chapman.edu
The LaTeXMathML modifications were made by Douglas Woodall, June 2006.
(for details see header on the LaTeXMathML part in middle of file)
Extensive clean-up and improvements by Paulo Soares, Oct 2007.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
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 Lesser General Public License
(at http://www.gnu.org/licences/lgpl.html) for more details.
}}}
!~MathSVG code (minified)
***/
//{{{
Math.sec=function(a){return 1/Math.cos(a)};Math.csc=function(a){return 1/Math.sin(a)};Math.cot=function(a){return 1/Math.tan(a)};Math.asec=function(a){return Math.acos(1/a)};Math.acsc=function(a){return Math.asin(1/a)};Math.acot=function(a){return Math.atan(1/a)};Math.sinh=function(a){return(Math.exp(a)-Math.exp(-a))/2};Math.cosh=function(a){return(Math.exp(a)+Math.exp(-a))/2};Math.tanh=function(a){return(Math.exp(a)-Math.exp(-a))/(Math.exp(a)+Math.exp(-a))};Math.sech=function(a){return 1/Math.cosh(a)};Math.csch=function(a){return 1/Math.sinh(a)};Math.coth=function(a){return 1/Math.tanh(a)};Math.asinh=function(a){return Math.log(a+Math.sqrt(a*a+1))};Math.acosh=function(a){return Math.log(a+Math.sqrt(a*a-1))};Math.atanh=function(a){return Math.log((1+a)/(1-a))/2};Math.sech=function(a){return 1/Math.cosh(a)};Math.csch=function(a){return 1/Math.sinh(a)};Math.coth=function(a){return 1/Math.tanh(a)};Math.asech=function(a){return Math.acosh(1/a)};Math.acsch=function(a){return Math.asinh(1/a)};Math.acoth=function(a){return Math.atanh(1/a)};Math.sign=function(a){return(a===0?0:(a<0?-1:1))};Math.step=function(a,c,b){return(a<0?(b?b:0):(c?c:1))};Math.root=function(a,b){return Math.pow(a,1/b)};Math.factorial=function(b){if(b===0){return 1}if(b<0){if((b%1)===0){return}if(b>-1){return Math.factorial(b+1)/(b+1)}return -Math.PI/(Math.factorial(-1-b)*Math.sin(Math.PI*b))}var a=b;if((b%1)===0){while(b>1){b=b-1;a=a*b}}else{a=Math.exp((b+0.5)*Math.log(b+1)-b-b*(0.1121105+b*0.08106103)/(1.452342+b*(2.410858+b)))}return a};Math.Gamma=function(a){return Math.factorial(a-1)};Math.Beta=function(a,b){return Math.Gamma(a)*Math.Gamma(b)/Math.Gamma(a+b)};Math.C=function(a,b){var c=1/((a+1)*Math.Beta(b+1,a-b+1));return c};Math.truncate=function(a,c){var b=c||0;return Math.floor(a*Math.pow(10,b))/Math.pow(10,b)};Math.randomString=function(b,d){var c,e="";var a=b.length-1;for(c=0;c<d;c++){e+=b.substr(Math.runif(0,a),1)}return e};Math.runif=function(d,c,f){var e=f||0;return Math.truncate((c+Math.pow(10,-e)-d)*Math.random()+d,e)};Math.rnormal=function(a,b){a=a||0;b=b||1;var d=0,c=0;while(d*c===0){d=Math.random();c=Math.random()}return b*(Math.sqrt(-2*Math.log(d))*Math.cos(2*Math.PI*c))+a};Math.range=function(e,a,d){if((a-e)*d<=0){return}var c,b=[];for(c=e;c<=a;c+=d){b[b.length]=c}return b};var MSVG=function(m){var h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";var t=["\uD835\uDC9C","\u212C","\uD835\uDC9E","\uD835\uDC9F","\u2130","\u2131","\uD835\uDCA2","\u210B","\u2110","\uD835\uDCA5","\uD835\uDCA6","\u2112","\u2133","\uD835\uDCA9","\uD835\uDCAA","\uD835\uDCAB","\uD835\uDCAC","\u211B","\uD835\uDCAE","\uD835\uDCAF","\uD835\uDCB0","\uD835\uDCB1","\uD835\uDCB2","\uD835\uDCB3","\uD835\uDCB4","\uD835\uDCB5","\uD835\uDCB6","\uD835\uDCB7","\uD835\uDCB8","\uD835\uDCB9","\u212F","\uD835\uDCBB","\u210A","\uD835\uDCBD","\uD835\uDCBE","\uD835\uDCBF","\uD835\uDCC0","\uD835\uDCC1","\uD835\uDCC2","\uD835\uDCC3","\u2134","\uD835\uDCC5","\uD835\uDCC6","\uD835\uDCC7","\uD835\uDCC8","\uD835\uDCC9","\uD835\uDCCA","\uD835\uDCCB","\uD835\uDCCC","\uD835\uDCCD","\uD835\uDCCE","\uD835\uDCCF"];var D=["\uD835\uDD04","\uD835\uDD05","\u212D","\uD835\uDD07","\uD835\uDD08","\uD835\uDD09","\uD835\uDD0A","\u210C","\u2111","\uD835\uDD0D","\uD835\uDD0E","\uD835\uDD0F","\uD835\uDD10","\uD835\uDD11","\uD835\uDD12","\uD835\uDD13","\uD835\uDD14","\u211C","\uD835\uDD16","\uD835\uDD17","\uD835\uDD18","\uD835\uDD19","\uD835\uDD1A","\uD835\uDD1B","\uD835\uDD1C","\u2128","\uD835\uDD1E","\uD835\uDD1F","\uD835\uDD20","\uD835\uDD21","\uD835\uDD22","\uD835\uDD23","\uD835\uDD24","\uD835\uDD25","\uD835\uDD26","\uD835\uDD27","\uD835\uDD28","\uD835\uDD29","\uD835\uDD2A","\uD835\uDD2B","\uD835\uDD2C","\uD835\uDD2D","\uD835\uDD2E","\uD835\uDD2F","\uD835\uDD30","\uD835\uDD31","\uD835\uDD32","\uD835\uDD33","\uD835\uDD34","\uD835\uDD35","\uD835\uDD36","\uD835\uDD37"];var s=["\uD835\uDD38","\uD835\uDD39","\u2102","\uD835\uDD3B","\uD835\uDD3C","\uD835\uDD3D","\uD835\uDD3E","\u210D","\uD835\uDD40","\uD835\uDD41","\uD835\uDD42","\uD835\uDD43","\uD835\uDD44","\u2115","\uD835\uDD46","\u2119","\u211A","\u211D","\uD835\uDD4A","\uD835\uDD4B","\uD835\uDD4C","\uD835\uDD4D","\uD835\uDD4E","\uD835\uDD4F","\uD835\uDD50","\u2124","\uD835\uDD52","\uD835\uDD53","\uD835\uDD54","\uD835\uDD55","\uD835\uDD56","\uD835\uDD57","\uD835\uDD58","\uD835\uDD59","\uD835\uDD5A","\uD835\uDD5B","\uD835\uDD5C","\uD835\uDD5D","\uD835\uDD5E","\uD835\uDD5F","\uD835\uDD60","\uD835\uDD61","\uD835\uDD62","\uD835\uDD63","\uD835\uDD64","\uD835\uDD65","\uD835\uDD66","\uD835\uDD67","\uD835\uDD68","\uD835\uDD69","\uD835\uDD6A","\uD835\uDD6B"];var z=0,b=1,d=2,p=3,x=4,e=5,q=6,r=7,o=8,f=9,B=10,A=11,c=12,j=13,l=14;var a=[{input:"\\varepsilon",tag:"mi",output:"\u025B",ttype:z},{input:"\\varsigma",tag:"mi",output:"\u03C2",ttype:z},{input:"\\vartheta",tag:"mi",output:"\u03D1",ttype:z},{input:"\\varphi",tag:"mi",output:"\u03D5",ttype:z},{input:"\\varpi",tag:"mi",output:"\u03D6",ttype:z},{input:"\\varrho",tag:"mi",output:"\u03F1",ttype:z},{input:"\\alpha",tag:"mi",output:"\u03B1",ttype:z},{input:"\\beta",tag:"mi",output:"\u03B2",ttype:z},{input:"\\gamma",tag:"mi",output:"\u03B3",ttype:z},{input:"\\delta",tag:"mi",output:"\u03B4",ttype:z},{input:"\\epsilon",tag:"mi",output:"\u03B5",ttype:z},{input:"\\zeta",tag:"mi",output:"\u03B6",ttype:z},{input:"\\eta",tag:"mi",output:"\u03B7",ttype:z},{input:"\\theta",tag:"mi",output:"\u03B8",ttype:z},{input:"\\iota",tag:"mi",output:"\u03B9",ttype:z},{input:"\\kappa",tag:"mi",output:"\u03BA",ttype:z},{input:"\\lambda",tag:"mi",output:"\u03BB",ttype:z},{input:"\\mu",tag:"mi",output:"\u03BC",ttype:z},{input:"\\nu",tag:"mi",output:"\u03BD",ttype:z},{input:"\\xi",tag:"mi",output:"\u03BE",ttype:z},{input:"\\omicron",tag:"mi",output:"\u03BF",ttype:z},{input:"\\pi",tag:"mi",output:"\u03C0",ttype:z},{input:"\\rho",tag:"mi",output:"\u03C1",ttype:z},{input:"\\sigma",tag:"mi",output:"\u03C3",ttype:z},{input:"\\tau",tag:"mi",output:"\u03C4",ttype:z},{input:"\\upsilon",tag:"mi",output:"\u03C5",ttype:z},{input:"\\phi",tag:"mi",output:"\u03C6",ttype:z},{input:"\\chi",tag:"mi",output:"\u03C7",ttype:z},{input:"\\psi",tag:"mi",output:"\u03C8",ttype:z},{input:"\\omega",tag:"mi",output:"\u03C9",ttype:z},{input:"\\Alpha",tag:"mo",output:"\u0391",ttype:z},{input:"\\Beta",tag:"mo",output:"\u0392",ttype:z},{input:"\\Gamma",tag:"mo",output:"\u0393",ttype:z},{input:"\\Delta",tag:"mo",output:"\u0394",ttype:z},{input:"\\Epsilon",tag:"mo",output:"\u0395",ttype:z},{input:"\\Zeta",tag:"mo",output:"\u0396",ttype:z},{input:"\\Eta",tag:"mo",output:"\u0397",ttype:z},{input:"\\Theta",tag:"mo",output:"\u0398",ttype:z},{input:"\\Iota",tag:"mo",output:"\u0399",ttype:z},{input:"\\Kappa",tag:"mo",output:"\u039A",ttype:z},{input:"\\Lambda",tag:"mo",output:"\u039B",ttype:z},{input:"\\Mu",tag:"mo",output:"\u039C",ttype:z},{input:"\\Nu",tag:"mo",output:"\u039D",ttype:z},{input:"\\Xi",tag:"mo",output:"\u039E",ttype:z},{input:"\\Omicron",tag:"mo",output:"\u039F",ttype:z},{input:"\\Pi",tag:"mo",output:"\u03A0",ttype:z},{input:"\\Rho",tag:"mo",output:"\u03A1",ttype:z},{input:"\\Sigma",tag:"mo",output:"\u03A3",ttype:z},{input:"\\Tau",tag:"mo",output:"\u03A4",ttype:z},{input:"\\Upsilon",tag:"mo",output:"\u03A5",ttype:z},{input:"\\Phi",tag:"mo",output:"\u03A6",ttype:z},{input:"\\Chi",tag:"mo",output:"\u03A7",ttype:z},{input:"\\Psi",tag:"mo",output:"\u03A8",ttype:z},{input:"\\Omega",tag:"mo",output:"\u03A9",ttype:z},{input:"\\frac12",tag:"mo",output:"\u00BD",ttype:z},{input:"\\frac14",tag:"mo",output:"\u00BC",ttype:z},{input:"\\frac34",tag:"mo",output:"\u00BE",ttype:z},{input:"\\frac13",tag:"mo",output:"\u2153",ttype:z},{input:"\\frac23",tag:"mo",output:"\u2154",ttype:z},{input:"\\frac15",tag:"mo",output:"\u2155",ttype:z},{input:"\\frac25",tag:"mo",output:"\u2156",ttype:z},{input:"\\frac35",tag:"mo",output:"\u2157",ttype:z},{input:"\\frac45",tag:"mo",output:"\u2158",ttype:z},{input:"\\frac16",tag:"mo",output:"\u2159",ttype:z},{input:"\\frac56",tag:"mo",output:"\u215A",ttype:z},{input:"\\frac18",tag:"mo",output:"\u215B",ttype:z},{input:"\\frac38",tag:"mo",output:"\u215C",ttype:z},{input:"\\frac58",tag:"mo",output:"\u215D",ttype:z},{input:"\\frac78",tag:"mo",output:"\u215E",ttype:z},{input:"\\pm",tag:"mo",output:"\u00B1",ttype:z},{input:"\\mp",tag:"mo",output:"\u2213",ttype:z},{input:"\\triangleleft",tag:"mo",output:"\u22B2",ttype:z},{input:"\\triangleright",tag:"mo",output:"\u22B3",ttype:z},{input:"\\cdot",tag:"mo",output:"\u22C5",ttype:z},{input:"\\star",tag:"mo",output:"\u22C6",ttype:z},{input:"\\ast",tag:"mo",output:"\u002A",ttype:z},{input:"\\times",tag:"mo",output:"\u00D7",ttype:z},{input:"\\div",tag:"mo",output:"\u00F7",ttype:z},{input:"\\circ",tag:"mo",output:"\u2218",ttype:z},{input:"\\bullet",tag:"mo",output:"\u2022",ttype:z},{input:"\\oplus",tag:"mo",output:"\u2295",ttype:z},{input:"\\ominus",tag:"mo",output:"\u2296",ttype:z},{input:"\\otimes",tag:"mo",output:"\u2297",ttype:z},{input:"\\bigcirc",tag:"mo",output:"\u25CB",ttype:z},{input:"\\oslash",tag:"mo",output:"\u2298",ttype:z},{input:"\\odot",tag:"mo",output:"\u2299",ttype:z},{input:"\\land",tag:"mo",output:"\u2227",ttype:z},{input:"\\wedge",tag:"mo",output:"\u2227",ttype:z},{input:"\\lor",tag:"mo",output:"\u2228",ttype:z},{input:"\\vee",tag:"mo",output:"\u2228",ttype:z},{input:"\\cap",tag:"mo",output:"\u2229",ttype:z},{input:"\\cup",tag:"mo",output:"\u222A",ttype:z},{input:"\\sqcap",tag:"mo",output:"\u2293",ttype:z},{input:"\\sqcup",tag:"mo",output:"\u2294",ttype:z},{input:"\\uplus",tag:"mo",output:"\u228E",ttype:z},{input:"\\amalg",tag:"mo",output:"\u2210",ttype:z},{input:"\\bigtriangleup",tag:"mo",output:"\u25B3",ttype:z},{input:"\\bigtriangledown",tag:"mo",output:"\u25BD",ttype:z},{input:"\\dag",tag:"mo",output:"\u2020",ttype:z},{input:"\\dagger",tag:"mo",output:"\u2020",ttype:z},{input:"\\ddag",tag:"mo",output:"\u2021",ttype:z},{input:"\\ddagger",tag:"mo",output:"\u2021",ttype:z},{input:"\\lhd",tag:"mo",output:"\u22B2",ttype:z},{input:"\\rhd",tag:"mo",output:"\u22B3",ttype:z},{input:"\\unlhd",tag:"mo",output:"\u22B4",ttype:z},{input:"\\unrhd",tag:"mo",output:"\u22B5",ttype:z},{input:"\\sum",tag:"mo",output:"\u2211",ttype:r},{input:"\\prod",tag:"mo",output:"\u220F",ttype:r},{input:"\\bigcap",tag:"mo",output:"\u22C2",ttype:r},{input:"\\bigcup",tag:"mo",output:"\u22C3",ttype:r},{input:"\\bigwedge",tag:"mo",output:"\u22C0",ttype:r},{input:"\\bigvee",tag:"mo",output:"\u22C1",ttype:r},{input:"\\bigsqcap",tag:"mo",output:"\u2A05",ttype:r},{input:"\\bigsqcup",tag:"mo",output:"\u2A06",ttype:r},{input:"\\coprod",tag:"mo",output:"\u2210",ttype:r},{input:"\\bigoplus",tag:"mo",output:"\u2A01",ttype:r},{input:"\\bigotimes",tag:"mo",output:"\u2A02",ttype:r},{input:"\\bigodot",tag:"mo",output:"\u2A00",ttype:r},{input:"\\biguplus",tag:"mo",output:"\u2A04",ttype:r},{input:"\\int",tag:"mo",output:"\u222B",ttype:z},{input:"\\oint",tag:"mo",output:"\u222E",ttype:z},{input:":=",tag:"mo",output:":=",ttype:z},{input:"\\lt",tag:"mo",output:"<",ttype:z},{input:"\\gt",tag:"mo",output:">",ttype:z},{input:"\\ne",tag:"mo",output:"\u2260",ttype:z},{input:"\\neq",tag:"mo",output:"\u2260",ttype:z},{input:"\\le",tag:"mo",output:"\u2264",ttype:z},{input:"\\leq",tag:"mo",output:"\u2264",ttype:z},{input:"\\leqslant",tag:"mo",output:"\u2264",ttype:z},{input:"\\ge",tag:"mo",output:"\u2265",ttype:z},{input:"\\geq",tag:"mo",output:"\u2265",ttype:z},{input:"\\geqslant",tag:"mo",output:"\u2265",ttype:z},{input:"\\equiv",tag:"mo",output:"\u2261",ttype:z},{input:"\\ll",tag:"mo",output:"\u226A",ttype:z},{input:"\\gg",tag:"mo",output:"\u226B",ttype:z},{input:"\\doteq",tag:"mo",output:"\u2250",ttype:z},{input:"\\prec",tag:"mo",output:"\u227A",ttype:z},{input:"\\succ",tag:"mo",output:"\u227B",ttype:z},{input:"\\preceq",tag:"mo",output:"\u227C",ttype:z},{input:"\\succeq",tag:"mo",output:"\u227D",ttype:z},{input:"\\subset",tag:"mo",output:"\u2282",ttype:z},{input:"\\supset",tag:"mo",output:"\u2283",ttype:z},{input:"\\subseteq",tag:"mo",output:"\u2286",ttype:z},{input:"\\supseteq",tag:"mo",output:"\u2287",ttype:z},{input:"\\sqsubset",tag:"mo",output:"\u228F",ttype:z},{input:"\\sqsupset",tag:"mo",output:"\u2290",ttype:z},{input:"\\sqsubseteq",tag:"mo",output:"\u2291",ttype:z},{input:"\\sqsupseteq",tag:"mo",output:"\u2292",ttype:z},{input:"\\sim",tag:"mo",output:"\u223C",ttype:z},{input:"\\simeq",tag:"mo",output:"\u2243",ttype:z},{input:"\\approx",tag:"mo",output:"\u2248",ttype:z},{input:"\\cong",tag:"mo",output:"\u2245",ttype:z},{input:"\\Join",tag:"mo",output:"\u22C8",ttype:z},{input:"\\bowtie",tag:"mo",output:"\u22C8",ttype:z},{input:"\\in",tag:"mo",output:"\u2208",ttype:z},{input:"\\ni",tag:"mo",output:"\u220B",ttype:z},{input:"\\owns",tag:"mo",output:"\u220B",ttype:z},{input:"\\propto",tag:"mo",output:"\u221D",ttype:z},{input:"\\vdash",tag:"mo",output:"\u22A2",ttype:z},{input:"\\dashv",tag:"mo",output:"\u22A3",ttype:z},{input:"\\models",tag:"mo",output:"\u22A8",ttype:z},{input:"\\perp",tag:"mo",output:"\u22A5",ttype:z},{input:"\\smile",tag:"mo",output:"\u2323",ttype:z},{input:"\\frown",tag:"mo",output:"\u2322",ttype:z},{input:"\\asymp",tag:"mo",output:"\u224D",ttype:z},{input:"\\notin",tag:"mo",output:"\u2209",ttype:z},{input:"\\begin{eqnarray}",output:"X",ttype:l,invisible:true},{input:"\\begin{array}",output:"X",ttype:l,invisible:true},{input:"\\\\",output:"}&{",ttype:o},{input:"\\end{eqnarray}",output:"}}",ttype:o},{input:"\\end{array}",output:"}}",ttype:o},{input:"\\big",tag:"mo",output:"X",atval:"1.2",ttype:A},{input:"\\Big",tag:"mo",output:"X",atval:"1.6",ttype:A},{input:"\\bigg",tag:"mo",output:"X",atval:"2.2",ttype:A},{input:"\\Bigg",tag:"mo",output:"X",atval:"2.9",ttype:A},{input:"\\left",tag:"mo",output:"X",ttype:x},{input:"\\right",tag:"mo",output:"X",ttype:e},{input:"{",output:"{",ttype:x,invisible:true},{input:"}",output:"}",ttype:e,invisible:true},{input:"(",tag:"mo",output:"(",atval:"1",ttype:j},{input:"[",tag:"mo",output:"[",atval:"1",ttype:j},{input:"\\lbrack",tag:"mo",output:"[",atval:"1",ttype:j},{input:"\\{",tag:"mo",output:"{",atval:"1",ttype:j},{input:"\\lbrace",tag:"mo",output:"{",atval:"1",ttype:j},{input:"\\langle",tag:"mo",output:"\u2329",atval:"1",ttype:j},{input:"\\lfloor",tag:"mo",output:"\u230A",atval:"1",ttype:j},{input:"\\lceil",tag:"mo",output:"\u2308",atval:"1",ttype:j},{input:")",tag:"mo",output:")",rtag:"mi",atval:"1",ttype:j},{input:"]",tag:"mo",output:"]",rtag:"mi",atval:"1",ttype:j},{input:"\\rbrack",tag:"mo",output:"]",rtag:"mi",atval:"1",ttype:j},{input:"\\}",tag:"mo",output:"}",rtag:"mi",atval:"1",ttype:j},{input:"\\rbrace",tag:"mo",output:"}",rtag:"mi",atval:"1",ttype:j},{input:"\\rangle",tag:"mo",output:"\u232A",rtag:"mi",atval:"1",ttype:j},{input:"\\rfloor",tag:"mo",output:"\u230B",rtag:"mi",atval:"1",ttype:j},{input:"\\rceil",tag:"mo",output:"\u2309",rtag:"mi",atval:"1",ttype:j},{input:"|",tag:"mo",output:"\u2223",atval:"1",ttype:j},{input:"\\|",tag:"mo",output:"\u2225",atval:"1",ttype:j},{input:"\\vert",tag:"mo",output:"\u2223",atval:"1",ttype:j},{input:"\\Vert",tag:"mo",output:"\u2225",atval:"1",ttype:j},{input:"\\mid",tag:"mo",output:"\u2223",atval:"1",ttype:j},{input:"\\parallel",tag:"mo",output:"\u2225",atval:"1",ttype:j},{input:"/",tag:"mo",output:"/",atval:"1.01",ttype:j},{input:"\\backslash",tag:"mo",output:"\u2216",atval:"1",ttype:j},{input:"\\setminus",tag:"mo",output:"\\",ttype:z},{input:"\\!",tag:"mspace",atname:"width",atval:"-0.167em",ttype:q},{input:"\\,",tag:"mspace",atname:"width",atval:"0.167em",ttype:q},{input:"\\>",tag:"mspace",atname:"width",atval:"0.222em",ttype:q},{input:"\\:",tag:"mspace",atname:"width",atval:"0.222em",ttype:q},{input:"\\;",tag:"mspace",atname:"width",atval:"0.278em",ttype:q},{input:"~",tag:"mspace",atname:"width",atval:"0.333em",ttype:q},{input:"\\quad",tag:"mspace",atname:"width",atval:"1em",ttype:q},{input:"\\qquad",tag:"mspace",atname:"width",atval:"2em",ttype:q},{input:"\\prime",tag:"mo",output:"\u2032",ttype:z},{input:"'",tag:"mo",output:"\u02B9",ttype:z},{input:"''",tag:"mo",output:"\u02BA",ttype:z},{input:"'''",tag:"mo",output:"\u2034",ttype:z},{input:"''''",tag:"mo",output:"\u2057",ttype:z},{input:"\\ldots",tag:"mo",output:"\u2026",ttype:z},{input:"\\cdots",tag:"mo",output:"\u22EF",ttype:z},{input:"\\vdots",tag:"mo",output:"\u22EE",ttype:z},{input:"\\ddots",tag:"mo",output:"\u22F1",ttype:z},{input:"\\forall",tag:"mo",output:"\u2200",ttype:z},{input:"\\exists",tag:"mo",output:"\u2203",ttype:z},{input:"\\Re",tag:"mo",output:"\u211C",ttype:z},{input:"\\Im",tag:"mo",output:"\u2111",ttype:z},{input:"\\aleph",tag:"mo",output:"\u2135",ttype:z},{input:"\\hbar",tag:"mo",output:"\u210F",ttype:z},{input:"\\ell",tag:"mo",output:"\u2113",ttype:z},{input:"\\wp",tag:"mo",output:"\u2118",ttype:z},{input:"\\emptyset",tag:"mo",output:"\u2205",ttype:z},{input:"\\infty",tag:"mo",output:"\u221E",ttype:z},{input:"\\surd",tag:"mo",output:"\\sqrt{}",ttype:o},{input:"\\partial",tag:"mo",output:"\u2202",ttype:z},{input:"\\nabla",tag:"mo",output:"\u2207",ttype:z},{input:"\\triangle",tag:"mo",output:"\u25B3",ttype:z},{input:"\\therefore",tag:"mo",output:"\u2234",ttype:z},{input:"\\angle",tag:"mo",output:"\u2220",ttype:z},{input:"\\diamond",tag:"mo",output:"\u22C4",ttype:z},{input:"\\Diamond",tag:"mo",output:"\u25C7",ttype:z},{input:"\\neg",tag:"mo",output:"\u00AC",ttype:z},{input:"\\lnot",tag:"mo",output:"\u00AC",ttype:z},{input:"\\bot",tag:"mo",output:"\u22A5",ttype:z},{input:"\\top",tag:"mo",output:"\u22A4",ttype:z},{input:"\\square",tag:"mo",output:"\u25AB",ttype:z},{input:"\\Box",tag:"mo",output:"\u25A1",ttype:z},{input:"\\wr",tag:"mo",output:"\u2240",ttype:z},{input:"\\arccos",tag:"mi",output:"arccos",ttype:b,func:true},{input:"\\arcsin",tag:"mi",output:"arcsin",ttype:b,func:true},{input:"\\arctan",tag:"mi",output:"arctan",ttype:b,func:true},{input:"\\arg",tag:"mi",output:"arg",ttype:b,func:true},{input:"\\cos",tag:"mi",output:"cos",ttype:b,func:true},{input:"\\cosh",tag:"mi",output:"cosh",ttype:b,func:true},{input:"\\cot",tag:"mi",output:"cot",ttype:b,func:true},{input:"\\coth",tag:"mi",output:"coth",ttype:b,func:true},{input:"\\csc",tag:"mi",output:"csc",ttype:b,func:true},{input:"\\deg",tag:"mi",output:"deg",ttype:b,func:true},{input:"\\det",tag:"mi",output:"det",ttype:b,func:true},{input:"\\dim",tag:"mi",output:"dim",ttype:b,func:true},{input:"\\exp",tag:"mi",output:"exp",ttype:b,func:true},{input:"\\gcd",tag:"mi",output:"gcd",ttype:b,func:true},{input:"\\hom",tag:"mi",output:"hom",ttype:b,func:true},{input:"\\inf",tag:"mo",output:"inf",ttype:r},{input:"\\ker",tag:"mi",output:"ker",ttype:b,func:true},{input:"\\lg",tag:"mi",output:"lg",ttype:b,func:true},{input:"\\lim",tag:"mo",output:"lim",ttype:r},{input:"\\liminf",tag:"mo",output:"liminf",ttype:r},{input:"\\limsup",tag:"mo",output:"limsup",ttype:r},{input:"\\ln",tag:"mi",output:"ln",ttype:b,func:true},{input:"\\log",tag:"mi",output:"log",ttype:b,func:true},{input:"\\max",tag:"mo",output:"max",ttype:r},{input:"\\min",tag:"mo",output:"min",ttype:r},{input:"\\Pr",tag:"mi",output:"Pr",ttype:b,func:true},{input:"\\sec",tag:"mi",output:"sec",ttype:b,func:true},{input:"\\sin",tag:"mi",output:"sin",ttype:b,func:true},{input:"\\sinh",tag:"mi",output:"sinh",ttype:b,func:true},{input:"\\sup",tag:"mo",output:"sup",ttype:r},{input:"\\tan",tag:"mi",output:"tan",ttype:b,func:true},{input:"\\tanh",tag:"mi",output:"tanh",ttype:b,func:true},{input:"\\gets",tag:"mo",output:"\u2190",ttype:z},{input:"\\leftarrow",tag:"mo",output:"\u2190",ttype:z},{input:"\\to",tag:"mo",output:"\u2192",ttype:z},{input:"\\rightarrow",tag:"mo",output:"\u2192",ttype:z},{input:"\\leftrightarrow",tag:"mo",output:"\u2194",ttype:z},{input:"\\uparrow",tag:"mo",output:"\u2191",ttype:z},{input:"\\downarrow",tag:"mo",output:"\u2193",ttype:z},{input:"\\updownarrow",tag:"mo",output:"\u2195",ttype:z},{input:"\\Leftarrow",tag:"mo",output:"\u21D0",ttype:z},{input:"\\Rightarrow",tag:"mo",output:"\u21D2",ttype:z},{input:"\\Leftrightarrow",tag:"mo",output:"\u21D4",ttype:z},{input:"\\iff",tag:"mo",output:"~\\Longleftrightarrow~",ttype:o},{input:"\\Uparrow",tag:"mo",output:"\u21D1",ttype:z},{input:"\\Downarrow",tag:"mo",output:"\u21D3",ttype:z},{input:"\\Updownarrow",tag:"mo",output:"\u21D5",ttype:z},{input:"\\mapsto",tag:"mo",output:"\u21A6",ttype:z},{input:"\\longleftarrow",tag:"mo",output:"\u2190",ttype:c},{input:"\\longrightarrow",tag:"mo",output:"\u2192",ttype:c},{input:"\\longleftrightarrow",tag:"mo",output:"\u2194",ttype:c},{input:"\\Longleftarrow",tag:"mo",output:"\u21D0",ttype:c},{input:"\\Longrightarrow",tag:"mo",output:"\u21D2",ttype:c},{input:"\\implies",tag:"mo",output:"\u21D2",ttype:c},{input:"\\Longleftrightarrow",tag:"mo",output:"\u21D4",ttype:c},{input:"\\longmapsto",tag:"mo",output:"\u21A6",ttype:z},{input:"\\sqrt",tag:"msqrt",output:"sqrt",ttype:b},{input:"\\root",tag:"mroot",output:"root",ttype:d},{input:"\\frac",tag:"mfrac",output:"/",ttype:d},{input:"\\stackrel",tag:"mover",output:"stackrel",ttype:d},{input:"\\atop",tag:"mfrac",output:"",ttype:p},{input:"\\choose",tag:"mfrac",output:"",ttype:p},{input:"_",tag:"msub",output:"_",ttype:p},{input:"^",tag:"msup",output:"^",ttype:p},{input:"\\mbox",tag:"mtext",output:"mbox",ttype:B},{input:"\\acute",tag:"mover",output:"\u00B4",ttype:b,acc:true},{input:"\\grave",tag:"mover",output:"\u0060",ttype:b,acc:true},{input:"\\breve",tag:"mover",output:"\u02D8",ttype:b,acc:true},{input:"\\check",tag:"mover",output:"\u02C7",ttype:b,acc:true},{input:"\\dot",tag:"mover",output:".",ttype:b,acc:true},{input:"\\ddot",tag:"mover",output:"..",ttype:b,acc:true},{input:"\\mathring",tag:"mover",output:"\u00B0",ttype:b,acc:true},{input:"\\vec",tag:"mover",output:"\u20D7",ttype:b,acc:true},{input:"\\overrightarrow",tag:"mover",output:"\u20D7",ttype:b,acc:true},{input:"\\overleftarrow",tag:"mover",output:"\u20D6",ttype:b,acc:true},{input:"\\hat",tag:"mover",output:"\u005E",ttype:b,acc:true},{input:"\\widehat",tag:"mover",output:"\u0302",ttype:b,acc:true},{input:"\\tilde",tag:"mover",output:"~",ttype:b,acc:true},{input:"\\widetilde",tag:"mover",output:"\u02DC",ttype:b,acc:true},{input:"\\bar",tag:"mover",output:"\u203E",ttype:b,acc:true},{input:"\\overbrace",tag:"mover",output:"\u23B4",ttype:b,acc:true},{input:"\\overline",tag:"mover",output:"\u00AF",ttype:b,acc:true},{input:"\\underbrace",tag:"munder",output:"\u23B5",ttype:b,acc:true},{input:"\\underline",tag:"munder",output:"\u00AF",ttype:b,acc:true},{input:"\\displaystyle",tag:"mstyle",atname:"displaystyle",atval:"true",ttype:b},{input:"\\textstyle",tag:"mstyle",atname:"displaystyle",atval:"false",ttype:b},{input:"\\scriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"1",ttype:b},{input:"\\scriptscriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"2",ttype:b},{input:"\\mathrm",tag:"mtext",output:"text",ttype:B},{input:"\\textrm",tag:"mtext",output:"text",ttype:B},{input:"\\mathbf",tag:"mstyle",atname:"mathvariant",atval:"bold",ttype:b,codes:h},{input:"\\textbf",tag:"mstyle",atname:"mathvariant",atval:"bold",ttype:b,codes:h},{input:"\\mathit",tag:"mstyle",atname:"mathvariant",atval:"italic",ttype:b},{input:"\\textit",tag:"mstyle",atname:"mathvariant",atval:"italic",ttype:b},{input:"\\mathtt",tag:"mstyle",atname:"mathvariant",atval:"monospace",ttype:b},{input:"\\texttt",tag:"mstyle",atname:"mathvariant",atval:"monospace",ttype:b},{input:"\\mathsf",tag:"mstyle",atname:"mathvariant",atval:"sans-serif",ttype:b},{input:"\\mathbb",tag:"mstyle",atname:"mathvariant",atval:"double-struck",ttype:b,codes:s},{input:"\\mathcal",tag:"mstyle",atname:"mathvariant",atval:"script",ttype:b,codes:t},{input:"\\mathfrak",tag:"mstyle",atname:"mathvariant",atval:"fraktur",ttype:b,codes:D}];var u=[];function n(){if(m.browser.mozilla||m.browser.opera){return true}else{return false}}function G(H,I){if(H.input>I.input){return 1}else{return -1}}function w(){var H=a.length;a.sort(G);for(var I=0;I<H;I++){u[I]=a[I].input}}function y(H,I){return m.trim(H.slice(I))}function E(I,L,M){if(M===0){var K,H;M=-1;K=I.length;while(M+1<K){H=(M+K)>>1;if(I[H]<L){M=H}else{K=H}}return K}else{for(var J=M;J<I.length&&I[J]<L;J++){}}return J}function v(O){var H=0;var I=0;var K;var Q;var P;var L="";var N=true;var M=O.length;for(var J=1;J<=M&&N;J++){Q=O.slice(0,J);I=H;H=E(u,Q,I);if(H<u.length&&O.slice(0,u[H].length)==u[H]){L=u[H];K=H;J=L.length}N=H<u.length&&O.slice(0,u[H].length)>=u[H]}if(L!==""){return a[K]}H=1;Q=O.slice(0,1);if("0"<=Q&&Q<="9"){P="mn"}else{P=(("A">Q||Q>"Z")&&("a">Q||Q>"z")?"mo":"mi")}return{input:Q,tag:P,output:Q,ttype:z}}function g(P){var K,I,U,J,M,S,O=document.createDocumentFragment();P=m.trim(P);K=v(P);if(K===null||K.ttype==e){return[null,P,null]}if(K.ttype==o){P=K.output+y(P,K.input.length);K=v(P);if(K===null||K.ttype==e){return[null,P,null]}}P=y(P,K.input.length);switch(K.ttype){case q:I=C(K.tag);I.setAttribute(K.atname,K.atval);return[I,P,K.tag];case r:return[C(K.tag,document.createTextNode(K.output)),P,K.tag];case z:I=C(K.tag,document.createTextNode(K.output));return[I,P,K.tag];case c:I=C(K.tag,document.createTextNode(K.output));I.setAttribute("minsize","1.5");I.setAttribute("maxsize","1.5");I=C("mover",I);I.appendChild(C("mspace"));return[I,P,K.tag];case j:I=C(K.tag,document.createTextNode(K.output));if(K.input=="|"||K.input=="\\vert"||K.input=="\\|"||K.input=="\\Vert"){I.setAttribute("lspace","0em");I.setAttribute("rspace","0em")}I.setAttribute("maxsize",K.atval);if(K.rtag!==null){return[I,P,K.rtag]}else{return[I,P,K.tag]}break;case A:var N=K.atval;K=v(P);if(K===null){return[null,P,null]}P=y(P,K.input.length);I=C(K.tag,document.createTextNode(K.output));I.setAttribute("minsize",N);I.setAttribute("maxsize",N);return[I,P,K.tag];case x:if(K.input=="\\left"){K=v(P);if(K!==null){if(K.input=="."){K.invisible=true}P=y(P,K.input.length)}}U=k(P,true,false);if(K===null||(typeof K.invisible=="boolean"&&K.invisible)){I=C("mrow",U[0])}else{I=C("mo",document.createTextNode(K.output));I=C("mrow",I);I.appendChild(U[0])}return[I,U[1],U[2]];case l:if(K.input=="\\begin{array}"){var T="";K=v(P);P=m.trim(P);if(K===null){T="l"}else{P=y(P,K.input.length);if(K.input!="{"){T="l"}else{do{K=v(P);if(K!==null){P=y(P,K.input.length);if(K.input!="}"){T=T+K.input}}}while(K!==null&&K.input!==""&&K.input!="}")}}U=k("{"+P,true,true);I=C("mtable",U[0]);T=T.replace(/l/g,"left ");T=T.replace(/r/g,"right ");T=T.replace(/c/g,"center ");I.setAttribute("columnalign",T);I.setAttribute("displaystyle","false");return[I,U[1],null]}else{U=k("{"+P,true,true);I=C("mtable",U[0]);I.setAttribute("columnspacing","0.167em");I.setAttribute("columnalign","right center left");I.setAttribute("displaystyle","true");I=C("mrow",I);return[I,U[1],null]}break;case B:if(P.charAt(0)=="{"){M=P.indexOf("}")}else{M=0}if(M==-1){M=P.length}S=P.slice(1,M);O.appendChild(C(K.tag,document.createTextNode(S)));P=y(P,M+1);return[C("mrow",O),P,null];case b:U=g(P);if(U[0]===null){return[C(K.tag,document.createTextNode(K.output)),P]}if(typeof K.func=="boolean"&&K.func){S=P.charAt(0);if(S=="^"||S=="_"||S==","){return[C(K.tag,document.createTextNode(K.output)),P,K.tag]}else{I=C("mrow",C(K.tag,document.createTextNode(K.output)));I.appendChild(U[0]);return[I,U[1],K.tag]}}if(K.input=="\\sqrt"){return[C(K.tag,U[0]),U[1],K.tag]}else{if(typeof K.acc=="boolean"&&K.acc){I=C(K.tag,U[0]);var H=K.output;var R=C("mo",document.createTextNode(H));if(K.input=="\\vec"||K.input=="\\check"){R.setAttribute("maxsize","1.2")}if(K.input=="\\underbrace"||K.input=="\\underline"){R.setAttribute("accentunder","true")}else{R.setAttribute("accent","true")}I.appendChild(R);if(K.input=="\\overbrace"||K.input=="\\underbrace"){I.ttype=r}return[I,U[1],K.tag]}else{if(typeof K.codes!="undefined"){for(M=0;M<U[0].childNodes.length;M++){if(U[0].childNodes[M].nodeName=="mi"||U[0].nodeName=="mi"){S=(U[0].nodeName=="mi"?U[0].firstChild.nodeValue:U[0].childNodes[M].firstChild.nodeValue);var Q=[];for(var L=0;L<S.length;L++){if(S.charCodeAt(L)>64&&S.charCodeAt(L)<91){Q=Q+K.codes[S.charCodeAt(L)-65]}else{if(S.charCodeAt(L)>96&&S.charCodeAt(L)<123){Q=Q+K.codes[S.charCodeAt(L)-71]}}}if(U[0].nodeName=="mi"){U[0]=C("mo").appendChild(document.createTextNode(Q))}else{U[0].replaceChild(C("mo").appendChild(document.createTextNode(Q)),U[0].childNodes[M])}}}}I=C(K.tag,U[0]);I.setAttribute(K.atname,K.atval);if(K.input=="\\scriptstyle"||K.input=="\\scriptscriptstyle"){I.setAttribute("displaystyle","false")}return[I,U[1],K.tag]}}break;case d:U=g(P);if(U[0]===null){return[C("mo",document.createTextNode(K.input)),P,null]}J=g(U[1]);if(J[0]===null){return[C("mo",document.createTextNode(K.input)),P,null]}if(K.input=="\\root"||K.input=="\\stackrel"){O.appendChild(J[0])}O.appendChild(U[0]);if(K.input=="\\frac"){O.appendChild(J[0])}return[C(K.tag,O),J[1],K.tag];case p:P=y(P,K.input.length);return[C("mo",document.createTextNode(K.output)),P,K.tag];default:return[C(K.tag,document.createTextNode(K.output)),P,K.tag]}}function F(M){var L,J,I,K,O,P,N;M=m.trim(M);J=v(M);O=g(M);K=O[0];M=O[1];P=O[2];L=v(M);if(L.ttype==p){M=y(M,L.input.length);O=g(M);if(O[0]===null){O[0]=C("mo",document.createTextNode("\u25A1"))}M=O[1];P=O[2];if(L.input=="_"||L.input=="^"){I=v(M);P=null;N=((J.ttype==r)||(K.ttype==r));if(L.input=="_"&&I.input=="^"){M=y(M,I.input.length);var H=g(M);M=H[1];P=H[2];K=C((N?"munderover":"msubsup"),K);K.appendChild(O[0]);K.appendChild(H[0])}else{if(L.input=="_"){K=C((N?"munder":"msub"),K);K.appendChild(O[0])}else{K=C((N?"mover":"msup"),K);K.appendChild(O[0])}}K=C("mrow",K)}else{K=C(L.tag,K);if(L.input=="\\atop"||L.input=="\\choose"){K.setAttribute("linethickness","0ex")}K.appendChild(O[0]);if(L.input=="\\choose"){K=C("mfenced",K)}}}return[K,M,P]}function k(O,N,T){var S,P,K,V,Z,L=document.createDocumentFragment();do{O=m.trim(O);K=F(O);P=K[0];O=K[1];Z=K[2];S=v(O);if(P!=undefined){if((Z=="mn"||Z=="mi")&&S!==null&&typeof S.func=="boolean"&&S.func){var Y=C("mspace");Y.setAttribute("width","0.167em");P=C("mrow",P);P.appendChild(Y)}L.appendChild(P)}}while((S.ttype!=e)&&S!==null&&S.output!="");Z=null;if(S.ttype==e){if(S.input=="\\right"){O=y(O,S.input.length);S=v(O);if(S!==null&&S.input=="."){S.invisible=true}if(S!==null){Z=S.rtag}}if(S!==null){O=y(O,S.input.length)}var W=L.childNodes.length;if(T&&W>0&&L.childNodes[W-1].nodeName=="mrow"&&W>1&&L.childNodes[W-2].nodeName=="mo"&&L.childNodes[W-2].firstChild.nodeValue=="&"){var I=[];var Q=L.childNodes.length;for(V=0;T&&V<Q;V=V+2){I[V]=[];P=L.childNodes[V];for(var U=0;U<P.childNodes.length;U++){if(P.childNodes[U].firstChild.nodeValue=="&"){I[V][I[V].length]=U}}}var J,H,M,R,X=document.createDocumentFragment();for(V=0;V<Q;V=V+2){J=document.createDocumentFragment();H=document.createDocumentFragment();P=L.firstChild;M=P.childNodes.length;R=0;for(U=0;U<M;U++){if(typeof I[V][R]!="undefined"&&U==I[V][R]){P.removeChild(P.firstChild);J.appendChild(C("mtd",H));R++}else{H.appendChild(P.firstChild)}}J.appendChild(C("mtd",H));if(L.childNodes.length>2){L.removeChild(L.firstChild);L.removeChild(L.firstChild)}X.appendChild(C("mtr",J))}return[X,O]}if(typeof S.invisible!="boolean"||!S.invisible){P=C("mo",document.createTextNode(S.output));L.appendChild(P)}}return[L,O,Z]}if(!document.createElementNS){document.createElementNS=function(I,H){return this.createElement(H)}}function C(H,J){var I=document.createElementNS("http://www.w3.org/1998/Math/MathML",H);if(J){m(I).append(J)}return I}return{showFormulaOnMouseOver:false,latexImages:false,latexConverter:"http://www.forkosh.dreamhost.com/mimetex.cgi?",mathColor:"black",mathFontSize:"",mathFontFamily:"",createElementXHTML:function(H,I,K){var J=document.createElementNS("http://www.w3.org/1999/xhtml",H);if(I){J.id=I}if(K){J.className=K}return J},define:function(J,K){if(MSVG.latexImages){return}if((typeof J)=="string"){J=[J];K=[K]}var I,H=J.length;if(H!=K.length){return}for(I=0;I<H;I++){a=a.concat([{input:"\\"+J[I],tag:"mo",output:K[I],ttype:o}])}w()},parseMath:function(L,K,I,H){if(L===null){return null}var M=k(L.replace(/^\s+/g,""),false,false)[0];var J=(M.firstChild.nodeName=="mstyle")?M.firstChild:C("mstyle",M);if(K){m(J).attr({displaystyle:"true"})}m(J).attr({mathcolor:H||MSVG.mathColor,fontsize:I||MSVG.mathFontSize,fontfamily:MSVG.mathFontFamily});J=C("math",J);if(MSVG.showFormulaOnMouseOver){m(J).attr({title:L.replace(/\s+/g," ")})}return J},parseMathExternal:function(M,L,I,H){if(M===null){return null}var K=MSVG.createElementXHTML("img");var J=MSVG.latexConverter+M;m(K).attr({src:J});if(MSVG.showFormulaOnMouseOver){m(K).attr({title:M.replace(/\s+/g," ")})}return K},generic:function(){if(MSVG.latexImages||!n()){MSVG.parseMath=MSVG.parseMathExternal}else{w()}if(!(window.SVGElement||m.browser.opera||m.browser.safari)){ASVG.drawPictures=ASVG.removePictures}}}}(jQuery);var ASVG=function($){var SVG;var collection=[];var chars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";var markerChars="o*sSx+<>|";function createSVGElement(elType){return document.createElementNS("http://www.w3.org/2000/svg",elType)}function getSVGElement(id,el){var node,res={node:null,newEl:false};if(id){id=SVG.id+"_"+id;res.node=$("#"+id)[0]}if(!res.node){res.node=createSVGElement(el);if(id){res.node.id=id}res.newEl=true}return res}function appendSVG(elmt){if(elmt.newEl){$(SVG.canvas).append(elmt.node)}}function setButton(text,title,func){var node=MSVG.createElementXHTML("span",null,"svgButton");node.title=title;node.onclick=func;$(node).append(text);$(node).css({paddingRight:"0.5em",paddingLeft:"0.5em",fontSize:"1em",fontFamily:"monospace",background:"blue",color:"yellow",cursor:"pointer"});$(node).mouseover(function(){$(this).css({background:"yellow",color:"blue"})});$(node).mouseout(function(){$(this).css({background:"blue",color:"yellow"})});node.setAttribute("owner",SVG.id);return node}function pictureAttributes(){this.stroke="blue";this.strokewidth=1;this.strokeopacity=1;this.strokedasharray="none";this.fill="none";this.fillopacity=1;this.fontstyle="normal";this.fontfamily="serif";this.fontweight="normal";this.fontsize=12;this.fontstroke="none";this.fontfill="black";this.largearc=0;this.sweep=0;this.rx=0;this.ry=0;this.closed=false;this.curve="";this.marker="o";this.markerstrokewidth=1;this.markerstroke="blue";this.markerfill=null;this.markersize=8;this.markeropacity=1;this.direction=[1,0];this.ticklabels="";this.pos="";this.points=200;this.axesstroke="black";this.axesstrokewidth=0.5;this.gridstroke="grey";this.gridstrokewidth=0.25;this.backgroundcolor="white";this.backgroundopacity=1}function pictureObject(){this.id=null;this.src="";this.borderstroke="black";this.borderwidth=0;this.canvas=null;this.width=300;this.height=200;this.factor=1;this.xmin=-5;this.xmax=5;this.ymin=null;this.ymax=null;this.xunitlength=null;this.yunitlength=null;this.origin=[0,0];this.coords="cartesian";this.mouse=[null,null];this.drag=null;this.pan=true;this.attr=new pictureAttributes()}function refresh(){translateAndEval(SVG.id)}function translateAndEval(id){var errstr;var src=SVG.src;$("#"+SVG.id+"Canvas").empty();$("#"+SVG.id+"mml").empty();ASVG.dynamic[id]={};src=src.replace(/dynamic\./g,"ASVG.dynamic."+id+".");SVG.attr=new pictureAttributes();try{with(Math){eval(src)}}catch(err){if(typeof err=="object"){errstr=err.name+" "+err.message+" "+err.number+" "+err.description}else{errstr=err}alert(errstr+"\n"+src)}collection[SVG.id]=SVG}function setOptions(atr){for(i in atr){SVG.attr[i]=atr[i]}}function getOption(opt,options){return(opt in options)?options[opt]:SVG.attr[opt]}function setAction(evt,fn,id){if(!$.isFunction(fn)){return}var node=(id)?$("#"+SVG.id+"_"+id):$("#"+SVG.id);$(node).bind(evt,fn)}function getPosition(evt){var obj=evt.currentTarget;var posX=(evt.pageX-obj.parentNode.offsetLeft-SVG.origin[0])/SVG.xunitlength;var posY=(SVG.height-SVG.origin[1]-(evt.pageY-obj.parentNode.offsetTop))/SVG.yunitlength;return[posX,posY]}function getAngle(p){p=p||[0,0];var res=Math.atan2(SVG.mouse[1]-p[1],SVG.mouse[0]-p[0]);res=(res<0)?res+2*Math.PI:res;return res}function getDistance(p){p=p||[0,0];return Math.sqrt(Math.pow(SVG.mouse[0]-p[0],2)+Math.pow(SVG.mouse[1]-p[1],2))}function updateButton(obj){var id=$(obj).attr("owner");var node=$("#"+id+"src");if(obj.firstChild.nodeValue=="Edit"){obj.firstChild.nodeValue="Update";obj.title="Update picture";node.val(SVG.src).css("display","block");return}else{SVG.src=node.val();translateAndEval(id)}}function switchTo(evt){var name=evt.currentTarget.id;if(SVG.id==name){return}SVG=collection[name]}function onWheel(evt){evt=evt||window.event;var factor=1;if(evt.wheelDelta){factor=(evt.wheelDelta>0)?0.8:1.25}else{if(evt.detail){factor=(evt.detail<0)?0.8:1.25}}if(evt.shiftKey){changeSize(factor)}else{changeScales(factor)}evt.preventDefault();evt.stopPropagation();return false}function onClick(evt){if(evt.button===0){if(evt.shiftKey){$("#"+SVG.id+"toolbar").slideToggle();$("#"+SVG.id+"src").val(SVG.src);evt.stopImmediatePropagation()}else{if(SVG.pan){SVG.drag=[evt.clientX,evt.clientY]}}}return false}function onDrop(evt){if(SVG.drag==null){return false}var xlen=(SVG.drag[0]-evt.clientX)/SVG.xunitlength;var ylen=(-SVG.drag[1]+evt.clientY)/SVG.yunitlength;SVG.drag=null;if(xlen==0&&ylen==0){return false}changeScales(1,[SVG.xmin+xlen,SVG.xmax+xlen,SVG.ymin+ylen,SVG.ymax+ylen]);return false}function setScales(){SVG.xunitlength=SVG.width/(SVG.xmax-SVG.xmin);SVG.yunitlength=SVG.height/(SVG.ymax-SVG.ymin);SVG.origin=[-SVG.xmin*SVG.xunitlength,-SVG.ymin*SVG.yunitlength]}function setSize(){var picture=$("#"+SVG.id)[0];picture.setAttribute("width",SVG.width);picture.setAttribute("height",SVG.height);picture.parentNode.style.width=SVG.width+"px";picture.parentNode.style.height=SVG.height+"px";var border=SVG.borderwidth*0.5;var node=$("#"+SVG.id+"ClipPath")[0];node.firstChild.setAttribute("d","M"+border+","+border+" "+(SVG.width-border)+","+border+" "+(SVG.width-border)+","+(SVG.height-border)+" "+border+","+(SVG.height-border));node=$("#"+SVG.id+"Coords")[0];if(node){node.setAttribute("x",SVG.width-border-2);node.setAttribute("y",SVG.height-border-5)}}function changeSize(factor){SVG.factor*=factor;SVG.width/=factor;SVG.height/=factor;setSize();setScales();translateAndEval(SVG.id)}function changeScales(factor,trans){trans=trans||[SVG.xmin,SVG.xmax,SVG.ymin,SVG.ymax];SVG.factor*=factor;var dx=(SVG.xmax-SVG.xmin)*(1-factor)*0.5;var dy=(SVG.ymax-SVG.ymin)*(1-factor)*0.5;SVG.xmin=trans[0]+dx;SVG.xmax=trans[1]-dx;SVG.ymin=trans[2]+dy;SVG.ymax=trans[3]-dy;setScales();translateAndEval(SVG.id)}function updateCoord(evt){if($.browser.opera){switchTo(evt)}SVG.mouse=getPosition(evt);if(SVG.coords!="none"){var coords;if(SVG.coords=="cartesian"){coords="C: ("+SVG.mouse[0].toFixed(2)+", "+SVG.mouse[1].toFixed(2)+")"}else{coords="P: ("+getDistance().toFixed(2)+", "+getAngle().toFixed(2)+")"}$("#"+SVG.id+"Coords").text(coords)}return false}function removeCoord(){$("#"+SVG.id+"Coords").text("")}function exportSVG(obj){var name=$(obj).attr("owner");var pic=$("#"+name)[0].parentNode.innerHTML;var pos=pic.indexOf("</svg")+6;pic=pic.substr(0,pos);var svg="<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n";if(pic.indexOf("svgCoords")>-1){pos=pic.lastIndexOf("<text");svg+=pic.substr(0,pos);pos=pic.lastIndexOf("</text")+7;svg+=pic.substr(pos)}else{svg+=pic}svg=svg.replace(/ /g,"");svg=svg.replace(/><(?!\/)/g,">\n<");obj.previousSibling.firstChild.nodeValue="Edit";$("#"+name+"src").val(svg).css("display","block")}function toSVG(p){var x=p[0]*SVG.xunitlength+SVG.origin[0];var y=SVG.height-p[1]*SVG.yunitlength-SVG.origin[1];return[x,y]}function toSVGPair(p){p=toSVG(p);return p[0]+" "+p[1]}function setStrokeAndFill(node,options){node.setAttribute("stroke",getOption("stroke",options));node.setAttribute("stroke-width",getOption("strokewidth",options)/SVG.factor);node.setAttribute("stroke-dasharray",getOption("strokedasharray",options));node.setAttribute("stroke-opacity",getOption("strokeopacity",options));node.setAttribute("fill",getOption("fill",options));node.setAttribute("fill-opacity",getOption("fillopacity",options))}function setText(st,id){$("#"+id).text(st)}function setMarkers(obj,options){if(!options.marker){return}var markersize=getOption("markersize",options)/SVG.factor;var markerstroke=getOption("markerstroke",options);var markeropacity=getOption("markeropacity",options);var markerfill=getOption("markerfill",options);if(!markerfill){markerfill=SVG.attr.backgroundcolor}var markerstrokewidth=getOption("markerstrokewidth",options)/SVG.factor;var node,node2,i,id,pos=["marker-start","marker-mid","marker-end"];var lim=options.marker.length;for(i=0;i<lim;i++){var type=options.marker.charAt(i);if(type=="-"){continue}id=((options.id)?options.id+"_":"")+"Marker_"+markerChars.indexOf(type);node=$("#"+SVG.id+"_"+id)[0];if(!node){node=getSVGElement(id,"marker").node;node.setAttribute("viewBox","0 0 10 10");node.setAttribute("refX",5);node.setAttribute("refY",5);node.setAttribute("orient","auto");node.setAttribute("stroke",markerstroke);node.setAttribute("stroke-width",markerstrokewidth);node.setAttribute("fill",markerfill);node.setAttribute("stroke-opacity",markeropacity);node.setAttribute("fill-opacity",markeropacity);switch(type){case"*":node.setAttribute("fill",markerstroke);case"o":node2=createSVGElement("circle");node2.setAttribute("cx",5);node2.setAttribute("cy",5);node2.setAttribute("r",4);break;case">":node2=createSVGElement("path");node2.setAttribute("d","M 0 0 L 10 5 L 0 10 z");node.setAttribute("fill",markerstroke);node.setAttribute("refX",10);break;case"<":node2=createSVGElement("path");node2.setAttribute("d","M 10 0 L 10 10 L 0 5 z");node.setAttribute("fill",markerstroke);node.setAttribute("refX",0);break;case"x":node2=createSVGElement("path");node2.setAttribute("d","M 0 0 L 10 10 M 0 10 L 10 0");break;case"+":node2=createSVGElement("path");node2.setAttribute("d","M 5 0 L 5 10 M 0 5 L 10 5");break;case"|":node2=createSVGElement("path");node2.setAttribute("d","M 5 0 L 5 10");break;case"S":node.setAttribute("fill",markerstroke);case"s":node2=createSVGElement("rect");node2.setAttribute("x",0);node2.setAttribute("y",0);node2.setAttribute("width",10);node2.setAttribute("height",10)}$(node).append(node2);$("#"+SVG.id+"_Defs:first").append(node)}node.setAttribute("markerWidth",markersize);node.setAttribute("markerHeight",markersize);obj.setAttribute(pos[i],"url(#"+SVG.id+"_"+id+")")}}function setLabels(p,options){if(!options.label){return}var i,point,pos;var label=(typeof options.label=="string")?[options.label]:options.label;var labelpos=getOption("pos",options);labelpos=(typeof labelpos=="string")?[labelpos]:labelpos;var poslen=labelpos.length;var markersize=getOption("markersize",options)/SVG.factor;var dx=(0.5*markersize/SVG.xunitlength)/SVG.factor;var dy=(0.5*markersize/SVG.yunitlength)/SVG.factor;for(i=0;i<label.length;i++){options.isLabel="_label"+i;point=p[i];pos=(poslen>i)?labelpos[i].toUpperCase():pos;if(/E/.test(pos)){point[0]+=dx}if(/W/.test(pos)){point[0]-=dx}if(/N/.test(pos)){point[1]+=dy}if(/S/.test(pos)){point[1]-=dy}options.pos=pos;text(point,label[i],options)}}function line(p,q,options){options=options||{};options.closed=false;options.curve="";path([p,q],options)}function dot(p,options){options=options||{};var direction=getOption("direction",options);var q=[p[0]+direction[0]/SVG.xunitlength,p[1]+direction[1]/SVG.yunitlength];options.marker=getOption("marker",options).charAt(0);var elmt=getSVGElement(options.id,"path");var st="M"+toSVGPair(p)+" "+toSVGPair(q);elmt.node.setAttribute("d",st);elmt.node.setAttribute("stroke","none");setMarkers(elmt.node,options);setLabels([p,q],options);appendSVG(elmt)}function path(list,options){options=options||{};var st,i,elmt=getSVGElement(options.id,"path");var curve=getOption("curve",options);var closed=getOption("closed",options);if(typeof plist=="string"){st=list}else{var len=list.length;if(len===0){return}st="M"+toSVGPair(list[0])+" "+curve;for(i=1;i<len;i++){st+=toSVGPair(list[i])+" "}if(closed){st+="Z"}}elmt.node.setAttribute("d",st);setStrokeAndFill(elmt.node,options);setMarkers(elmt.node,options);setLabels(list,options);appendSVG(elmt)}function rotate(id,angle,options){if(!id||!angle){return}var node=$("#"+SVG.id+"_"+id)[0];if(node){options=options||{};var center=options.center?toSVG(options.center):SVG.origin;angle=-angle*180/Math.PI;var transform=node.getAttribute("transform")||"";transform="rotate("+angle+" "+center+") "+(options.replace?"":transform);node.setAttribute("transform",transform)}}function translate(id,delta,options){if(!id||!delta){return}var node=$("#"+SVG.id+"_"+id)[0];if(node){options=options||{};delta=toSVG(delta);var transform=node.getAttribute("transform")||"";transform="translate("+(delta[0]-SVG.origin[0])+" "+(SVG.origin[1]+delta[1]-SVG.height)+") "+(options.replace?"":transform);node.setAttribute("transform",transform)}}function curve(list,options){options=options||{};options.curve=options.curve||"T";path(list,options)}function circle(center,radius,options){ellipse(center,radius,radius,options)}function loop(p,options){options=options||{};var d=options.direction||[1,0];options.curve="C";options.closed=false;path([p,[p[0]+d[0],p[1]+d[1]],[p[0]-d[1],p[1]+d[0]],p],options)}function arc(options){options=options||{};var start=options.start;var end=options.end;var center=options.center;var startangle=options.startangle;var endangle=options.endangle;var st="M",elmt=getSVGElement(options.id,"path");var largearc=getOption("largearc",options);var sweep=getOption("sweep",options);var closed=getOption("closed",options);var radius=options.radius;if(center!=null&&startangle!=null&&endangle!=null&&radius!=null){end=[radius*Math.cos(startangle)+center[0],radius*Math.sin(startangle)+center[1]];start=[radius*Math.cos(endangle)+center[0],radius*Math.sin(endangle)+center[1]]}if(start==null||end==null){return}if(!radius){var v=[end[0]-start[0],end[1]-start[1]];radius=Math.sqrt(v[0]*v[0]+v[1]*v[1])}if(closed&¢er!=null){st+=toSVGPair(center)+" "}st+=toSVGPair(start)+" A"+radius*SVG.xunitlength+","+radius*SVG.yunitlength+" 0 "+largearc+","+sweep+" "+toSVGPair(end);if(closed&¢er!=null){st+=" z"}elmt.node.setAttribute("d",st);setStrokeAndFill(elmt.node,options);setMarkers(elmt.node,options);setLabels([start,end],options);appendSVG(elmt)}function ellipse(center,rx,ry,options){options=options||{};var elmt=getSVGElement(options.id,"ellipse");center=toSVG(center);elmt.node.setAttribute("cx",center[0]);elmt.node.setAttribute("cy",center[1]);elmt.node.setAttribute("rx",rx*SVG.xunitlength);elmt.node.setAttribute("ry",ry*SVG.yunitlength);setStrokeAndFill(elmt.node,options);appendSVG(elmt)}function polygon(list,options){options=options||{};options.closed=true;path(list,options)}function rect(p,q,options){options=options||{};var elmt=getSVGElement(options.id,"rect");elmt.node.setAttribute("x",toSVG(p)[0]);elmt.node.setAttribute("y",toSVG(q)[1]);elmt.node.setAttribute("width",(q[0]-p[0])*SVG.xunitlength);elmt.node.setAttribute("height",(q[1]-p[1])*SVG.yunitlength);elmt.node.setAttribute("rx",getOption("rx",options)*SVG.xunitlength);elmt.node.setAttribute("ry",getOption("ry",options)*SVG.yunitlength);setStrokeAndFill(elmt.node,options);appendSVG(elmt)}function text(p,st,options){options=options||{};options.fill=options.fill||SVG.attr.fontfill;var id=options.id;var factor=(options.fixed)?1:SVG.factor;if(id&&options.isLabel){id+=options.isLabel}var pos=getOption("pos",options).toUpperCase();var fontsize=getOption("fontsize",options)/factor;var node,dx=0,dy=0,str=st.toString();var q=toSVG(p);if(/\$/.test(str)){var dnode=$("#"+SVG.id+"mml:first");if(id){node=$("#"+id)[0]}if(!node){node=MSVG.createElementXHTML("div",id);node.style.position="absolute";dnode.append(node)}else{$(node).empty()}str=$.trim(str);str=str.substr(1,str.length-2);$(node).append(MSVG.parseMath(str,true,fontsize+"px",options.fill));dx=-node.offsetWidth/2;dy=-node.offsetHeight/2;if(/N/.test(pos)){dy=-node.offsetHeight}if(/S/.test(pos)){dy=0}if(/E/.test(pos)){dx=0}if(/W/.test(pos)){dx=-node.offsetWidth}node.style.left=(q[0]+dx)+"px";node.style.top=(q[1]+dy)+"px"}else{var baseline="middle",textanchor="middle";if(/E/.test(pos)){textanchor="start"}if(/W/.test(pos)){textanchor="end"}if(/N/.test(pos)){baseline="text-after-edge"}if(/S/.test(pos)){baseline="text-before-edge"}var elmt=getSVGElement(id,"text");$(elmt.node).empty().text(str);elmt.node.setAttribute("x",q[0]);elmt.node.setAttribute("y",q[1]);elmt.node.setAttribute("font-style",getOption("fontstyle",options));elmt.node.setAttribute("font-family",getOption("fontfamily",options));elmt.node.setAttribute("font-weight",getOption("fontweight",options));elmt.node.setAttribute("font-size",fontsize);elmt.node.setAttribute("text-anchor",textanchor);elmt.node.setAttribute("dominant-baseline",baseline);options.stroke=getOption("fontstroke",options);setStrokeAndFill(elmt.node,options);appendSVG(elmt)}}function image(url,options){options=options||{};var elmt=getSVGElement(options.id,"image");var height=options.height||SVG.height;var width=options.width||SVG.width;var point=toSVG(options.point||[SVG.xmin,SVG.ymin]);var pos=(options.pos||"").toUpperCase();var x=point[0]-width*0.5;var y=point[1]-height*0.5;if(/N/.test(pos)){y-=height*0.5}if(/S/.test(pos)){y+=height*0.5}if(/E/.test(pos)){x+=width*0.5}if(/W/.test(pos)){x-=width*0.5}elmt.node.setAttribute("x",x);elmt.node.setAttribute("y",y);elmt.node.setAttribute("width",width);elmt.node.setAttribute("height",height);elmt.node.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",url);appendSVG(elmt)}function grid(options){options=options||{};var dx,dy,x,y,k,st="",start,stop,limit;var stroke=options.stroke||SVG.attr.gridstroke;var strokewidth=(options.strokewidth||SVG.attr.gridstrokewidth)/SVG.factor;var strokedasharray=getOption("strokedasharray",options);var strokeopacity=getOption("strokeopacity",options);if(SVG.coords=="polar"){dx=options.dx||1;dy=options.dy||3;var lim=Math.max(Math.abs(SVG.xmax),Math.abs(SVG.xmin),Math.abs(SVG.ymax),Math.abs(SVG.ymin));for(x=dx;x<lim;x+=dx){circle([0,0],x,{stroke:stroke,strokewidth:strokewidth,strokedasharray:strokedasharray,strokeopacity:strokeopacity})}if(dy>1){for(y=1;y<dy;y++){k=Math.tan(y*Math.PI/(2*dy));line([SVG.xmin,SVG.xmin*k],[SVG.xmax,SVG.xmax*k],{stroke:stroke,strokewidth:strokewidth,strokedasharray:strokedasharray,strokeopacity:strokeopacity});line([SVG.xmin,-SVG.xmin*k],[SVG.xmax,-SVG.xmax*k],{stroke:stroke,strokewidth:strokewidth,strokedasharray:strokedasharray,strokeopacity:strokeopacity})}}}else{dx=options.dx||1;dy=options.dy||dx;var gdx=dx*SVG.xunitlength;var gdy=dy*SVG.yunitlength;var border=SVG.borderwidth*0.5;var node=createSVGElement("path");node.setAttribute("class","svgGrid");start=SVG.origin[0];stop=SVG.width-border;limit=SVG.height-border;for(x=start;x<stop;x+=gdx){st+=" M"+x+","+border+" "+x+","+limit}start=SVG.origin[0]-gdx;for(x=start;x>border;x-=gdx){st+=" M"+x+","+border+" "+x+","+limit}start=SVG.height-SVG.origin[1];stop=SVG.height-border;limit=SVG.width-border;for(y=start;y<stop;y+=gdy){st+=" M"+border+","+y+" "+limit+","+y}start=SVG.height-SVG.origin[1]-gdy;for(y=start;y>border;y-=gdy){st+=" M"+border+","+y+" "+limit+","+y}node.setAttribute("d",st);node.setAttribute("stroke-width",strokewidth);node.setAttribute("stroke",stroke);node.setAttribute("stroke-dasharray",strokedasharray);node.setAttribute("stroke-opacity",strokeopacity);$(SVG.canvas).append(node)}}function axes(options){options=options||{};var x,y,start,stop;var orig=options.origin||[0,0];var origin=toSVG(orig);var dx=options.dx||1;var dy=options.dy||dx;var fontsize=getOption("fontsize",options);var border=SVG.borderwidth*0.5;var ddx=Math.max(0,Math.floor(-Math.log(dx+1e-9)/Math.log(10))+1);var ddy=Math.max(0,Math.floor(-Math.log(dy+1e-9)/Math.log(10))+1);options.marker="-|"+(options.marker||"-");options.strokewidth=(options.strokewidth||SVG.attr.axesstrokewidth)/SVG.factor;options.stroke=options.stroke||SVG.attr.axesstroke;var temp=options.stroke;options.markerstroke=options.stroke;options.markersize=fontsize*SVG.factor;var list1=[],label1=[];start=orig[0]+dx;stop=SVG.xmax-0.25*dx;for(x=start;x<stop;x+=dx){list1.push([x,orig[1]]);label1.push(String(x.toFixed(ddx)))}list1.push([SVG.xmax-border/SVG.xunitlength,orig[1]]);label1.push("");var list2=[],label2=[];start=orig[0]-dx;stop=SVG.xmin+0.25*dx;for(x=start;x>stop;x-=dx){list2.push([x,orig[1]]);label2.push(String(x.toFixed(ddx)))}list2.push([SVG.xmin+border/SVG.xunitlength,orig[1]]);label2.push("");list2.reverse();list2=list2.concat(list1);if(options.ticklabels!=false){label2.reverse();options.label=label2.concat(label1);options.pos=(SVG.height-origin[1]>2*fontsize)?"S":"N"}var group=getSVGElement("Axes","g");$(group.node).empty();var tempNode=SVG.canvas;SVG.canvas=group.node;path(list2,options);list1=[],label1=[];start=orig[1]+dy;stop=SVG.ymax-0.25*dy;for(y=start;y<stop;y+=dy){list1.push([orig[0],y]);label1.push(String(y.toFixed(ddy)))}list1.push([orig[0],SVG.ymax-border/SVG.yunitlength]);label1.push("");list2=[];label2=[];start=orig[1]-dy;stop=SVG.ymin+0.25*dy;for(y=start;y>stop;y-=dy){list2.push([orig[0],y]);label2.push(String(y.toFixed(ddy)))}list2.push([orig[0],SVG.ymin+border/SVG.yunitlength]);label2.push("");list2.reverse();list2=list2.concat(list1);if(options.ticklabels!=false){label2.reverse();options.label=label2.concat(label1);options.pos=(origin[0]>2*fontsize)?"W":"E"}options.stroke=temp;path(list2,options);SVG.canvas=tempNode;appendSVG(group)}function list(fun,tmin,tmax,points){var inc=(tmax-tmin)/points;if(inc<=0||fun.length==0){return}var t,pth,g=[],xt,yt;for(t=1;t>=0;t--){if($.isFunction(fun[t])){g[t]=fun[t]}else{if(typeof fun[t]=="string"){with(Math){eval("g["+t+"] = function(x){return "+fun[t]+"}")}}else{return}}}if(g.length<2){return}pth=[];for(t=tmin;t<=tmax;t+=inc){xt=g[0](t);yt=g[1](t);if(isFinite(xt)&&isFinite(yt)){pth[pth.length]=[xt,yt]}}return pth}function plot(fun,options){options=options||{};var i,steps=options.steps||[];var leftMarkers=options.leftMarkers||"-";var rightMarkers=options.rightMarkers||"-";if(steps.length===0){plotter(fun,options)}else{var n_steps=steps.length-1;options.max=steps[0];options.marker="--"+leftMarkers.charAt(0);plotter(fun,options);for(i=0;i<n_steps;i++){options.max=steps[i+1];options.min=steps[i];options.marker=rightMarkers.charAt((rightMarkers.length>i)?i:0)+"-"+leftMarkers.charAt((leftMarkers.length>i+1)?i+1:0);plotter(fun,options)}options.max=null;options.min=steps[n_steps];options.marker=rightMarkers.charAt((rightMarkers.length==n_steps)?n_steps-1:0)+"--";plotter(fun,options)}}function plotter(fun,options){options=options||{};options.closed=false;options.curve="";var xmin=(options.min==null)?SVG.xmin:options.min;var xmax=(options.max==null)?SVG.xmax:options.max;var points=getOption("points",options);var pth=list(["x",fun],xmin,xmax,points);if(pth){path(pth,options)}}function area(fun1,fun2,options){options=options||{};options.curve="";options.closed=true;var xmin=(options.min==null)?SVG.xmin:options.min;var xmax=(options.max==null)?SVG.xmax:options.max;var points=getOption("points",options);var pth1=list(["x",fun1],xmin,xmax,points);var pth2=list(["x",fun2],xmin,xmax,points);if(pth1&&pth2){pth2.reverse();pth1=pth1.concat(pth2);path(pth1,options)}}function polarPlot(fun,options){var g1,g2;if(typeof fun=="string"){with(Math){eval("g1 = function(x){return ("+fun+")*cos(x)}");eval("g2 = function(x){return ("+fun+")*sin(x)}")}}else{if($.isFunction(fun)){with(Math){eval("g1 = function(x){return fun(x)*cos(x)}");eval("g2 = function(x){return fun(x)*sin(x)}")}}}parametricPlot(g1,g2,options)}function parametricPlot(fun1,fun2,options){options=options||{};options.closed=false;options.curve="";var xmin=(options.min==null)?0:options.min;var xmax=(options.max==null)?2*Math.PI:options.max;var points=getOption("points",options);var pth=list([fun1,fun2],xmin,xmax,points);if(pth){path(pth,options)}}function slopeField(fun,options){options=options||{};var g=fun;if(typeof fun=="string"){with(Math){eval("g = function(x,y){return "+fun+"}")}}var gxy,x,y,u,v,dz;var dx=(options.dx==null)?1:options.dx;var dy=(options.dy==null)?1:options.dy;dz=Math.sqrt(dx*dx+dy*dy)/6;var xmin=Math.ceil(SVG.xmin/dx);var ymin=Math.ceil(SVG.ymin/dy);for(x=xmin;x<=SVG.xmax;x+=dx){for(y=ymin;y<=SVG.ymax;y+=dy){gxy=g(x,y);if(!isNaN(gxy)){if(Math.abs(gxy)=="Infinity"){u=0;v=dz}else{u=dz/Math.sqrt(1+gxy*gxy);v=gxy*u}line([x-u,y-v],[x+u,y+v],options)}}}}return{dynamic:{},removePictures:function(obj){var pictures=obj?[obj]:$(".svgGraph");$(pictures).each(function(){var target=this.parentNode;$(this).remove();$(target).css({color:"red",background:"yellow"});$(target).text("Missing picture: your browser does not support inline SVG");window.setTimeout(function(){$(target).remove()},10000)})},drawPictures:function(obj){var options,xmin,xmax,ymin,ymax;var pictures=obj?[obj]:$(".svgGraph");$(pictures).each(function(){SVG=new pictureObject();options=this.getAttribute("options");if(options!=""){with(Math){eval("options="+options)}setOptions(options)}else{options={}}SVG.width=options.width||SVG.width;SVG.height=options.height||SVG.height;SVG.coords=options.coords||SVG.coords;SVG.borderwidth=options.borderwidth||SVG.borderwidth;SVG.borderstroke=options.borderstroke||SVG.borderstroke;if(options.pan==false){SVG.pan=false}SVG.src=this.getAttribute("script");var container=this.parentNode;container.removeChild(this);options.scales=options.scales||[];switch(options.scales.length){case 0:xmin=SVG.xmin;xmax=SVG.xmax;ymin=null;ymax=null;break;case 2:xmin=options.scales[0];xmax=options.scales[1];ymin=null;ymax=null;break;case 4:xmin=options.scales[0];xmax=options.scales[1];ymin=options.scales[2];ymax=options.scales[3];break;default:return}if(xmin>=xmax){throw"Incorrect values: xmax<=xmin."}var xunitlength=SVG.width/(xmax-xmin);if(typeof ymin!="number"){ymin=-SVG.height/(2*xunitlength);ymax=-ymin}if(ymin>=ymax){throw"Incorrect values: ymax<=ymin."}SVG.xmin=xmin;SVG.xmax=xmax;SVG.ymin=ymin;SVG.ymax=ymax;setScales();SVG.id=Math.randomString(chars,20);var qnode=createSVGElement("svg");qnode.id=SVG.id;qnode.setAttribute("xmlns","http://www.w3.org/2000/svg");var node=createSVGElement("clipPath");node.id=SVG.id+"ClipPath";var node2=createSVGElement("path");$(node).append(node2);node2=createSVGElement("defs");node2.id=SVG.id+"_Defs";$(node2).append(node);$(qnode).append(node2);node=createSVGElement("rect");node.setAttribute("class","svgBackground");node.setAttribute("x","0");node.setAttribute("y","0");node.setAttribute("width","100%");node.setAttribute("height","100%");node.setAttribute("stroke",SVG.borderstroke);node.setAttribute("stroke-width",SVG.borderwidth);node.setAttribute("fill",SVG.attr.backgroundcolor);node.setAttribute("fill-opacity",SVG.attr.backgroundopacity);$(qnode).append(node);node=createSVGElement("g");node.id=SVG.id+"Canvas";node.setAttribute("clip-path","url(#"+SVG.id+"ClipPath)");SVG.canvas=node;$(qnode).append(node);if(SVG.coords!="none"){node=createSVGElement("text");node.id=SVG.id+"Coords";node.setAttribute("class","svgCoords");node.setAttribute("text-anchor","end");node.setAttribute("font-size",(SVG.attr.fontsize*0.8));$(qnode).append(node)}$(container).append(qnode);container.style.position="relative";node=MSVG.createElementXHTML("span",SVG.id+"mml");$(container).append(node);node=MSVG.createElementXHTML("span",SVG.id+"toolbar");node.style.position="absolute";node.style.textAlign="left";node.style.zIndex=10;node2=setButton("Update","Edit script",function(){updateButton(this)});$(node).append(node2);node2=setButton("SVG","View SVG code",function(){exportSVG(this)});$(node).append(node2);node2=setButton("-","Zoom out",function(){changeScales(1.25)});$(node).append(node2);node2=setButton("+","Zoom in",function(){changeScales(0.8)});$(node).append(node2);node2=setButton("\u2191","Enlarge picture",function(){changeSize(0.8)});$(node).append(node2);node2=setButton("\u2193","Reduce picture",function(){changeSize(1.25)});$(node).append(node2);$(node).append("<br />");node2=MSVG.createElementXHTML("textarea",SVG.id+"src");$(node2).attr({rows:8,cols:80});$(node).append(node2);$(node).hide();$(container).append(node);setAction("mousemove",updateCoord);setAction("mouseout",removeCoord);setAction("mouseover",switchTo);setAction("mousedown",onClick);if(SVG.pan){setAction("mouseup",onDrop)}if(window.addEventListener){var evt=$.browser.mozilla?"DOMMouseScroll":"mousewheel";qnode.addEventListener(evt,onWheel,false)}setSize();translateAndEval(SVG.id)})}}}(jQuery);
//}}}
/***
!~TiddlyWiki formatters
***/
//{{{
if(!version.extensions.MathSVGPlugin) { //# ensure that the plugin is only installed once
version.extensions.MathSVGPlugin = {installed: true};
MSVG.generic();
config.formatterHelpers.MathSVGHelper = function(w) {
this.lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
if(lookaheadMatch){
var eq = MSVG.parseMath(lookaheadMatch[1],this.displaystyle);
if(this.displaystyle){
var node = createTiddlyElement(w.output,"div");
node.style.textAlign='center';
node.appendChild(eq);
w.output.appendChild(node);
} else {w.output.appendChild(eq);}
w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
}
}
config.formatters.push( {
name: "clatex",
match: "\\$\\$",
lookaheadRegExp: /\$\$((?:.|\n)*?)\$\$/mg,
displaystyle: true,
handler: config.formatterHelpers.MathSVGHelper
})
config.formatters.push( {
name: "clatex2",
match: "\\\\\\\[",
lookaheadRegExp: /\\\[\s*(.*?)\s*\\\]/mg,
displaystyle: true,
handler: config.formatterHelpers.MathSVGHelper
})
config.formatters.push( {
name: "latex",
match: "\\$",
lookaheadRegExp: /\$((?:.|\n)*?)\$/mg,
displaystyle: false,
handler: config.formatterHelpers.MathSVGHelper
})
config.formatters.push( {
name: "graph",
match: "\\(:graph",
lookaheadRegExp: /\(:graph(\((.*?),?\s?(\{.+\})?\))?[\s]+((?:.|\n)*?)[\s]+:\)/mg,
handler: function(w){
this.lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
if(lookaheadMatch){
var element = (lookaheadMatch[2] == "inline") ? "span" : "div";
var eq = createTiddlyElement(w.output,element);
switch(lookaheadMatch[2]){
case "center":
eq.style.marginLeft = "auto";
eq.style.marginRight = "auto";
break;
case "left":
eq.style.cssFloat = "left";
break;
case "right":
eq.style.cssFloat = "right";
}
var svg = createTiddlyElement(eq,"embed");
svg.className="svgGraph";
svg.setAttribute('options',lookaheadMatch[3]||"");
svg.setAttribute('script',lookaheadMatch[4]);
ASVG.drawPictures(svg);
w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
}
}
})
}
//}}}
/***
!Metadata:
|''Name:''|SyntaxHighlighterPlugin|
|''Description:''|Code Syntax Highlighter Plugin for TiddlyWiki.|
|''Version:''|1.1.3|
|''Date:''|Oct 24, 2008|
|''Source:''|http://www.coolcode.cn/show-310-1.html|
|''Author:''|Ma Bingyao (andot (at) ujn (dot) edu (dot) cn)|
|''License:''|[[GNU Lesser General Public License|http://www.gnu.org/licenses/lgpl.txt]]|
|''~CoreVersion:''|2.4.1|
|''Browser:''|Firefox 1.5+; InternetExplorer 6.0; Safari; Opera; Chrome; etc.|
!Syntax:
<code cys:nocontrols:nogutter>
<code options>
codes
</code>
</code>
!Examples:
<code java>
public class HelloWorld {
public static void main(String args[]) {
System.out.println("HelloWorld!");
}
}
</code>
!Revision History:
|''Version''|''Date''|''Note''|
|1.1.2|Oct 15, 2008|Optimize Highlight|
|1.0.0|Oct 13, 2008|Initial release|
!Code section:
***/
//{{{
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>©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($){return $.collapse},func:function($,_){$.parentNode.removeChild($);_.div.className=_.div.className.replace("collapsed","")}},ViewSource:{label:"view plain",func:function($,_){var A=dp.sh.Utils.FixForBlogger(_.originalCode).replace(/</g,"<"),B=window.open("","_blank","width=750, height=400, location=0, resizable=1, menubar=0, scrollbars=0");B.document.write("<textarea style=\"width:99%;height:99%\">"+A+"</textarea>");B.document.close()}},CopyToClipboard:{label:"copy to clipboard",check:function(){return window.clipboardData!=null||dp.sh.ClipboardSwf!=null},func:function($,A){var B=dp.sh.Utils.FixForBlogger(A.originalCode).replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");if(window.clipboardData)window.clipboardData.setData("text",B);else if(dp.sh.ClipboardSwf!=null){var _=A.flashCopier;if(_==null){_=document.createElement("div");A.flashCopier=_;A.div.appendChild(_)}_.innerHTML="<embed src=\""+dp.sh.ClipboardSwf+"\" FlashVars=\"clipboard="+encodeURIComponent(B)+"\" width=\"0\" height=\"0\" type=\"application/x-shockwave-flash\"></embed>"}alert("The code is in your clipboard now")}},PrintSource:{label:"print",func:function($,B){var _=document.createElement("IFRAME"),A=null;_.style.cssText="position:absolute;width:0px;height:0px;left:-500px;top:-500px;";document.body.appendChild(_);A=_.contentWindow.document;dp.sh.Utils.CopyStyles(A,window.document);A.write("<div class=\""+B.div.className.replace("collapsed","")+" printing\">"+B.div.innerHTML+"</div>");A.close();_.contentWindow.focus();_.contentWindow.print();alert("Printing...");document.body.removeChild(_)}},About:{label:"?",func:function(_){var A=window.open("","_blank","dialog,width=300,height=150,scrollbars=0"),$=A.document;dp.sh.Utils.CopyStyles($,window.document);$.write(dp.sh.Strings.AboutDialog.replace("{V}",dp.sh.Version));$.close();A.focus()}}};dp.sh.Toolbar.Create=function(B){var A=document.createElement("DIV");A.className="tools";for(var _ in dp.sh.Toolbar.Commands){var $=dp.sh.Toolbar.Commands[_];if($.check!=null&&!$.check(B))continue;A.innerHTML+="<a href=\"#\" onclick=\"dp.sh.Toolbar.Command('"+_+"',this);return false;\">"+$.label+"</a>"}return A};dp.sh.Toolbar.Command=function(_,$){var A=$;while(A!=null&&A.className.indexOf("dp-highlighter")==-1)A=A.parentNode;if(A!=null)dp.sh.Toolbar.Commands[_].func($,A.highlighter)};dp.sh.Utils.CopyStyles=function(A,_){var $=_.getElementsByTagName("link");for(var B=0;B<$.length;B++)if($[B].rel.toLowerCase()=="stylesheet")A.write("<link type=\"text/css\" rel=\"stylesheet\" href=\""+$[B].href+"\"></link>")};dp.sh.Utils.FixForBlogger=function($){return(dp.sh.isBloggerMode==true)?$.replace(/<br\s*\/?>|<br\s*\/?>/gi,"\n"):$};dp.sh.RegexLib={MultiLineCysComments:new RegExp("_\\*[\\s\\S]*?\\*_","gm"),SingleLineCysComments:new RegExp("_\\s.*$","gm"),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(_,$,A){this.value=_;this.index=$;this.length=_.length;this.css=A};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($,_){if($.index<_.index)return-1;else if($.index>_.index)return 1;else if($.length<_.length)return-1;else if($.length>_.length)return 1;return 0};dp.sh.Highlighter.prototype.CreateElement=function(_){var $=document.createElement(_);$.highlighter=this;return $};dp.sh.Highlighter.prototype.GetMatches=function(_,B){var $=0,A=null;while((A=_.exec(this.code))!=null)this.matches[this.matches.length]=new dp.sh.Match(A[0],A.index,B)};dp.sh.Highlighter.prototype.AddBit=function($,A){if($==null||$.length==0)return;var C=this.CreateElement("SPAN");$=$.replace(/ /g," ");$=$.replace(/</g,"<");$=$.replace(/\n/gm," <br>");if(A!=null){if((/br/gi).test($)){var _=$.split(" <br>");for(var B=0;B<_.length;B++){C=this.CreateElement("SPAN");C.className=A;C.innerHTML=_[B];this.div.appendChild(C);if(B+1<_.length)this.div.appendChild(this.CreateElement("BR"))}}else{C.className=A;C.innerHTML=$;this.div.appendChild(C)}}else{C.innerHTML=$;this.div.appendChild(C)}};dp.sh.Highlighter.prototype.IsInside=function(_){if(_==null||_.length==0)return false;for(var A=0;A<this.matches.length;A++){var $=this.matches[A];if($==null)continue;if((_.index>$.index)&&(_.index<$.index+$.length))return true}return false};dp.sh.Highlighter.prototype.ProcessRegexList=function(){for(var $=0;$<this.regexList.length;$++)this.GetMatches(this.regexList[$].regex,this.regexList[$].css)};dp.sh.Highlighter.prototype.ProcessSmartTabs=function(E){var B=E.split("\n"),$="",D=4,A="\t";function _(A,E,_){var B=A.substr(0,E),C=A.substr(E+1,A.length),$="";for(var D=0;D<_;D++)$+=" ";return B+$+C}function C(B,C){if(B.indexOf(A)==-1)return B;var D=0;while((D=B.indexOf(A))!=-1){var $=C-D%C;B=_(B,D,$)}return B}for(var F=0;F<B.length;F++)$+=C(B[F],D)+"\n";return $};dp.sh.Highlighter.prototype.SwitchToList=function(){var C=this.div.innerHTML.replace(/<(br)\/?>/gi,"\n"),B=C.split("\n");if(this.addControls==true)this.bar.appendChild(dp.sh.Toolbar.Create(this));if(this.showColumns){var A=this.CreateElement("div"),_=this.CreateElement("div"),E=10,G=1;while(G<=150)if(G%E==0){A.innerHTML+=G;G+=(G+"").length}else{A.innerHTML+="·";G++}_.className="columns";_.appendChild(A);this.bar.appendChild(_)}for(var G=0,D=this.firstLine;G<B.length-1;G++,D++){var $=this.CreateElement("LI"),F=this.CreateElement("SPAN");$.className=(G%2==0)?"alt":"";F.innerHTML=B[G]+" ";$.appendChild(F);this.ol.appendChild($)}this.div.innerHTML=""};dp.sh.Highlighter.prototype.Highlight=function(C){function A($){return $.replace(/^\s*(.*?)[\s\n]*$/g,"$1")}function $($){return $.replace(/\n*$/,"").replace(/^\n*/,"")}function _(B){var E=dp.sh.Utils.FixForBlogger(B).split("\n"),C=new Array(),D=new RegExp("^\\s*","g"),$=1000;for(var F=0;F<E.length&&$>0;F++){if(A(E[F]).length==0)continue;var _=D.exec(E[F]);if(_!=null&&_.length>0)$=Math.min(_[0].length,$)}if($>0)for(F=0;F<E.length;F++)E[F]=E[F].substr($);return E.join("\n")}function D(A,$,_){return A.substr($,_-$)}var F=0;if(C==null)C="";this.originalCode=C;this.code=$(_(C));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 E=0;E<this.matches.length;E++)if(this.IsInside(this.matches[E]))this.matches[E]=null;for(E=0;E<this.matches.length;E++){var B=this.matches[E];if(B==null||B.length==0)continue;this.AddBit(D(this.code,F,B.index),null);this.AddBit(B.value,B.css);F=B.index+B.length}this.AddBit(this.code.substr(F),null);this.SwitchToList();this.div.appendChild(this.bar);this.div.appendChild(this.ol)};dp.sh.Highlighter.prototype.GetKeywords=function($){return"\\b"+$.replace(/ /g,"\\b|\\b")+"\\b"};dp.sh.BloggerMode=function(){dp.sh.isBloggerMode=true};dp.sh.HighlightAll=function(N,B,K,I,O,E){function A(){var $=arguments;for(var _=0;_<$.length;_++){if($[_]==null)continue;if(typeof($[_])=="string"&&$[_]!="")return $[_]+"";if(typeof($[_])=="object"&&$[_].value!="")return $[_].value+""}return null}function J($,_){for(var A=0;A<_.length;A++)if(_[A]==$)return true;return false}function L(A,B,C){var _=new RegExp("^"+A+"\\[(\\w+)\\]$","gi"),$=null;for(var D=0;D<B.length;D++)if(($=_.exec(B[D]))!=null)return $[1];return C}function C(B,A,_){var $=document.getElementsByTagName(_);for(var C=0;C<$.length;C++)if($[C].getAttribute("name")==A)B.push($[C])}var T=[],P=null,M={},$="innerHTML";C(T,N,"pre");C(T,N,"textarea");if(T.length==0)return;for(var R in dp.sh.Brushes){var F=dp.sh.Brushes[R].Aliases;if(F==null)continue;for(var G=0;G<F.length;G++)M[F[G]]=R}for(G=0;G<T.length;G++){var _=T[G],U=A(_.attributes["class"],_.className,_.attributes["language"],_.language),Q="";if(U==null)continue;U=U.split(":");Q=U[0].toLowerCase();if(M[Q]==null)continue;P=new dp.sh.Brushes[M[Q]]();_.style.display="none";P.noGutter=(B==null)?J("nogutter",U):!B;P.addControls=(K==null)?!J("nocontrols",U):K;P.collapse=(I==null)?J("collapse",U):I;P.showColumns=(E==null)?J("showcolumns",U):E;var D=document.getElementsByTagName("head")[0];if(P.Style&&D){var S=document.createElement("style");S.setAttribute("type","text/css");if(S.styleSheet)S.styleSheet.cssText=P.Style;else{var H=document.createTextNode(P.Style);S.appendChild(H)}D.appendChild(S)}P.firstLine=(O==null)?parseInt(L("firstline",U,1)):O;P.Highlight(_[$]);P.source=_;_.parentNode.insertBefore(P.div,_)}};version.extensions.SyntaxHighLighterPlugin={major:1,minor:1,revision:3,date:new Date(2008,10,24)};dp.sh.ClipboardSwf="clipboard.swf";dp.sh.Highlight=function(_,Q,B,J,H,M,D){function A(){var $=arguments;for(var _=0;_<$.length;_++){if($[_]==null)continue;if(typeof($[_])=="string"&&$[_]!="")return $[_]+"";if(typeof($[_])=="object"&&$[_].value!="")return $[_].value+""}return null}function I($,_){for(var A=0;A<_.length;A++)if(_[A]==$)return true;return false}function K(A,B,C){var _=new RegExp("^"+A+"\\[(\\w+)\\]$","gi"),$=null;for(var D=0;D<B.length;D++)if(($=_.exec(B[D]))!=null)return $[1];return C}var N=null,$="innerHTML";if(this.registered==undefined){var L={};for(var O in dp.sh.Brushes){var E=dp.sh.Brushes[O].Aliases;if(E==null)continue;for(var F=0;F<E.length;F++)L[E[F]]=O}this.registered=L}Q=Q.split(":");language=Q[0].toLowerCase();if(this.registered[language]==null)return;N=new dp.sh.Brushes[this.registered[language]]();_.style.display="none";N.noGutter=(B==null)?I("nogutter",Q):!B;N.addControls=(J==null)?!I("nocontrols",Q):J;N.collapse=(H==null)?I("collapse",Q):H;N.showColumns=(D==null)?I("showcolumns",Q):D;var C=document.getElementsByTagName("head")[0],P=document.getElementById(N.CssClass);if(N.Style&&C&&!P){P=document.createElement("style");P.setAttribute("id",N.CssClass);P.setAttribute("type","text/css");if(P.styleSheet)P.styleSheet.cssText=N.Style;else{var G=document.createTextNode(N.Style);P.appendChild(G)}C.appendChild(P)}N.firstLine=(M==null)?parseInt(K("firstline",Q,1)):M;N.Highlight(_[$]);N.source=_;_.parentNode.insertBefore(N.div,_)};config.formatters.push({name:"SyntaxHighlighter",match:"^<code[\\s]+[^>]+>\\n",element:"pre",handler:function(_){this.lookaheadRegExp=/<code[\s]+([^>]+)>\n((?:^[^\n]*\n)+?)(^<\/code>$\n?)/mg;this.lookaheadRegExp.lastIndex=_.matchStart;var $=this.lookaheadRegExp.exec(_.source);if($&&$.index==_.matchStart){var C=$[1],B=$[2];if(config.browser.isIE)B=B.replace(/\n/g,"\r");var A=createTiddlyElement(_.output,this.element,null,null,B);dp.sh.Highlight(A,C);_.nextMatch=$.index+$[0].length}}});config.formatterHelpers.enclosedTextHelper=function(_){this.lookaheadRegExp.lastIndex=_.matchStart;var $=this.lookaheadRegExp.exec(_.source);if($&&$.index==_.matchStart){var B=$[1];if(config.browser.isIE)B=B.replace(/\n/g,"\r");var A=createTiddlyElement(_.output,this.element,null,null,B);switch(_.matchText){case"/*{{{*/\n":dp.sh.Highlight(A,"css");break;case"//{{{\n":dp.sh.Highlight(A,"js");break;case"<!--{{{-->\n":dp.sh.Highlight(A,"xml");break}_.nextMatch=$.index+$[0].length}};dp.sh.Brushes.Cys=function(){var _="int double void", $="break case catch class const __finally __exception __try "+"const_cast continue private public protected __declspec "+"default delete deprecated dllexport dllimport do dynamic_cast "+"else enum explicit extern if for friend goto inline "+"mutable naked namespace new noinline noreturn nothrow "+"register reinterpret_cast return selectany "+"sizeof static static_cast struct switch template this "+"thread throw true false try typedef typeid typename union "+"using uuid virtual volatile whcar_t while";this.regexList=[{regex:dp.sh.RegexLib.SingleLineCysComments,css:"comment"},{regex:dp.sh.RegexLib.MultiLineCysComments,css:"comment"},{regex:dp.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:new RegExp("[a-zA-Z]:|[a-zA-Z_][0-9a-zA-Z_]+:","gm"),css:"label"},{regex:new RegExp("[-`~!@#$%^&*<>|+?=/\\\\]+","gm"),css:"operatur"},{regex:new RegExp(this.GetKeywords(_),"gm"),css:"datatypes"},{regex:new RegExp(this.GetKeywords($),"gm"),css:"keyword"}];this.CssClass="dp-cys";this.Style=".dp-cys .datatypes { color: #2E8B57; font-weight: bold; }"};dp.sh.Brushes.Cys.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Cys.Aliases=["cys","cystem"];dp.sh.Brushes.Cpp=function(){var _="ATOM BOOL BOOLEAN BYTE CHAR COLORREF DWORD DWORDLONG DWORD_PTR "+"DWORD32 DWORD64 FLOAT HACCEL HALF_PTR HANDLE HBITMAP HBRUSH "+"HCOLORSPACE HCONV HCONVLIST HCURSOR HDC HDDEDATA HDESK HDROP HDWP "+"HENHMETAFILE HFILE HFONT HGDIOBJ HGLOBAL HHOOK HICON HINSTANCE HKEY "+"HKL HLOCAL HMENU HMETAFILE HMODULE HMONITOR HPALETTE HPEN HRESULT "+"HRGN HRSRC HSZ HWINSTA HWND INT INT_PTR INT32 INT64 LANGID LCID LCTYPE "+"LGRPID LONG LONGLONG LONG_PTR LONG32 LONG64 LPARAM LPBOOL LPBYTE LPCOLORREF "+"LPCSTR LPCTSTR LPCVOID LPCWSTR LPDWORD LPHANDLE LPINT LPLONG LPSTR LPTSTR "+"LPVOID LPWORD LPWSTR LRESULT PBOOL PBOOLEAN PBYTE PCHAR PCSTR PCTSTR PCWSTR "+"PDWORDLONG PDWORD_PTR PDWORD32 PDWORD64 PFLOAT PHALF_PTR PHANDLE PHKEY PINT "+"PINT_PTR PINT32 PINT64 PLCID PLONG PLONGLONG PLONG_PTR PLONG32 PLONG64 POINTER_32 "+"POINTER_64 PSHORT PSIZE_T PSSIZE_T PSTR PTBYTE PTCHAR PTSTR PUCHAR PUHALF_PTR "+"PUINT PUINT_PTR PUINT32 PUINT64 PULONG PULONGLONG PULONG_PTR PULONG32 PULONG64 "+"PUSHORT PVOID PWCHAR PWORD PWSTR SC_HANDLE SC_LOCK SERVICE_STATUS_HANDLE SHORT "+"SIZE_T SSIZE_T TBYTE TCHAR UCHAR UHALF_PTR UINT UINT_PTR UINT32 UINT64 ULONG "+"ULONGLONG ULONG_PTR ULONG32 ULONG64 USHORT USN VOID WCHAR WORD WPARAM WPARAM WPARAM "+"char bool short int __int32 __int64 __int8 __int16 long float double __wchar_t "+"clock_t _complex _dev_t _diskfree_t div_t ldiv_t _exception _EXCEPTION_POINTERS "+"FILE _finddata_t _finddatai64_t _wfinddata_t _wfinddatai64_t __finddata64_t "+"__wfinddata64_t _FPIEEE_RECORD fpos_t _HEAPINFO _HFILE lconv intptr_t "+"jmp_buf mbstate_t _off_t _onexit_t _PNH ptrdiff_t _purecall_handler "+"sig_atomic_t size_t _stat __stat64 _stati64 terminate_function "+"time_t __time64_t _timeb __timeb64 tm uintptr_t _utimbuf "+"va_list wchar_t wctrans_t wctype_t wint_t signed",$="break case catch class const __finally __exception __try "+"const_cast continue private public protected __declspec "+"default delete deprecated dllexport dllimport do dynamic_cast "+"else enum explicit extern if for friend goto inline "+"mutable naked namespace new noinline noreturn nothrow "+"register reinterpret_cast return selectany "+"sizeof static static_cast struct switch template this "+"thread throw true false try typedef typeid typename union "+"using uuid virtual void volatile whcar_t while";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("^ *#.*","gm"),css:"preprocessor"},{regex:new RegExp(this.GetKeywords(_),"gm"),css:"datatypes"},{regex:new RegExp(this.GetKeywords($),"gm"),css:"keyword"}];this.CssClass="dp-cpp";this.Style=".dp-cpp .datatypes { color: #2E8B57; font-weight: bold; }"};dp.sh.Brushes.Cpp.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Cpp.Aliases=["cpp","c","c++"];dp.sh.Brushes.CSharp=function(){var $="abstract as base bool break byte case catch char checked class const "+"continue decimal default delegate do double else enum event explicit "+"extern false finally fixed float for foreach get goto if implicit in int "+"interface internal is lock long namespace new null object operator out "+"override params private protected public readonly ref return sbyte sealed set "+"short sizeof stackalloc static string struct switch this throw true try "+"typeof uint ulong unchecked unsafe ushort using virtual void while";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($),"gm"),css:"keyword"}];this.CssClass="dp-c";this.Style=".dp-c .vars { color: #d00; }"};dp.sh.Brushes.CSharp.prototype=new dp.sh.Highlighter();dp.sh.Brushes.CSharp.Aliases=["c#","c-sharp","csharp"];dp.sh.Brushes.CSS=function(){var _="ascent azimuth background-attachment background-color background-image background-position "+"background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top "+"border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color "+"border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width "+"border-bottom-width border-left-width border-width border cap-height caption-side centerline clear clip color "+"content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display "+"elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font "+"height letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top "+"margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans "+"outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page "+"page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position "+"quotes richness size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress "+"table-layout text-align text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em "+"vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index",$="above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder "+"both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed "+"continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero default digits disc dotted double "+"embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia "+"gray green groove handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic "+"justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha "+"lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower "+"navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset "+"outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side "+"rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow "+"small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize "+"table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal "+"text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin "+"upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow",A="[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif";this.regexList=[{regex:dp.sh.RegexLib.MultiLineCComments,css:"comment"},{regex:dp.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:dp.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp("\\#[a-zA-Z0-9]{3,6}","g"),css:"value"},{regex:new RegExp("(-?\\d+)(.\\d+)?(px|em|pt|:|%|)","g"),css:"value"},{regex:new RegExp("!important","g"),css:"important"},{regex:new RegExp(this.GetKeywordsCSS(_),"gm"),css:"keyword"},{regex:new RegExp(this.GetValuesCSS($),"g"),css:"value"},{regex:new RegExp(this.GetValuesCSS(A),"g"),css:"value"}];this.CssClass="dp-css";this.Style=".dp-css .value { color: black; }"+".dp-css .important { color: red; }"};dp.sh.Highlighter.prototype.GetKeywordsCSS=function($){return"\\b([a-z_]|)"+$.replace(/ /g,"(?=:)\\b|\\b([a-z_\\*]|\\*|)")+"(?=:)\\b"};dp.sh.Highlighter.prototype.GetValuesCSS=function($){return"\\b"+$.replace(/ /g,"(?!-)(?!:)\\b|\\b()")+":\\b"};dp.sh.Brushes.CSS.prototype=new dp.sh.Highlighter();dp.sh.Brushes.CSS.Aliases=["css"];dp.sh.Brushes.Delphi=function(){var $="abs addr and ansichar ansistring array as asm begin boolean byte cardinal "+"case char class comp const constructor currency destructor div do double "+"downto else end except exports extended false file finalization finally "+"for function goto if implementation in inherited int64 initialization "+"integer interface is label library longint longword mod nil not object "+"of on or packed pansichar pansistring pchar pcurrency pdatetime pextended "+"pint64 pointer private procedure program property pshortstring pstring "+"pvariant pwidechar pwidestring protected public published raise real real48 "+"record repeat set shl shortint shortstring shr single smallint string then "+"threadvar to true try type unit until uses val var varirnt while widechar "+"widestring with word write writeln xor";this.regexList=[{regex:new RegExp("\\(\\*[\\s\\S]*?\\*\\)","gm"),css:"comment"},{regex:new RegExp("{(?!\\$)[\\s\\S]*?}","gm"),css:"comment"},{regex:dp.sh.RegexLib.SingleLineCComments,css:"comment"},{regex:dp.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp("\\{\\$[a-zA-Z]+ .+\\}","g"),css:"directive"},{regex:new RegExp("\\b[\\d\\.]+\\b","g"),css:"number"},{regex:new RegExp("\\$[a-zA-Z0-9]+\\b","g"),css:"number"},{regex:new RegExp(this.GetKeywords($),"gm"),css:"keyword"}];this.CssClass="dp-delphi";this.Style=".dp-delphi .number { color: blue; }"+".dp-delphi .directive { color: #008284; }"+".dp-delphi .vars { color: #000; }"};dp.sh.Brushes.Delphi.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Delphi.Aliases=["delphi","pascal"];dp.sh.Brushes.Java=function(){var $="abstract assert boolean break byte case catch char class const "+"continue default do double else enum extends "+"false final finally float for goto if implements import "+"instanceof int interface long native new null "+"package private protected public return "+"short static strictfp super switch synchronized this throw throws true "+"transient try void volatile while";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("\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b","gi"),css:"number"},{regex:new RegExp("(?!\\@interface\\b)\\@[\\$\\w]+\\b","g"),css:"annotation"},{regex:new RegExp("\\@interface\\b","g"),css:"keyword"},{regex:new RegExp(this.GetKeywords($),"gm"),css:"keyword"}];this.CssClass="dp-j";this.Style=".dp-j .annotation { color: #646464; }"+".dp-j .number { color: #C00000; }"};dp.sh.Brushes.Java.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Java.Aliases=["java"];dp.sh.Brushes.JScript=function(){var $="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($),"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.Lua=function(){var $="break do end else elseif function if local nil not or repeat return and then until while this",_="math\\.\\w+ string\\.\\w+ os\\.\\w+ debug\\.\\w+ io\\.\\w+ error fopen dofile coroutine\\.\\w+ arg getmetatable ipairs loadfile loadlib loadstring longjmp print rawget rawset seek setmetatable assert tonumber tostring";this.regexList=[{regex:new RegExp("--\\[\\[[\\s\\S]*\\]\\]--","gm"),css:"comment"},{regex:new RegExp("--[^\\[]{2}.*$","gm"),css:"comment"},{regex:dp.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:dp.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp(this.GetKeywords($),"gm"),css:"keyword"},{regex:new RegExp(this.GetKeywords(_),"gm"),css:"func"},];this.CssClass="dp-lua"};dp.sh.Brushes.Lua.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Lua.Aliases=["lua"];dp.sh.Brushes.Mxml=function(){this.CssClass="dp-mxml";this.Style=".dp-mxml .cdata { color: #000000; }"+".dp-mxml .tag { color : #0000ff; }"+".dp-mxml .tag-name { color: #0000ff; }"+".dp-mxml .script { color: green; }"+".dp-mxml .metadata { color: green; }"+".dp-mxml .attribute { color: #000000; }"+".dp-mxml .attribute-value { color: #990000; }"+".dp-mxml .trace { color: #cc6666; }"+".dp-mxml .var { color: #6699cc; }"+".dp-mxml .comment { color: #009900; }"+".dp-mxml .string { color: #990000; }"+".dp-mxml .keyword { color: blue; }"};dp.sh.Brushes.Mxml.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Mxml.Aliases=["mxml"];dp.sh.Brushes.Mxml.prototype.ProcessRegexList=function(){function H(_,$){_[_.length]=$}function B(B,_){var A=0,$=false;for(A=0;A<B.length;A++)if(_.index>B[A].firstIndex&&_.index<B[A].lastIndex)$=true;return $}var $=0,F=null,D=null,A=null,C="",E=new Array(),_="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",G=[{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("trace"),"gm"),css:"trace"},{regex:new RegExp(this.GetKeywords(_),"gm"),css:"keyword"}];A=new RegExp("<\\!\\[CDATA\\[(.|\\s)*?\\]\\]>","gm");while((F=A.exec(this.code))!=null){C=F[0].substr(0,12);H(this.matches,new dp.sh.Match(C,F.index,"cdata"));C=F[0].substr(12,F[0].length-12-6);for(var I=0;I<G.length;I++)while((D=G[I].regex.exec(C))!=null)H(this.matches,new dp.sh.Match(D[0],F.index+12+D.index,G[I].css));C=F[0].substr(F[0].length-6,6);H(this.matches,new dp.sh.Match(C,F.index+F[0].length-6,"cdata"));E.push({firstIndex:F.index,lastIndex:F.index+F[0].length-1})}this.GetMatches(new RegExp("(<|<)!--\\s*.*?\\s*--(>|>)","gm"),"comments");A=new RegExp("([:\\w-.]+)\\s*=\\s*(\".*?\"|'.*?'|\\w+)*|(\\w+)","gm");while((F=A.exec(this.code))!=null){if(F[1]==null)continue;if(B(E,F))continue;H(this.matches,new dp.sh.Match(F[1],F.index,"attribute"));if(F[2]!=undefined)H(this.matches,new dp.sh.Match(F[2],F.index+F[0].indexOf(F[2]),"attribute-value"))}A=new RegExp("(?:<|<)/*\\?*\\s*([:\\w-.]+)","gm");while((F=A.exec(this.code))!=null){if(B(E,F))continue;C=F[0].substr(4,F[0].length-4);switch(C){case"mx:Script":case"/mx:Script":H(this.matches,new dp.sh.Match(F[0]+">",F.index,"script"));break;case"mx:Metadata":case"/mx:Metadata":H(this.matches,new dp.sh.Match(F[0]+">",F.index,"metadata"));break;default:H(this.matches,new dp.sh.Match(F[0],F.index,"tag-name"));break}}A=new RegExp("\\?>|>|/>","gm");while((F=A.exec(this.code))!=null){if(B(E,F))continue;H(this.matches,new dp.sh.Match(F[0],F.index,"tag"))}};dp.sh.Brushes.Perl=function(){var _="abs accept alarm atan2 bind binmode bless caller chdir chmod chomp chop chown chr chroot close closedir connect cos crypt dbmclose dbmopen defined delete dump each endgrent endhostent endnetent endprotoent endpwent endservent eof exec exists exp fcntl fileno flock fork format formline getc getgrent getgrgid getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr getnetbyname getnetent getpeername getpgrp getppid getpriority getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname getservbyport getservent getsockname getsockopt glob gmtime grep hex import index int ioctl join keys kill lc lcfirst length link listen localtime lock log lstat m map mkdir msgctl msgget msgrcv msgsnd no oct open opendir ord pack pipe pop pos print printf prototype push q qq quotemeta qw qx rand read readdir readline readlink readpipe recv ref rename reset reverse rewinddir rindex rmdir scalar seek seekdir semctl semget semop send setgrent sethostent setnetent setpgrp setpriority setprotoent setpwent setservent setsockopt shift shmctl shmget shmread shmwrite shutdown sin sleep socket socketpair sort splice split sprintf sqrt srand stat study sub substr symlink syscall sysopen sysread sysseek system syswrite tell telldir tie tied time times tr truncate uc ucfirst umask undef unlink unpack unshift untie utime values vec waitpid wantarray warn write qr",$="s select goto die do package redo require return continue for foreach last next wait while use if else elsif eval exit unless switch case",A="my our local";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("(\\$|@|%)\\w+","g"),css:"vars"},{regex:new RegExp(this.GetKeywords(_),"gmi"),css:"func"},{regex:new RegExp(this.GetKeywords($),"gm"),css:"keyword"},{regex:new RegExp(this.GetKeywords(A),"gm"),css:"declarations"}];this.CssClass="dp-perl"};dp.sh.Brushes.Perl.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Perl.Aliases=["perl"];dp.sh.Brushes.Php=function(){var _="abs acos acosh addcslashes addslashes "+"array_change_key_case array_chunk array_combine array_count_values array_diff "+"array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill "+"array_filter array_flip array_intersect array_intersect_assoc array_intersect_key "+"array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map "+"array_merge array_merge_recursive array_multisort array_pad array_pop array_product "+"array_push array_rand array_reduce array_reverse array_search array_shift "+"array_slice array_splice array_sum array_udiff array_udiff_assoc "+"array_udiff_uassoc array_uintersect array_uintersect_assoc "+"array_uintersect_uassoc array_unique array_unshift array_values array_walk "+"array_walk_recursive atan atan2 atanh base64_decode base64_encode base_convert "+"basename bcadd bccomp bcdiv bcmod bcmul bindec bindtextdomain bzclose bzcompress "+"bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite ceil chdir "+"checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists "+"closedir closelog copy cos cosh count count_chars date decbin dechex decoct "+"deg2rad delete ebcdic2ascii echo empty end ereg ereg_replace eregi eregi_replace error_log "+"error_reporting escapeshellarg escapeshellcmd eval exec exit exp explode extension_loaded "+"feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents "+"fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype "+"floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv fputs fread fscanf "+"fseek fsockopen fstat ftell ftok getallheaders getcwd getdate getenv gethostbyaddr gethostbyname "+"gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid getmyuid getopt "+"getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext "+"gettimeofday gettype glob gmdate gmmktime ini_alter ini_get ini_get_all ini_restore ini_set "+"interface_exists intval ip2long is_a is_array is_bool is_callable is_dir is_double "+"is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long "+"is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_soap_fault "+"is_string is_subclass_of is_uploaded_file is_writable is_writeable mkdir mktime nl2br "+"parse_ini_file parse_str parse_url passthru pathinfo readlink realpath rewind rewinddir rmdir "+"round str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split "+"str_word_count strcasecmp strchr strcmp strcoll strcspn strftime strip_tags stripcslashes "+"stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk "+"strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime "+"strtoupper strtr strval substr substr_compare",$="and or xor __FILE__ __LINE__ array as break case "+"cfunction class const continue declare default die do else "+"elseif empty enddeclare endfor endforeach endif endswitch endwhile "+"extends for foreach function include include_once global if "+"new old_function return static switch use require require_once "+"var while __FUNCTION__ __CLASS__ "+"__METHOD__ abstract interface public implements extends private protected throw";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("\\$\\w+","g"),css:"vars"},{regex:new RegExp(this.GetKeywords(_),"gmi"),css:"func"},{regex:new RegExp(this.GetKeywords($),"gm"),css:"keyword"}];this.CssClass="dp-c"};dp.sh.Brushes.Php.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Php.Aliases=["php"];dp.sh.Brushes.Python=function(){var $="and assert break class continue def del elif else "+"except exec finally for from global if import in is "+"lambda not or pass print raise return try yield while",_="None True False self cls class_";this.regexList=[{regex:dp.sh.RegexLib.SingleLinePerlComments,css:"comment"},{regex:new RegExp("^\\s*@\\w+","gm"),css:"decorator"},{regex:new RegExp("(['\"]{3})([^\\1])*?\\1","gm"),css:"comment"},{regex:new RegExp("\"(?!\")(?:\\.|\\\\\\\"|[^\\\"\"\\n\\r])*\"","gm"),css:"string"},{regex:new RegExp("'(?!')*(?:\\.|(\\\\\\')|[^\\''\\n\\r])*'","gm"),css:"string"},{regex:new RegExp("\\b\\d+\\.?\\w*","g"),css:"number"},{regex:new RegExp(this.GetKeywords($),"gm"),css:"keyword"},{regex:new RegExp(this.GetKeywords(_),"gm"),css:"special"}];this.CssClass="dp-py";this.Style=".dp-py .builtins { color: #ff1493; }"+".dp-py .magicmethods { color: #808080; }"+".dp-py .exceptions { color: brown; }"+".dp-py .types { color: brown; font-style: italic; }"+".dp-py .commonlibs { color: #8A2BE2; font-style: italic; }"};dp.sh.Brushes.Python.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Python.Aliases=["py","python"];dp.sh.Brushes.Ruby=function(){var $="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",_="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($),"gm"),css:"keyword"},{regex:new RegExp(this.GetKeywords(_),"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"];dp.sh.Brushes.Sql=function(){var _="abs avg case cast coalesce convert count current_timestamp "+"current_user day isnull left lower month nullif replace right "+"session_user space substring sum system_user upper user year",$="absolute action add after alter as asc at authorization begin bigint "+"binary bit by cascade char character check checkpoint close collate "+"column commit committed connect connection constraint contains continue "+"create cube current current_date current_time cursor database date "+"deallocate dec decimal declare default delete desc distinct double drop "+"dynamic else end end-exec escape except exec execute false fetch first "+"float for force foreign forward free from full function global goto grant "+"group grouping having hour ignore index inner insensitive insert instead "+"int integer intersect into is isolation key last level load local max min "+"minute modify move name national nchar next no numeric of off on only "+"open option order out output partial password precision prepare primary "+"prior privileges procedure public read real references relative repeatable "+"restrict return returns revoke rollback rollup rows rule schema scroll "+"second section select sequence serializable set size smallint static "+"statistics table temp temporary then time timestamp to top transaction "+"translation trigger true truncate uncommitted union unique update values "+"varchar varying view when where with work",A="all and any between cross in join like not null or outer some";this.regexList=[{regex:new RegExp("--(.*)$","gm"),css:"comment"},{regex:dp.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:dp.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp(this.GetKeywords(_),"gmi"),css:"func"},{regex:new RegExp(this.GetKeywords(A),"gmi"),css:"op"},{regex:new RegExp(this.GetKeywords($),"gmi"),css:"keyword"}];this.CssClass="dp-sql";this.Style=".dp-sql .func { color: #ff1493; }"+".dp-sql .op { color: #808080; }"};dp.sh.Brushes.Sql.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Sql.Aliases=["sql"];dp.sh.Brushes.Vb=function(){var $="AddHandler AddressOf AndAlso Alias And Ansi As Assembly Auto "+"Boolean ByRef Byte ByVal Call Case Catch CBool CByte CChar CDate "+"CDec CDbl Char CInt Class CLng CObj Const CShort CSng CStr CType "+"Date Decimal Declare Default Delegate Dim DirectCast Do Double Each "+"Else ElseIf End Enum Erase Error Event Exit False Finally For Friend "+"Function Get GetType GoSub GoTo Handles If Implements Imports In "+"Inherits Integer Interface Is Let Lib Like Long Loop Me Mod Module "+"MustInherit MustOverride MyBase MyClass Namespace New Next Not Nothing "+"NotInheritable NotOverridable Object On Option Optional Or OrElse "+"Overloads Overridable Overrides ParamArray Preserve Private Property "+"Protected Public RaiseEvent ReadOnly ReDim REM RemoveHandler Resume "+"Return Select Set Shadows Shared Short Single Static Step Stop String "+"Structure Sub SyncLock Then Throw To True Try TypeOf Unicode Until "+"Variant When While With WithEvents WriteOnly Xor";this.regexList=[{regex:new RegExp("'.*$","gm"),css:"comment"},{regex:dp.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:new RegExp("^\\s*#.*","gm"),css:"preprocessor"},{regex:new RegExp(this.GetKeywords($),"gm"),css:"keyword"}];this.CssClass="dp-vb"};dp.sh.Brushes.Vb.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Vb.Aliases=["vb","vb.net"];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 B(_,$){_[_.length]=$}var $=0,A=null,_=null;this.GetMatches(new RegExp("(<|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](>|>)","gm"),"cdata");this.GetMatches(new RegExp("(<|<)!--\\s*.*?\\s*--(>|>)","gm"),"comments");_=new RegExp("([:\\w-.]+)\\s*=\\s*(\".*?\"|'.*?'|\\w+)*|(\\w+)","gm");while((A=_.exec(this.code))!=null){if(A[1]==null)continue;B(this.matches,new dp.sh.Match(A[1],A.index,"attribute"));if(A[2]!=undefined)B(this.matches,new dp.sh.Match(A[2],A.index+A[0].indexOf(A[2]),"attribute-value"))}this.GetMatches(new RegExp("(<|<)/*\\?*(?!\\!)|/*\\?*(>|>)","gm"),"tag");_=new RegExp("(?:<|<)/*\\?*\\s*([:\\w-.]+)","gm");while((A=_.exec(this.code))!=null)B(this.matches,new dp.sh.Match(A[1],A.index+A[0].indexOf(A[1]),"tag-name"))}
//}}}