652. File Comparison Report

Produced on Mon May 12 13:06:32 2008 UTC. This report uses XHTML and CSS2, and is best viewed with a reasonably standards compliant browser such as the latest version of Firefox or Internet Explorer. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

652.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.0.5\plugins\tiny_mce\themes\advanced editor_template_src.js Thu Sep 20 08:59:24 2007 UTC
2 Dolphin-v.6.1.0\plugins\tiny_mce\themes\advanced editor_template_src.js Thu Mar 27 13:53:28 2008 UTC

652.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 256 560
Changed 232 1896
Inserted 13 20
Removed 11 73

652.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

652.4 Active regular expressions

No regular expressions were active.

652.5 Comparison detail

1   /**   1   /**
2     *   $Id:   editor_tem plate_src. js   256   200 7 -0 4 -
2 4   09 : 0 3
: 20 Z   spocke   $
  2     *   $Id:   editor_tem plate_src. js   710   200 8 -0 3 - 12   1 2
:
3 7 : 55 Z   spocke   $
3    *   3    *
4    * @author  Moxiecode   4    * @author  Moxiecode
5     *   @copyright   Copyright   ©   2004-200 7 ,   Moxiecode   Systems   AB,   All   rights   reserved.   5     *   @copyright   Copyright   ©   2004-200 8 ,   Moxiecode   Systems   AB,   All   rights   reserved.
6    */   6    */
7     7  
8   /* Import  theme spec ific langu age pack * /   8   (function( ) {
9   tinyMCE.im portThemeL anguagePac k('advance d');   9       var DO M = tinymc e.DOM, Eve nt = tinym ce.dom.Eve nt, extend  = tinymce .extend, e ach = tiny mce.each,  Cookie = t inymce.uti l.Cookie,  lastExtID,  explode =  tinymce.e xplode;
10     10  
11   var TinyMC E_Advanced Theme = {   11       // Tel l it to lo ad theme s pecific la nguage pac k(s)
12       // Pri vate theme  fields   12       tinymc e.ThemeMan ager.requi reLangPack ('advanced ');
13       _defCo lors : "00 0000,99330 0,333300,0 03300,0033 66,000080, 333399,333 333,800000 ,FF6600,80 8000,00800 0,008080,0 000FF,6666 99,808080, FF0000,FF9 900,99CC00 ,339966,33 CCCC,3366F F,800080,9 99999,FF00 FF,FFCC00, FFFF00,00F F00,00FFFF ,00CCFF,99 3366,C0C0C 0,FF99CC,F FCC99,FFFF 99,CCFFCC, CCFFFF,99C CFF,CC99FF ,FFFFFF",    
14       _autoI mportCSSCl asses : tr ue,    
15       _resiz er : {},    
16       _butto ns : [    
17           //  Control i d, button  img, butto n title, c ommand, us er_interfa ce, value    
18           [' bold', '{$ lang_bold_ img}', 'la ng_bold_de sc', 'Bold '],    
19           [' italic', ' {$lang_ita lic_img}',  'lang_ita lic_desc',  'Italic'] ,    
20           [' underline' , '{$lang_ underline_ img}', 'la ng_underli ne_desc',  'Underline '],    
21           [' strikethro ugh', 'str ikethrough .gif', 'la ng_striket rough_desc ', 'Strike through'],    
22           [' justifylef t', 'justi fyleft.gif ', 'lang_j ustifyleft _desc', 'J ustifyLeft '],    
23           [' justifycen ter', 'jus tifycenter .gif', 'la ng_justify center_des c', 'Justi fyCenter'] ,    
24           [' justifyrig ht', 'just ifyright.g if', 'lang _justifyri ght_desc',  'JustifyR ight'],    
25           [' justifyful l', 'justi fyfull.gif ', 'lang_j ustifyfull _desc', 'J ustifyFull '],    
26           [' bullist',  'bullist.g if', 'lang _bullist_d esc', 'Ins ertUnorder edList'],    
27           [' numlist',  'numlist.g if', 'lang _numlist_d esc', 'Ins ertOrdered List'],    
28           [' outdent',  'outdent.g if', 'lang _outdent_d esc', 'Out dent'],    
29           [' indent', ' indent.gif ', 'lang_i ndent_desc ', 'Indent '],    
30           [' cut', 'cut .gif', 'la ng_cut_des c', 'Cut'] ,    
31           [' copy', 'co py.gif', ' lang_copy_ desc', 'Co py'],    
32           [' paste', 'p aste.gif',  'lang_pas te_desc',  'Paste'],    
33           [' undo', 'un do.gif', ' lang_undo_ desc', 'Un do'],    
34           [' redo', 're do.gif', ' lang_redo_ desc', 'Re do'],    
35           [' link', 'li nk.gif', ' lang_link_ desc', 'mc eLink', tr ue],    
36           [' unlink', ' unlink.gif ', 'lang_u nlink_desc ', 'unlink '],    
37           [' image', 'i mage.gif',  'lang_ima ge_desc',  'mceImage' , true],    
38           [' cleanup',  'cleanup.g if', 'lang _cleanup_d esc', 'mce Cleanup'],    
39           [' help', 'he lp.gif', ' lang_help_ desc', 'mc eHelp'],    
40           [' code', 'co de.gif', ' lang_theme _code_desc ', 'mceCod eEditor'],    
41           [' hr', 'hr.g if', 'lang _theme_hr_ desc', 'in serthorizo ntalrule'] ,    
42           [' removeform at', 'remo veformat.g if', 'lang _theme_rem oveformat_ desc', 're moveformat '],    
43           [' sub', 'sub .gif', 'la ng_theme_s ub_desc',  'subscript '],    
44           [' sup', 'sup .gif', 'la ng_theme_s up_desc',  'superscri pt'],    
45           [' forecolor' , 'forecol or.gif', ' lang_theme _forecolor _desc', 'f orecolor',  true],    
46           [' forecolorp icker', 'f orecolor.g if', 'lang _theme_for ecolor_des c', 'forec olorpicker ', true],    
47           [' backcolor' , 'backcol or.gif', ' lang_theme _backcolor _desc', 'H iliteColor ', true],    
48           [' backcolorp icker', 'b ackcolor.g if', 'lang _theme_bac kcolor_des c', 'backc olorpicker ', true],    
49           [' charmap',  'charmap.g if', 'lang _theme_cha rmap_desc' , 'mceChar Map'],    
50           [' visualaid' , 'visuala id.gif', ' lang_theme _visualaid _desc', 'm ceToggleVi sualAid'],    
51           [' anchor', ' anchor.gif ', 'lang_t heme_ancho r_desc', ' mceInsertA nchor'],    
52           [' newdocumen t', 'newdo cument.gif ', 'lang_n ewdocument _desc', 'm ceNewDocum ent']    
53       ],    
54     13  
55       _butto nMap : 'an chor,backc olor,bold, bullist,ch armap,clea nup,code,c opy,cut,fo recolor,he lp,hr,imag e,indent,i talic,just ifycenter, justifyful l,justifyl eft,justif yright,lin k,newdocum ent,numlis t,outdent, paste,redo ,removefor mat,strike through,su b,sup,unde rline,undo ,unlink,vi sualaid,ad vhr,ltr,rt l,emotions ,flash,ful lpage,full screen,ies pell,inser tdate,inse rttime,pas tetext,pas teword,sel ectall,pre view,print ,save,repl ace,search ,table,cel l_props,de lete_col,d elete_row, col_after, col_before ,row_after ,row_befor e,merge_ce lls,row_pr ops,split_ cells,dele te_table',   14       tinymc e.create(' tinymce.th emes.Advan cedTheme',  {
56     15           //  Control n ame lookup , format:  title, com mand
57       /**   16           co ntrols : {
58        * Ret urns HTML  code for t he specifi ced contro l.   17                bold : [ 'bold_desc ', 'Bold'] ,
59        */   18                italic :  ['italic_ desc', 'It alic'],
60       getCon trolHTML :  function( button_nam e) {   19                underlin e : ['unde rline_desc ', 'Underl ine'],
61           va r i, x, bu t;   20                striketh rough : [' striketrou gh_desc',  'Strikethr ough'],
62     21                justifyl eft : ['ju stifyleft_ desc', 'Ju stifyLeft' ],
63           //  Lookup bu tton in bu tton list   22                justifyc enter : [' justifycen ter_desc',  'JustifyC enter'],
64           fo r (i=0; i< TinyMCE_Ad vancedThem e._buttons .length; i ++) {   23                justifyr ight : ['j ustifyrigh t_desc', ' JustifyRig ht'],
65                but = Ti nyMCE_Adva ncedTheme. _buttons[i ];   24                justifyf ull : ['ju stifyfull_ desc', 'Ju stifyFull' ],
66     25                bullist  : ['bullis t_desc', ' InsertUnor deredList' ],
67                if (but[ 0] == butt on_name &&  (button_n ame == "fo recolor" | | button_n ame == "ba ckcolor"))   26                numlist  : ['numlis t_desc', ' InsertOrde redList'],
68                    retu rn tinyMCE .getMenuBu ttonHTML(b ut[0], but [2], '{$th emeurl}/im ages/' + b ut[1], but [3] + "Men u", but[3] , (but.len gth > 4 ?  but[4] : f alse), (bu t.length >  5 ? but[5 ] : null)) ;   27                outdent  : ['outden t_desc', ' Outdent'],
69     28                indent :  ['indent_ desc', 'In dent'],
70                if (but[ 0] == butt on_name)   29                cut : [' cut_desc',  'Cut'],
71                    retu rn tinyMCE .getButton HTML(but[0 ], but[2],  '{$themeu rl}/images /' + but[1 ], but[3],  (but.leng th > 4 ? b ut[4] : fa lse), (but .length >  5 ? but[5]  : null));   30                copy : [ 'copy_desc ', 'Copy'] ,
72           }   31                paste :  ['paste_de sc', 'Past e'],
73     32                undo : [ 'undo_desc ', 'Undo'] ,
74           //  Custom co ntrolls ot her than b uttons   33                redo : [ 'redo_desc ', 'Redo'] ,
75           sw itch (butt on_name) {   34                link : [ 'link_desc ', 'mceLin k'],
76                case "fo rmatselect ":   35                unlink :  ['unlink_ desc', 'un link'],
77                    var  html = '<s elect id=" {$editor_i d}_formatS elect" nam e="{$edito r_id}_form atSelect"  onfocus="t inyMCE.add SelectAcce ssibility( event, thi s, window) ;" onchang e="tinyMCE .execInsta nceCommand (\'{$edito r_id}\',\' FormatBloc k\',false, this.optio ns[this.se lectedInde x].value); " class="m ceSelectLi st">';   36                image :  ['image_de sc', 'mceI mage'],
78                    var  formats =  tinyMCE.ge tParam("th eme_advanc ed_blockfo rmats", "p ,address,p re,h1,h2,h 3,h4,h5,h6 ", true).s plit(',');   37                cleanup  : ['cleanu p_desc', ' mceCleanup '],
79                    var  lookup = [   38                help : [ 'help_desc ', 'mceHel p'],
80                         ['p', '{$l ang_theme_ paragraph} '],   39                code : [ 'code_desc ', 'mceCod eEditor'],
81                         ['address' , '{$lang_ theme_addr ess}'],   40                hr : ['h r_desc', ' InsertHori zontalRule '],
82                         ['pre', '{ $lang_them e_pre}'],   41                removefo rmat : ['r emoveforma t_desc', ' RemoveForm at'],
83                         ['h1', '{$ lang_theme _h1}'],   42                sub : [' sub_desc',  'subscrip t'],
84                         ['h2', '{$ lang_theme _h2}'],   43                sup : [' sup_desc',  'superscr ipt'],
85                         ['h3', '{$ lang_theme _h3}'],   44                forecolo r : ['fore color_desc ', 'ForeCo lor'],
86                         ['h4', '{$ lang_theme _h4}'],   45                forecolo rpicker :  ['forecolo r_desc', ' mceForeCol or'],
87                         ['h5', '{$ lang_theme _h5}'],   46                backcolo r : ['back color_desc ', 'Hilite Color'],
88                         ['h6', '{$ lang_theme _h6}'],   47                backcolo rpicker :  ['backcolo r_desc', ' mceBackCol or'],
89                         ['div', '{ $lang_them e_div}'],   48                charmap  : ['charma p_desc', ' mceCharMap '],
90                         ['blockquo te', '{$la ng_theme_b lockquote} '],   49                visualai d : ['visu alaid_desc ', 'mceTog gleVisualA id'],
91                         ['code', ' {$lang_the me_code}'] ,   50                anchor :  ['anchor_ desc', 'mc eInsertAnc hor'],
92                         ['dt', '{$ lang_theme _dt}'],   51                newdocum ent : ['ne wdocument_ desc', 'mc eNewDocume nt'],
93                         ['dd', '{$ lang_theme _dd}'],   52                blockquo te : ['blo ckquote_de sc', 'mceB lockQuote' ]
94                         ['samp', ' {$lang_the me_samp}']    
95                    ];    
96      
97                    html  += '<opti on value=" ">{$lang_t heme_block }</option> ';    
98      
99                    // B uild forma t select    
100                    for  (var i=0;  i<formats. length; i+ +) {    
101                         for (var x =0; x<look up.length;  x++) {    
102                             if (fo rmats[i] = = lookup[x ][0])    
103                                 ht ml += '<op tion value ="&lt;' +  lookup[x][ 0] + '&gt; ">' + look up[x][1] +  '</option >';    
104                         }    
105                    }    
106      
107                    html  += '</sel ect>';    
108      
109                    retu rn html;    
110      
111                case "st yleselect" :    
112                    retu rn '<selec t id="{$ed itor_id}_s tyleSelect " onmoused own="tinyM CE.themes. advanced._ setupCSSCl asses(\'{$ editor_id} \');" name ="{$editor _id}_style Select" on focus="tin yMCE.addSe lectAccess ibility(ev ent,this,w indow);" o nchange="t inyMCE.exe cInstanceC ommand(\'{ $editor_id }\',\'mceS etCSSClass \',false,t his.option s[this.sel ectedIndex ].value);"  class="mc eSelectLis t">{$style _select_op tions}</se lect>';    
113      
114                case "fo ntselect":    
115                    var  fontHTML =  '<select  id="{$edit or_id}_fon tNameSelec t" name="{ $editor_id }_fontName Select" on focus="tin yMCE.addSe lectAccess ibility(ev ent, this,  window);"  onchange= "tinyMCE.e xecInstanc eCommand(\ '{$editor_ id}\',\'Fo ntName\',f alse,this. options[th is.selecte dIndex].va lue);" cla ss="mceSel ectList">< option val ue="">{$la ng_theme_f ontdefault }</option> ';    
116                    var  iFonts = ' Arial=aria l,helvetic a,sans-ser if;Courier  New=couri er new,cou rier,monos pace;Georg ia=georgia ,times new  roman,tim es,serif;T ahoma=taho ma,arial,h elvetica,s ans-serif; Times New  Roman=time s new roma n,times,se rif;Verdan a=verdana, arial,helv etica,sans -serif;Imp act=impact ;WingDings =wingdings ';    
117                    var  nFonts = ' Andale Mon o=andale m ono,times; Arial=aria l,helvetic a,sans-ser if;Arial B lack=arial  black,ava nt garde;B ook Antiqu a=book ant iqua,palat ino;Comic  Sans MS=co mic sans m s,sand;Cou rier New=c ourier new ,courier;G eorgia=geo rgia,palat ino;Helvet ica=helvet ica;Impact =impact,ch icago;Symb ol=symbol; Tahoma=tah oma,arial, helvetica, sans-serif ;Terminal= terminal,m onaco;Time s New Roma n=times ne w roman,ti mes;Trebuc het MS=tre buchet ms, geneva;Ver dana=verda na,geneva; Webdings=w ebdings;Wi ngdings=wi ngdings,za pf dingbat s';    
118                    var  fonts = ti nyMCE.getP aram("them e_advanced _fonts", n Fonts).spl it(';');    
119                    for  (i=0; i<fo nts.length ; i++) {    
120                         if (fonts[ i] != '')  {    
121                             var pa rts = font s[i].split ('=');    
122                             fontHT ML += '<op tion value ="' + part s[1] + '"> ' + parts[ 0] + '</op tion>';    
123                         }    
124                    }    
125      
126                    font HTML += '< /select>';    
127                    retu rn fontHTM L;    
128      
129                case "fo ntsizesele ct":    
130                    retu rn '<selec t id="{$ed itor_id}_f ontSizeSel ect" name= "{$editor_ id}_fontSi zeSelect"  onfocus="t inyMCE.add SelectAcce ssibility( event, thi s, window) ;" onchang e="tinyMCE .execInsta nceCommand (\'{$edito r_id}\',\' FontSize\' ,false,thi s.options[ this.selec tedIndex]. value);" c lass="mceS electList" >'+    
131                             '<opti on value=" 0">{$lang_ theme_font _size}</op tion>'+    
132                             '<opti on value=" 1">1 (8 pt )</option> '+    
133                             '<opti on value=" 2">2 (10 p t)</option >'+    
134                             '<opti on value=" 3">3 (12 p t)</option >'+    
135                             '<opti on value=" 4">4 (14 p t)</option >'+    
136                             '<opti on value=" 5">5 (18 p t)</option >'+    
137                             '<opti on value=" 6">6 (24 p t)</option >'+    
138                             '<opti on value=" 7">7 (36 p t)</option >'+    
139                             '</sel ect>';    
140      
141                case "|" :    
142                case "se parator":    
143                    retu rn '<img s rc="{$them eurl}/imag es/separat or.gif" wi dth="2" he ight="20"  class="mce SeparatorL ine" alt=" " />';    
144      
145                case "sp acer":    
146                    retu rn '<img s rc="{$them eurl}/imag es/separat or.gif" wi dth="2" he ight="15"  border="0"  class="mc eSeparator Line" styl e="vertica l-align: m iddle" alt ="" />';    
147      
148                case "ro wseparator ":    
149                    retu rn '<br /> ';    
150           }    
151      
152           re turn "";    
153       },   53           },
154     54  
155       /**   55           st ateControl s : ['bold ', 'italic ', 'underl ine', 'str ikethrough ', 'bullis t', 'numli st', 'just ifyleft',  'justifyce nter', 'ju stifyright ', 'justif yfull', 's ub', 'sup' , 'blockqu ote'],
156        * The me specifi c execcomm and handli ng.    
157        */    
158       execCo mmand : fu nction(edi tor_id, el ement, com mand, user _interface , value) {    
159           sw itch (comm and) {    
160                case 'mc eHelp':    
161                    tiny MCE.openWi ndow({    
162                         file : 'ab out.htm',    
163                         width : 48 0,    
164                         height : 3 80    
165                    }, {    
166                         tinymce_ve rsion : ti nyMCE.majo rVersion +  "." + tin yMCE.minor Version,    
167                         tinymce_re leasedate  : tinyMCE. releaseDat e,    
168                         inline : " yes"    
169                    });    
170                return t rue;    
171     56  
172                case "mc eLink":   57           in it : funct ion(ed, ur l) {
173                    var  inst = tin yMCE.getIn stanceById (editor_id );   58                var t =  this, s, v ;
174                    var  doc = inst .getDoc();    
175                    var  selectedTe xt = "";    
176     59       
177                    if ( tinyMCE.is MSIE) {   60                t.editor  = ed;
178                         var rng =  doc.select ion.create Range();   61                t.url =  url;
179                         selectedTe xt = rng.t ext;   62                t.onReso lveName =  new tinymc e.util.Dis patcher(th is);
180                    } el se    
181                         selectedTe xt = inst. getSel().t oString();    
182     63  
183                    if ( !tinyMCE.l inkElement ) {   64                // Defau lt setting s
184                         if ((tinyM CE.selecte dElement.n odeName.to LowerCase( ) != "img" ) && (sele ctedText.l ength <= 0 ))   65                t.settin gs = s = e xtend({
185                             return  true;   66                    them e_advanced _path : tr ue,
186                    }   67                    them e_advanced _toolbar_l ocation :  'bottom',
187     68                    them e_advanced _buttons1  : "bold,it alic,under line,strik ethrough,| ,justifyle ft,justify center,jus tifyright, justifyful l,|,styles elect,form atselect",
188                    var  href = "",  target =  "", title  = "", oncl ick = "",  action = " insert", s tyle_class  = "";   69                    them e_advanced _buttons2  : "bullist ,numlist,| ,outdent,i ndent,|,un do,redo,|, link,unlin k,anchor,i mage,clean up,help,co de",
189     70                    them e_advanced _buttons3  : "hr,remo veformat,v isualaid,| ,sub,sup,| ,charmap",
190                    if ( tinyMCE.se lectedElem ent.nodeNa me.toLower Case() ==  "a")   71                    them e_advanced _blockform ats : "p,a ddress,pre ,h1,h2,h3, h4,h5,h6",
191                         tinyMCE.li nkElement  = tinyMCE. selectedEl ement;   72                    them e_advanced _toolbar_a lign : "ce nter",
192     73                    them e_advanced _fonts : " Andale Mon o=andale m ono,times; Arial=aria l,helvetic a,sans-ser if;Arial B lack=arial  black,ava nt garde;B ook Antiqu a=book ant iqua,palat ino;Comic  Sans MS=co mic sans m s,sans-ser if;Courier  New=couri er new,cou rier;Georg ia=georgia ,palatino; Helvetica= helvetica; Impact=imp act,chicag o;Symbol=s ymbol;Taho ma=tahoma, arial,helv etica,sans -serif;Ter minal=term inal,monac o;Times Ne w Roman=ti mes new ro man,times; Trebuchet  MS=trebuch et ms,gene va;Verdana =verdana,g eneva;Webd ings=webdi ngs;Wingdi ngs=wingdi ngs,zapf d ingbats",
193                    // I s anchor n ot a link   74                    them e_advanced _font_size s : "1,2,3 ,4,5,6,7",
194                    if ( tinyMCE.li nkElement  != null &&  tinyMCE.g etAttrib(t inyMCE.lin kElement,  'href') ==  "")   75                    them e_advanced _more_colo rs : 1,
195                         tinyMCE.li nkElement  = null;   76                    them e_advanced _row_heigh t : 23,
196     77                    them e_advanced _resize_ho rizontal :  1,
197                    if ( tinyMCE.li nkElement)  {   78                    them e_advanced _resizing_ use_cookie  : 1
198                         href = tin yMCE.getAt trib(tinyM CE.linkEle ment, 'hre f');   79                }, ed.se ttings);
199                         target = t inyMCE.get Attrib(tin yMCE.linkE lement, 't arget');    
200                         title = ti nyMCE.getA ttrib(tiny MCE.linkEl ement, 'ti tle');    
201                         onclick =  tinyMCE.ge tAttrib(ti nyMCE.link Element, ' onclick');    
202                         style_clas s = tinyMC E.getAttri b(tinyMCE. linkElemen t, 'class' );    
203     80  
204                         // Try old  onclick t o if copy/ pasted con tent   81                if ((v =  s.theme_a dvanced_pa th_locatio n) && v !=  'none')
205                         if (onclic k == "")   82                    s.th eme_advanc ed_statusb ar_locatio n = s.them e_advanced _path_loca tion;
206                             onclic k = tinyMC E.getAttri b(tinyMCE. linkElemen t, 'onclic k');    
207     83  
208                         onclick =  tinyMCE.cl eanupEvent Str(onclic k);   84                if (s.th eme_advanc ed_statusb ar_locatio n == 'none ')
    85                    s.th eme_advanc ed_statusb ar_locatio n = 0;
209     86  
210                         href = eva l(tinyMCE. settings[' urlconvert er_callbac k'] + "(hr ef, tinyMC E.linkElem ent, true) ;");   87                // Init  editor
211     88                ed.onIni t.add(func tion() {
212                         // Use mce _href if d efined   89                    ed.o nNodeChang e.add(t._n odeChanged , t);
213                         mceRealHre f = tinyMC E.getAttri b(tinyMCE. linkElemen t, 'mce_hr ef');   90                    ed.d om.loadCSS (ed.baseUR I.toAbsolu te("themes /advanced/ skins/" +  ed.setting s.skin + " /content.c ss"));
214                         if (mceRea lHref != " ") {   91                 });
215                             href =  mceRealHr ef;    
216      
217                             if (ti nyMCE.getP aram('conv ert_urls') )    
218                                 hr ef = eval( tinyMCE.se ttings['ur lconverter _callback' ] + "(href , tinyMCE. linkElemen t, true);" );    
219                         }    
220      
221                         action = " update";    
222                    }    
223  
   
224                    var  template =  new Array ();    
225     92  
226                    temp late['file '] = 'link .htm';   93                ed.onSet ProgressSt ate.add(fu nction(ed,  b, ti) {
227                    temp late['widt h'] = 310;   94                    var  co, id = e d.id, tb;
228                    temp late['heig ht'] = 200 ;    
229     95  
230                    // L anguage sp ecific wid th and hei ght addons   96                    if ( b) {
231                    temp late['widt h'] += tin yMCE.getLa ng('lang_i nsert_link _delta_wid th', 0);   97                         t.progress Timer = se tTimeout(f unction()  {
232                    temp late['heig ht'] += ti nyMCE.getL ang('lang_ insert_lin k_delta_he ight', 0);   98                             co = e d.getConta iner();
    99                             co = c o.insertBe fore(DOM.c reate('DIV ', {style  : 'positio n:relative '}), co.fi rstChild);
    100                             tb = D OM.get(ed. id + '_tbl ');
233     101  
234                    if ( inst.setti ngs['inser tlink_call back']) {   102                             DOM.ad d(co, 'div ', {id : i d + '_bloc ker', 'cla ss' : 'mce Blocker',  style : {w idth : tb. clientWidt h + 2, hei ght : tb.c lientHeigh t + 2}});
235                         var return Val = eval (inst.sett ings['inse rtlink_cal lback'] +  "(href, ta rget, titl e, onclick , action,  style_clas s);");   103                             DOM.ad d(co, 'div ', {id : i d + '_prog ress', 'cl ass' : 'mc eProgress' , style :  {left : tb .clientWid th / 2, to p : tb.cli entHeight  / 2}});
236                         if (return Val && ret urnVal['hr ef'])   104                         }, ti || 0 );
237                             TinyMC E_Advanced Theme._ins ertLink(re turnVal['h ref'], ret urnVal['ta rget'], re turnVal['t itle'], re turnVal['o nclick'],  returnVal[ 'style_cla ss']);    
238                    } el se {   105                    } el se {
239                         tinyMCE.op enWindow(t emplate, { href : hre f, target  : target,  title : ti tle, oncli ck : oncli ck, action  : action,  className  : style_c lass, inli ne : "yes" });   106                         DOM.remove (id + '_bl ocker');
    107                         DOM.remove (id + '_pr ogress');
    108                         clearTimeo ut(t.progr essTimer);
240                    }   109                    }
    110                });
241     111  
242                    retu rn true;   112                DOM.load CSS(ed.bas eURI.toAbs olute(s.ed itor_css | | "themes/ advanced/s kins/" + e d.settings .skin + "/ ui.css"));
243     113  
244                case "mc eImage":   114                if (s.sk in_variant )
245                    var  src = "",  alt = "",  border = " ", hspace  = "", vspa ce = "", w idth = "",  height =  "", align  = "";   115                    DOM. loadCSS(ed .baseURI.t oAbsolute( s.editor_c ss || "the mes/advanc ed/skins/"  + ed.sett ings.skin  + "/ui_" +  s.skin_va riant + ". css"));
246                    var  title = "" , onmouseo ver = "",  onmouseout  = "", act ion = "ins ert";   116           },
247                    var  img = tiny MCE.imgEle ment;    
248                    var  inst = tin yMCE.getIn stanceById (editor_id );    
249     117  
250                    if ( tinyMCE.se lectedElem ent != nul l && tinyM CE.selecte dElement.n odeName.to LowerCase( ) == "img" ) {   118           cr eateContro l : functi on(n, cf)  {
251                         img = tiny MCE.select edElement;   119                var cd,  c;
252                         tinyMCE.im gElement =  img;    
253                    }    
254     120  
255                    if ( img) {   121                if (c =  cf.createC ontrol(n))
256                         // Is it a  internal  MCE visual  aid image , then ski p this one .   122                     return   c ;
257                         if (tinyMC E.getAttri b(img, 'na me').index Of('mce_')  == 0)    
258                              return   true ;    
259     123  
260                         src = tiny MCE.getAtt rib(img, ' src');   124                switch ( n) {
261                         alt = tiny MCE.getAtt rib(img, ' alt');   125                    case  "stylesel ect":
    126                         return thi s._createS tyleSelect ();
262     127  
263                         // Try pol ling out t he title   128                    case  "formatse lect":
264                         if (alt ==  "")   129                         return thi s._createB lockFormat s();
265                             alt =  tinyMCE.ge tAttrib(im g, 'title' );    
266     130  
267                         // Fix wid th/height  attributes  if the st yles is sp ecified   131                    case  "fontsele ct":
268                         if (tinyMC E.isGecko)  {   132                         return thi s._createF ontSelect( );
269                             var w  = img.styl e.width;    
270                             if (w  != null &&  w != "")    
271                                 im g.setAttri bute("widt h", w);    
272     133  
273                             var h  = img.styl e.height;   134                    case  "fontsize select":
274                             if (h  != null &&  h != "")   135                         return thi s._createF ontSizeSel ect();
275                                 im g.setAttri bute("heig ht", h);    
276                         }    
277     136  
278                         border = t inyMCE.get Attrib(img , 'border' );   137                    case  "forecolo r":
279                         hspace = t inyMCE.get Attrib(img , 'hspace' );   138                         return thi s._createF oreColorMe nu();
280                         vspace = t inyMCE.get Attrib(img , 'vspace' );    
281                         width = ti nyMCE.getA ttrib(img,  'width');    
282                         height = t inyMCE.get Attrib(img , 'height' );    
283                         align = ti nyMCE.getA ttrib(img,  'align');    
284                         onmouseove r = tinyMC E.getAttri b(img, 'on mouseover' );    
285                         onmouseout  = tinyMCE .getAttrib (img, 'onm ouseout');    
286                         title = ti nyMCE.getA ttrib(img,  'title');    
287     139  
288                         // Is real y specifie d?   140                    case  "backcolo r":
289                         if (tinyMC E.isMSIE)  {   141                         return thi s._createB ackColorMe nu();
290                             width  = img.attr ibutes['wi dth'].spec ified ? wi dth : "";    
291                             height  = img.att ributes['h eight'].sp ecified ?  height : " ";    
292                         }   142                }
293     143  
294                         //onmouseo ver = tiny MCE.getIma geSrc(tiny MCE.cleanu pEventStr( onmouseove r));   144                if ((cd  = this.con trols[n]))
295                         //onmouseo ut = tinyM CE.getImag eSrc(tinyM CE.cleanup EventStr(o nmouseout) );   145                    retu rn cf.crea teButton(n , {title :  "advanced ." + cd[0] , cmd : cd [1], ui :  cd[2], val ue : cd[3] });
296  
  146            },
297                         src = eval (tinyMCE.s ettings['u rlconverte r_callback '] + "(src , img, tru e);");    
298     147  
299                         // Use mce _src if de fined   148           ex ecCommand  : function (cmd, ui,  val) {
300                         mceRealSrc  = tinyMCE .getAttrib (img, 'mce _src');   149                var f =  this['_' +  cmd];
301                         if (mceRea lSrc != "" ) {    
302                             src =  mceRealSrc ;    
303     150  
304                             if (ti nyMCE.getP aram('conv ert_urls') )   151                if (f) {
305                                 sr c = eval(t inyMCE.set tings['url converter_ callback']  + "(src,  img, true) ;");   152                    f.ca ll(this, u i, val);
    153                    retu rn true;
306                         }   154                }
307     155  
308                         //if (onmo useover !=  "")   156                return f alse;
309                         //  onmous eover = ev al(tinyMCE .settings[ 'urlconver ter_callba ck'] + "(o nmouseover , img, tru e);");   157           },
310     158  
311                         //if (onmo useout !=  "")   159           _i mportClass es : funct ion() {
312                         //  onmous eout = eva l(tinyMCE. settings[' urlconvert er_callbac k'] + "(on mouseout,  img, true) ;");   160                var ed =  this.edit or, c = ed .controlMa nager.get( 'stylesele ct');
313     161  
314                         action = " update";   162                if (c.ge tLength()  == 0) {
    163                    each (ed.dom.ge tClasses() , function (o) {
    164                         c.add(o['c lass'], o[ 'class']);
    165                    });
315                    }   166                }
    167           },
