// ----------------------------------------------------------------------------
// markItUp! Universal MarkUp Engine, JQuery plugin
// v 1.1.0 beta
// Dual licensed under the MIT and GPL licenses.
// ----------------------------------------------------------------------------
// Copyright (C) 2007-2008 Jay Salvat
// http://markitup.jaysalvat.com/
// ----------------------------------------------------------------------------
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(3($){$.2L.Y=3(f,g){C k,u,A,I;u=A=I=l;k={B:\'\',17:\'\',T:\'\',1w:\'\',1U:o,2w:\'2s\',1j:\'~/3l/1D.15\',1c:\'\',28:\'25\',1k:o,1B:\'\',1A:\'\',1z:{},1X:{},1V:{},1T:{},2E:[{}]};$.R(k,f,g);2(!k.T){$(\'3v\').1f(3(a,b){1N=$(b).11(0).3j.3f(/(.*)3c\\.3a(\\.37)?\\.34$/);2(1N!==2g){k.T=1N[1]}})}4 G.1f(3(){C d,q,16,18,m,D,J,L,Z,1x,w,1u,K,14;d=$(G);q=G;16=[];14=l;18=m=0;D=-1;k.1c=1i(k.1c);k.1j=1i(k.1j);3 1i(a,b){2(b){4 a.W(/("|\')~\\//g,"$1"+k.T)}4 a.W(/^~\\//,k.T)}3 2C(){B=\'\';17=\'\';2(k.B){B=\'B="\'+k.B+\'"\'}7 2(d.1S("B")){B=\'B="Y\'+(d.1S("B").2y(0,1).3z())+(d.1S("B").2y(1))+\'"\'}2(k.17){17=\'O="\'+k.17+\'"\'}d.1P(\'<v \'+17+\'"></v>\');d.1P(\'<v \'+B+\' O="Y"></v>\');d.1P(\'<v O="3u"></v>\');d.2r("2q");Z=$(\'<v O="3r"></v>\').2p(d);$(1M(k.2E)).1L(Z);1x=$(\'<v O="3p"></v>\').1K(d);2(k.1k===o&&$.1a.3k!==o){1k=$(\'<v O="3i"></v>\').1K(d).1b("3d",3(e){C h=d.2a(),y=e.2d,1n,1o;1n=3(e){d.2u("2a",31.30(20,e.2d+h-y)+"2Y");4 l};1o=3(e){$("15").1I("2t",1n).1I("1t",1o);4 l};$("15").1b("2t",1n).1b("1t",1o)});1x.2n(1k)}d.23(1Q).2R(1Q);d.1b("1C",3(e,a){2(a.1r!==l){11()}2(q===$.Y.21){V(a)}});d.1h(3(){$.Y.21=G})}3 1M(b){C c=$(\'<U></U>\'),i=0;$(\'z:1Y > U\',c).2u(\'2M\',\'p\');$(b).1f(3(){C a=G,t=\'\',1m,z,j;1m=(a.12)?(a.1W||\'\')+\' [3K+\'+a.12+\']\':(a.1W||\'\');12=(a.12)?\'2J="\'+a.12+\'"\':\'\';2(a.2I){z=$(\'<z O="3J">\'+(a.2I||\'\')+\'</z>\').1L(c)}7{i++;2H(j=16.5-1;j>=0;j--){t+=16[j]+"-"}z=$(\'<z O="2G 2G\'+t+(i)+\' \'+(a.3I||\'\')+\'"><a 3H="" \'+12+\' 1m="\'+1m+\'">\'+(a.1W||\'\')+\'</a></z>\').1b("3G",3(){4 l}).2F(3(){4 l}).1t(3(){2(a.2D){3F(a.2D)()}V(a);4 l}).1Y(3(){$(\'> U\',G).3E();$(N).3D(\'2F\',3(){$(\'U U\',Z).2A()})},3(){$(\'> U\',G).2A()}).1L(c);2(a.2z){16.3C(i);$(z).2r(\'3B\').2n(1M(a.2z))}}});16.3A();4 c}3 2x(c){2(c){c=c.3w();c=c.W(/\\(\\!\\(([\\s\\S]*?)\\)\\!\\)/g,3(x,a){C b=a.1R(\'|!|\');2(I===o){4(b[1]!==2v)?b[1]:b[0]}7{4(b[1]===2v)?"":b[0]}});c=c.W(/\\[\\!\\[([\\s\\S]*?)\\]\\!\\]/g,3(x,a){C b=a.1R(\':!:\');2(14===o){4 l}1O=3t(b[0],(b[1])?b[1]:\'\');2(1O===2g){14=o}4 1O});4 c}4""}3 F(a){2($.3s(a)){a=a(L)}4 2x(a)}3 1g(a){H=F(J.H);19=F(J.19);Q=F(J.Q);M=F(J.M);2(Q!==""){p=H+Q+M}7 2(6===\'\'&&19!==\'\'){p=H+19+M}7{p=H+(a||6)+M}4{p:p,H:H,Q:Q,19:19,M:M}}3 V(a){C b,j,n,i;L=J=a;11();$.R(L,{1v:"",T:k.T,q:q,6:(6||\'\'),m:m});F(k.1B);F(J.1B);2(u===o&&A===o){F(J.3q)}$.R(L,{1v:1});2(u===o&&A===o){P=6.1R(/\\r?\\n/);2H(j=0,n=P.5,i=0;i<n;i++){2($.3o(P[i])!==\'\'){$.R(L,{1v:++j,6:P[i]});P[i]=1g(P[i]).p}7{P[i]=""}}8={p:P.3n(\'\\n\')};X=m;b=8.p.5+(($.1a.2m)?n:0)}7 2(u===o){8=1g(6);X=m+8.H.5;b=8.p.5-8.H.5-8.M.5;b-=1q(8.p)}7 2(A===o){8=1g(6);X=m;b=8.p.5;b-=1q(8.p)}7{8=1g(6);X=m+8.p.5;b=0;X-=1q(8.p)}2((6===\'\'&&8.Q===\'\')){D+=1J(8.p);X=m+8.H.5;b=8.p.5-8.H.5-8.M.5;D=d.E().1e(m,d.E().5).5;D-=1J(d.E().1e(0,m))}$.R(L,{m:m,18:18});2(8.p!==6&&14===l){2l(8.p);1H(X,b)}7{D=-1}11();$.R(L,{1v:\'\',6:6});2(u===o&&A===o){F(J.3h)}F(J.1A);F(k.1A);2(w&&k.1U){1F()}A=I=u=14=l}3 1J(a){2($.1a.2m){4 a.5-a.W(/\\n*/g,\'\').5}4 0}3 1q(a){2($.1a.2i){4 a.5-a.W(/\\r*/g,\'\').5}4 0}3 2l(a){2(N.6){C b=N.6.1E();b.2h=a}7{d.E(d.E().1e(0,m)+a+d.E().1e(m+6.5,d.E().5))}}3 1H(a,b){2(q.2e){1d=q.2e();1d.3b(o);1d.29(\'1G\',a);1d.39(\'1G\',b);1d.38()}7 2(q.2c){q.2c(a,a+b)}q.2b=18;q.1h()}3 11(){q.1h();18=q.2b;2(N.6){6=N.6.1E().2h;2($.1a.2i){C a=N.6.1E(),1p=a.36();1p.35(q);m=-1;33(1p.32(a)){1p.29(\'1G\');m++}}7{m=q.2k}}7{m=q.2k;6=d.E().1e(m,q.3e)}4 6}3 1D(){2(!w||w.2Z){2(k.1w){w=3g.2f(\'\',\'1D\',k.1w)}7{K=$(\'<2j O="2X"></2j>\');2(k.2w==\'2s\'){K.1K(1x)}7{K.2p(Z)}w=K[K.5-1].2W||2V[K.5-1]}}7 2(I===o){2(K){K.3m()}w.27();w=K=l}2(!k.1U){1F()}2(k.1w){w.1h()}}3 1F(){2(w){w.N.2f();w.N.2U(26());w.N.27()}}3 26(){2(k.1c!==\'\'){$.2o({24:\'2T\',2K:l,2B:k.1c,25:k.28+\'=\'+2S(d.E()),22:3(a){15=1i(a,1)}})}7{2(!1u){$.2o({2K:l,2B:k.1j,22:3(a){1u=1i(a,1)}})}15=1u.W(/<!-- 3x -->/g,d.E())}4 15}3 1Q(e){A=e.A;I=e.I;u=(!(e.I&&e.u))?e.u:l;$.R(L,{u:u,A:A,I:I});2(e.24===\'23\'){2(u===o){z=$("a[2J="+3y.2Q(e.1l)+"]",Z).1s(\'z\');2(z.5!==0){u=l;z.2P(\'1t\');4 l}}2(e.1l===13||e.1l===10){2(u===o){u=l;V(k.1V);4 k.1V.1y}7 2(A===o){A=l;V(k.1X);4 k.1X.1y}7{V(k.1z);4 k.1z.1y}}2(e.1l===9){2(D!==-1){11();D=d.E().5-D;1H(D,0);D=-1;4 l}7{V(k.1T);4 k.1T.1y}}}}2C()})};$.2L.2O=3(){4 G.1f(3(){$$=$(G).1I().2N(\'2q\');$$.1s(\'v\').1s(\'v.Y\').1s(\'v\').Q($$)})};$.Y=3(a){C b={1r:l};$.R(b,a);2(b.1r){4 $(b.1r).1f(3(){$(G).1h();$(G).1Z(\'1C\',[b])})}7{$(\'q\').1Z(\'1C\',[b])}}})(3L);',62,234,'||if|function|return|length|selection|else|string|||||||||||||false|caretPosition||true|block|textarea||||ctrlKey|div|previewWindow|||li|shiftKey|id|var|caretOffset|val|prepare|this|openWith|altKey|clicked|iFrame|hash|closeWith|document|class|lines|replaceWith|extend||root|ul|markup|replace|start|markItUp|header||get|key||abort|html|levels|nameSpace|scrollPosition|placeHolder|browser|bind|previewParserPath|range|substring|each|build|focus|localize|previewTemplatePath|resizeHandle|keyCode|title|mouseMove|mouseUp|rangeCopy|fixIeBug|target|parent|mouseup|template|line|previewInWindow|footer|keepDefault|onEnter|afterInsert|beforeInsert|insertion|preview|createRange|refreshPreview|character|set|unbind|fixOperaBug|insertAfter|appendTo|dropMenus|miuScript|value|wrap|keyPressed|split|attr|onTab|previewAutoRefresh|onCtrlEnter|name|onShiftEnter|hover|trigger||focused|success|keydown|type|data|renderPreview|close|previewParserVar|moveStart|height|scrollTop|setSelectionRange|clientY|createTextRange|open|null|text|msie|iframe|selectionStart|insert|opera|append|ajax|insertBefore|markItUpEditor|addClass|after|mousemove|css|undefined|previewPosition|magicMarkups|substr|dropMenu|hide|url|init|call|markupSet|click|markItUpButton|for|separator|accesskey|async|fn|display|removeClass|markItUpRemove|triggerHandler|fromCharCode|keyup|encodeURIComponent|POST|write|frame|contentWindow|markItUpPreviewFrame|px|closed|max|Math|inRange|while|js|moveToElementText|duplicate|pack|select|moveEnd|markitup|collapse|jquery|mousedown|selectionEnd|match|window|afterMultiInsert|markItUpResizeHandle|src|safari|templates|remove|join|trim|markItUpFooter|beforeMultiInsert|markItUpHeader|isFunction|prompt|markItUpContainer|script|toString|content|String|toUpperCase|pop|markItUpDropMenu|push|one|show|eval|contextmenu|href|className|markItUpSeparator|Ctrl|jQuery'.split('|'),0,{}))
// -------------------------------------------------------------------
// markItUp!
// -------------------------------------------------------------------
// Copyright (C) 2008 Jay Salvat
// http://markitup.jaysalvat.com/
// -------------------------------------------------------------------
// Textile tags example
// http://en.wikipedia.org/wiki/Textile_(markup_language)
// http://www.textism.com/
// -------------------------------------------------------------------
// Feel free to add more tags
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// Removed tags
// {name:'Heading 5', key:'5', openWith:'h5(!(([![Class]!]))!). ', placeHolder:'Your title here...' },
// {name:'Heading 6', key:'6', openWith:'h6(!(([![Class]!]))!). ', placeHolder:'Your title here...' },
// -------------------------------------------------------------------

markItUpTextile = {
	previewParserPath:	'', // path to your Textile parser
	onShiftEnter:		{keepDefault:false, replaceWith:'\n\n'},
	markupSet: [
		{name:'Heading 1', key:'1', className:"markitup_h1_button", openWith:'h1(!(([![Class]!]))!). ', placeHolder:'Your title here...' },
		{name:'Heading 2', key:'2', className:"markitup_h2_button", openWith:'h2(!(([![Class]!]))!). ', placeHolder:'Your title here...' },
		{name:'Heading 3', key:'3', className:"markitup_h3_button", openWith:'h3(!(([![Class]!]))!). ', placeHolder:'Your title here...' },
		{name:'Heading 4', key:'4', className:"markitup_h4_button", openWith:'h4(!(([![Class]!]))!). ', placeHolder:'Your title here...' },
        //{name:'Heading 5', key:'5', className:"markitup_h5_button", openWith:'h5(!(([![Class]!]))!). ', placeHolder:'Your title here...' },
        //{name:'Heading 6', key:'6', className:"markitup_h6_button", openWith:'h6(!(([![Class]!]))!). ', placeHolder:'Your title here...' },
		{name:'Paragraph', key:'P', className:"markitup_p_button", openWith:'p(!(([![Class]!]))!). '},
        {name:'Horizontal Rule', className:"markitup_hr_button", openWith:'\n---------------------------------------\n'},
		{separator:'---------------' },
		{name:'Bold', key:'B', className:"markitup_bold_button", closeWith:'*', openWith:'*'},
		{name:'Italic', key:'I', className:"markitup_italic_button", closeWith:'_', openWith:'_'},
		{name:'Stroke through', key:'S', className:"markitup_stroke_button", closeWith:'-', openWith:'-'},
		{separator:'---------------' },
		{name:'Bulleted list', className:"markitup_ulist_button", openWith:'(!(* |!|*)!)', placeHolder:'Your bullet point here...\n* Your second point here...' },
		{name:'Numeric list', className:"markitup_olist_button", openWith:'(!(# |!|#)!)', placeHolder:'Your numbered list item here...\n# Your second item here...' }, 
		{separator:'---------------' },
		{name:'Picture', className:"markitup_img_button", replaceWith:'![![URL of image:!:http://]!]([![Alternative text]!])!'}, 
		//{name:'Link', openWith:'"', closeWith:'([![Title]!])":[![Link:!:http://]!]', placeHolder:'Your text to link here...' },
		{name:'Link', className:"markitup_link_button", key:'L', openWith:'"', closeWith:'":[![URL to link:!:http://]!]', placeHolder:'Your text to link here...' },
        {separator:'---------------' },
		{name:'Quotes', className:"markitup_bq_button", key:'Q', openWith:'bq(!(([![Class]!]))!). '},
		//{name:'Code', className:"markitup_code_button", openWith:'@', closeWith:'@'},
		{separator:'---------------' },
        {name:'Templates', className:"markitup_template_button", dropMenu: [
            {name:'// TEMPLATES' },
            {name:'Simple Article 1', openWith:'h2. SubheadingGoesHere\n\nYourFirstParagraphGoesHere\n\n'},
            {name:'Simple Article 2', openWith:'YourIntroParagraphGoesHere\n\nh2. YourFirstSectionTitleHere\n\nYourFirstParagraphGoesHere\n\nh2. YourSecondSectionTitleHere\n\nEtcetera\n\n'},
            {name:'Simple Article 2 w/footnotes', openWith:'YourIntroParagraphGoesHere\n\nh2. YourFirstSectionTitleHere\n\nYourFirstParagraphGoesHere[1]\n\nh2. YourSecondSectionTitleHere\n\nEtcetera\n\n---------------------------------------\n\nfn1. YourFootnoteGoesHere'},
            {separator:'---------------' },
            {name:'Recipe', openWith:'h2. Ingredients\n\n* ingredient1\n* ingredient2\n\nh2.Preparation\n\n# Step1Instructions\n# Step2Instructions'}
          ]
        },
        {name:'Snippets', className:"markitup_snippet_button", dropMenu: [
            {name:'// SNIPPETS' },
            {name:'Credit image (generic)', openWith:'\n\n"_[![Name of image to credit:!:]!]_":[![URL of image to original image:!:http://]!] _image by [![Name of photographer:!:]!]_'},
            {name:'Credit image (Flickr)', openWith:'\n\n"_[![Name of image to credit:!:]!]_":[![URL of image on Flickr:!:http://]!] _image used under a_\n"_Creative Commons License_":http://creativecommons.org/ \n_courtesy of [![Name of photographer:!:]!] at Flickr_'},
            {name:'Add related links', openWith:'\n\n---------------------------------------\n\n*You might also be interested in:*\n\n* "":'},
            {separator:'---------------' },
            {name:'Add sport report block', openWith:'h2. [![Sport being covered:!:]!]\n\nh3. [![League/Division being covered:!:]!]\n\nYourReportGoesHere\n\n'},
                {name:'License your post', className:"markitup_snippet_button", dropMenu: [
                {name:'// CREATIVE COMMONS' },
                {name:'Attribution', openWith:'\n!/images/logos/legal/creative-commons/buttons/text-only/by-80x15.png(Some Rights Reserved - Attribution)!:http://creativecommons.org/licenses/by/3.0/\n'},
                {name:'Share Alike', openWith:'\n!/images/logos/legal/creative-commons/buttons/text-only/by-sa-80x15.png(Some Rights Reserved - Attribution, Share Alike)!:http://creativecommons.org/licenses/by-sa/3.0/\n'},
                {name:'No derivatives', openWith:'\n!/images/logos/legal/creative-commons/buttons/text-only/by-nd-80x15.png(Some Rights Reserved - Attribution, No derivatives)!:http://creativecommons.org/licenses/by-nd/3.0/\n'},
                {name:'Non-commercial', openWith:'\n!/images/logos/legal/creative-commons/buttons/text-only/by-nc-80x15.png(Some Rights Reserved - Attribution, Non-commercial)!:http://creativecommons.org/licenses/by-nc/3.0/\n'},
                {name:'Non-commercial, Share Alike', openWith:'\n!/images/logos/legal/creative-commons/buttons/text-only/by-nc-sa-80x15.png(Some Rights Reserved - Attribution, Non-commercial, Share Alike)!:http://creativecommons.org/licenses/by-nc-sa/3.0/\n'},
                {name:'Non-commercial, No Derivatives', openWith:'\n!/images/logos/legal/creative-commons/buttons/text-only/by-nc-nd-80x15.png(Some Rights Reserved - Attribution, Non-commercial, No derivatives)!:http://creativecommons.org/licenses/by-nc-nd/3.0/\n'},
                {name:'// COPYRIGHT' },
                {name:'All Rights Reserved &copy;', openWith:'\nAll Rights Reserved (c)\n'}
                
              ]
            }
          ]
        }
		//{name:'Preview', call:'preview', className:'preview'}
	]
}