316     168  
317                    var  template =  new Array ();   169           _c reateStyle Select : f unction(n)  {
318     170                var t =  this, ed =  t.editor,  cf = ed.c ontrolMana ger, c = c f.createLi stBox('sty leselect',  {
319                    temp late['file '] = 'imag e.htm?src= {$src}';   171                    titl e : 'advan ced.style_ select',
320                    temp late['widt h'] = 355;   172                    onse lect : fun ction(v) {
321                    temp late['heig ht'] = 265  + (tinyMC E.isMSIE ?  25 : 0);   173                         if (c.sele ctedValue  === v) {
322     174                             ed.exe cCommand(' mceSetStyl eInfo', 0,  {command  : 'removef ormat'});
323                    // L anguage sp ecific wid th and hei ght addons   175                             c.sele ct();
324                    temp late['widt h'] += tin yMCE.getLa ng('lang_i nsert_imag e_delta_wi dth', 0);   176                             return  false;
325                    temp late['heig ht'] += ti nyMCE.getL ang('lang_ insert_ima ge_delta_h eight', 0) ;    
326      
327                    if ( inst.setti ngs['inser timage_cal lback']) {    
328                         var return Val = eval (inst.sett ings['inse rtimage_ca llback'] +  "(src, al t, border,  hspace, v space, wid th, height , align, t itle, onmo useover, o nmouseout,  action);" );    
329                         if (return Val && ret urnVal['sr c'])    
330                             TinyMC E_Advanced Theme._ins ertImage(r eturnVal[' src'], ret urnVal['al t'], retur nVal['bord er'], retu rnVal['hsp ace'], ret urnVal['vs pace'], re turnVal['w idth'], re turnVal['h eight'], r eturnVal[' align'], r eturnVal[' title'], r eturnVal[' onmouseove r'], retur nVal['onmo useout']);    
331                    } el se   177                         } else
332                         tinyMCE.op enWindow(t emplate, { src : src,  alt : alt , border :  border, h space : hs pace, vspa ce : vspac e, width :  width, he ight : hei ght, align  : align,  title : ti tle, onmou seover : o nmouseover , onmouseo ut : onmou seout, act ion : acti on, inline  : "yes"}) ;   178                             ed.exe cCommand(' mceSetCSSC lass', 0,  v);
333      
334                    retu rn true;    
335      
336                case "fo recolor":    
337                    var  fcp = new  TinyMCE_La yer(editor _id + '_fc Preview',  false), p,  img, elm;    
338      
339                    Tiny MCE_Advanc edTheme._h ideMenus(e ditor_id);    
340      
341                    if ( !fcp.exist s()) {    
342                         fcp.create ('div', 'm ceColorPre view', doc ument.getE lementById (editor_id  + '_toolb ar'));    
343                         elm = fcp. getElement ();    
344                         elm._edito r_id = edi tor_id;    
345                         elm._comma nd = "fore color";    
346                         elm._switc hId = edit or_id + "_ forecolor" ;    
347                         tinyMCE.ad dEvent(elm , 'click',  TinyMCE_A dvancedThe me._handle MenuEvent) ;    
348                         tinyMCE.ad dEvent(elm , 'mouseov er', TinyM CE_Advance dTheme._ha ndleMenuEv ent);    
349                         tinyMCE.ad dEvent(elm , 'mouseou t', TinyMC E_Advanced Theme._han dleMenuEve nt);    
350                    }   179                    }
    180                });
351     181  
352                    img  = tinyMCE. selectNode s(document .getElemen tById(edit or_id + "_ forecolor" ), functio n(n) {retu rn n.nodeN ame == "IM G";})[0];   182                each(ed. getParam(' theme_adva nced_style s', '', 'h ash'), fun ction(v, k ) {
353                    p =  tinyMCE.ge tAbsPositi on(img, do cument.get ElementByI d(editor_i d + '_tool bar'));   183                    if ( v)
354     184                         c.add(t.ed itor.trans late(k), v );
355                    fcp. moveTo(p.a bsLeft, p. absTop);   185                });
356                    fcp. getElement ().style.b ackgroundC olor = val ue != null  ? value :  tinyMCE.g etInstance ById(edito r_id).fore Color;    
357                    fcp. show();    
358      
359                    retu rn false;    
360      
361                case "fo recolorpic ker":    
362                    this ._pickColo r(editor_i d, 'foreco lor');    
363                    retu rn true;    
364      
365                case "fo recolorMen u":    
366                    Tiny MCE_Advanc edTheme._h ideMenus(e ditor_id);    
367      
368                    // C reate colo r layer    
369                    var  ml = new T inyMCE_Lay er(editor_ id + '_fcM enu');    
370      
371                    if ( !ml.exists ())    
372                         ml.create( 'div', 'mc eMenu', do cument.bod y, TinyMCE _AdvancedT heme._getC olorHTML(e ditor_id,  'theme_adv anced_text _colors',  'forecolor '));    
373      
374                    tiny MCE.switch Class(edit or_id + '_ forecolor' , 'mceMenu ButtonFocu s');    
375                    ml.m oveRelativ eTo(docume nt.getElem entById(ed itor_id +  "_forecolo r"), 'bl') ;    
376      
377                    ml.m oveBy(tiny MCE.isMSIE  && !tinyM CE.isOpera  ? -1 : 1,  -1);    
378     186  
379                    if ( tinyMCE.is Opera)   187                c.onPost Render.add (function( ed, n) {
380                         ml.moveBy( 0, -2);   188                    Even t.add(n, ' focus', t. _importCla sses, t);
    189                    Even t.add(n, ' mousedown' , t._impor tClasses,  t);
    190                });
381     191  
382                    ml.s how();   192                 return   c ;
383                 return   true ;   193           },
384     194  
385                case "Hi liteColor" :   195           _c reateFontS elect : fu nction() {
386                    var  bcp = new  TinyMCE_La yer(editor _id + '_bc Preview',  false), p,  img;   196                var c, t  = this, e d = t.edit or;
387     197  
388                    Tiny MCE_Advanc edTheme._h ideMenus(e ditor_id);   198                c = ed.c ontrolMana ger.create ListBox('f ontselect' , {title :  'advanced .fontdefau lt', cmd :  'FontName '});
389     199  
390                    if ( !bcp.exist s()) {   200                each(ed. getParam(' theme_adva nced_fonts ', t.setti ngs.theme_ advanced_f onts, 'has h'), funct ion(v, k)  {
391                         bcp.create ('div', 'm ceColorPre view', doc ument.getE lementById (editor_id  + '_toolb ar'));   201                    c.ad d(ed.trans late(k), v , {style :  v.indexOf ('dings')  == -1 ? 'f ont-family :' + v : ' '});
392                         elm = bcp. getElement ();   202                 });
393                         elm._edito r_id = edi tor_id;    
394                         elm._comma nd = "Hili teColor";    
395                         elm._switc hId = edit or_id + "_ backcolor" ;    
396                         tinyMCE.ad dEvent(elm , 'click',  TinyMCE_A dvancedThe me._handle MenuEvent) ;    
397                         tinyMCE.ad dEvent(elm , 'mouseov er', TinyM CE_Advance dTheme._ha ndleMenuEv ent);    
398                         tinyMCE.ad dEvent(elm , 'mouseou t', TinyMC E_Advanced Theme._han dleMenuEve nt);    
399                    }    
400  
   
401                    img  = tinyMCE. selectNode s(document .getElemen tById(edit or_id + "_ backcolor" ), functio n(n) {retu rn n.nodeN ame == "IM G";})[0];    
402                    p =  tinyMCE.ge tAbsPositi on(img, do cument.get ElementByI d(editor_i d + '_tool bar'));    
403     203  
404                    bcp. moveTo(p.a bsLeft, p. absTop);   204                return c ;
405                    bcp. getElement ().style.b ackgroundC olor = val ue != null  ? value :  tinyMCE.g etInstance ById(edito r_id).back Color;   205           },
406                    bcp. show();    
407     206  
408                    retu rn false;   207           _c reateFontS izeSelect  : function () {
    208                var c, t  = this, l o = [
    209                    "1 ( 8 pt)",
    210                    "2 ( 10 pt)",
    211                    "3 ( 12 pt)",
    212                    "4 ( 14 pt)",
    213                    "5 ( 18 pt)",
    214                    "6 ( 24 pt)",
    215                    "7 ( 36 pt)"
    216                ], fz =  [8, 10, 12 , 14, 18,  24, 36];
409     217  
410                case "Hi liteColorM enu":   218                c = t.ed itor.contr olManager. createList Box('fonts izeselect' , {title :  'advanced .font_size ', cmd : ' FontSize'} );
411                    Tiny MCE_Advanc edTheme._h ideMenus(e ditor_id);    
412     219  
413                    // C reate colo r layer   220                each(exp lode(t.set tings.them e_advanced _font_size s), functi on(v) {
414                    var  ml = new T inyMCE_Lay er(editor_ id + '_bcM enu');   221                    c.ad d(lo[parse Int(v) - 1 ], v, {'st yle' : 'fo nt-size:'  + fz[v - 1 ] + 'pt',  'class' :  'mceFontSi ze' + v});
    222                });
415     223  
416                    if ( !ml.exists ())   224                return c ;
417                         ml.create( 'div', 'mc eMenu', do cument.bod y, TinyMCE _AdvancedT heme._getC olorHTML(e ditor_id,  'theme_adv anced_back ground_col ors', 'Hil iteColor') );   225           },
418     226  
419                    tiny MCE.switch Class(edit or_id + '_ backcolor' , 'mceMenu ButtonFocu s');   227           _c reateBlock Formats :  function()  {
420                    ml.m oveRelativ eTo(docume nt.getElem entById(ed itor_id +  "_backcolo r"), 'bl') ;   228                var c, f mts = {
    229                    p :  'advanced. paragraph' ,
    230                    addr ess : 'adv anced.addr ess',
    231                    pre  : 'advance d.pre',
    232                    h1 :  'advanced .h1',
    233                    h2 :  'advanced .h2',
    234                    h3 :  'advanced .h3',
    235                    h4 :  'advanced .h4',
    236                    h5 :  'advanced .h5',
    237                    h6 :  'advanced .h6',
    238                    div  : 'advance d.div',
    239                    bloc kquote : ' advanced.b lockquote' ,
    240                    code  : 'advanc ed.code',
    241                    dt :  'advanced .dt',
    242                    dd :  'advanced .dd',
    243                    samp  : 'advanc ed.samp'
    244                }, t = t his;
421     245  
422                    ml.m oveBy(tiny MCE.isMSIE  && !tinyM CE.isOpera  ? -1 : 1,  -1);   246                c = t.ed itor.contr olManager. createList Box('forma tselect',  {title : ' advanced.b lock', cmd  : 'Format Block'});
423     247  
424                    if ( tinyMCE.is Opera)   248                each(exp lode(t.set tings.them e_advanced _blockform ats), func tion(v) {
425                         ml.moveBy( 0, -2);   249                    c.ad d(t.editor .translate (fmts[v]),  v, {'clas s' : 'mce_ formatPrev iew mce_'  + v});
    250                });
426     251  
427                    ml.s how();   252                 return   c ;
428                 return   true ;   253           },
429          254  
430                case "ba ckcolorpic ker":   255           _c reateForeC olorMenu :  function( ) {
431                    this ._pickColo r(editor_i d, 'Hilite Color');   256                var c, t  = this, s  = t.setti ngs, o = { }, v;
432                    retu rn true;    
433     257  
434                 case   " mceColorPi cker ":   258                if (s.th eme_advanc ed_more_co lors) {
435                    if ( user_inter face) {   259                    o.mo re_colors_ func = fun ction() {
436                         var templa te = [];   260                         t._ mceColorPi cker (0,   {
    261                             color  : c.value,
    262                             func :  function( co) {
    263                                 c. setColor(c o);
    264                             }
    265                         });
    266                    };
    267                }
437          268  
438                         if (!value ['callback '] && !val ue['color' ])   269                if (v =  s.theme_ad vanced_tex t_colors)
439                             value[ 'color'] =  value['do cument'].g etElementB yId(value[ 'element_i d']).value ;   270                    o.co lors = v;
440     271  
441                         template[' file'] = ' color_pick er.htm';   272                o.title  = 'advance d.forecolo r_desc';
442                         template[' width'] =  380;   273                o.cmd =  'ForeColor ';
443                         template[' height'] =  250;   274                o.scope  = this;
444                         template[' close_prev ious'] = " no";    
445     275  
446                         template[' width'] +=  tinyMCE.g etLang('la ng_theme_a dvanced_co lorpicker_ delta_widt h', 0);   276                c = t.ed itor.contr olManager. createColo rSplitButt on('foreco lor', o);
447                         template[' height'] + = tinyMCE. getLang('l ang_theme_ advanced_c olorpicker _delta_hei ght', 0);    
448     277  
449                         if (typeof (value['st ore_select ion']) ==  "undefined ")   278                return c ;
450                             value[ 'store_sel ection'] =  true;   279           },
451     280  
452                         tinyMCE.la stColorPic kerValue =  value;   281           _c reateBackC olorMenu :  function( ) {
453                         tinyMCE.op enWindow(t emplate, { editor_id  : editor_i d, mce_sto re_selecti on : value ['store_se lection'],  inline :  "yes", com mand : "mc eColorPick er", input _color : v alue['colo r']});   282                var c, t  = this, s  = t.setti ngs, o = { }, v;
454                    } el se {    
455                         var savedV al = tinyM CE.lastCol orPickerVa lue, elm;    
456     283  
457                         if (savedV al['callba ck']) {   284                if (s.th eme_advanc ed_more_co lors) {
458                             savedV al['callba ck'](value );   285                    o.mo re_colors_ func = fun ction() {
459                             return  true;   286                         t._mceColo rPicker(0,  {
    287                             color  : c.value,
    288                             func :  function( co) {
    289                                 c. setColor(c o);
460                         }   290                             }
461  
  291                         });
462                         elm = save dVal['docu ment'].get ElementByI d(savedVal ['element_ id']);   292                     };
463                         elm.value  = value;    
464  
   
465                         if (elm.on change !=  null && el m.onchange  != '')    
466                             eval(' elm.onchan ge();');    
467                    }   293                }
468                return t rue;    
469      
470                case "mc eCodeEdito r":    
471                    var  template =  new Array ();    
472     294  
473                    temp late['file '] = 'sour ce_editor. htm';   295                if (v =  s.theme_ad vanced_bac kground_co lors)
474                    temp late['widt h'] = pars eInt(tinyM CE.getPara m("theme_a dvanced_so urce_edito r_width",  720));   296                    o.co lors = v;
475                    temp late['heig ht'] = par seInt(tiny MCE.getPar am("theme_ advanced_s ource_edit or_height" , 580));    
476     297  
477                    tiny MCE.openWi ndow(templ ate, {edit or_id : ed itor_id, r esizable :  "yes", sc rollbars :  "no", inl ine : "yes "});   298                o.title  = 'advance d.backcolo r_desc';
478                    retu rn true;   299                o.cmd =  'HiliteCol or';
479     300                o.scope  = this;
480                case "mc eCharMap":    
481                    var  template =  new Array ();    
482     301  
483                    temp late['file '] = 'char map.htm';   302                c = t.ed itor.contr olManager. createColo rSplitButt on('backco lor', o);
484                    temp late['widt h'] = 550  + (tinyMCE .isOpera ?  40 : 0);    
485                    temp late['heig ht'] = 250 ;    
486     303  
487                    temp late['widt h'] += tin yMCE.getLa ng('lang_t heme_advan ced_charma p_delta_wi dth', 0);   304                return c ;
488                    temp late['heig ht'] += ti nyMCE.getL ang('lang_ theme_adva nced_charm ap_delta_h eight', 0) ;   305           },
489     306  
490                    tiny MCE.openWi ndow(templ ate, {edit or_id : ed itor_id, i nline : "y es"});   307           re nderUI : f unction(o)  {
491                    retu rn true;   308                var n, i c, tb, t =  this, ed  = t.editor , s = t.se ttings, sc , p, nl;
492     309  
493                case "mc eInsertAnc hor":   310                n = p =  DOM.create ('span', { id : ed.id  + '_paren t', 'class ' : 'mceEd itor ' + e d.settings .skin + 'S kin' + (s. skin_varia nt ? ' ' +  ed.settin gs.skin +  'Skin' + t ._ufirst(s .skin_vari ant) : '') });
494                    var  template =  new Array ();    
495     311  
496                    temp late['file '] = 'anch or.htm';   312                if (!DOM .boxModel)
497                    temp late['widt h'] = 320;   313                    n =  DOM.add(n,  'div', {' class' : ' mceOldBoxM odel'});
498                    temp late['heig ht'] = 90  + (tinyMCE .isNS7 ? 3 0 : 0);    
499     314  
500                    temp late['widt h'] += tin yMCE.getLa ng('lang_t heme_advan ced_anchor _delta_wid th', 0);   315                n = sc =  DOM.add(n , 'table',  {id : ed. id + '_tbl ', dir : ' ltr', 'cla ss' : 'mce Layout', c ellSpacing  : 0, cell Padding :  0});
501                    temp late['heig ht'] += ti nyMCE.getL ang('lang_ theme_adva nced_ancho r_delta_he ight', 0);   316                n = tb =  DOM.add(n , 'tbody') ;
502     317  
503                    tiny MCE.openWi ndow(templ ate, {edit or_id : ed itor_id, i nline : "y es"});   318                switch ( (s.theme_a dvanced_la yout_manag er || ''). toLowerCas e()) {
504                    retu rn true;   319                    case  "rowlayou t":
    320                         ic = t._ro wLayout(s,  tb, o);
    321                         break;
505     322  
506                 case   " mceNewDo cu
m en t":
  323                     case   "
cu sto m layou t":
507                    if ( confirm(ti nyMCE.getL ang('lang_ newdocumen t')))   324                         ic = ed.ex ecCallback ("theme_ad vanced_cus tom_layout ", s, tb,  o, p);
508                         tinyMCE.ex ecInstance Command(ed itor_id, ' mceSetCont ent', fals e, ' ');   325                         break;
509     326  
510                    retu rn true;   327                    defa ult:
    328                         ic = t._si mpleLayout (s, tb, o,  p);
511           }   329                }
512     330  
513           re turn false ;   331                n = o.ta rgetNode;
514       },    
515     332  
516       /**   333                // Add c lasses to  first and  last TRs
517        * Edi tor instan ce templat e function .   334                nl = DOM .stdMode ?  sc.getEle mentsByTag Name('tr')  : sc.rows ; // Quick  fix for I E 8
518        */   335                DOM.addC lass(nl[0] , 'mceFirs t');
519       getEdi torTemplat e : functi on(setting s, editorI d) {   336                DOM.addC lass(nl[nl .length -  1], 'mceLa st');
520           fu nction rem oveFromArr ay(in_arra y, remove_ array) {    
521                var outA rray = new  Array(),  skip;    
522                   337  
523                for (var  i=0; i<in _array.len gth; i++)  {   338                // Add c lasses to  first and  last TDs
524                    skip  = false;   339                each(DOM .select('t r', tb), f unction(n)  {
525     340                    DOM. addClass(n .firstChil d, 'mceFir st');
526                    for  (var j=0;  j<remove_a rray.lengt h; j++) {   341                    DOM. addClass(n .childNode s[n.childN odes.lengt h - 1], 'm ceLast');
527                         if (in_arr ay[i] == r emove_arra y[j]) {   342                 } );
528                             skip =  true;    
529                         }    
530                     }
   
531     343  
532                    if ( !skip) {   344                if (DOM. get(s.them e_advanced _toolbar_c ontainer))
533                         outArray[o utArray.le ngth] = in _array[i];   345                    DOM. get(s.them e_advanced _toolbar_c ontainer). appendChil d(p);
534                    }   346                 else
535                 }   347                    DOM. insertAfte r(p, n);
536     348  
537                return o utArray;   349                Event.ad d(ed.id +  '_path_row ', 'click' , function (e) {
538           }   350                    e =  e.target;
539     351  
540           fu nction add ToArray(in _array, ad d_array) {   352                    if ( e.nodeName  == 'A') {
541                for (var  i=0; i<ad d_array.le ngth; i++)  {   353                         t._sel(e.c lassName.r eplace(/^. *mcePath_( [0-9]+).*$ /, '$1'));
542                    in_a rray[in_ar ray.length ] = add_ar ray[i];    
543                }    
544     354  
545                return  in_array ;   355                         return  Event.canc el(e) ;
546           }   356                    }
    357                });
    358   /*
    359                if (DOM. get(ed.id  + '_path_r ow')) {
    360                    Even t.add(ed.i d + '_tbl' , 'mouseov er', funct ion(e) {
    361                         var re;
547     362       
548           va r template  = new Arr ay();   363                         e = e.targ et;
549           va r deltaHei ght = 0;    
550           va r resizing  = tinyMCE .getParam( "theme_adv anced_resi zing", fal se);    
551           va r path = t inyMCE.get Param("the me_advance d_path", t rue);    
552           va r statusba rHTML = '< div id="{$ editor_id} _path" cla ss="mceSta tusbarPath Text" styl e="display : ' + (pat h ? "block " : "none" ) + '">&#1 60;</div>< div id="{$ editor_id} _resize" c lass="mceS tatusbarRe size" styl e="display : ' + (res izing ? "b lock" : "n one") + '"  onmousedo wn="tinyMC E.themes.a dvanced._s etResizing (event,\'{ $editor_id }\',true); "></div><b r style="c lear: both " />';    
553           va r layoutMa nager = ti nyMCE.getP aram("them e_advanced _layout_ma nager", "S impleLayou t");    
554      
555           //  Setup sty le select  options --  MOVED UP  FOR EXTERN AL TOOLBAR  COMPATABI LITY!    
556           va r styleSel ectHTML =  '<option v alue="">{$ lang_theme _style_sel ect}</opti on>';    
557           if  (settings ['theme_ad vanced_sty les']) {    
558                var styl esAr = set tings['the me_advance d_styles'] .split(';' );    
559                    
560                for (var  i=0; i<st ylesAr.len gth; i++)  {    
561                    var  key, value ;    
562      
563                    key  = stylesAr [i].split( '=')[0];    
564                    valu e = styles Ar[i].spli t('=')[1];    
565      
566                    styl eSelectHTM L += '<opt ion value= "' + value  + '">' +  key + '</o ption>';    
567                }    
568     364  
569                TinyMCE_ AdvancedTh eme._autoI mportCSSCl asses = fa lse;   365                         if (e.node Name == 'S PAN' && DO M.hasClass (e.parentN ode, 'mceB utton')) {
    366                             re = D OM.get(ed. id + '_pat h_row');
    367                             t.last Path = re. innerHTML;
    368                             DOM.se tHTML(re,  e.parentNo de.title);
570           }   369                         }
    370                    });
571     371  
572           sw itch(layou tManager)  {   372                    Even t.add(ed.i d + '_tbl' , 'mouseou t', functi on(e) {
573                case "Si mpleLayout " : //the  default Ti nyMCE Layo ut (for ba ckwards co mpatibilit y)...   373                         if (t.last Path) {
574                    var  toolbarHTM L = "";   374                             DOM.se tHTML(ed.i d + '_path _row', t.l astPath);
575                    var  toolbarLoc ation = ti nyMCE.getP aram("them e_advanced _toolbar_l ocation",  "bottom");   375                             t.last Path = 0;
576                    var  toolbarAli gn = tinyM CE.getPara m("theme_a dvanced_to olbar_alig n", "cente r");    
577                    var  pathLocati on = tinyM CE.getPara m("theme_a dvanced_pa th_locatio n", "none" ); // Comp atiblity    
578                    var  statusbarL ocation =  tinyMCE.ge tParam("th eme_advanc ed_statusb ar_locatio n", pathLo cation);    
579                    var  defVals =  {    
580                         theme_adva nced_butto ns1 : "bol d,italic,u nderline,s trikethrou gh,separat or,justify left,justi fycenter,j ustifyrigh t,justifyf ull,separa tor,styles elect,form atselect",    
581                         theme_adva nced_butto ns2 : "bul list,numli st,separat or,outdent ,indent,se parator,un do,redo,se parator,li nk,unlink, anchor,ima ge,cleanup ,help,code ",    
582                         theme_adva nced_butto ns3 : "hr, removeform at,visuala id,separat or,sub,sup ,separator ,charmap"    
583                    };    
584      
585                    // A dd accessi bility con trol    
586                    tool barHTML +=  '<a href= "#" access key="q" ti tle="' + t inyMCE.get Lang("lang _toolbar_f ocus") + ' "';    
587      
588                    if ( !tinyMCE.g etParam("a ccessibili ty_focus") )    
589                         toolbarHTM L += ' onf ocus="tiny MCE.getIns tanceById( \'' + edit orId + '\' ).getWin() .focus();" ';    
590      
591                    tool barHTML +=  '></a>';    
592      
593                    // R ender rows    
594                    for  (var i=1;  i<100; i++ ) {    
595                         var def =  defVals["t heme_advan ced_button s" + i];    
596      
597                         var button s = tinyMC E.getParam ("theme_ad vanced_but tons" + i,  def == nu ll ? '' :  def, true,  ',');    
598                         if (button s.length = = 0)    
599                             break;    
600      
601                         buttons =  removeFrom Array(butt ons, tinyM CE.getPara m("theme_a dvanced_di sable", "" , true, ', '));    
602                         buttons =  addToArray (buttons,  tinyMCE.ge tParam("th eme_advanc ed_buttons " + i + "_ add", "",  true, ',') );    
603                         buttons =  addToArray (tinyMCE.g etParam("t heme_advan ced_button s" + i + " _add_befor e", "", tr ue, ','),  buttons);    
604      
605                         for (var b =0; b<butt ons.length ; b++)    
606                             toolba rHTML += t inyMCE.get ControlHTM L(buttons[ b]);    
607      
608                         if (button s.length >  0) {    
609                             toolba rHTML += " <br />";    
610                             deltaH eight -= 2 3;    
611                         }   376                         }
    377                    });
612                    }   378                }
    379   */
613     380  
614                    // A dd accessi bility con trol   381                if (!ed. getParam(' accessibil ity_focus' ) || ed.ge tParam('ta b_focus'))
615                    tool barHTML +=  '<a href= "#" access key="z" on focus="tin yMCE.getIn stanceById (\'' + edi torId + '\ ').getWin( ).focus(); "></a>';   382                    Even t.add(DOM. add(p, 'a' , {href :  '#'}, '<!- - IE -->') , 'focus',  function( ) {tinyMCE .get(ed.id ).focus(); });
616     383  
617                    // S etup templ ate html   384                if (s.th eme_advanc ed_toolbar _location  == 'extern al')
618                    temp late['html '] = '<tab le class=" mceEditor"  border="0 " cellpadd ing="0" ce llspacing= "0" width= "{$width}"  height="{ $height}"  style="wid th:{$width _style};he ight:{$hei ght_style} "><tbody>' ;   385                    o.de ltaHeight  = 0;
619     386  
620                    if ( toolbarLoc ation == " top")   387                t.deltaH eight = o. deltaHeigh t;
621                         template[' html'] +=  '<tr><td d ir="ltr" c lass="mceT oolbarTop"  align="'  + toolbarA lign + '"  height="1"  nowrap="n owrap"><sp an id="' +  editorId  + '_toolba r" class=" mceToolbar Container" >' + toolb arHTML + ' </span></t d></tr>';   388                o.target Node = nul l;
622     389  
623                    if ( statusbarL ocation ==  "top") {   390                return {
624                         template[' html'] +=  '<tr><td c lass="mceS tatusbarTo p" height= "1">' + st atusbarHTM L + '</td> </tr>';   391                    ifra meContaine r : ic,
625                         deltaHeigh t   -=   23;   392                    edit orContaine r : ed.id  + '_parent ',
626                     }
  393                    size Container  : sc,
627  
  394                     deltaHeigh t   :   o.deltaHei ght
628                    temp late['html '] += '<tr ><td align ="center"> <span id=" {$editor_i d}"></span ></td></tr >';   395                 } ;
    396            },
629     397  
630                    if ( toolbarLoc ation == " bottom")   398           ge tInfo : fu nction() {
631                         template[' html'] +=  '<tr><td d ir="ltr" c lass="mceT oolbarBott om" align= "' + toolb arAlign +  '" height= "1"><span  id="' + ed itorId + ' _toolbar"  class="mce ToolbarCon tainer">'  + toolbarH TML + '</s pan></td>< /tr>';   399                return {
    400                    long name : 'Ad vanced the me',
    401                    auth or : 'Moxi ecode Syst ems AB',
    402                    auth orurl : 'h ttp://tiny mce.moxiec ode.com',
    403                    vers ion : tiny mce.majorV ersion + " ." + tinym ce.minorVe rsion
    404                }
    405           },
632     406  
633                    // E xternal to olbar chan ges   407           re sizeBy : f unction(dw , dh) {
634                    if ( toolbarLoc ation == " external")  {   408                var e =  DOM.get(th is.editor. id + '_tbl ');
635                         var bod =  document.b ody;    
636                         var elm =  document.c reateEleme nt ("div") ;    
637     409  
638                         toolbarHTM L = tinyMC E.replaceV ar(toolbar HTML, 'sty le_select_ options',  styleSelec tHTML);   410                this.res izeTo(e.cl ientWidth  + dw, e.cl ientHeight  + dh);
639                         toolbarHTM L = tinyMC E.applyTem plate(tool barHTML, { editor_id  : editorId });   411           },
640     412  
641                         elm.classN ame = "mce ToolbarExt ernal";   413           re sizeTo : f unction(w,  h) {
642                         elm.id = e ditorId+"_ toolbar";   414                var ed =  this.edit or, s = ed .settings,  e = DOM.g et(ed.id +  '_tbl'),  ifr = DOM. get(ed.id  + '_ifr'),  dh;
643                         elm.innerH TML = '<ta ble width= "100%" bor der="0" al ign="cente r"><tr><td  align="ce nter">'+to olbarHTML+ '</td></tr ></table>' ;    
644                         bod.append Child (elm );    
645                         // bod.sty le.marginT op = elm.o ffsetHeigh t + "px";    
646     415  
647                         deltaHeigh t = 0;   416                // Bound ery fix bo x
648                         tinyMCE.ge tInstanceB yId(editor Id).toolba rElement =  elm;   417                w = Math .max(s.the me_advance d_resizing _min_width  || 100, w );
    418                h = Math .max(s.the me_advance d_resizing _min_heigh t || 100,  h);
    419                w = Math .min(s.the me_advance d_resizing _max_width  || 0xFFFF , w);
    420                h = Math .min(s.the me_advance d_resizing _max_heigh t || 0xFFF F, h);
649     421  
650                         //template ['html'] =  '<div id= "mceExtern alToolbar"  align="ce nter" clas s="mceTool barExterna l"><table  width="100 %" border= "0" align= "center">< tr><td ali gn="center ">'+toolba rHTML+'</t d></tr></t able></div >' + templ ate["html" ];   422                // Calc  difference  between i frame and  container
651                    } el se {   423                dh = e.c lientHeigh t - ifr.cl ientHeight ;
652                         tinyMCE.ge tInstanceB yId(editor Id).toolba rElement =  null;    
653                    }    
654     424  
655                    if ( statusbarL ocation ==  "bottom")  {   425                // Resiz e iframe a nd contain er
656                         template[' html'] +=  '<tr><td c lass="mceS tatusbarBo ttom" heig ht="1">' +  statusbar HTML + '</ td></tr>';   426                DOM.setS tyle(ifr,  'height',  h - dh);
657                         deltaHeigh t -= 23;   427                DOM.setS tyles(e, { width : w,  height :  h});
658                     }
  428            } ,
659     429  
660                    temp late['html '] += '</t body></tab le>';   430           //  Internal  functions
661                    //"S impleLayou t"    
662                break;    
663     431  
664                case "Ro wLayout" :  //Contain er Layout  - containe rs defined  in "theme _advanced_ containers " are rend ered from  top to bot tom.   432           _s impleLayou t : functi on(s, tb,  o, p) {
665                    temp late['html '] = '<tab le class=" mceEditor"  border="0 " cellpadd ing="0" ce llspacing= "0" width= "{$width}"  height="{ $height}"  style="wid th:{$width }px;height :{$height} px"><tbody >';   433                var t =  this, ed =  t.editor,  lo = s.th eme_advanc ed_toolbar _location,  sl = s.th eme_advanc ed_statusb ar_locatio n, n, ic,  etb, c;
666     434  
667                    var  containers  = tinyMCE .getParam( "theme_adv anced_cont ainers", " ", true, " ,");   435                // Creat e toolbar  container  at top
668                    var  defaultCon tainerCSS  = tinyMCE. getParam(" theme_adva nced_conta iners_defa ult_class" , "contain er");   436                if (lo = = 'top')
669                    var  defaultCon tainerAlig n = tinyMC E.getParam ("theme_ad vanced_con tainers_de fault_alig n", "cente r");   437                    t._a ddToolbars (tb, o);
670     438  
671                    //Re nder Conta iners:   439                // Creat e external  toolbar
672                    for  (var i = 0 ; i < cont ainers.len gth; i++)   440                if (lo = = 'externa l') {
673                    {   441                    n =  c = DOM.cr eate('div' , {style :  'position :relative' });
674                         if (contai ners[i] ==  "mceEdito r") //Exce ptions for  mceEditor  and ...   442                    n =  DOM.add(n,  'div', {i d : ed.id  + '_extern al', 'clas s' : 'mceE xternalToo lbar'});
675                             templa te['html']  += '<tr>< td align=" center" cl ass="mceEd itor_borde r"><span i d="{$edito r_id}"></s pan></td>< /tr>';   443                    DOM. add(n, 'a' , {id : ed .id + '_ex ternal_clo se', href  : 'javascr ipt:;', 'c lass' : 'm ceExternal Close'});
676                         else if (c ontainers[ i] == "mce Elementpat h" || cont ainers[i]  == "mceSta tusbar") / / ... mceE lementpath :   444                    n =  DOM.add(n,  'table',  {id : ed.i d + '_tble xt', cellS pacing : 0 , cellPadd ing : 0});
677                         {   445                    etb  = DOM.add( n, 'tbody' );
678                             var pa thClass =  "mceStatus bar";    
679     446  
680                             if (i  == contain ers.length -1)   447                    if ( p.firstChi ld.classNa me == 'mce OldBoxMode l')
681                             {   448                         p.firstChi ld.appendC hild(c);
682                                 pa thClass =  "mceStatus barBottom" ;    
683                             }    
684                             else i f (i == 0)    
685                             {    
686                                 pa thClass =  "mceStatus bar";    
687                             }    
688                             else   449                    else
689                             {   450                         p.insertBe fore(c, p. firstChild );
690                                 de ltaHeight- =2;    
691                             }    
692     451  
693                             templa te['html']  += '<tr>< td class=" ' + pathCl ass + '" h eight="1"> ' + status barHTML +  '</td></tr >';   452                    t._a ddToolbars (etb, o);
694                             deltaH eight -= 2 2;    
695                         } else { / / Render n ormal Cont ainer    
696                             var cu rContainer  = tinyMCE .getParam( "theme_adv anced_cont ainer_"+co ntainers[i ], "", tru e, ',');    
697                             var cu rContainer HTML = "";    
698                             var cu rAlign = t inyMCE.get Param("the me_advance d_containe r_"+contai ners[i]+"_ align", de faultConta inerAlign) ;    
699                             var cu rCSS = tin yMCE.getPa ram("theme _advanced_ container_ "+containe rs[i]+"_cl ass", defa ultContain erCSS);    
700     453  
701                             curCon tainer = r emoveFromA rray(curCo ntainer, t inyMCE.get Param("the me_advance d_disable" , "", true , ','));   454                    ed.o nMouseUp.a dd(functio n() {
    455                         var e = DO M.get(ed.i d + '_exte rnal');
    456                         DOM.show(e );
702     457  
703                             for (v ar j=0; j< curContain er.length;  j++)   458                         DOM.hide(l astExtID);
704                                 cu rContainer HTML += ti nyMCE.getC ontrolHTML (curContai ner[j]);    
705     459  
706                             if (cu rContainer .length >  0) {   460                         var f = Ev ent.add(ed .id + '_ex ternal_clo se', 'clic k', functi on() {
707                                 cu rContainer HTML += "< br />";   461                             DOM.hi de(ed.id +  '_externa l');
708                                 de ltaHeight  -= 23;   462                             Event. remove(ed. id + '_ext ernal_clos e', 'click ', f);
709                              }
  463                         } );
710     464  
711                             templa te['html']  += '<tr>< td class=" ' + curCSS  + '" alig n="' + cur Align + '"  height="1 ">' + curC ontainerHT ML + '</td ></tr>';   465                         DOM.show(e );
712                         }   466                         DOM.setSty le(e, 'top ', 0 - DOM .getRect(e d.id + '_t blext').h  - 1);
713                    }    
714     467  
715                    temp late['html '] += '</t body></tab le>';   468                         // Fixes I E renderin g bug
716                    //Ro wLayout   469                         DOM.hide(e );
717                break;   470                         DOM.show(e );
    471                         e.style.fi lter = '';
718     472  
719                case "Cu stomLayout " : //User  defined l ayout call back...   473                         lastExtID  = ed.id +  '_external ';
720                    var  customLayo ut = tinyM CE.getPara m("theme_a dvanced_cu stom_layou t","");    
721     474  
722                    if ( customLayo ut != "" & & eval("ty peof(" + c ustomLayou t + ")") ! = "undefin ed") {   475                         e = null;
723                         template =  eval(cust omLayout +  "(templat e);");   476                     }) ;
724                    }    
725                 break ;    
726           }   477                }
727     478  
728           if  (resizing )   479                if (sl = = 'top')
729                template ['html'] + = '<span i d="{$edito r_id}_resi ze_box" cl ass="mceRe sizeBox">< /span>';   480                    t._a ddStatusBa r(tb, o);
730     481  
731           te mplate['ht ml'] = tin yMCE.repla ceVar(temp late['html '], 'style _select_op tions', st yleSelectH TML);   482                // Creat e iframe c ontainer
    483                if (!s.t heme_advan ced_toolba r_containe r) {
    484                    n =  DOM.add(tb , 'tr');
    485                    n =  ic = DOM.a dd(n, 'td' , {'class'  : 'mceIfr ameContain er'});
    486                }
732     487  
733           //  Set to de fault valu es   488                // Creat e toolbar  container  at bottom
734           if  (!templat e['delta_w idth'])   489                if (lo = = 'bottom' )
735                template ['delta_wi dth'] = 0;   490                    t._a ddToolbars (tb, o);
736     491  
737           if  (!templat e['delta_h eight'])   492                if (sl = = 'bottom' )
738                template ['delta_he ight'] = d eltaHeight ;   493                    t._a ddStatusBa r(tb, o);
739     494  
740            return   template ;   495                 return   ic ;
741       },   496           },
742     497  
743        initInst a nce   :   function( in s
t
)   {
  498            _rowL a yout   :   function(
s ,   t b,   o )   {
744           if  (tinyMCE. getParam(" theme_adva nced_resiz ing", fals e)) {   499                var t =  this, ed =  t.editor,  dc, da, c f = ed.con trolManage r, n, ic,  to, a;
745                if (tiny MCE.getPar am("theme_ advanced_r esizing_us e_cookie",  true)) {    
746                    var  w = TinyMC E_Advanced Theme._get Cookie("Ti nyMCE_" +  inst.edito rId + "_wi dth");    
747                    var  h = TinyMC E_Advanced Theme._get Cookie("Ti nyMCE_" +  inst.edito rId + "_he ight");    
748     500  
749                    Tiny MCE_Advanc edTheme._r esizeTo(in st, w, h,  tinyMCE.ge tParam("th eme_advanc ed_resize_ horizontal ", true));   501                dc = s.t heme_advan ced_contai ners_defau lt_class | | '';
750                }   502                da = s.t heme_advan ced_contai ners_defau lt_align | | 'center' ;
751           }    
752     503  
753           in st.addShor tcut('ctrl ', 'k', 'l ang_link_d esc', 'mce Link');   504                each(exp lode(s.the me_advance d_containe rs || ''),  function( c, i) {
754       },   505                    var  v = s['the me_advance d_containe r_' + c] | | '';
755      
756       remove Instance :  function( inst) {    
757           ne w TinyMCE_ Layer(inst .editorId  + '_fcMenu ').remove( );    
758           ne w TinyMCE_ Layer(inst .editorId  + '_bcMenu ').remove( );    
759       },    
760     506  
761       hideIn stance : f unction(in st) {   507                    swit ch (c.toLo werCase())  {
762           Ti nyMCE_Adva ncedTheme. _hideMenus (inst.edit orId);   508                         case 'mcee ditor':
763       },   509                             n = DO M.add(tb,  'tr');
    510                             n = ic  = DOM.add (n, 'td',  {'class' :  'mceIfram eContainer '});
    511                             break;
764     512  
765       _handl eMenuEvent  : functio n(e) {   513                         case 'mcee lementpath ':
766           va r te = tin yMCE.isMSI E ? window .event.src Element :  e.target;   514                             t._add StatusBar( tb, o);
767           ti nyMCE._men uButtonEve nt(e.type  == "mouseo ver" ? "ov er" : "out ", documen t.getEleme ntById(te. _switchId) );   515                             break;
768     516  
769           if  (e.type = = "click")   517                         default:
770                tinyMCE. execInstan ceCommand( te._editor _id, te._c ommand);   518                             a = s[ 'theme_adv anced_cont ainer_' +  c + '_alig n'].toLowe rCase();
771       },   519                             a = 'm ce' + t._u first(a);
772     520  
773       _hideM enus : fun ction(id)  {   521                             n = DO M.add(DOM. add(tb, 't r'), 'td',  {
774           va r fcml = n ew TinyMCE _Layer(id  + '_fcMenu '), bcml =  new TinyM CE_Layer(i d + '_bcMe nu');   522                                 'c lass' : 'm ceToolbar  ' + (s['th eme_advanc ed_contain er_' + c +  '_class']  || dc) +  ' ' + a ||  da
    523                             });
775     524  
776           if  (fcml.exi sts() && f cml.isVisi ble()) {   525                             to = c f.createTo olbar("too lbar" + i) ;
777                tinyMCE. switchClas s(id + '_f orecolor',  'mceMenuB utton');   526                             t._add Controls(v , to);
778                fcml.hid e();   527                             DOM.se tHTML(n, t o.renderHT ML());
    528                             o.delt aHeight -=  s.theme_a dvanced_ro w_height;
779           }   529                    }
    530                });
780     531  
781           if  (bcml.exi sts() && b cml.isVisi ble()) {   532                return i c;
782                tinyMCE. switchClas s(id + '_b ackcolor',  'mceMenuB utton');    
783                bcml.hid e();    
784           }    
785       },   533           },
786     534  
787       /**   535           _a ddControls  : functio n(v, tb) {
788        * Nod e change h andler.   536                var t =  this, s =  t.settings , di, cf =  t.editor. controlMan ager;
789        */    
790       handle NodeChange  : functio n(editor_i d, node, u ndo_index,  undo_leve ls, visual _aid, any_ selection,  setup_con tent) {    
791           va r alignNod e, breakOu t, classNo de;    
792      
793           fu nction sel ectByValue (select_el m, value,  first_inde x) {    
794                first_in dex = type of(first_i ndex) == " undefined"  ? false :  true;    
795     537  
796                if (sele ct_elm) {   538                if (s.th eme_advanc ed_disable  && !t._di sabled) {
797                    for  (var i=0;  i<select_e lm.options .length; i ++) {   539                    di =  {};
798                         var ov = " " + select _elm.optio ns[i].valu e;    
799     540  
800                         if (first_ index && o v.toLowerC ase().inde xOf(value. toLowerCas e()) == 0)  {   541                    each (explode(s .theme_adv anced_disa ble), func tion(v) {
801                             select _elm.selec tedIndex =  i;   542                         di[v] = 1;
802                             return  true;   543                     } );
803                         }
   
804     544  
805                         if (ov ==  value) {   545                    t._d isabled =  di;
806                             select _elm.selec tedIndex =  i;   546                }  else
807                             return  true;   547                    di =  t._disabl ed;
808                         }    
809                    }    
810                }
   
811     548  
812                return f alse;   549                each(exp lode(v), f unction(n)  {
813            } ;   550                     var c ;
814     551  
815           //  No node p rovided   552                    if ( di && di[n ])
816           if  (node ==  null)    
817                return;   553                         return;
818     554  
819           //  Update pa th   555                    // C ompatiblit y with 2.x
820           va r pathElm  = document .getElemen tById(edit or_id + "_ path");   556                    if ( n == 'tabl econtrols' ) {
821           va r inst = t inyMCE.get InstanceBy Id(editor_ id);   557                         each(["tab le","|","r ow_props", "cell_prop s","|","ro w_before", "row_after ","delete_ row","|"," col_before ","col_aft er","delet e_col","|" ,"split_ce lls","merg e_cells"],  function( n) {
822           va r doc = in st.getDoc( );   558                             n = t. createCont rol(n, cf) ;
823           Ti nyMCE_Adva ncedTheme. _hideMenus (editor_id );    
824     559  
825           if  ( pathElm) {   560                             if ( n)
826                // Get n ode path   561                                 tb .add(n);
827                var pare ntNode = n ode;   562                         });
828                var path  = new Arr ay();    
829                   563  
830                while (p arentNode  != null) {   564                         return ;
831                    if ( parentNode .nodeName. toUpperCas e() == "BO DY") {    
832                         break ;    
833                    }   565                    }
834     566  
835                    // O nly append  element n odes to pa th   567                    c =  t.createCo ntrol(n, c f);
836                    if ( parentNode .nodeType  == 1 && ti nyMCE.getA ttrib(pare ntNode, "c lass").ind exOf('mceI temHidden' ) == -1) {    
837                         path[path. length] =  parentNode ;    
838                    }    
839     568  
840                    pare ntNode = p arentNode. parentNode ;   569                    if ( c)
841                 }
  570                         tb.add(c);
    571                });
    572            } ,
842     573  
843                // Setup  HTML   574           _a ddToolbars  : functio n(c, o) {
844                var html  = "";   575                var t =  this, i, t b, ed = t. editor, s  = t.settin gs, v, cf  = ed.contr olManager,  di, n, h  = [], a;
845                for (var  i=path.le ngth-1; i> =0; i--) {    
846                    var  nodeName =  path[i].n odeName.to LowerCase( );    
847                    var  nodeData =  "";    
848     576  
849                    if ( nodeName.i ndexOf("ht ml:") == 0 )   577                a = s.th eme_advanc ed_toolbar _align.toL owerCase() ;
850                         nodeName =  nodeName. substring( 5);   578                a = 'mce ' + t._ufi rst(a);
851     579  
852                    if ( nodeName = = "b") {   580                n = DOM. add(DOM.ad d(c, 'tr') , 'td', {' class' : ' mceToolbar  ' + a});
853                         nodeName =  "strong";    
854                    }    
855     581  
856                    if ( nodeName = = "i") {   582                if (!ed. getParam(' accessibil ity_focus' ) || ed.ge tParam('ta b_focus'))
857                         nodeName =  "em";   583                    h.pu sh(DOM.cre ateHTML('a ', {href :  '#', onfo cus : 'tin yMCE.get(\ '' + ed.id  + '\').fo cus();'},  '<!-- IE - ->'));
858                    }    
859     584  
860                    if ( nodeName = = "span")  {   585                h.push(D OM.createH TML('a', { href : '#' , accesske y : 'q', t itle : ed. getLang("a dvanced.to olbar_focu s")}, '<!- - IE -->') );
861                         var cn = t inyMCE.get Attrib(pat h[i], "cla ss");    
862                         if (cn !=  "" && cn.i ndexOf('mc eItem') ==  -1)    
863                             nodeDa ta += "cla ss: " + cn  + " ";    
864     586  
865                         var st = t inyMCE.get Attrib(pat h[i], "sty le");   587                // Creat e toolbar  and add th e controls
866                         if (st !=  "") {   588                for (i=1 ; (v = s[' theme_adva nced_butto ns' + i]);  i++) {
867                             st = t inyMCE.ser ializeStyl e(tinyMCE. parseStyle (st));   589                    tb =  cf.create Toolbar("t oolbar" +  i, {'class ' : 'mceTo olbarRow'  + i});
868                             nodeDa ta += "sty le: " + ti nyMCE.xmlE ncode(st)  + " ";    
869                         }    
870                    }    
871     590  
872                    if ( nodeName = = "font")  {   591                    if ( s['theme_a dvanced_bu ttons' + i  + '_add'] )
873                         if (tinyMC E.getParam ("convert_ fonts_to_s pans"))   592                         v += ',' +  s['theme_ advanced_b uttons' +  i + '_add' ];
874                             nodeNa me = "span ";    
875     593  
876                         var face =  tinyMCE.g etAttrib(p ath[i], "f ace");   594                    if ( s['theme_a dvanced_bu ttons' + i  + '_add_b efore'])
877                         if (face ! = "")   595                         v = s['the me_advance d_buttons'  + i + '_a dd_before' ] + ',' +  v;
878                             nodeDa ta += "fon t: " + tin yMCE.xmlEn code(face)  + " ";    
879     596  
880                         var size =  tinyMCE.g etAttrib(p ath[i], "s ize");   597                    t._a ddControls (v, tb);
881                         if (size ! = "")    
882                             nodeDa ta += "siz e: " + tin yMCE.xmlEn code(size)  + " ";    
883     598  
884                         var color  = tinyMCE. getAttrib( path[i], " color");   599                    //n. appendChil d(n = tb.r ender());
885                         if (color  != "")   600                    h.pu sh(tb.rend erHTML());
886                             nodeDa ta += "col or: " + ti nyMCE.xmlE ncode(colo r) + " ";    
887                    }    
888     601  
889                    if ( tinyMCE.ge tAttrib(pa th[i], 'id ') != "")  {   602                    o.de ltaHeight  -= s.theme _advanced_ row_height ;
890                         nodeData + = "id: " +  path[i].g etAttribut e('id') +  " ";    
891                    }   603                }
892     604  
893                    var  className  = tinyMCE. getVisualA idClass(ti nyMCE.getA ttrib(path [i], "clas s"), false );   605                h.push(D OM.createH TML('a', { href : '#' , accesske y : 'z', t itle : ed. getLang("a dvanced.to olbar_focu s"), onfoc us : 'tiny MCE.getIns tanceById( \'' + ed.i d + '\').f ocus();'},  '<!-- IE  -->'));
894                    if ( className  != "" && c lassName.i ndexOf('mc eItem') ==  -1)   606                DOM.setH TML(n, h.j oin(''));
895                         nodeData + = "class:  " + classN ame + " ";   607           },
896     608  
897                    if ( tinyMCE.ge tAttrib(pa th[i], 'sr c') != "")  {   609           _a ddStatusBa r : functi on(tb, o)  {
898                         var src =  tinyMCE.ge tAttrib(pa th[i], "mc e_src");   610                var n, t  = this, e d = t.edit or, s = t. settings,  r, mf, me,  td;
899     611  
900                         if (src ==  "")   612                n = DOM. add(tb, 't r');
901                              src =  tinyMCE.g etAttrib(p ath[i], "s rc");   613                n = td =  DOM.add(n , 'td', {' class' : ' mceStatusb ar'});
    614                n = DOM. add(n, 'di v', {id :  ed.id + '_ path_row'} , s.theme_ advanced_p ath ? ed.t ranslate(' advanced.p ath') + ':  ' : '&nbs p;');
    615                DOM.add( n, 'a', {h ref : '#',  accesskey  : 'x'});
902     616  
903                         nodeData + = "src: "  + tinyMCE. xmlEncode( src) + " " ;   617                if (s.th eme_advanc ed_resizin g && !tiny mce.isOldW ebKit) {
904                    }   618                    DOM. add(td, 'a ', {id : e d.id + '_r esize', hr ef : 'java script:;',  onclick :  "return f alse;", 'c lass' : 'm ceResize'} );
905     619  
906                    if ( path[i].no deName ==  'A' && tin yMCE.getAt trib(path[ i], 'href' ) != "") {   620                    if ( s.theme_ad vanced_res izing_use_ cookie) {
907                         var href =  tinyMCE.g etAttrib(p ath[i], "m ce_href");   621                         ed.onPostR ender.add( function()  {
    622                             var o  = Cookie.g etHash("Ti nyMCE_" +  ed.id + "_ size"), c  = DOM.get( ed.id + '_ tbl');
908     623  
909                         if ( href == "" )   624                             if ( !o )
910                              href  = tinyMCE. getAttrib( path[i], " href");   625                                 re turn;
911     626  
912                         nodeData + = "href: "  + tinyMCE .xmlEncode (href) + "  ";   627                             if (s. theme_adva nced_resiz e_horizont al)
913                    }   628                                 c. style.widt h = o.cw +  'px';
914     629  
915                    clas sName = ti nyMCE.getA ttrib(path [i], "clas s");   630                             c.styl e.height =  o.ch + 'p x';
916                    if ( (nodeName  == "img" | | nodeName  == "span" ) && class Name.index Of('mceIte m') != -1)  {   631                             DOM.ge t(ed.id +  '_ifr').st yle.height  = (parseI nt(o.ch) +  t.deltaHe ight) + 'p x';
917                         nodeName =  className .replace(/ mceItem([a -z]+)/gi,  '$1').toLo werCase();   632                         });
918                         nodeData =  path[i].g etAttribut e('title') ;    
919                    }   633                    }
920     634  
921                    if ( nodeName = = "a" && ( anchor = t inyMCE.get Attrib(pat h[i], "nam e")) != "" ) {   635                    ed.o nPostRende r.add(func tion() {
922                         nodeName =  "a";   636                         Event.add( ed.id + '_ resize', ' mousedown' , function (e) {
923                         nodeName + = "#" + ti nyMCE.xmlE ncode(anch or);   637                             var c,  p, w, h,  n, pa;
924                         nodeData =  "";    
925                    }    
926     638  
927                    if ( tinyMCE.ge tAttrib(pa th[i], 'na me').index Of("mce_")  != 0) {   639                             // Mea sure conta iner
928                         var classN ame = tiny MCE.getVis ualAidClas s(tinyMCE. getAttrib( path[i], " class"), f alse);   640                             c = DO M.get(ed.i d + '_tbl' );
929                         if (classN ame != ""  && classNa me.indexOf ('mceItem' ) == -1) {   641                             w = c. clientWidt h;
930                             nodeNa me += "."  + classNam e;   642                             h = c. clientHeig ht;
931                         }    
932                    }    
933     643  
934                    var  cmd = 'tin yMCE.execI nstanceCom mand(\'' +  editor_id  + '\',\'m ceSelectNo deDepth\', false,\''  + i + '\') ;';   644                             miw =  s.theme_ad vanced_res izing_min_ width || 1 00;
935                    html  += '<a ti tle="' + n odeData +  '" href="j avascript: ' + cmd +  '" onclick ="' + cmd  + 'return  false;" on mousedown= "return fa lse;" targ et="_self"  class="mc ePathItem" >' + nodeN ame + '</a >';   645                             mih =  s.theme_ad vanced_res izing_min_ height ||  100;
    646                             maw =  s.theme_ad vanced_res izing_max_ width || 0 xFFFF;
    647                             mah =  s.theme_ad vanced_res izing_max_ height ||  0xFFFF;
936     648  
937                    if ( i > 0) {   649                             // Set up placeho lder
938                         html += "  &raquo; ";   650                             p = DO M.add(DOM. get(ed.id  + '_parent '), 'div',  {'class'  : 'mcePlac eHolder'}) ;
939                    }   651                             DOM.se tStyles(p,  {width :  w, height  : h});
940                }    
941     652  
942                pathElm. innerHTML  = '<a href ="#" acces skey="x">< /a>' + tin yMCE.getLa ng('lang_t heme_path' ) + ": " +  html + '& #160;';   653                             // Rep lace with  placeholde r
943           }   654                             DOM.hi de(c);
    655                             DOM.sh ow(p);
944     656  
945           //  Reset old  states   657                             // Cre ate intern al resize  obj
946           ti nyMCE.swit chClass(ed itor_id +  '_justifyl eft', 'mce ButtonNorm al');   658                             r = {
947           ti nyMCE.swit chClass(ed itor_id +  '_justifyr ight', 'mc eButtonNor mal');   659                                 x  : e.screen X,
948           ti nyMCE.swit chClass(ed itor_id +  '_justifyc enter', 'm ceButtonNo rmal');   660                                 y  : e.screen Y,
949           ti nyMCE.swit chClass(ed itor_id +  '_justifyf ull', 'mce ButtonNorm al');   661                                 w  : w,
950           ti nyMCE.swit chClass(ed itor_id +  '_bold', ' mceButtonN ormal');   662                                 h  : h,
951           ti nyMCE.swit chClass(ed itor_id +  '_italic',  'mceButto nNormal');   663                                 dx  : null,
952           ti nyMCE.swit chClass(ed itor_id +  '_underlin e', 'mceBu ttonNormal ');   664                                 dy  : null
953           ti nyMCE.swit chClass(ed itor_id +  '_striketh rough', 'm ceButtonNo rmal');   665                             };
954           ti nyMCE.swit chClass(ed itor_id +  '_bullist' , 'mceButt onNormal') ;    
955           ti nyMCE.swit chClass(ed itor_id +  '_numlist' , 'mceButt onNormal') ;    
956           ti nyMCE.swit chClass(ed itor_id +  '_sub', 'm ceButtonNo rmal');    
957           ti nyMCE.swit chClass(ed itor_id +  '_sup', 'm ceButtonNo rmal');    
958           ti nyMCE.swit chClass(ed itor_id +  '_anchor',  'mceButto nNormal');    
959           ti nyMCE.swit chClass(ed itor_id +  '_link', ' mceButtonD isabled');    
960           ti nyMCE.swit chClass(ed itor_id +  '_unlink',  'mceButto nDisabled' );    
961           ti nyMCE.swit chClass(ed itor_id +  '_outdent' , 'mceButt onDisabled ');    
962           ti nyMCE.swit chClass(ed itor_id +  '_image',  'mceButton Normal');    
963           ti nyMCE.swit chClass(ed itor_id +  '_hr', 'mc eButtonNor mal');    
964     666  
965           if  (node.nod eName == " A" && tiny MCE.getAtt rib(node,  "class").i ndexOf('mc eItemAncho r') != -1)   667                             // Sta rt listeni ng
966                tinyMCE. switchClas s(editor_i d + '_anch or', 'mceB uttonSelec ted');   668                             mf = E vent.add(d ocument, ' mousemove' , function (e) {
    669                                 va r w, h;
967     670  
968           //  Get link   671                                 //  Calc delt a values
969           va r anchorLi nk = tinyM CE.getPare ntElement( node, "a",  "href");   672                                 r. dx = e.scr eenX - r.x ;
    673                                 r. dy = e.scr eenY - r.y ;
970     674  
971           if  (anchorLi nk || any_ selection)  {   675                                 //  Boundery  fix box
972                tinyMCE. switchClas s(editor_i d + '_link ', anchorL ink ? 'mce ButtonSele cted' : 'm ceButtonNo rmal');   676                                 w  = Math.max (miw, r.w  + r.dx);
973                tinyMCE. switchClas s(editor_i d + '_unli nk', ancho rLink ? 'm ceButtonSe lected' :  'mceButton Normal');   677                                 h  = Math.max (mih, r.h  + r.dy);
974           }   678                                 w  = Math.min (maw, w);
    679                                 h  = Math.min (mah, h);
975     680  
976           //  Handle vi sual aid   681                                 //  Resize pl aceholder
977           ti nyMCE.swit chClass(ed itor_id +  '_visualai d', visual _aid ? 'mc eButtonSel ected' : ' mceButtonN ormal');   682                                 if  (s.theme_ advanced_r esize_hori zontal)
    683                                      p.style. width = w  + 'px';
978     684  
979           if  (undo_lev els != -1)  {   685                                 p. style.heig ht = h + ' px';
980                tinyMCE. switchClas s(editor_i d + '_undo ', 'mceBut tonDisable d');    
981                tinyMCE. switchClas s(editor_i d + '_redo ', 'mceBut tonDisable d');    
982           }    
983     686  
984           //  Within li , blockquo te   687                                 re turn Event .cancel(e) ;
985           if  (tinyMCE. getParentE lement(nod e, "li,blo ckquote"))   688                              });
986                tinyMCE. switchClas s(editor_i d + '_outd ent', 'mce ButtonNorm al');    
987  
   
988           //  Has redo  levels    
989           if  (undo_ind ex != -1 & & (undo_in dex < undo _levels-1  && undo_le vels > 0))    
990                tinyMCE. switchClas s(editor_i d + '_redo ', 'mceBut tonNormal' );    
991     689  
992           //  Has undo  levels   690                             me = E vent.add(d ocument, ' mouseup',  function(e ) {
993           if  (undo_ind ex != -1 & & (undo_in dex > 0 &&  undo_leve ls > 0))   691                                 va r ifr;
994                tinyMCE. switchClas s(editor_i d + '_undo ', 'mceBut tonNormal' );    
995     692  
996           //  Select cl ass in sel ect box   693                                 //  Stop list ening
997           va r selectEl m = docume nt.getElem entById(ed itor_id +  "_styleSel ect");   694                                 Ev ent.remove (document,  'mousemov e', mf);
    695                                 Ev ent.remove (document,  'mouseup' , me);
998              696  
999           if  (selectEl m) {   697                                 c. style.disp lay = '';
1000                TinyMCE_ AdvancedTh eme._setup CSSClasses (editor_id );   698                                 DO M.remove(p );
1001     699  
1002                classNod e = node;   700                                 if  (r.dx ===  null)
1003                breakOut  = false;   701                                      return;
1004                var inde x = 0;    
1005     702  
1006                do {   703                                 if r = DOM.ge t(ed.id +  '_ifr');
1007                    if ( classNode  && classNo de.classNa me) {    
1008                         for (var i =0; i<sele ctElm.opti ons.length ; i++) {    
1009                             if (se lectElm.op tions[i].v alue == cl assNode.cl assName) {    
1010                                 in dex = i;    
1011                                 br eakOut = t rue;    
1012                                 br eak;    
1013                             }    
1014                         }    
1015                    }    
1016                } while  (!breakOut  && classN ode != nul l && (clas sNode = cl assNode.pa rentNode)  != null);    
1017     704  
1018                selectEl m.selected Index = in dex;   705                                 if  (s.theme_ advanced_r esize_hori zontal)
1019           }   706                                      c.style. width = (r .w + r.dx)  + 'px';
1020     707  
1021           //  Select fo rmatblock   708                                 c. style.heig ht = (r.h  + r.dy) +  'px';
1022           va r selectEl m = docume nt.getElem entById(ed itor_id +  "_formatSe lect");   709                                 if r.style.he ight = (if r.clientHe ight + r.d y) + 'px';
1023           if  (selectEl m) {    
1024                var elm  = tinyMCE. getParentE lement(nod e, "p,div, h1,h2,h3,h 4,h5,h6,pr e,address" );    
1025     710  
1026                if (elm)   711                                 if  (s.theme_ advanced_r esizing_us e_cookie)  {
1027                    sele ctByValue( selectElm,  "<" + elm .nodeName. toLowerCas e() + ">") ;   712                                      Cookie.s etHash("Ti nyMCE_" +  ed.id + "_ size", {
1028                 else   713                                          cw :  r.w + r.d x,
1029                    sele ctByValue( selectElm,  "");   714                                          ch :  r.h + r.d y
    715                                       });
1030           }   716                                 }
    717                             });
1031     718  
1032           //  Select fo ntselect   719                             return  Event.can cel(e);
1033           va r selectEl m = docume nt.getElem entById(ed itor_id +  "_fontName Select");   720                         } );
1034           if  (selectEl m) {   721                     } );
1035                if (!tin yMCE.isSaf ari && !(t inyMCE.isM SIE && !ti nyMCE.isOp era)) {    
1036                    var  face = ins t.queryCom mandValue( 'FontName' );    
1037      
1038                    face  = face ==  null || f ace == ""  ? "" : fac e;    
1039      
1040                    sele ctByValue( selectElm,  face, fac e != "");    
1041                } else {    
1042                    var  elm = tiny MCE.getPar entElement (node, "fo nt", "face ");    
1043      
1044                    if ( elm) {    
1045                         var family  = tinyMCE .getAttrib (elm, "fac e");    
1046      
1047                         if (family  == '')    
1048                             family  = '' + el m.style.fo ntFamily;    
1049      
1050                         if (!selec tByValue(s electElm,  family, fa mily != "" ))    
1051                             select ByValue(se lectElm, " ");    
1052                    }  else    
1053                         selectByVa lue(select Elm, "");    
1054                 }
   
1055           }   722                }
1056     723  
1057           //  Select fo ntsize   724                o.deltaH eight -= 2 1;
1058           va r selectEl m = docume nt.getElem entById(ed itor_id +  "_fontSize Select");   725                n = tb =  null;
1059           if  (selectEl m) {   726           } ,
1060                if (!tin yMCE.isSaf ari && !ti nyMCE.isOp era) {    
1061                    var  size = ins t.queryCom mandValue( 'FontSize' );    
1062                    sele ctByValue( selectElm,  size == n ull || siz e == "" ?  "0" : size );    
1063                }  else {    
1064                    var  elm = tiny MCE.getPar entElement (node, "fo nt", "size ");    
1065                    if ( elm) {    
1066                         var size =  tinyMCE.g etAttrib(e lm, "size" );    
1067     727  
1068                         if (size = = '') {   728           _n odeChanged  : functio n(ed, cm,  n, co) {
1069                             var si zes = new  Array('',  '8px', '10 px', '12px ', '14px',  '18px', ' 24px', '36 px');   729                var t =  this, p, d e = 0, v,  c, s = t.s ettings;
1070     730  
1071                             size =  '' + elm. style.font Size;   731                tinymce. each(t.sta teControls , function (c) {
    732                    cm.s etActive(c , ed.query CommandSta te(t.contr ols[c][1]) );
    733                });
1072     734  
1073                             for (v ar i=0; i< sizes.leng th; i++) {   735                cm.setAc tive('visu alaid', ed .hasVisual );
1074                                 if  (('' + si zes[i]) ==  size) {   736                cm.setDi sabled('un do', !ed.u ndoManager .hasUndo()  && !ed.ty ping);
1075                                      size = i ;   737                cm.setDi sabled('re do', !ed.u ndoManager .hasRedo() );
1076                                      break;   738                cm.setDi sabled('ou tdent', !e d.queryCom mandState( 'Outdent') );
1077                                 }    
1078                             }    
1079                         }    
1080     739  
1081                         if (!selec tByValue(s electElm,  size))   740                p = DOM. getParent( n, 'A');
1082                             select ByValue(se lectElm, " ");   741                if (c =  cm.get('li nk')) {
1083                    } el se   742                    if ( !p || !p.n ame) {
1084                         selectByVa lue(select Elm, "0");   743                         c.setDisab led(!p &&  co);
    744                         c.setActiv e(!!p);
1085                }   745                    }
1086           }   746                }
1087     747  
1088           //  Handle al ign attrib utes   748                if (c =  cm.get('un link')) {
1089           al ignNode =  node;   749                    c.se tDisabled( !p && co);
1090           br eakOut = f alse;   750                    c.se tActive(!! p && !p.na me);
1091           do  {    
1092                if (!ali gnNode.get Attribute  || !alignN ode.getAtt ribute('al ign'))    
1093                    cont inue;    
1094      
1095                switch ( alignNode. getAttribu te('align' ).toLowerC ase()) {    
1096                    case  "left":    
1097                         tinyMCE.sw itchClass( editor_id  + '_justif yleft', 'm ceButtonSe lected');    
1098                         breakOut =  true;    
1099                    brea k;    
1100      
1101                    case  "right":    
1102                         tinyMCE.sw itchClass( editor_id  + '_justif yright', ' mceButtonS elected');    
1103                         breakOut =  true;    
1104                    brea k;    
1105      
1106                    case  "middle":    
1107                    case  "center":    
1108                         tinyMCE.sw itchClass( editor_id  + '_justif ycenter',  'mceButton Selected') ;    
1109                         breakOut =  true;    
1110                    brea k;    
1111      
1112                    case  "justify" :    
1113                         tinyMCE.sw itchClass( editor_id  + '_justif yfull', 'm ceButtonSe lected');    
1114                         breakOut =  true;    
1115                    brea k;    
1116                }   751                }
1117           }  while (!br eakOut &&  (alignNode  = alignNo de.parentN ode) != nu ll);    
1118     752  
1119           //  Div justi fication   753                if (c =  cm.get('an chor')) {
1120           va r div = ti nyMCE.getP arentEleme nt(node, " div");   754                    c.se tActive(!! p && p.nam e);
1121           if  (div && d iv.style.t extAlign = = "center" )    
1122                tinyMCE. switchClas s(editor_i d + '_just ifycenter' , 'mceButt onSelected ');    
1123     755  
1124           //  Do specia l text   756                    if ( tinymce.is WebKit) {
1125           if  (!setup_c ontent) {   757                         p = DOM.ge tParent(n,  'IMG');
1126                // , "Ju stifyLeft" , "_justif yleft", "J ustifyCent er", "just ifycenter" , "Justify Right", "j ustifyrigh t", "Justi fyFull", " justifyful l", "Inser tUnordered List", "bu llist", "I nsertOrder edList", " numlist",  "InsertUno rderedList ", "bullis t", "Outde nt", "outd ent", "Ind ent", "ind ent", "sub script", " sub"   758                         c.setActiv e(!!p && D OM.getAttr ib(p, 'mce _name') ==  'a');
1127                var ar =  new Array ("Bold", " _bold", "I talic", "_ italic", " Strikethro ugh", "_st rikethroug h", "super script", " _sup", "su bscript",  "_sub");    
1128                for (var  i=0; i<ar .length; i +=2) {    
1129                    if ( inst.query CommandSta te(ar[i]))    
1130                         tinyMCE.sw itchClass( editor_id  + ar[i+1],  'mceButto nSelected' );    
1131                }   759                    }
1132      
1133                if (inst .queryComm andState(" Underline" ) && (node .parentNod e == null  || node.pa rentNode.n odeName !=  "A"))    
1134                    tiny MCE.switch Class(edit or_id + '_ underline' , 'mceButt onSelected ');    
1135           }   760                }
1136     761  
1137           //  Handle el ements   762                p = DOM. getParent( n, 'IMG');
1138           do  {   763                if (c =  cm.get('im age'))
1139                switch ( node.nodeN ame) {   764                    c.se tActive(!! p && n.cla ssName.ind exOf('mceI tem') == - 1);
1140                    case  "UL":    
1141                         tinyMCE.sw itchClass( editor_id  + '_bullis t', 'mceBu ttonSelect ed');    
1142                    brea k;    
1143      
1144                    case  "OL":    
1145                         tinyMCE.sw itchClass( editor_id  + '_numlis t', 'mceBu ttonSelect ed');    
1146                    brea k;    
1147     765  
1148                    case  "HR":   766                if (c =  cm.get('st yleselect' )) {
1149                          tinyMCE.s witchClass (editor_id  + '_hr',  'mceButton Selected') ;   767                    if ( n.classNam e) {
1150                    brea k;   768                         t._importC lasses();
1151     769                         c.select(n .className );
1152                    case  "IMG":   770                    }  else
1153                    if ( tinyMCE.ge tAttrib(no de, 'name' ).indexOf( 'mce_') !=  0 && tiny MCE.getAtt rib(node,  'class').i ndexOf('mc eItem') ==  -1) {   771                         c.select() ;
1154                         tinyMCE.sw itchClass( editor_id  + '_image' , 'mceButt onSelected ');    
1155                    }
   
1156                    brea k;    
1157                }   772                }
1158           }  while ((no de = node. parentNode ) != null) ;    
1159       },    
1160      
1161       // Pri vate theme  internal  functions    
1162      
1163       // Thi s function  auto impo rts CSS cl asses into  the class  selection  droplist    
1164       _setup CSSClasses  : functio n(editor_i d) {    
1165           va r i, selec tElm;    
1166      
1167           if  (!TinyMCE _AdvancedT heme._auto ImportCSSC lasses)    
1168                return;    
1169      
1170           se lectElm =  document.g etElementB yId(editor _id + '_st yleSelect' );    
1171     773  
1172           if  (selectEl m && selec tElm.getAt tribute('c ssImported ') != 'tru e') {   774                 if   (c   =   cm.g e t('format select ') )   {
1173                var csse s = tinyMC E.getCSSCl asses(edit or_id);   775                    p =  DOM.getPar ent(n, DOM .isBlock);
1174                 if   (c ss e s   &&   select Elm )   {    
1175                    for  (i=0; i<cs ses.length ; i++)    
1176                         selectElm. options[se lectElm.op tions.leng th] = new  Option(css es[i], css es[i]);    
1177                }    
1178     776  
1179                // Only  do this on ce   777                    if ( p)
1180                if (csse s != null  && csses.l ength > 0)   778                         c.select(p .nodeName. toLowerCas e());
1181                    sele ctElm.setA ttribute(' cssImporte d', 'true' );    
1182           }   779                }
1183       },    
1184      
1185       _setCo okie : fun ction(name , value, e xpires, pa th, domain , secure)  {    
1186           va r curCooki e = name +  "=" + esc ape(value)  +    
1187                ((expire s) ? "; ex pires=" +  expires.to GMTString( ) : "") +    
1188                ((path)  ? "; path= " + escape (path) : " ") +    
1189                ((domain ) ? "; dom ain=" + do main : "")  +    
1190                ((secure ) ? "; sec ure" : "") ;    
1191     780  
1192           do cument.coo kie = curC ookie;   781                if (c =  cm.get('fo ntselect') )
1193       },   782                    c.se lect(ed.qu eryCommand Value('Fon tName'));
1194      
1195       _getCo okie : fun ction(name ) {    
1196           va r dc = doc ument.cook ie;    
1197           va r prefix =  name + "= ";    
1198           va r begin =  dc.indexOf ("; " + pr efix);    
1199     783  
1200           if  (begin ==  -1) {   784                if (c =  cm.get('fo ntsizesele ct'))
1201                begin =  dc.indexOf (prefix);   785                    c.se lect(ed.qu eryCommand Value('Fon tSize'));
1202     786  
1203                if (begi n != 0)   787                if (s.th eme_advanc ed_path &&  s.theme_a dvanced_st atusbar_lo cation) {
1204                    retu rn null;   788                    p =  DOM.get(ed .id + '_pa th') || DO M.add(ed.i d + '_path _row', 'sp an', {id :  ed.id + ' _path'});
1205           }  else   789                    DOM. setHTML(p,  '');
1206                begin +=  2;    
1207     790  
1208           va r end = do cument.coo kie.indexO f(";", beg in);   791                    ed.d om.getPare nt(n, func tion(n) {
    792                         var na = n .nodeName. toLowerCas e(), u, pi , ti = '';
1209     793  
1210           if  (end == - 1)   794                         // Ignore  non elemen t and hidd en element s
1211                end = dc .length;   795                         if (n.node Type != 1  || (DOM.ha sClass(n,  'mceItemHi dden') ||  DOM.hasCla ss(n, 'mce ItemRemove d')))
1212      
1213           re turn unesc ape(dc.sub string(beg in + prefi x.length,  end));    
1214       },    
1215      
1216       _resiz eTo : func tion(inst,  w, h, set _w) {    
1217           va r editorCo ntainer =  document.g etElementB yId(inst.e ditorId +  '_parent') ;    
1218           va r tableElm  = editorC ontainer.f irstChild;    
1219           va r iframe =  inst.ifra meElement;    
1220      
1221           if  (w == nul l || w ==  "null") {    
1222                set_w =  false;    
1223                w = 0;    
1224           }    
1225      
1226           if  (h == nul l || h ==  "null")    
1227                return;   796                             return ;
1228     797  
1229           w  = parseInt (w);   798                         // Fake na me
1230           h  = parseInt (h);   799                         if (v = DO M.getAttri b(n, 'mce_ name'))
1231     800                              na = v;
1232           if  (tinyMCE. isGecko) {    
1233                w += 2;    
1234                h += 2;    
1235            }    
1236      
1237           va r dx = w -  tableElm. clientWidt h;    
1238           va r dy = h -  tableElm. clientHeig ht;    
1239      
1240           w  = w < 1 ?  30 : w;    
1241           h  = h < 1 ?  30 : h;    
1242      
1243           if  (set_w)    
1244                tableElm .style.wid th = w + " px";    
1245     801       
1246           ta bleElm.sty le.height  = h + "px" ;   802                         // Handle  prefix
    803                         if (tinymc e.isIE &&  n.scopeNam e !== 'HTM L')
    804                             na = n .scopeName  + ':' + n a;
1247     805  
1248           iw  = iframe. clientWidt h + dx;   806                         // Remove  internal p refix
1249           ih  = iframe. clientHeig ht + dy;   807                         na = na.re place(/mce \:/g, '');
1250     808  
1251           iw  = iw < 1  ? 30 : iw;   809                         // Handle  node name
1252           ih  = ih < 1  ? 30 : ih;   810                         switch (na ) {
1253     811                             case ' b':
1254           if  (tinyMCE. isGecko) {   812                                 na  = 'strong ';
1255                iw -= 2;   813                                  break;
1256                ih -= 2;    
1257            }    
1258     814  
1259           if  (set_w)   815                             case ' i':
1260                iframe.s tyle.width  = iw + "p x";   816                                 na  = 'em';
    817                                 br eak;
1261     818  
1262           if rame.style .height =  ih + "px";   819                             case ' img':
    820                                 if  (v = DOM. getAttrib( n, 'src'))
    821                                      ti += 's rc: ' + v  + ' ';
1263     822  
1264           //  Is it to  small, mak e it bigge r again   823                                 br eak;
1265           if  (set_w) {    
1266                var tabl eBodyElm =  tableElm. firstChild ;    
1267                var minI frameWidth  = tableBo dyElm.scro llWidth;    
1268                if (inst .iframeEle ment.clien tWidth < m inIframeWi dth) {    
1269                    dx =  minIframe Width - in st.iframeE lement.cli entWidth;    
1270     824  
1271                    inst .iframeEle ment.style .width = ( iw + dx) +  "px";   825                             case ' a':
1272                }   826                                 if  (v = DOM. getAttrib( n, 'name') ) {
    827                                      ti += 'n ame: ' + v  + ' ';
    828                                      na += '# ' + v;
1273           }   829                                 }
1274     830  
1275           //  Remove pe sky table  controls   831                                 if  (v = DOM. getAttrib( n, 'href') )
1276           in st.useCSS  = false;   832                                      ti += 'h ref: ' + v  + ' ';
1277       },    
1278      
1279       /**    
1280        * Han dles resiz ing events .    
1281        */    
1282       _resiz eEventHand ler : func tion(e) {    
1283           va r resizer  = TinyMCE_ AdvancedTh eme._resiz er;    
1284      
1285           //  Do nothin g    
1286           if  (!resizer .resizing)    
1287                return;    
1288     833  
1289           e  = typeof(e ) == "unde fined" ? w indow.even t : e;   834                                  break;
1290  
   
1291           va r dx = e.s creenX - r esizer.dow nX;    
1292           va r dy = e.s creenY - r esizer.dow nY;    
1293           va r resizeBo x = resize r.resizeBo x;    
1294           va r editorId  = resizer .editorId;    
1295     835  
1296           sw itch (e.ty pe) {   836                             case  'font' :
1297                case  "mousemove " :   837                                 if  (s.conver t_fonts_to _spans)
1298                    var  w, h;   838                                      na = 'sp an';
1299     839  
1300                    w =  resizer.wi dth + dx;   840                                 if  (v = DOM. getAttrib( n, 'face') )
1301                    h =  resizer.he ight + dy;   841                                      ti += 'f ont: ' + v  + ' ';
1302     842  
1303                    w =  w < 1 ? 1  : w;   843                                 if  (v = DOM. getAttrib( n, 'size') )
1304                    h =  h < 1 ? 1  : h;   844                                      ti += 's ize: ' + v  + ' ';
1305     845  
1306                    if ( resizer.ho rizontal)   846                                 if  (v = DOM. getAttrib( n, 'color' ))
1307                         resizeBox. style.widt h = w + "p x";   847                                      ti += 'c olor: ' +  v + ' ';
1308     848  
1309                    resi zeBox.styl e.height =  h + "px";    
1310                    brea k;   849                                 br eak;
1311     850  
1312                 case   "mou s eu p " :   851                              case   ' s
p an' :
1313                    Tiny MCE_Advanc edTheme._s etResizing (e, editor Id, false) ;   852                                 if  (v = DOM. getAttrib( n, 'style' ))
1314                    Tiny MCE_Advanc edTheme._r esizeTo(ti nyMCE.getI nstanceByI d(editorId ), resizer .width + d x, resizer .height +  dy, resize r.horizont al);   853                                      ti += 's tyle: ' +  v + ' ';
1315     854  
1316                    // E xpire in a  month    
1317                    if ( tinyMCE.ge tParam("th eme_advanc ed_resizin g_use_cook ie", true) ) {    
1318                         var expire s = new Da te();    
1319                         expires.se tTime(expi res.getTim e() + 3600 000 * 24 *  30);    
1320      
1321                         // Set the  cookies    
1322                         TinyMCE_Ad vancedThem e._setCook ie("TinyMC E_" + edit orId + "_w idth", ""  + (resizer .horizonta l ? resize r.width +  dx : ""),  expires);    
1323                         TinyMCE_Ad vancedThem e._setCook ie("TinyMC E_" + edit orId + "_h eight", ""  + (resize r.height +  dy), expi res);    
1324                    }    
1325                    brea k;   855                                 br eak;
1326           }   856                         }
1327       },    
1328      
1329       /**    
1330        * Sta rts/stops  the editor  resizing.    
1331        */    
1332       _setRe sizing : f unction(e,  editor_id , state) {    
1333           e  = typeof(e ) == "unde fined" ? w indow.even t : e;    
1334      
1335           va r resizer  = TinyMCE_ AdvancedTh eme._resiz er;    
1336           va r editorCo ntainer =  document.g etElementB yId(editor _id + '_pa rent');    
1337           va r editorAr ea = docum ent.getEle mentById(e ditor_id +  '_parent' ).firstChi ld;    
1338           va r resizeBo x = docume nt.getElem entById(ed itor_id +  '_resize_b ox');    
1339           va r inst = t inyMCE.get InstanceBy Id(editor_ id);    
1340      
1341           if  (state) {    
1342                // Place  box over  editor are a    
1343                var widt h = editor Area.clien tWidth;    
1344                var heig ht = edito rArea.clie ntHeight;    
1345     857  
1346                resizeBo x.style.wi dth = widt h + "px";   858                         if (v = DO M.getAttri b(n, 'id') )
1347                resizeBo x.style.he ight = hei ght + "px" ;   859                             ti +=  'id: ' + v  + ' ';
1348     860  
1349                resizer. iframeWidt h = inst.i frameEleme nt.clientW idth;   861                         if (v = n. className)  {
1350                resizer. iframeHeig ht = inst. iframeElem ent.client Height;   862                             v = v. replace(/( webkit-[\w \-]+|Apple -[\w\-]+|m ceItem\w+| mceVisualA id)/g, '') ;
1351     863  
1352                // Hide  editor and  show resi ze box   864                             if (v  && v.index Of('mceIte m') == -1)  {
1353                editorAr ea.style.d isplay = " none";   865                                 ti  += 'class : ' + v +  ' ';
1354                resizeBo x.style.di splay = "b lock";    
1355     866  
1356                // Add e vent handl ers, only  once   867                                 if  (DOM.isBl ock(n) ||  na == 'img ' || na ==  'span')
1357                if (!res izer.event Handlers)  {   868                                      na += '. ' + v;
1358                    if ( tinyMCE.is MSIE)    
1359                         tinyMCE.ad dEvent(doc ument, "mo usemove",  TinyMCE_Ad vancedThem e._resizeE ventHandle r);    
1360                    else    
1361                         tinyMCE.ad dEvent(win dow, "mous emove", Ti nyMCE_Adva ncedTheme. _resizeEve ntHandler) ;    
1362      
1363                    tiny MCE.addEve nt(documen t, "mouseu p", TinyMC E_Advanced Theme._res izeEventHa ndler);    
1364      
1365                    resi zer.eventH andlers =  true;    
1366                }   869                             }
1367      
1368                resizer. resizing =  true;    
1369                resizer. downX = e. screenX;    
1370                resizer. downY = e. screenY;    
1371                resizer. width = pa rseInt(res izeBox.sty le.width);    
1372                resizer. height = p arseInt(re sizeBox.st yle.height );    
1373                resizer. editorId =  editor_id ;    
1374                resizer. resizeBox  = resizeBo x;    
1375                resizer. horizontal  = tinyMCE .getParam( "theme_adv anced_resi ze_horizon tal", true );    
1376           }  else {    
1377                resizer. resizing =  false;    
1378                resizeBo x.style.di splay = "n one";    
1379                editorAr ea.style.d isplay = t inyMCE.isM SIE && !ti nyMCE.isOp era ? "blo ck" : "tab le";    
1380                tinyMCE. execComman d('mceRese tDesignMod e');    
1381           }   870                         }
1382       },    
1383     871  
1384       _getCo lorHTML :  function(i d, n, cm)  {   872                         na = na.re place(/(ht ml:)/g, '' );
1385           va r i, h, cl ;   873                         na = {name  : na, nod e : n, tit le : ti};
    874                         t.onResolv eName.disp atch(t, na );
    875                         ti = na.ti tle;
    876                         na = na.na me;
1386     877  
1387           h  = '<span c lass="mceM enuLine">< /span>';   878                         //u = "jav ascript:ti nymce.Edit orManager. get('" + e d.id + "') .theme._se l('" + (de ++) + "'); ";
1388           cl  = tinyMCE .getParam( n, TinyMCE _AdvancedT heme._defC olors).spl it(',');   879                         pi = DOM.c reate('a',  {'href' :  "javascri pt:;", onm ousedown :  "return f alse;", ti tle : ti,  'class' :  'mcePath_'  + (de++)} , na);
1389     880  
1390           h  += '<table  class="mc eColors">< tr>';   881                         if (p.hasC hildNodes( )) {
1391           fo r (i=0; i< cl.length;  i++) {   882                             p.inse rtBefore(d ocument.cr eateTextNo de(' \u00b b '), p.fi rstChild);
1392                c = 'tin yMCE.execI nstanceCom mand(\'' +  id + '\',  \'' + cm  + '\', fal se, \'#' +  cl[i] + ' \');';   883                             p.inse rtBefore(p i, p.first Child);
1393                h += '<t d><a href= "javascrip t:' + c +  '" style=" background -color: #'  + cl[i] +  '" onclic k="' + c +  ';return  false;"></ a></td>';   884                         } else
1394     885                             p.appe ndChild(pi );
1395                if ((i+1 ) % 8 == 0 )   886                    }, e d.getBody( ));
1396                    h +=  '</tr><tr >';    
1397           }   887                }
    888           },
1398     889  
1399           h  += '</tr>< /table>';   890           //  Commands  gets calle d by execC ommand
1400      
1401           if  (tinyMCE. getParam(" theme_adva nced_more_ colors", t rue))    
1402                h += '<a  href="jav ascript:vo id(0);" on click="Tin yMCE_Advan cedTheme._ pickColor( \'' + id +  '\',\'' +  cm + '\') ;" class=" mceMoreCol ors">' + t inyMCE.get Lang('lang _more_colo rs') + '</ a>';    
1403     891  
1404           re turn h;   892           _s el : funct ion(v) {
    893                this.edi tor.execCo mmand('mce SelectNode Depth', fa lse, v);
1405       },   894           },
1406     895  
1407        _ pi c kCol or   :   function(
i d ,   cm )   {
  896            _ m c eInsertAnc h or   :   function( u i
,   v )   {
1408           va r inputCol or, inst =  tinyMCE.s electedIns tance;   897                var ed =  this.edit or;
1409     898  
1410           if  (cm == 'f orecolor'  && inst)   899                ed.windo wManager.o pen({
1411                inputCol or = inst. foreColor;   900                    url  : tinymce. baseURL +  '/themes/a dvanced/an chor.htm',
    901                    widt h : 320 +  parseInt(e d.getLang( 'advanced. anchor_del ta_width',  0)),
    902                    heig ht : 90 +  parseInt(e d.getLang( 'advanced. anchor_del ta_height' , 0)),
    903                    inli ne : true
    904                }, {
    905                    them e_url : th is.url
    906                });
    907           },
1412     908  
1413           if  ((cm == ' backcolor'  || cm ==  'HiliteCol or') && in st)   909           _m ceCharMap  : function () {
1414                inputCol or = inst. backColor;   910                var ed =  this.edit or;
1415     911  
1416           ti nyMCE.exec Command('m ceColorPic ker', true , {color :  inputColo r, callbac k : functi on(c) {   912                ed.windo wManager.o pen({
1417                tinyMCE. execInstan ceCommand( id, cm, fa lse, c);   913                    url  : tinymce. baseURL +  '/themes/a dvanced/ch armap.htm' ,
1418            } } );   914                    widt h : 550 +  parseInt(e d.getLang( 'advanced. charmap_de lta_width' , 0)),
    915                    heig ht : 250 +  parseInt( ed.getLang ('advanced .charmap_d elta_heigh t', 0)),
    916                    inli ne : true
    917                }, {
    918                    them e_url : th is.url
    919                 }
);
1419       },   920           },
1420     921  
1421       _inser tImage : f unction(sr c, alt, bo rder, hspa ce, vspace , width, h eight, ali gn, title,  onmouseov er, onmous eout) {   922           _m ceHelp : f unction()  {
1422           ti nyMCE.exec Command("m ceInsertCo ntent", fa lse, tinyM CE.createT agHTML('im g', {   923                var ed =  this.edit or;
1423                src : ti nyMCE.conv ertRelativ eToAbsolut eURL(tinyM CE.setting s['base_hr ef'], src) , // Force  absolute   924  
1424                mce_src  : src,   925                ed.windo wManager.o pen({
1425                alt : al t,   926                    url  : tinymce. baseURL +  '/themes/a dvanced/ab out.htm',
1426                border :  border,   927                     width   :   480 ,
1427                hspace :  hspace,   928                     height   :   380 ,
1428                vspace :  vspace,   929                    
i n l in e   :   t ru e
1429                 width   :   width ,   930                }, {
1430                 height   :   height ,   931                    them e_url : th is.url
1431                align :  align,   932                 })
;
1432                 t i t l
e   :   t itl e ,
   
1433                onmouseo ver : onmo useover,    
1434                onmouseo ut : onmou seout    
1435            }) ) ;    
1436       },   933           },
1437     934  
1438       _inser tLink : fu nction(hre f, target,  title, on click, sty le_class)  {   935           _m ceColorPic ker : func tion(u, v)  {
1439           ti nyMCE.exec Command('m ceBeginUnd oLevel');   936                var ed =  this.edit or;
1440     937  
1441           if  (tinyMCE. selectedIn stance &&  tinyMCE.se lectedElem ent && tin yMCE.selec tedElement .nodeName. toLowerCas e() == "im g") {   938                v = v ||  {};
1442                var doc  = tinyMCE. selectedIn stance.get Doc();    
1443                var link Element =  tinyMCE.ge tParentEle ment(tinyM CE.selecte dElement,  "a");    
1444                var newL ink = fals e;    
1445     939  
1446                if (!lin kElement)  {   940                ed.windo wManager.o pen({
1447                    link Element =  doc.create Element("a ");   941                    url  : tinymce. baseURL +  '/themes/a dvanced/co lor_picker .htm',
1448                    
n ewL in k   =   true ;
  942                    widt h : 375 +  parseInt(e d.getLang( 'advanced. colorpicke r_delta_wi dth', 0)),
1449                 }
  943                    heig ht : 250 +  parseInt( ed.getLang ('advanced .colorpick er_delta_h eight', 0) ),
    944                    clos e_previous  : false,
    945                     i n l in e   :   true
    946                }, {
    947                    inpu t_color :  v.color,
    948                    func  : v.func,
    949                    them e_url : th is.url
    950                });
    951            } ,
1450     952  
1451                 var   mhr e f   =  
h r e f ;
  953           _m ceCodeEdit or : funct ion(ui, va l) {
1452                var thre f = eval(t inyMCE.set tings['url converter_ callback']  + "(href,  linkEleme nt);");   954                 var  
e d   =   t h is. e ditor ;
1453                mhref =  tinyMCE.ge tParam('co nvert_urls ') ? href  : mhref;    
1454     955  
1455                tinyMCE. setAttrib( linkElemen t, 'href',  thref);   956                ed.windo wManager.o pen({
1456                tinyMCE. setAttrib( linkElemen t, 'mce_hr ef', mhref );   957                    url  : tinymce. baseURL +  '/themes/a dvanced/so urce_edito r.htm',
1457                tinyMCE. setAttrib( linkElemen t, 'target ', target) ;   958                    widt h : parseI nt(ed.getP aram("them e_advanced _source_ed itor_width ", 720)),
1458                tinyMCE. setAttrib( linkElemen t, 'title' , title);   959                    heig ht : parse Int(ed.get Param("the me_advance d_source_e ditor_heig ht", 580)) ,
1459                tinyMCE. setAttrib( linkElemen t, 'onclic k', onclic k);   960                    inli ne : true,
1460                tinyMCE. setAttrib( linkElemen t, 'class' , style_cl ass);   961                    resi zable : tr ue,
    962                    maxi mizable :  true
    963                }, {
    964                    them e_url : th is.url
    965                });
    966           },
1461     967  
1462                if (newL ink) {   968           _m ceImage :  function(u i, val) {
1463                    link Element.ap pendChild( tinyMCE.se lectedElem ent.cloneN ode(true)) ;   969                var ed =  this.edit or;
1464                    tiny MCE.select edElement. parentNode .replaceCh ild(linkEl ement, tin yMCE.selec tedElement );    
1465                }    
1466     970  
    971                // Inter nal image  object lik e a flash  placeholde r
    972                if (ed.d om.getAttr ib(ed.sele ction.getN ode(), 'cl ass').inde xOf('mceIt em') != -1 )
1467                return;   973                    retu rn;
1468           }    
1469     974  
1470           if  (!tinyMCE .linkEleme nt && tiny MCE.select edInstance ) {   975                ed.windo wManager.o pen({
1471                if (tiny MCE.isSafa ri) {   976                    url  : tinymce. baseURL +  '/themes/a dvanced/im age.htm',
1472                    tiny MCE.execCo mmand("mce InsertCont ent", fals e, '<a hre f="' + tin yMCE.uniqu eURL + '"> ' + tinyMC E.selected Instance.s election.g etSelected HTML() + ' </a>');   977                    widt h : 355 +  parseInt(e d.getLang( 'advanced. image_delt a_width',  0)),
1473                }  else   978                    heig ht : 275 +  parseInt( ed.getLang ('advanced .image_del ta_height' , 0)),
1474                    tiny MCE.select edInstance .contentDo cument.exe cCommand(" createlink ", false,  tinyMCE.un iqueURL);   979                    inli ne : true
    980                } , {
    981                    them e_url : th is.url
    982                });
    983           },
1475     984  
1476                tinyMCE. linkElemen t = tinyMC E.getEleme ntByAttrib uteValue(t inyMCE.sel ectedInsta nce.conten tDocument. body, "a",  "href", t inyMCE.uni queURL);   985           _m ceLink : f unction(ui , val) {
    986                var ed =  this.edit or;
1477     987  
1478                var elem entArray =  tinyMCE.g etElements ByAttribut eValue(tin yMCE.selec tedInstanc e.contentD ocument.bo dy, "a", " href", tin yMCE.uniqu eURL);   988                ed.windo wManager.o pen({
    989                    url  : tinymce. baseURL +  '/themes/a dvanced/li nk.htm',
    990                    widt h : 310 +  parseInt(e d.getLang( 'advanced. link_delta _width', 0 )),
    991                    heig ht : 200 +  parseInt( ed.getLang ('advanced .link_delt a_height',  0)),
    992                    inli ne : true
    993                }, {
    994                    them e_url : th is.url
    995                });
    996           },
1479     997  
1480                for (var  i=0; i<el ementArray .length; i ++) {   998           _m ceNewDocum ent : func tion() {
1481                     var   mhr e f   =  
h r e f ;
  999                 var  
e d   =   t h is. e ditor ;
1482                    var  thref = ev al(tinyMCE .settings[ 'urlconver ter_callba ck'] + "(h ref, eleme ntArray[i] );");    
1483                    mhre f = tinyMC E.getParam ('convert_ urls') ? h ref : mhre f;    
1484     1000  
1485                    tiny MCE.setAtt rib(elemen tArray[i],  'href', t href);   1001                ed.windo wManager.c onfirm('ad vanced.new document',  function( s) {
1486                    tiny MCE.setAtt rib(elemen tArray[i],  'mce_href ', mhref);   1002                    if ( s)
1487                    tiny MCE.setAtt rib(elemen tArray[i],  'target',  target);   1003                         ed.execCom mand('mceS etContent' , false, ' ');
1488                    tiny MCE.setAtt rib(elemen tArray[i],  'title',  title);   1004                });
1489                    tiny MCE.setAtt rib(elemen tArray[i],  'onclick' , onclick) ;   1005            } ,
1490                    tiny MCE.setAtt rib(elemen tArray[i],  'class',  style_clas s);    
1491                 }
   
1492     1006  
1493                tinyMCE. linkElemen t = elemen tArray[0];   1007           _m ceForeColo r : functi on() {
    1008                var t =  this;
    1009  
    1010                this._mc eColorPick er(0, {
    1011                    func  : functio n(co) {
    1012                         t.editor.e xecCommand ('ForeColo r', false,  co);
1494           }   1013                    }
    1014                });
    1015           },
1495     1016  
1496           if  (tinyMCE. linkElemen t) {   1017           _m ceBackColo r : functi on() {
1497                 var   mhref   =  
h ref ;
  1018                 var   t   =   t h is ;
1498                href = e val(tinyMC E.settings ['urlconve rter_callb ack'] + "( href, tiny MCE.linkEl ement);");    
1499                mhref =  tinyMCE.ge tParam('co nvert_urls ') ? href  : mhref;    
1500     1019  
1501                tinyMCE. setAttrib( tinyMCE.li nkElement,  'href', h ref);   1020                this._mc eColorPick er(0, {
1502                tinyMCE. setAttrib( tinyMCE.li nkElement,  'mce_href ', mhref);   1021                    func  : functio n(co) {
1503                tinyMCE. setAttrib( tinyMCE.li nkElement,  'target',  target);   1022                         t.editor.e xecCommand ('HiliteCo lor', fals e, co);
1504                tinyMCE. setAttrib( tinyMCE.li nkElement,  'title',  title);    
1505                tinyMCE. setAttrib( tinyMCE.li nkElement,  'onclick' , onclick) ;    
1506                tinyMCE. setAttrib( tinyMCE.li nkElement,  'class',  style_clas s);    
1507           }   1023                    }
    1024                });
    1025           },
1508     1026  
1509           ti nyMCE.exec Command('m ceEndUndoL evel');   1027           _u first : fu nction(s)  {
    1028                return s .substring (0, 1).toU pperCase()  + s.subst ring(1);
1510       }   1029           }
1511   }
;
  1030        } ) ;
1512      
1513   tinyMCE.ad dTheme("ad vanced", T inyMCE_Adv ancedTheme );    
1514     1031  
1515   // Add def ault butto ns maps fo r advanced  theme and  all inter nal plugin s   1032       tinymc e.ThemeMan ager.add(' advanced',  tinymce.t hemes.Adva ncedTheme) ;
1516   tinyMCE.ad dButtonMap (TinyMCE_A dvancedThe me._button Map);   1033   }());