By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,865 Members | 1,717 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,865 IT Pros & Developers. It's quick & easy.

How to call a Javascript function from iframe

P: 23
Hi,

I have used a rich text editor in my application. I got it from one of the site.all are JS files.

My problem is, i want to call a javascript function from the iframe.

Can anybody help me in this regard
Apr 27 '09 #1
Share this Question
Share on Google+
17 Replies


Ciary
Expert 100+
P: 247
what do you do with the iframe?

if it is just a box, you do something like this
Expand|Select|Wrap|Line Numbers
  1. <script language="javascript" type="text/javascript">
  2.     function clicking(){
  3.         top.window.MyScript();
  4.     }
  5. </script>
  6. <input type="button" onclick="clicking()" />
  7.  
if you open a page in it (like with a an uploader) you put this in the page you open
Expand|Select|Wrap|Line Numbers
  1. <script language="javascript" type="text/javascript">
  2.     top.window.MyScript();
  3. </script>
  4.  
Apr 27 '09 #2

P: 23
Hi,

My requirement is using iframe only. from iframe i want to call a javascript function.
Apr 27 '09 #3

Ciary
Expert 100+
P: 247
what triggers the script to be executed? what's the content of the iframe apart from a javascript function?
Apr 27 '09 #4

P: 23
I am using two JS files here to display the rich text editor. see below the JS files

1) richtext.js

Expand|Select|Wrap|Line Numbers
  1. function getXHTML(data) {
  2.  
  3.     return new Html2Xhtml(data).parse()
  4. };
  5. function Html2Xhtml(data) {
  6.     this.data = data || ''
  7. };
  8. Html2Xhtml.prototype.setHTML = function(data) {
  9.     this.data = data || this.data
  10. };
  11. function test(name)
  12. {
  13.     alert(name);
  14.     //alert("Malathi");
  15. }
  16. Html2Xhtml.prototype.parse = function() {
  17.     var state = 0;
  18.     var xhtml = '';
  19.     var p = 0;
  20.     var unget = false;
  21.     var tagname = '';
  22.     var attrname = '';
  23.     var attrval = '';
  24.     var quot = '';
  25.     var data = this.data;
  26.     var len = data.length;
  27.     var phpval = '';
  28.     var tagtype = 0;
  29.     var insidepre = false;
  30.     while (1) {
  31.         if (p >= len && !unget) {
  32.             return xhtml
  33.         }
  34.         if (unget) {
  35.             unget = false
  36.         } else {
  37.             var c = data.substr(p++, 1)
  38.         }
  39.         switch (state) {
  40.         case 0:
  41.             if (c == '<') {
  42.                 state = 1;
  43.                 break
  44.             }
  45.             var cc = c.charCodeAt();
  46.             if (Html2Xhtml.charEntities[cc]) {
  47.                 xhtml += '&#' + Html2Xhtml.charEntities[cc] + ';'
  48.  
  49.             } else {
  50.                 xhtml += c
  51.             }
  52.             break;
  53.         case 1:
  54.             if (/[a-zA-Z]/.test(c)) {
  55.                 state = 2;
  56.                 tagtype = 1;
  57.                 tagname = c.toLowerCase();
  58.                 break
  59.             }
  60.             if (c == '/') {
  61.                 state = 2;
  62.                 tagtype = -1;
  63.                 break
  64.             }
  65.             if (c == '!') {
  66.                 if (data.substr(p, 2) == '--') {
  67.                     xhtml += '<!--';
  68.                     p += 2;
  69.                     state = 9;
  70.                     break
  71.                 }
  72.                 xhtml += '<!';
  73.                 state = 10;
  74.                 break
  75.             }
  76.             if (c == '?') {
  77.                 state = 11;
  78.                 xhtml += '<' + '?';
  79.                 break
  80.             }
  81.             xhtml += '&lt;';
  82.             unget = true;
  83.             state = 0;
  84.             break;
  85.         case 2:
  86.             if (Html2Xhtml.isSpaceChar[c]) {
  87.                 xhtml += (!insidepre && tagtype > 0 && Html2Xhtml.hasNLBefore[tagname] && xhtml.length && xhtml.substr(xhtml.length - 1, 1) != '\n' ? '\n': '') + (tagtype > 0 ? '<': '</') + tagname;
  88.                 state = 3;
  89.                 break
  90.             }
  91.             if (c == '/') {
  92.                 xhtml += (!insidepre && tagtype > 0 && Html2Xhtml.hasNLBefore[tagname] && xhtml.length && xhtml.substr(xhtml.length - 1, 1) != '\n' ? '\n': '') + (tagtype > 0 ? '<': '</') + tagname;
  93.                 if (data.substr(p, 1) != '>') {
  94.                     state = 3;
  95.                     break
  96.                 }
  97.                 state = 4;
  98.                 break
  99.             }
  100.             if (c == '>') {
  101.                 xhtml += (!insidepre && tagtype > 0 && Html2Xhtml.hasNLBefore[tagname] && xhtml.length && xhtml.substr(xhtml.length - 1, 1) != '\n' ? '\n': '') + (tagtype > 0 ? '<': '</') + tagname;
  102.                 unget = true;
  103.                 state = 4;
  104.                 break
  105.             }
  106.             tagname += c.toLowerCase();
  107.             break;
  108.         case 3:
  109.             if (Html2Xhtml.isSpaceChar[c]) {
  110.                 break
  111.             }
  112.             if (c == '/') {
  113.                 if (data.substr(p, 1) != '>') {
  114.                     break
  115.                 }
  116.                 state = 4;
  117.                 break
  118.             }
  119.             if (c == '>') {
  120.                 unget = true;
  121.                 state = 4;
  122.                 break
  123.             }
  124.             attrname = c.toLowerCase();
  125.             attrval = '';
  126.             state = 5;
  127.             break;
  128.         case 4:
  129.             xhtml += (Html2Xhtml.isEmptyTag[tagname] ? ' />': '>') + (!insidepre && tagtype < 0 && Html2Xhtml.hasNLAfter[tagname] && p < len && data.substr(p, 1) != '\n' ? '\n': '');
  130.             if (tagtype > 0 && Html2Xhtml.dontAnalyzeContent[tagname]) {
  131.                 state = 13;
  132.                 attrname = attrval = quot = '';
  133.                 tagtype = 0;
  134.                 break
  135.             }
  136.             if (tagname == 'pre') {
  137.                 insidepre = !insidepre
  138.             }
  139.             state = 0;
  140.             tagname = attrname = attrval = quot = '';
  141.             tagtype = 0;
  142.             break;
  143.         case 5:
  144.             if (Html2Xhtml.isSpaceChar[c]) {
  145.                 xhtml += ' ' + attrname;
  146.                 if (Html2Xhtml.isEmptyAttr[attrname]) {
  147.                     xhtml += '="' + attrname + '"'
  148.                 }
  149.                 state = 3;
  150.                 break
  151.             }
  152.             if (c == '/') {
  153.                 xhtml += ' ' + attrname;
  154.                 if (Html2Xhtml.isEmptyAttr[attrname]) {
  155.                     xhtml += '="' + attrname + '"'
  156.                 }
  157.                 if (data.substr(p, 1) != '>') {
  158.                     state = 3;
  159.                     break
  160.                 }
  161.                 state = 4;
  162.                 break
  163.             }
  164.             if (c == '>') {
  165.                 xhtml += ' ' + attrname;
  166.                 if (Html2Xhtml.isEmptyAttr[attrname]) {
  167.                     xhtml += '="' + attrname + '"'
  168.                 }
  169.                 unget = true;
  170.                 state = 4;
  171.                 break
  172.             }
  173.             if (c == '=') {
  174.                 xhtml += ' ' + attrname + '=';
  175.                 state = 6;
  176.                 break
  177.             }
  178.             if (c == '"' || c == "'") {
  179.                 attrname += '?'
  180.             } else {
  181.                 attrname += c.toLowerCase()
  182.             }
  183.             break;
  184.         case 6:
  185.             if (Html2Xhtml.isSpaceChar[c]) {
  186.                 xhtml += (Html2Xhtml.isEmptyAttr[attrname] ? '"' + attrname + '"': '""');
  187.                 state = 3;
  188.                 break
  189.             }
  190.             if (c == '>') {
  191.                 xhtml += (Html2Xhtml.isEmptyAttr[attrname] ? '"' + attrname + '"': '""');
  192.                 unget = true;
  193.                 state = 4;
  194.                 break
  195.             }
  196.             if (c == '/' && data.substr(p, 1) == '>') {
  197.                 xhtml += (Html2Xhtml.isEmptyAttr[attrname] ? '"' + attrname + '"': '""');
  198.                 state = 4;
  199.                 break
  200.             }
  201.             if (c == '"' || c == "'") {
  202.                 quot = c;
  203.                 state = 8;
  204.                 break
  205.             }
  206.             attrval = c;
  207.             state = 7;
  208.             break;
  209.         case 7:
  210.             if (Html2Xhtml.isSpaceChar[c]) {
  211.                 xhtml += '"' + Html2Xhtml.escapeQuot(attrval, '"') + '"';
  212.                 state = 3;
  213.                 break
  214.             }
  215.             if (c == '/' && data.substr(p, 1) == '>') {
  216.                 xhtml += '"' + Html2Xhtml.escapeQuot(attrval, '"') + '"';
  217.                 state = 4;
  218.                 break
  219.             }
  220.             if (c == '>') {
  221.                 unget = true;
  222.                 xhtml += '"' + Html2Xhtml.escapeQuot(attrval, '"') + '"';
  223.                 state = 4;
  224.                 break
  225.             }
  226.             attrval += c;
  227.             break;
  228.         case 8:
  229.             if (c == quot) {
  230.                 xhtml += '"' + Html2Xhtml.escapeQuot(attrval, '"') + '"';
  231.                 state = 3;
  232.                 break
  233.             }
  234.             attrval += c;
  235.             break;
  236.         case 9:
  237.             if (c == '-' && data.substr(p, 2) == '->') {
  238.                 p += 2;
  239.                 xhtml += '-->';
  240.                 state = 0;
  241.                 break
  242.             }
  243.             xhtml += c;
  244.             break;
  245.         case 10:
  246.             if (c == '>') {
  247.                 state = 0
  248.             }
  249.             xhtml += c;
  250.             break;
  251.         case 11:
  252.             if (c == "'" || c == '"') {
  253.                 quot = c;
  254.                 state = 12;
  255.                 break
  256.             }
  257.             if (c == '?' && data.substr(p, 1) == '>') {
  258.                 state = 0;
  259.                 xhtml += '?' + '>';
  260.                 p++;
  261.                 break
  262.             }
  263.             xhtml += c;
  264.             break;
  265.         case 12:
  266.             if (c == quot) {
  267.                 state = 11;
  268.                 xhtml += quot + Html2Xhtml.escapeQuot(phpval, quot) + quot;
  269.                 phpval = quot = '';
  270.                 break
  271.             }
  272.             phpval += c;
  273.             break;
  274.         case 13:
  275.             if (c == '<' && data.substr(p, tagname.length + 1).toLowerCase() == '/' + tagname) {
  276.                 unget = true;
  277.                 state = 0;
  278.                 tagname = '';
  279.                 break
  280.             }
  281.             if (tagname == 'textarea') {
  282.                 xhtml += Html2Xhtml.escapeHTMLChar(c)
  283.             } else {
  284.                 xhtml += c
  285.             }
  286.             break
  287.         }
  288.     }
  289.     return xhtml
  290. };
  291. Html2Xhtml.escapeQuot = function(str, quot) {
  292.     if (!quot) {
  293.         quot = '"'
  294.     }
  295.     if (quot == '"') {
  296.         return str.replace(/"/ig, '\\"')
  297.     }
  298.     return str.replace(/'/ig, "\\'")
  299. };
  300. Html2Xhtml.escapeHTMLChar = function(c) {
  301.     if (c == '&') {
  302.         return '&amp;'
  303.     }
  304.     if (c == '<') {
  305.         return '&lt;'
  306.     }
  307.     if (c == '>') {
  308.         return '&gt;'
  309.     }
  310.     var cc = c.charCodeAt();
  311.     if (Html2Xhtml.charEntities[cc]) {
  312.         return '&' + Html2Xhtml.charEntities[cc] + ';'
  313.     } else {
  314.         return c
  315.     }
  316. };
  317. Html2Xhtml.isSpaceChar = {
  318.     ' ': 1,
  319.     '\r': 1,
  320.     '\n': 1,
  321.     '\t': 1
  322. };
  323. Html2Xhtml.isEmptyTag = {
  324.     'area': 1,
  325.     'base': 1,
  326.     'basefont': 1,
  327.     'br': 1,
  328.     'hr': 1,
  329.     'img': 1,
  330.     'input': 1,
  331.     'link': 1,
  332.     'meta': 1,
  333.     'param': 1
  334. };
  335. Html2Xhtml.isEmptyAttr = {
  336.     'checked': 1,
  337.     'compact': 1,
  338.     'declare': 1,
  339.     'defer': 1,
  340.     'disabled': 1,
  341.     'ismap': 1,
  342.     'multiple': 1,
  343.     'noresize': 1,
  344.     'nosave': 1,
  345.     'noshade': 1,
  346.     'nowrap': 1,
  347.     'readonly': 1,
  348.     'selected': 1
  349. };
  350. Html2Xhtml.hasNLBefore = {
  351.     'div': 1,
  352.     'p': 1,
  353.     'table': 1,
  354.     'tbody': 1,
  355.     'tr': 1,
  356.     'td': 1,
  357.     'th': 1,
  358.     'title': 1,
  359.     'head': 1,
  360.     'body': 1,
  361.     'script': 1,
  362.     'comment': 1,
  363.     'li': 1,
  364.     'meta': 1,
  365.     'h1': 1,
  366.     'h2': 1,
  367.     'h3': 1,
  368.     'h4': 1,
  369.     'h5': 1,
  370.     'h6': 1,
  371.     'hr': 1,
  372.     'ul': 1,
  373.     'ol': 1,
  374.     'option': 1,
  375.     'link': 1
  376. };
  377. Html2Xhtml.hasNLAfter = {
  378.     'html': 1,
  379.     'head': 1,
  380.     'body': 1,
  381.     'p': 1,
  382.     'th': 1,
  383.     'style': 1
  384. };
  385. Html2Xhtml.dontAnalyzeContent = {
  386.     'textarea': 1,
  387.     'script': 1,
  388.     'style': 1
  389. };
  390. Html2Xhtml.charEntities = {
  391.     160 : '160',//'nbsp',
  392.     161 : '161',//'iexcl',
  393.     162 : '162',//'cent',
  394.     163 : '163',//'pound',
  395.     164 : '164',//'curren',
  396.     165 : '165',//'yen',
  397.     166 : '166',//'brvbar',
  398.     167 : '167',//'sect',
  399.     168 : '168',//'uml',
  400.     169 : '169',//'copy',
  401.     170 : '170',//'ordf',
  402.     171 : '171',//'laquo',
  403.     172 : '172',//'not',
  404.     173 : '173',//'shy',
  405.     174 : '174',//'reg',
  406.     175 : '175',//'macr',
  407.     176 : '176',//'deg',
  408.     177 : '177',//'plusmn',
  409.     178 : '178',//'sup2',
  410.     179 : '179',//'sup3',
  411.     180 : '180',//'acute',
  412.     181 : '181',//'micro',
  413.     182 : '182',//'para',
  414.     183 : '183',//'middot',
  415.     184 : '184',//'cedil',
  416.     185 : '185',//'sup1',
  417.     186 : '186',//'ordm',
  418.     187 : '187',//'raquo',
  419.     188 : '188',//'frac14',
  420.     189 : '189',//'frac12',
  421.     190 : '190',//'frac34',
  422.     191 : '191',//'iquest',
  423.     192 : '192',//'agrave',
  424.     193 : '193',//'aacute',
  425.     194 : '194',//'acirc',
  426.     195 : '195',//'atilde',
  427.     196 : '196',//'auml',
  428.     197 : '197',//'aring',
  429.     198 : '198',//'aelig',
  430.     199 : '199',//'ccedil',
  431.     200 : '200',//'egrave',
  432.     201 : '201',//'eacute',
  433.     202 : '202',//'ecirc',
  434.     203 : '203',//'euml',
  435.     204 : '204',//'igrave',
  436.     205 : '205',//'iacute',
  437.     206 : '206',//'icirc',
  438.     207 : '207',//'iuml',
  439.     208 : '208',//'eth',
  440.     209 : '209',//'ntilde',
  441.     210 : '210',//'ograve',
  442.     211 : '211',//'oacute',
  443.     212 : '212',//'ocirc',
  444.     213 : '213',//'otilde',
  445.     214 : '214',//'ouml',
  446.     215 : '215',//'times',
  447.     216 : '216',//'oslash',
  448.     217 : '217',//'ugrave',
  449.     218 : '218',//'uacute',
  450.     219 : '219',//'ucirc',
  451.     220 : '220',//'uuml',
  452.     221 : '221',//'yacute',
  453.     222 : '222',//'thorn',
  454.     223 : '223',//'szlig',
  455.     224 : '224',//'agrave',
  456.     225 : '225',//'aacute',
  457.     226 : '226',//'acirc',
  458.     227 : '227',//'atilde',
  459.     228 : '228',//'auml',
  460.     229 : '229',//'aring',
  461.     230 : '230',//'aelig',
  462.     231 : '231',//'ccedil',
  463.     232 : '232',//'egrave',
  464.     233 : '233',//'eacute',
  465.     234 : '234',//'ecirc',
  466.     235 : '235',//'euml',
  467.     236 : '236',//'igrave',
  468.     237 : '237',//'iacute',
  469.     238 : '238',//'icirc',
  470.     239 : '239',//'iuml',
  471.     240 : '240',//'eth',
  472.     241 : '241',//'ntilde',
  473.     242 : '242',//'ograve',
  474.     243 : '243',//'oacute',
  475.     244 : '244',//'ocirc',
  476.     245 : '245',//'otilde',
  477.     246 : '246',//'ouml',
  478.     247 : '247',//'divide',
  479.     248 : '248',//'oslash',
  480.     249 : '249',//'ugrave',
  481.     250 : '250',//'uacute',
  482.     251 : '251',//'ucirc',
  483.     252 : '252',//'uuml',
  484.     253 : '253',//'yacute',
  485.     254 : '254',//'thorn',
  486.     255 : '255',//'yuml',
  487.     338 : '338',//'oelig',
  488.     339 : '339',//'oelig',
  489.     352 : '352',//'scaron',
  490.     353 : '353',//'scaron',
  491.     376 : '376',//'yuml',
  492.     710 : '710',//'circ',
  493.     732 : '732',//'tilde',
  494.     8194 :'8194',//'ensp',
  495.     8195 :'8195',//'emsp',
  496.     8201 :'8201',//'thinsp',
  497.     8204 :'8204',//'zwnj',
  498.     8205 :'8205',//'zwj',
  499.     8206 :'8206',//'lrm',
  500.     8207 :'8207',//'rlm',
  501.     8211 :'8211',//'ndash',
  502.     8212 :'8212',//'mdash',
  503.     8216 :'8216',//'lsquo',
  504.     8217 :'8217',//'rsquo',
  505.     8218 :'8218',//'sbquo',
  506.     8220 :'8220',//'ldquo',
  507.     8221 :'8221',//'rdquo',
  508.     8222 :'8222',//'bdquo',
  509.     8224 :'8224',//'dagger',
  510.     8225 :'8225',//'dagger',
  511.     8240 :'8240',//'permil',
  512.     8249 :'8249',//'lsaquo',
  513.     8250 :'8250',//'rsaquo',
  514.     8364 :'8364',//'euro',
  515.     402 : '402',//'fnof',
  516.     913 : '913',//'alpha',
  517.     914 : '914',//'beta',
  518.     915 : '915',//'gamma',
  519.     916 : '916',//'delta',
  520.     917 : '917',//'epsilon',
  521.     918 : '918',//'zeta',
  522.     919 : '919',//'eta',
  523.     920 : '920',//'theta',
  524.     921 : '921',//'iota',
  525.     922 : '922',//'kappa',
  526.     923 : '923',//'lambda',
  527.     924 : '924',//'mu',
  528.     925 : '925',//'nu',
  529.     926 : '926',//'xi',
  530.     927 : '927',//'omicron',
  531.     928 : '928',//'pi',
  532.     929 : '929',//'rho',
  533.     931 : '931',//'sigma',
  534.     932 : '932',//'tau',
  535.     933 : '933',//'upsilon',
  536.     934 : '934',//'phi',
  537.     935 : '935',//'chi',
  538.     936 : '936',//'psi',
  539.     937 : '937',//'omega',
  540.     945 : '945',//'alpha',
  541.     946 : '946',//'beta',
  542.     947 : '947',//'gamma',
  543.     948 : '948',//'delta',
  544.     949 : '949',//'epsilon',
  545.     950 : '950',//'zeta',
  546.     951 : '951',//'eta',
  547.     952 : '952',//'theta',
  548.     953 : '953',//'iota',
  549.     954 : '954',//'kappa',
  550.     955 : '955',//'lambda',
  551.     956 : '956',//'mu',
  552.     957 : '957',//'nu',
  553.     958 : '958',//'xi',
  554.     959 : '959',//'omicron',
  555.     960 : '960',//'pi',
  556.     961 : '961',//'rho',
  557.     962 : '962',//'sigmaf',
  558.     963 : '963',//'sigma',
  559.     964 : '964',//'tau',
  560.     965 : '965',//'upsilon',
  561.     966 : '966',//'phi',
  562.     967 : '967',//'chi',
  563.     968 : '968',//'psi',
  564.     969 : '969',//'omega',
  565.     977 : '977',//'thetasym',
  566.     978 : '978',//'upsih',
  567.     982 : '982',//'piv',
  568.     8226 :'8226',//'bull',
  569.     8230 :'8230',//'hellip',
  570.     8242 :'8242',//'prime',
  571.     8243 :'8243',//'prime',
  572.     8254 :'8254',//'oline',
  573.     8260 :'8260',//'frasl',
  574.     8472 :'8472',//'weierp',
  575.     8465 :'8465',//'image',
  576.     8476 :'8476',//'real',
  577.     8482 :'8482',//'trade',
  578.     8501 :'8501',//'alefsym',
  579.     8592 :'8592',//'larr',
  580.     8593 :'8593',//'uarr',
  581.     8594 :'8594',//'rarr',
  582.     8595 :'8595',//'darr',
  583.     8596 :'8596',//'harr',
  584.     8629 :'8629',//'crarr',
  585.     8656 :'8656',//'larr',
  586.     8657 :'8657',//'uarr',
  587.     8658 :'8658',//'rarr',
  588.     8659 :'8659',//'darr',
  589.     8660 :'8660',//'harr',
  590.     8704 :'8704',//'forall',
  591.     8706 :'8706',//'part',
  592.     8707 :'8707',//'exist',
  593.     8709 :'8709',//'empty',
  594.     8711 :'8711',//'nabla',
  595.     8712 :'8712',//'isin',
  596.     8713 :'8713',//'notin',
  597.     8715 :'8715',//'ni',
  598.     8719 :'8719',//'prod',
  599.     8721 :'8721',//'sum',
  600.     8722 :'8722',//'minus',
  601.     8727 :'8727',//'lowast',
  602.     8730 :'8730',//'radic',
  603.     8733 :'8733',//'prop',
  604.     8734 :'8734',//'infin',
  605.     8736 :'8736',//'ang',
  606.     8743 :'8743',//'and',
  607.     8744 :'8744',//'or',
  608.     8745 :'8745',//'cap',
  609.     8746 :'8746',//'cup',
  610.     8747 :'8747',//'int',
  611.     8756 :'8756',//'there4',
  612.     8764 :'8764',//'sim',
  613.     8773 :'8773',//'cong',
  614.     8776 :'8776',//'asymp',
  615.     8800 :'8800',//'ne',
  616.     8801 :'8801',//'equiv',
  617.     8804 :'8804',//'le',
  618.     8805 :'8805',//'ge',
  619.     8834 :'8834',//'sub',
  620.     8835 :'8835',//'sup',
  621.     8836 :'8836',//'nsub',
  622.     8838 :'8838',//'sube',
  623.     8839 :'8839',//'supe',
  624.     8853 :'8853',//'oplus',
  625.     8855 :'8855',//'otimes',
  626.     8869 :'8869',//'perp',
  627.     8901 :'8901',//'sdot',
  628.     8968 :'8968',//'lceil',
  629.     8969 :'8969',//'rceil',
  630.     8970 :'8970',//'lfloor',
  631.     8971 :'8971',//'rfloor',
  632.     9001 :'9001',//'lang',
  633.     9002 :'9002',//'rang',
  634.     9426 :'9426',//'copy',
  635.     9674 :'9674',//'loz',
  636.     9824 :'9824',//'spades',
  637.     9827 :'9827',//'clubs',
  638.     9829 : '9829',//'hearts',
  639.     9830 : '9830'//'diams'
  640. };
  641. function trim(str) {
  642.     if (typeof str != "string") return str;
  643.     str = str.replace(/^\s+|\s+$/g, "");
  644.     return str;
  645. }
  646. function rteGetOffsetTop(elm) {
  647.     var mOffsetTop = elm.offsetTop;
  648.     var mOffsetParent = elm.offsetParent;
  649.     while (mOffsetParent) {
  650.         mOffsetTop += mOffsetParent.offsetTop;
  651.         mOffsetParent = mOffsetParent.offsetParent;
  652.     }
  653.     return mOffsetTop;
  654. };
  655. function rteGetOffsetLeft(elm) {
  656.     var mOffsetLeft = elm.offsetLeft;
  657.     var mOffsetParent = elm.offsetParent;
  658.     while (mOffsetParent) {
  659.         mOffsetLeft += mOffsetParent.offsetLeft;
  660.         mOffsetParent = mOffsetParent.offsetParent;
  661.     }
  662.     return mOffsetLeft;
  663. };
  664. function rteHideMenus() {
  665.     rteMouseOutFormatMenu();
  666.     document.getElementById("format3").style.display = "none";
  667.     rteMouseOutFontFaceMenu();
  668.     document.getElementById("fontface3").style.display = "none";
  669.     rteMouseOutFontSizeMenu();
  670.     document.getElementById("fontsize3").style.display = "none";
  671.     rteMouseOutFontColorMenu();
  672.     document.getElementById("fontcolor3").style.display = "none";
  673. };
  674. function rteColorClick(hexcolor) {
  675.     rteHideMenus();
  676.     document.getElementById(rteName).contentWindow.document.execCommand("forecolor", false, hexcolor);
  677.     document.getElementById("fontcolor4").style.backgroundColor = hexcolor;
  678. };
  679. function rteMouseOverMenuFontColorContents() {
  680.     this.className = "rtedropdown14";
  681. };
  682. function rteMouseOutMenuFontColorContents() {
  683.     this.className = "rtedropdown13";
  684. };
  685. function rteMouseOverMenuContents() {
  686.     this.style.color = "#FFFFFF";
  687.     this.style.backgroundColor = "#316AC5";
  688.     document.getElementById(rteName).contentWindow.focus();
  689. };
  690. function rteMouseOutMenuContents() {
  691.     this.style.color = "#000000";
  692.     this.style.backgroundColor = "#FFFFFF";
  693. };
  694. function rteMouseDownMenuContents() {
  695.     if (this.innerHTML == "Header 1") {
  696.         document.getElementById(rteName).contentWindow.document.execCommand("formatblock", false, "<h1>");
  697.         document.getElementById("format1").innerHTML = "Header 1";
  698.     } else if (this.innerHTML == "Header 2") {
  699.         document.getElementById(rteName).contentWindow.document.execCommand("formatblock", false, "<h2>");
  700.         document.getElementById("format1").innerHTML = "Header 2";
  701.     } else if (this.innerHTML == "Header 3") {
  702.         document.getElementById(rteName).contentWindow.document.execCommand("formatblock", false, "<h3>");
  703.         document.getElementById("format1").innerHTML = "Header 3";
  704.     } else if (this.innerHTML == "Header 4") {
  705.         document.getElementById(rteName).contentWindow.document.execCommand("formatblock", false, "<h4>");
  706.         document.getElementById("format1").innerHTML = "Header 4";
  707.     } else if (this.innerHTML == "Header 5") {
  708.         document.getElementById(rteName).contentWindow.document.execCommand("formatblock", false, "<h5>");
  709.         document.getElementById("format1").innerHTML = "Header 5";
  710.     } else if (this.innerHTML == "Header 6") {
  711.         document.getElementById(rteName).contentWindow.document.execCommand("formatblock", false, "<h6>");
  712.         document.getElementById("format1").innerHTML = "Header 6";
  713.     } else if (this.innerHTML == "Paragraph") {
  714.         document.getElementById(rteName).contentWindow.document.execCommand("formatblock", false, "<p>");
  715.         document.getElementById("format1").innerHTML = "Paragraph";
  716.     } else if (this.innerHTML == "Arial") {
  717.         document.getElementById(rteName).contentWindow.document.execCommand("fontname", false, "arial");
  718.         document.getElementById("fontface1").innerHTML = "Arial";
  719.     } else if (this.innerHTML == "Arial Black") {
  720.         document.getElementById(rteName).contentWindow.document.execCommand("fontname", false, "arial black");
  721.         document.getElementById("fontface1").innerHTML = "Arial Black";
  722.     } else if (this.innerHTML == "Arial Narrow") {
  723.         document.getElementById(rteName).contentWindow.document.execCommand("fontname", false, "arial narrow");
  724.         document.getElementById("fontface1").innerHTML = "Arial Narrow";
  725.     } else if (this.innerHTML == "Courier New") {
  726.         document.getElementById(rteName).contentWindow.document.execCommand("fontname", false, "courier new");
  727.         document.getElementById("fontface1").innerHTML = "Courier New";
  728.     } else if (this.innerHTML == "Century Gothic") {
  729.         document.getElementById(rteName).contentWindow.document.execCommand("fontname", false, "century gothic");
  730.         document.getElementById("fontface1").innerHTML = "Century Gothic";
  731.     } else if (this.innerHTML == "Comic Sans MS") {
  732.         document.getElementById(rteName).contentWindow.document.execCommand("fontname", false, "comic sans ms");
  733.         document.getElementById("fontface1").innerHTML = "Comic Sans MS";
  734.     } else if (this.innerHTML == "Impact") {
  735.         document.getElementById(rteName).contentWindow.document.execCommand("fontname", false, "impact");
  736.         document.getElementById("fontface1").innerHTML = "Impact";
  737.     } else if (this.innerHTML == "Tahoma") {
  738.         document.getElementById(rteName).contentWindow.document.execCommand("fontname", false, "tahoma");
  739.         document.getElementById("fontface1").innerHTML = "Tahoma";
  740.     } else if (this.innerHTML == "Times New Roman") {
  741.         document.getElementById(rteName).contentWindow.document.execCommand("fontname", false, "times new roman");
  742.         document.getElementById("fontface1").innerHTML = "Times New Roman";
  743.     } else if (this.innerHTML == "Trebuchet MS") {
  744.         document.getElementById(rteName).contentWindow.document.execCommand("fontname", false, "trebuchet ms");
  745.         document.getElementById("fontface1").innerHTML = "Trebuchet MS";
  746.     } else if (this.innerHTML == "Verdana") {
  747.         document.getElementById(rteName).contentWindow.document.execCommand("fontname", false, "verdana");
  748.         document.getElementById("fontface1").innerHTML = "Verdana";
  749.     } else if (this.innerHTML == "1") {
  750.         document.getElementById(rteName).contentWindow.document.execCommand("fontsize", false, "1");
  751.         document.getElementById("fontsize1").innerHTML = "1";
  752.     } else if (this.innerHTML == "2") {
  753.         document.getElementById(rteName).contentWindow.document.execCommand("fontsize", false, "2");
  754.         document.getElementById("fontsize1").innerHTML = "2";
  755.     } else if (this.innerHTML == "3") {
  756.         document.getElementById(rteName).contentWindow.document.execCommand("fontsize", false, "3");
  757.         document.getElementById("fontsize1").innerHTML = "3";
  758.     } else if (this.innerHTML == "4") {
  759.         document.getElementById(rteName).contentWindow.document.execCommand("fontsize", false, "4");
  760.         document.getElementById("fontsize1").innerHTML = "4";
  761.     } else if (this.innerHTML == "5") {
  762.         document.getElementById(rteName).contentWindow.document.execCommand("fontsize", false, "5");
  763.         document.getElementById("fontsize1").innerHTML = "5";
  764.     } else if (this.innerHTML == "6") {
  765.         document.getElementById(rteName).contentWindow.document.execCommand("fontsize", false, "6");
  766.         document.getElementById("fontsize1").innerHTML = "6";
  767.     } else if (this.innerHTML == "7") {
  768.         document.getElementById(rteName).contentWindow.document.execCommand("fontsize", false, "7");
  769.         document.getElementById("fontsize1").innerHTML = "7";
  770.     }
  771.     this.style.color = "#000000";
  772.     this.style.backgroundColor = "#FFFFFF";
  773.     rteHideMenus();
  774. };
  775. function rteMouseOverFormatMenu() {
  776.     document.getElementById("format1").className = "rtedropdown4";
  777.     document.getElementById("format2").className = "rtedropdown5";
  778. };
  779. function rteMouseDownFormatMenu() {
  780.     rteHideMenus();
  781.     document.getElementById("format1").className = "rtedropdown4";
  782.     document.getElementById("format2").className = "rtedropdown6";
  783.     document.getElementById("format1").style.left = rteGetOffsetLeft(document.getElementById("format1"));
  784.     document.getElementById("format1").style.top = rteGetOffsetTop(document.getElementById("format1")) + document.getElementById("format1").offsetHeight;
  785.     document.getElementById("format3").style.display = (document.getElementById("format3").style.display == "none") ? "": "none";
  786.     var kids = document.getElementsByTagName('DIV');
  787.     for (var i = 0; i < kids.length; i++) {
  788.         if (kids[i].id == "format1" || kids[i].id == "format2") {
  789.             kids[i].onmouseout = rteMouseDownFormatMenu;
  790.         } else if (kids[i].id == "fontface1" || kids[i].id == "fontface2") {
  791.             kids[i].onmouseout = rteMouseOutFontFaceMenu;
  792.         } else if (kids[i].id == "fontsize1" || kids[i].id == "fontsize2") {
  793.             kids[i].onmouseout = rteMouseOutFontSizeMenu;
  794.         } else if (kids[i].id == "fontcolor1" || kids[i].id == "fontcolor2") {
  795.             kids[i].onmouseout = rteMouseOutFontColorMenu;
  796.         }
  797.     }
  798. };
  799. function rteMouseOutFormatMenu() {
  800.     document.getElementById("format1").className = "rtedropdown1";
  801.     document.getElementById("format2").className = "rtedropdown2";
  802. };
  803. function rteMouseOverFontFaceMenu() {
  804.     document.getElementById("fontface1").className = "rtedropdown4";
  805.     document.getElementById("fontface2").className = "rtedropdown5";
  806. };
  807. function rteMouseDownFontFaceMenu() {
  808.     rteHideMenus();
  809.     document.getElementById("fontface1").className = "rtedropdown4";
  810.     document.getElementById("fontface2").className = "rtedropdown6";
  811.     document.getElementById("fontface1").style.left = rteGetOffsetLeft(document.getElementById("fontface1"));
  812.     document.getElementById("fontface1").style.top = rteGetOffsetTop(document.getElementById("fontface1")) + document.getElementById("fontface1").offsetHeight;
  813.     document.getElementById("fontface3").style.display = (document.getElementById("fontface3").style.display == "none") ? "": "none";
  814.     var kids = document.getElementsByTagName('DIV');
  815.     for (var i = 0; i < kids.length; i++) {
  816.         if (kids[i].id == "format1" || kids[i].id == "format2") {
  817.             kids[i].onmouseout = rteMouseOutFormatMenu;
  818.         } else if (kids[i].id == "fontface1" || kids[i].id == "fontface2") {
  819.             kids[i].onmouseout = rteMouseDownFontFaceMenu;
  820.         } else if (kids[i].id == "fontsize1" || kids[i].id == "fontsize2") {
  821.             kids[i].onmouseout = rteMouseOutFontSizeMenu;
  822.         } else if (kids[i].id == "fontcolor1" || kids[i].id == "fontcolor2") {
  823.             kids[i].onmouseout = rteMouseOutFontColorMenu;
  824.         }
  825.     }
  826. };
  827. function rteMouseOutFontFaceMenu() {
  828.     document.getElementById("fontface1").className = "rtedropdown1";
  829.     document.getElementById("fontface2").className = "rtedropdown2";
  830. };
  831. function rteMouseOverFontSizeMenu() {
  832.     document.getElementById("fontsize1").className = "rtedropdown4";
  833.     document.getElementById("fontsize2").className = "rtedropdown5";
  834. };
  835. function rteMouseDownFontSizeMenu() {
  836.     rteHideMenus();
  837.     document.getElementById("fontsize1").className = "rtedropdown4";
  838.     document.getElementById("fontsize2").className = "rtedropdown6";
  839.     document.getElementById("fontsize1").style.left = rteGetOffsetLeft(document.getElementById("fontsize1"));
  840.     document.getElementById("fontsize1").style.top = rteGetOffsetTop(document.getElementById("fontsize1")) + document.getElementById("fontsize1").offsetHeight;
  841.     document.getElementById("fontsize3").style.display = (document.getElementById("fontsize3").style.display == "none") ? "": "none";
  842.     var kids = document.getElementsByTagName('DIV');
  843.     for (var i = 0; i < kids.length; i++) {
  844.         if (kids[i].id == "format1" || kids[i].id == "format2") {
  845.             kids[i].onmouseout = rteMouseOutFormatMenu;
  846.         } else if (kids[i].id == "fontface1" || kids[i].id == "fontface2") {
  847.             kids[i].onmouseout = rteMouseOutFontFaceMenu;
  848.         } else if (kids[i].id == "fontsize1" || kids[i].id == "fontsize2") {
  849.             kids[i].onmouseout = rteMouseDownFontSizeMenu;
  850.         } else if (kids[i].id == "fontcolor1" || kids[i].id == "fontcolor2") {
  851.             kids[i].onmouseout = rteMouseOutFontColorMenu;
  852.         }
  853.     }
  854. };
  855. function rteMouseOutFontSizeMenu() {
  856.     document.getElementById("fontsize1").className = "rtedropdown1";
  857.     document.getElementById("fontsize2").className = "rtedropdown2";
  858. };
  859. function rteMouseOverFontColorMenu() {
  860.     document.getElementById("fontcolor1").className = "rtedropdown8";
  861.     document.getElementById("fontcolor2").className = "rtedropdown5b";
  862. };
  863. function rteMouseDownFontColorMenu() {
  864.     rteHideMenus();
  865.     document.getElementById("fontcolor1").className = "rtedropdown12";
  866.     document.getElementById("fontcolor2").className = "rtedropdown9b";
  867.     document.getElementById("fontcolor1").style.left = rteGetOffsetLeft(document.getElementById("fontcolor1"));
  868.     document.getElementById("fontcolor1").style.top = rteGetOffsetTop(document.getElementById("fontcolor1")) + document.getElementById("fontcolor1").offsetHeight;
  869.     document.getElementById("fontcolor3").style.display = (document.getElementById("fontcolor3").style.display == "none") ? "": "none";
  870.     var kids = document.getElementsByTagName('DIV');
  871.     for (var i = 0; i < kids.length; i++) {
  872.         if (kids[i].id == "format1" || kids[i].id == "format2") {
  873.             kids[i].onmouseout = rteMouseOutFormatMenu;
  874.         } else if (kids[i].id == "fontface1" || kids[i].id == "fontface2") {
  875.             kids[i].onmouseout = rteMouseOutFontFaceMenu;
  876.         } else if (kids[i].id == "fontsize1" || kids[i].id == "fontsize2") {
  877.             kids[i].onmouseout = rteMouseOutFontSizeMenu;
  878.         } else if (kids[i].id == "fontcolor1" || kids[i].id == "fontcolor2") {
  879.             kids[i].onmouseout = rteMouseDownFontColorMenu;
  880.         }
  881.     }
  882. };
  883. function rteMouseOutFontColorMenu() {
  884.     document.getElementById("fontcolor1").className = "rtedropdown10";
  885.     document.getElementById("fontcolor2").className = "rtedropdown11b";
  886. };
  887. function rteBtnMouseUpBottom() {
  888.     this.className = "rtebtn9";
  889. };
  890. function rteBtnMouseOutBottom() {
  891.     this.className = "rtebtn6";
  892. };
  893. function rteBtnMouseOutDownBottom() {
  894.     this.className = "rtebtn9";
  895. };
  896. function rteBtnMouseOverBottom() {
  897.     this.className = "rtebtn7";
  898. };
  899. function rteModeType(id) {
  900.     if (id == "rte_design_mode") {
  901.         rteFormHandler2();        
  902.         document.getElementById(rteName).contentWindow.document.body.innerHTML = getXHTML(trim(document.getElementById(rteFormName).value));        
  903.         //document.getElementById(rteName).contentWindow.document.body.innerHTML = getXHTML(trim(document.getElementById(rteName).contentWindow.document.body.innerHTML));        
  904.         document.getElementById("tb1").style.display = "";
  905.         document.getElementById("tb2").style.display = "";
  906.         document.getElementById("tb3").style.display = "";
  907.         document.getElementById(rteFormName).style.display = "none";
  908.         document.getElementById(rteName).style.display = "";
  909.         document.getElementById("preview_" + rteName).style.display = "none";
  910.         document.getElementById(rteName).contentWindow.focus();
  911.        return false;
  912.  
  913.     } else if (id == "rte_code_mode") {
  914.         rteFormHandler();
  915.         document.getElementById(rteFormName).value = getXHTML(trim(document.getElementById(rteName).contentWindow.document.body.innerHTML));
  916.  
  917.         document.getElementById("tb1").style.display = "none";
  918.         document.getElementById("tb2").style.display = "none";
  919.         document.getElementById("tb3").style.display = "none";
  920.         document.getElementById(rteFormName).style.display = "";
  921.         document.getElementById(rteName).style.display = "none";
  922.         document.getElementById("preview_" + rteName).style.display = "none";
  923.     } else if (id == "rte_preview_mode") {
  924.         rteFormHandler();
  925.         html = "<div style=\"padding:5px;\">" + getXHTML(trim(document.getElementById(rteFormName).value)) + "</div>";
  926.  
  927.         document.getElementById('preview_' + rteName).contentWindow.document.open();
  928.         document.getElementById('preview_' + rteName).contentWindow.document.write("<html><head><style type=\"text/css\">@import url(" + document.getElementById("preview_css").value + ");</style></head><body>" + html + "</body></html>");
  929.         document.getElementById('preview_' + rteName).contentWindow.document.close();
  930.         document.getElementById("tb1").style.display = "none";
  931.         document.getElementById("tb2").style.display = "none";
  932.         document.getElementById("tb3").style.display = "none";
  933.         document.getElementById(rteFormName).style.display = "none";
  934.         document.getElementById(rteName).style.display = "none";
  935.         document.getElementById("preview_" + rteName).style.display = "";
  936.     }
  937. };
  938. function rteBtnMouseDownBottom() {
  939.     var kids = document.getElementsByTagName("DIV");
  940.     for (var i = 0; i < kids.length; i++) {
  941.         if (kids[i].className == "rtebtn6" || kids[i].className == "rtebtn7" || kids[i].className == "rtebtn8" || kids[i].className == "rtebtn9") {
  942.             kids[i].className = "rtebtn6";
  943.             kids[i].onmouseover = rteBtnMouseOverBottom;
  944.             kids[i].onmouseout = rteBtnMouseOutBottom;
  945.             kids[i].onmousedown = rteBtnMouseDownBottom;
  946.             kids[i].onmouseup = rteBtnMouseUpBottom;
  947.         }
  948.     }
  949.     this.className = "rtebtn9";
  950.     this.onmouseover = rteBtnMouseOverBottom;
  951.     this.onmouseout = rteBtnMouseOutDownBottom;
  952.     this.onmouseup = rteBtnMouseUpBottom;
  953. };
  954. function rteBtnMouseDown() {
  955.     var kids = document.getElementsByTagName('DIV');
  956.     for (var i = 0; i < kids.length; i++) {
  957.         if (kids[i].className == "rtebtn2" || kids[i].className == "rtebtn3" || kids[i].className == "rtebtn4") {
  958.             kids[i].className = "rtebtn1";
  959.         }
  960.     }
  961.     rteSelection();
  962.     this.className = "rtebtn4";
  963. };
  964. function rteBtnMouseUp() {
  965.     this.className = "rtebtn4";
  966. };
  967. function rteBtnMouseOut() {
  968.     this.className = "rtebtn1";
  969. };
  970. function rteBtnMouseOver() {
  971.     this.className = "rtebtn2";
  972. };
  973. //for insert symbol
  974. function rteBtnInsertSymbol() {
  975.     window.open(rteHTMLPathInsertSymbol, "blank", "toolbar=no,width=450,height=450");
  976. };
  977.  
  978. function rteBtnInsertImage() {
  979.     window.open(rteHTMLPathInsertImage, "blank", "toolbar=no,width=300,height=220");
  980. };
  981. function rteBtnEditLink() {
  982.     window.open(rteHTMLPathEditLink, "blank", "toolbar=no,width=250,height=300");
  983. };
  984.  
  985. function rteBtnEditTable() {
  986.     window.open(rteHTMLPathEditTable, "blank", "toolbar=no,width=320,height=210");
  987. };
  988. function rteBtnCreateLink() {
  989.     window.open(rteHTMLPathInsertLink, "blank", "toolbar=no,width=250,height=300");
  990. };
  991. function rteBtnPrint() {
  992.     if (document.all) {
  993.         var oFrame = window.frames[rteName];
  994.         oFrame.focus();
  995.         oFrame.print();
  996.     }
  997.     else {
  998.         var oFrame = document.getElementById(rteName).contentWindow;
  999.         oFrame.focus();
  1000.         oFrame.window.print();
  1001.     }
  1002. };
  1003. function rteInsertHTML(html) {
  1004.     if (document.all) {
  1005.         var oRng = document.getElementById(rteName).contentWindow.document.selection.createRange();
  1006.         oRng.pasteHTML(html);
  1007.         oRng.collapse(false);
  1008.         oRng.select();
  1009.     } else {
  1010.         document.getElementById(rteName).contentWindow.document.execCommand('insertHTML', false, html);
  1011.     }
  1012. };
  1013. function rteBtnInsertForm() {
  1014.     window.open(rteHTMLPathInsertForm, "blank", "toolbar=no,width=320,height=180");
  1015. };
  1016. function rteBtnInsertCheckbox() {
  1017.     window.open(rteHTMLPathInsertCheckbox, "blank", "toolbar=no,width=320,height=150");
  1018. };
  1019. function rteBtnInsertRadio() {
  1020.     window.open(rteHTMLPathInsertRadiobutton, "blank", "toolbar=no,width=320,height=150");
  1021. };
  1022. function rteBtnInsertFlash() {
  1023.     window.open(rteHTMLPathInsertFlash, "blank", "toolbar=no,width=350,height=130");
  1024. };
  1025. function rteBtnInsertTextArea() {
  1026.     window.open(rteHTMLPathInsertTextArea, "blank", "toolbar=no,width=320,height=230");
  1027. };
  1028. function rteBtnInsertSubmit() {
  1029.     window.open(rteHTMLPathInsertSubmit, "blank", "toolbar=no,width=320,height=130");
  1030. };
  1031. function rteBtnInsertImageSubmit() {
  1032.     window.open(rteHTMLPathInsertImageSubmit, "blank", "toolbar=no,width=320,height=130");
  1033. };
  1034. function rteBtnInsertReset() {
  1035.     window.open(rteHTMLPathInsertReset, "blank", "toolbar=no,width=320,height=130");
  1036. };
  1037. function rteBtnInsertHidden() {
  1038.     window.open(rteHTMLPathInsertHidden, "blank", "toolbar=no,width=320,height=130");
  1039. };
  1040. function rteBtnInsertPassword() {
  1041.     window.open(rteHTMLPathInsertPassword, "blank", "toolbar=no,width=320,height=150");
  1042. };
  1043. function rteBtnInsertText() {
  1044.     window.open(rteHTMLPathInsertText, "blank", "toolbar=no,width=320,height=170");
  1045. };
  1046. function rteAbout() {
  1047.     msg = window.open("", "msg", "height=100,width=320");
  1048.     msg.document.write("<style>");
  1049.     msg.document.write("body, td {");
  1050.     msg.document.write("background-color:#FFFFFF;");
  1051.     msg.document.write("font-family:arial;");
  1052.     msg.document.write("font-size:11px;");
  1053.     msg.document.write("}");
  1054.     msg.document.write("input {");
  1055.     msg.document.write("font-family:arial;");
  1056.     msg.document.write("font-size:11px;");
  1057.     msg.document.write("}");
  1058.     msg.document.write("select {");
  1059.     msg.document.write("font-family:arial;");
  1060.     msg.document.write("font-size:11px;");
  1061.     msg.document.write("}");
  1062.     msg.document.write("</style>");
  1063.     msg.document.write("<fieldset>");
  1064.     msg.document.write("<legend><b>XtRanS</b></legend>");
  1065.     msg.document.write("<table width=\"100%\" cellspacing=\"2\" cellpadding=\"0\" border=\"0\">");
  1066.     msg.document.write("<tr>");
  1067.     msg.document.write("<td colspan=\"2\" align=\"center\">Copyright &copy; 2009 Cepha Imaging Pvt Ltd<br><a href=\"http://www.cepha.co.in\" target=\"_blank\">www.Cepha.com</a></td>");
  1068.     msg.document.write("</tr>");
  1069.     //msg.document.write("<tr>");
  1070.     //msg.document.write("<td colspan=\"2\" align=\"center\"><input type=\"button\" value=\"License\" onclick=\"window.open('http://www.freerichtexteditor.com/page/5.htm' , 'blank','');\"><input type=\"button\" value=\"Donate\" onclick=\"window.open('http://www.freerichtexteditor.com/page/7.htm' , 'blank','');\"><input type=\"button\" value=\"Download\" onclick=\"window.open('http://www.freerichtexteditor.com/page/4.htm' , 'blank','');\"></td>");
  1071.     //msg.document.write("</tr>");
  1072.     msg.document.write("</table>");
  1073.     msg.document.write("</fieldset>");
  1074.     msg.document.close();
  1075. };
  1076. function rteBtnInsertTable() {
  1077.     window.open(rteHTMLPathInsertTable, "blank", "toolbar=no,width=320,height=240");
  1078. };
  1079. function rteBtnInsertTableRowBefore() {
  1080.     if (window.getSelection) {
  1081.         var selected_obj = document.getElementById(rteName).contentWindow.window.getSelection().focusNode;
  1082.     }
  1083.     else if (document.getSelection) {
  1084.         var selected_obj = document.getElementById(rteName).contentWindow.document.getSelection().focusNode;
  1085.     }
  1086.     else if (document.selection) {
  1087.         var selected_obj = document.getElementById(rteName).contentWindow.document.selection.createRange().parentElement();
  1088.     }
  1089.     current_tag = selected_obj;
  1090.     while (current_tag.tagName != "TABLE") {
  1091.         if (current_tag.tagName == "TR") {
  1092.             cellTotal = current_tag.cells.length;
  1093.             RowIndex = current_tag.rowIndex;
  1094.         }
  1095.         if (current_tag.parentNode.tagName == "TBODY") {
  1096.             var x = current_tag.parentNode.insertRow(RowIndex);
  1097.             for (i = 0; i < cellTotal; i++) {
  1098.                 var j = x.insertCell(i);
  1099.                 j.innerHTML = "&nbsp;";
  1100.             }
  1101.         }
  1102.         current_tag = current_tag.parentNode;
  1103.     }
  1104. };
  1105. function rteBtnInsertTableRowAfter() {
  1106.     if (window.getSelection) {
  1107.         var selected_obj = document.getElementById(rteName).contentWindow.window.getSelection().focusNode;
  1108.     }
  1109.     else if (document.getSelection) {
  1110.         var selected_obj = document.getElementById(rteName).contentWindow.document.getSelection().focusNode;
  1111.     }
  1112.     else if (document.selection) {
  1113.         var selected_obj = document.getElementById(rteName).contentWindow.document.selection.createRange().parentElement();
  1114.     }
  1115.     current_tag = selected_obj;
  1116.     while (current_tag.tagName != "TABLE") {
  1117.         if (current_tag.tagName == "TR") {
  1118.             cellTotal = current_tag.cells.length;
  1119.             RowIndex = current_tag.rowIndex;
  1120.         }
  1121.         if (current_tag.parentNode.tagName == "TBODY") {
  1122.             var x = current_tag.parentNode.insertRow(RowIndex + 1);
  1123.             for (i = 0; i < cellTotal; i++) {
  1124.                 var j = x.insertCell(i);
  1125.                 j.innerHTML = "&nbsp;";
  1126.             }
  1127.         }
  1128.         current_tag = current_tag.parentNode;
  1129.     }
  1130. };
  1131. function rteBtnInsertTableColumnBefore() {
  1132.     if (window.getSelection) {
  1133.         var selected_obj = document.getElementById(rteName).contentWindow.window.getSelection().focusNode;
  1134.     }
  1135.     else if (document.getSelection) {
  1136.         var selected_obj = document.getElementById(rteName).contentWindow.document.getSelection().focusNode;
  1137.     }
  1138.     else if (document.selection) {
  1139.         var selected_obj = document.getElementById(rteName).contentWindow.document.selection.createRange().parentElement();
  1140.     }
  1141.     current_tag = selected_obj;
  1142.     while (current_tag.tagName != "TABLE") {
  1143.         if (current_tag.tagName == "TD") {
  1144.             cellIndex = current_tag.cellIndex;
  1145.         }
  1146.         if (current_tag.tagName == "TBODY") {
  1147.             RowTotal = current_tag.parentNode.rows.length;
  1148.             var x = current_tag.parentNode;
  1149.             for (i = 0; i < RowTotal; i++) {
  1150.                 var j = x.rows[i].insertCell(cellIndex);
  1151.                 j.innerHTML = "&nbsp;";
  1152.             }
  1153.         }
  1154.         current_tag = current_tag.parentNode;
  1155.     }
  1156. };
  1157. function rteBtnInsertTableColumnAfter() {
  1158.     if (window.getSelection) {
  1159.         var selected_obj = document.getElementById(rteName).contentWindow.window.getSelection().focusNode;
  1160.     }
  1161.     else if (document.getSelection) {
  1162.         var selected_obj = document.getElementById(rteName).contentWindow.document.getSelection().focusNode;
  1163.     }
  1164.     else if (document.selection) {
  1165.         var selected_obj = document.getElementById(rteName).contentWindow.document.selection.createRange().parentElement();
  1166.     }
  1167.     current_tag = selected_obj;
  1168.     while (current_tag.tagName != "TABLE") {
  1169.         if (current_tag.tagName == "TD") {
  1170.             cellIndex = current_tag.cellIndex;
  1171.         }
  1172.         if (current_tag.tagName == "TBODY") {
  1173.             RowTotal = current_tag.parentNode.rows.length;
  1174.             var x = current_tag.parentNode;
  1175.             for (i = 0; i < RowTotal; i++) {
  1176.                 var j = x.rows[i].insertCell(cellIndex + 1);
  1177.                 j.innerHTML = "&nbsp;";
  1178.             }
  1179.         }
  1180.         current_tag = current_tag.parentNode;
  1181.     }
  1182. };
  1183. function rteBtnDeleteTableColumn() {
  1184.     if (window.getSelection) {
  1185.         var selected_obj = document.getElementById(rteName).contentWindow.window.getSelection().focusNode;
  1186.     }
  1187.     else if (document.getSelection) {
  1188.         var selected_obj = document.getElementById(rteName).contentWindow.document.getSelection().focusNode;
  1189.     }
  1190.     else if (document.selection) {
  1191.         var selected_obj = document.getElementById(rteName).contentWindow.document.selection.createRange().parentElement();
  1192.     }
  1193.     current_tag = selected_obj;
  1194.     while (current_tag.tagName != "TABLE") {
  1195.         if (current_tag.tagName == "TD") {
  1196.             cellIndex = current_tag.cellIndex;
  1197.         }
  1198.         if (current_tag.tagName == "TBODY") {
  1199.             RowTotal = current_tag.parentNode.rows.length;
  1200.             var x = current_tag.parentNode;
  1201.             for (i = 0; i < RowTotal; i++) {
  1202.                 j = x.rows[i].deleteCell(cellIndex);
  1203.             }
  1204.         }
  1205.         current_tag = current_tag.parentNode;
  1206.     }
  1207. };
  1208. function rteBtnDeleteTableRow() {
  1209.     if (window.getSelection) {
  1210.         var selected_obj = document.getElementById(rteName).contentWindow.window.getSelection().focusNode;
  1211.     }
  1212.     else if (document.getSelection) {
  1213.         var selected_obj = document.getElementById(rteName).contentWindow.document.getSelection().focusNode;
  1214.     }
  1215.     else if (document.selection) {
  1216.         var selected_obj = document.getElementById(rteName).contentWindow.document.selection.createRange().parentElement();
  1217.     }
  1218.     current_tag = selected_obj;
  1219.     while (current_tag.tagName != "TABLE") {
  1220.         if (current_tag.tagName == "TR") {
  1221.             RowIndex = current_tag.rowIndex;
  1222.         }
  1223.         if (current_tag.tagName == "TBODY") {
  1224.             RowTotal = current_tag.parentNode.rows.length;
  1225.             var x = current_tag.parentNode;
  1226.             x.deleteRow(RowIndex);
  1227.         }
  1228.         current_tag = current_tag.parentNode;
  1229.     }
  1230. };
  1231. function rteAction(ID) {
  1232.     rteHideMenus();
  1233.     if (this.id != "editlink" && this.id != "insertflash" && this.id != "edittable" && this.id != "createlink" && this.id != "insertimage" && this.id != "inserttable" && this.id != "insertrowbelow" && this.id != "insertrowabove" && this.id != "insertcolumnleft" && this.id != "insertcolumnright" && this.id != "deletecolumn" && this.id != "deleterow" && this.id != "insertform" && this.id != "form_checkbox" && this.id != "form_radio" && this.id != "form_dropdown" && this.id != "form_textarea" && this.id != "form_submit" && this.id != "form_image_submit" && this.id != "form_reset" && this.id != "form_hidden" && this.id != "form_password" && this.id != "form_textfield" && this.id != "spellcheck" && this.id != "printrte" && this.id != "aboutrte") {
  1234.         document.getElementById(rteName).contentWindow.document.execCommand(this.id, false, null);
  1235.         document.getElementById(this.id).className = "rtebtn4";
  1236.         document.getElementById(this.id).onmouseout = rteBtnMouseDown;
  1237.         document.getElementById(rteName).contentWindow.focus();
  1238.     }
  1239. };
  1240. function startRTE(rtePreloadContent) {
  1241.     //alert(rtePreloadContent);
  1242.     rteCSS = document.getElementById("preview_css").value;
  1243.     var kids = document.getElementsByTagName("FORM");
  1244.     for (var i = 0; i < kids.length; i++) {
  1245.         kids[i].onsubmit = rteFormHandler;
  1246.     }
  1247.     document.getElementById(rteName).contentWindow.document.designMode = "on";
  1248.     //alert(rteFormName);
  1249.     document.getElementById(rteFormName).value = rtePreloadContent;
  1250.     document.getElementById(rteName).contentWindow.document.open();    
  1251.     document.getElementById(rteName).contentWindow.document.write("<html><head><style type=\"text/css\">@import url(" + rteCSS + ");</style><script src=\"richtext.js\" type=\"text/javascript\" language=\"javascript\"></script></head><body>" + rtePreloadContent + "</body></html>");
  1252.     document.getElementById(rteName).contentWindow.document.close();
  1253.     if (document.all && !window.opera) {
  1254.         document.getElementById(rteName).contentWindow.document.attachEvent("onkeypress", rteSelection);
  1255.         document.getElementById(rteName).contentWindow.document.attachEvent("onclick", rteSelection);
  1256.         document.getElementById(rteName).contentWindow.document.attachEvent("onmouseup", rteSelection);
  1257.     } else {
  1258.         //alert("in else");
  1259.         document.getElementById(rteName).contentWindow.document.execCommand("useCSS", false, null);
  1260.         document.getElementById(rteName).contentWindow.document.addEventListener("keypress", rteSelection, true);
  1261.         document.getElementById(rteName).contentWindow.document.addEventListener("click", rteSelection, true);
  1262.         document.getElementById(rteName).contentWindow.document.addEventListener("mouseup", rteSelection, true);
  1263.     }
  1264.     rteSelection();
  1265.     var kids = document.getElementsByTagName("DIV");
  1266.     for (var i = 0; i < kids.length; i++) {
  1267.         if (kids[i].className == "rtebtn6") {
  1268.             kids[i].onmouseover = rteBtnMouseOverBottom;
  1269.             kids[i].onmouseout = rteBtnMouseOutBottom;
  1270.             kids[i].onmousedown = rteBtnMouseDownBottom;
  1271.             kids[i].onmouseup = rteBtnMouseUpBottom;
  1272.         }
  1273.     }
  1274. };
  1275. function rteFormHandler() {
  1276.     if (document.getElementById(rteFormName).style.display == "") {
  1277.         var newHTML = getXHTML(trim(document.getElementById(rteFormName).value));
  1278.     }
  1279.     else {
  1280.         var newHTML = getXHTML(trim(document.getElementById(rteName).contentWindow.document.body.innerHTML));
  1281.     }
  1282.     pattern = /<div[^>]*border: 1px dotted red[^>]*>.*<\/form><\/div>/gi;
  1283.     matchesArray = newHTML.match(pattern);
  1284.     if (matchesArray != null) {
  1285.         for (i = 0; i < matchesArray.length; i++) {
  1286.             pattern2 = /<div[^>]*border: 1px dotted red[^>]*>/gi;
  1287.             pattern3 = /<\/div>/gi;
  1288.             replacement = matchesArray[i];
  1289.             replacement = replacement.replace(pattern2, "");
  1290.             replacement = replacement.replace(pattern3, "");
  1291.             if (document.getElementById(rteFormName).style.display == "") {
  1292.                 newHTML = document.getElementById(rteFormName).value.replace(matchesArray[i], replacement);
  1293.             }
  1294.             else {
  1295.                 newHTML = document.getElementById(rteName).contentWindow.document.body.innerHTML.replace(matchesArray[i], replacement);
  1296.             }
  1297.         }
  1298.     }
  1299.     pattern = /<table[^>]*class=\"rte_tbl\"[^>]*>/gi;
  1300.     matchesArray = newHTML.match(pattern);
  1301.     if (matchesArray != null) {
  1302.         for (i = 0; i < matchesArray.length; i++) {
  1303.             pattern2 = /class=\"rte_tbl\"/gi;
  1304.             replacement = matchesArray[i];
  1305.             replacement = replacement.replace(pattern2, "");
  1306.             newHTML = newHTML.replace(matchesArray[i], replacement);
  1307.         }
  1308.     }
  1309.     document.getElementById(rteFormName).value = newHTML;
  1310.     document.getElementById(rteName).contentWindow.document.body.innerHTML = newHTML;
  1311. };
  1312. function rteFormHandler2() {
  1313.     if (document.getElementById(rteFormName).style.display == "") {
  1314.         var newHTML = document.getElementById(rteFormName).value;
  1315.     }
  1316.     else {
  1317.         var newHTML = document.getElementById(rteName).contentWindow.document.body.innerHTML;
  1318.     }
  1319.     pattern = /<form[^>]*>[^<]*<\/form>/gi;
  1320.     matchesArray = newHTML.match(pattern);
  1321.     if (matchesArray != null) {
  1322.         for (i = 0; i < matchesArray.length; i++) {
  1323.             replacement = matchesArray[i];
  1324.             replacement = replacement.replace(matchesArray[i], "<div style=\"border: 1px dotted red;\">" + matchesArray[i] + "</div>");
  1325.             if (document.getElementById(rteFormName).style.display == "") {
  1326.                 newHTML = document.getElementById(rteFormName).value.replace(matchesArray[i], replacement);
  1327.             }
  1328.             else {
  1329.                 newHTML = document.getElementById(rteName).contentWindow.document.body.innerHTML.replace(matchesArray[i], replacement);
  1330.             }
  1331.         }
  1332.     }
  1333.     pattern = /<table[^>]*border=\"0\"[^>]*>/gi;
  1334.     matchesArray = newHTML.match(pattern);
  1335.     if (matchesArray != null) {
  1336.         for (i = 0; i < matchesArray.length; i++) {
  1337.             pattern2 = /border=\"0\"/gi;
  1338.             replacement = matchesArray[i];
  1339.             replacement = replacement.replace(pattern2, "border=\"0\" class=\"rte_tbl\"");
  1340.             newHTML = newHTML.replace(matchesArray[i], replacement);
  1341.         }
  1342.     }
  1343.     if (document.getElementById(rteFormName).style.display == "") {
  1344.         document.getElementById(rteFormName).value = newHTML;
  1345.     }
  1346.     else {
  1347.         document.getElementById(rteName).contentWindow.document.body.innerHTML = newHTML;
  1348.     }
  1349. };
  1350. function rteSelection() {
  1351.     rteHideMenus();
  1352.     if (document.getElementById("rte_code_mode").className == "rtebtn9") {
  1353.         document.getElementById("tb1").style.display = "none";
  1354.         document.getElementById("tb2").style.display = "none";
  1355.         document.getElementById("tb3").style.display = "none";
  1356.     } else {
  1357.         document.getElementById("format1").innerHTML = "Paragraph";
  1358.         document.getElementById("fontface1").innerHTML = "Verdana";
  1359.         document.getElementById("fontsize1").innerHTML = "2";
  1360.         var kids = document.getElementsByTagName('DIV');
  1361.         for (var i = 0; i < kids.length; i++) {
  1362.             switch (kids[i].className) {
  1363.             case "rtebtn1":
  1364.                 if (kids[i].onmouseover != rteBtnMouseOver) {
  1365.                     kids[i].onmouseover = rteBtnMouseOver;
  1366.                 }
  1367.                 if (kids[i].onclick != rteAction) {
  1368.                     kids[i].onclick = rteAction;
  1369.                 }
  1370.                 if (kids[i].className == "rtebtn4") {
  1371.                     if (kids[i].onmouseout != rteBtnMouseDown) {
  1372.                         kids[i].onmouseout = rteBtnMouseDown;
  1373.                     }
  1374.                 } else {
  1375.                     if (kids[i].onmouseout != rteBtnMouseOut) {
  1376.                         kids[i].onmouseout = rteBtnMouseOut;
  1377.                     }
  1378.                 }
  1379.                 if (kids[i].onmousedown != rteBtnMouseDown) {
  1380.                     kids[i].onmousedown = rteBtnMouseDown;
  1381.                 }
  1382.                 if (kids[i].onmouseup != rteBtnMouseUp) {
  1383.                     kids[i].onmouseup = rteBtnMouseUp;
  1384.                 }
  1385.                 break;
  1386.             case "rtebtn2":
  1387.                 kids[i].className = "rtebtn1";
  1388.                 if (kids[i].onmouseover != rteBtnMouseOver) {
  1389.                     kids[i].onmouseover = rteBtnMouseOver;
  1390.                 }
  1391.                 if (kids[i].onclick != rteAction) {
  1392.                     kids[i].onclick = rteAction;
  1393.                 }
  1394.                 if (kids[i].className == "rtebtn4") {
  1395.                     if (kids[i].onmouseout = rteBtnMouseDown) {
  1396.                         kids[i].onmouseout = rteBtnMouseDown;
  1397.                     }
  1398.                 } else {
  1399.                     if (kids[i].onmouseout != rteBtnMouseOut) {
  1400.                         kids[i].onmouseout = rteBtnMouseOut;
  1401.                     }
  1402.                 }
  1403.                 if (kids[i].onmousedown != rteBtnMouseDown) {
  1404.                     kids[i].onmousedown = rteBtnMouseDown;
  1405.                 }
  1406.                 if (kids[i].onmouseup != rteBtnMouseUp) {
  1407.                     kids[i].onmouseup = rteBtnMouseUp;
  1408.                 }
  1409.                 break;
  1410.             case "rtebtn3":
  1411.                 kids[i].className = "rtebtn1";
  1412.                 if (kids[i].onmouseover != rteBtnMouseOver) {
  1413.                     kids[i].onmouseover = rteBtnMouseOver;
  1414.                 }
  1415.                 if (kids[i].onclick != rteAction) {
  1416.                     kids[i].onclick = rteAction;
  1417.                 }
  1418.                 if (kids[i].className == "rtebtn4") {
  1419.                     if (kids[i].onmouseout != rteBtnMouseDown) {
  1420.                         kids[i].onmouseout = rteBtnMouseDown;
  1421.                     }
  1422.                 } else {
  1423.                     if (kids[i].onmouseout != rteBtnMouseOut) {
  1424.                         kids[i].onmouseout = rteBtnMouseOut;
  1425.                     }
  1426.                 }
  1427.                 if (kids[i].onmousedown != rteBtnMouseDown) {
  1428.                     kids[i].onmousedown = rteBtnMouseDown;
  1429.                 }
  1430.                 if (kids[i].onmouseup != rteBtnMouseUp) {
  1431.                     kids[i].onmouseup = rteBtnMouseUp;
  1432.                 }
  1433.                 break;
  1434.             case "rtebtn4":
  1435.                 kids[i].className = "rtebtn1";
  1436.                 if (kids[i].onmouseover != rteBtnMouseOver) {
  1437.                     kids[i].onmouseover = rteBtnMouseOver;
  1438.                 }
  1439.                 if (kids[i].onclick != rteAction) {
  1440.                     kids[i].onclick = rteAction;
  1441.                 }
  1442.                 if (kids[i].onmouseout != rteBtnMouseOut) {
  1443.                     kids[i].onmouseout = rteBtnMouseOut;
  1444.                 }
  1445.                 if (kids[i].onmousedown != rteBtnMouseDown) {
  1446.                     kids[i].onmousedown = rteBtnMouseDown;
  1447.                 }
  1448.                 if (kids[i].onmouseup != rteBtnMouseUp) {
  1449.                     kids[i].onmouseup = rteBtnMouseUp;
  1450.                 }
  1451.                 break;
  1452.             }
  1453.             switch (kids[i].id) {
  1454.             case "format1":
  1455.                 if (kids[i].onmouseover != rteMouseOverFormatMenu) {
  1456.                     kids[i].onmouseover = rteMouseOverFormatMenu;
  1457.                 }
  1458.                 if (kids[i].onmousedown != rteMouseDownFormatMenu) {
  1459.                     kids[i].onmousedown = rteMouseDownFormatMenu;
  1460.                 }
  1461.                 if (kids[i].onmouseout != rteMouseOutFormatMenu) {
  1462.                     kids[i].onmouseout = rteMouseOutFormatMenu;
  1463.                 }
  1464.                 if (kids[i].className == "rtedropdown6") {
  1465.                     if (kids[i].onmouseout != rteMouseDownFormatMenu) {
  1466.                         kids[i].onmouseout = rteMouseDownFormatMenu;
  1467.                     }
  1468.                 } else {
  1469.                     if (kids[i].onmouseout != rteMouseOutFormatMenu) {
  1470.                         kids[i].onmouseout = rteMouseOutFormatMenu;
  1471.                     }
  1472.                 }
  1473.                 break;
  1474.             case "format2":
  1475.                 if (kids[i].onmouseover != rteMouseOverFormatMenu) {
  1476.                     kids[i].onmouseover = rteMouseOverFormatMenu;
  1477.                 }
  1478.                 if (kids[i].onmousedown != rteMouseDownFormatMenu) {
  1479.                     kids[i].onmousedown = rteMouseDownFormatMenu;
  1480.                 }
  1481.                 if (kids[i].onmouseout != rteMouseOutFormatMenu) {
  1482.                     kids[i].onmouseout = rteMouseOutFormatMenu;
  1483.                 }
  1484.                 if (kids[i].className == "rtedropdown6") {
  1485.                     kids[i].onmouseout = rteMouseDownFormatMenu;
  1486.                 } else {
  1487.                     kids[i].onmouseout = rteMouseOutFormatMenu;
  1488.                 }
  1489.                 break;
  1490.             case "fontface1":
  1491.                 if (kids[i].onmouseover != rteMouseOverFontFaceMenu) {
  1492.                     kids[i].onmouseover = rteMouseOverFontFaceMenu;
  1493.                 }
  1494.                 if (kids[i].onmousedown != rteMouseDownFontFaceMenu) {
  1495.                     kids[i].onmousedown = rteMouseDownFontFaceMenu;
  1496.                 }
  1497.                 if (kids[i].onmouseout != rteMouseOutFontFaceMenu) {
  1498.                     kids[i].onmouseout = rteMouseOutFontFaceMenu;
  1499.                 }
  1500.                 if (kids[i].className == "rtedropdown6") {
  1501.                     if (kids[i].onmouseout != rteMouseDownFontFaceMenu) {
  1502.                         kids[i].onmouseout = rteMouseDownFontFaceMenu;
  1503.                     }
  1504.                 } else {
  1505.                     if (kids[i].onmouseout != rteMouseOutFontFaceMenu) {
  1506.                         kids[i].onmouseout = rteMouseOutFontFaceMenu;
  1507.                     }
  1508.                 }
  1509.                 break;
  1510.             case "fontface2":
  1511.                 if (kids[i].onmouseover != rteMouseOverFontFaceMenu) {
  1512.                     kids[i].onmouseover = rteMouseOverFontFaceMenu;
  1513.                 }
  1514.                 if (kids[i].onmousedown != rteMouseDownFontFaceMenu) {
  1515.                     kids[i].onmousedown = rteMouseDownFontFaceMenu;
  1516.                 }
  1517.                 if (kids[i].onmouseout != rteMouseOutFontFaceMenu) {
  1518.                     kids[i].onmouseout = rteMouseOutFontFaceMenu;
  1519.                 }
  1520.                 if (kids[i].className == "rtedropdown6") {
  1521.                     if (kids[i].onmouseout != rteMouseDownFontFaceMenu) {
  1522.                         kids[i].onmouseout = rteMouseDownFontFaceMenu;
  1523.                     }
  1524.                 } else {
  1525.                     if (kids[i].onmouseout != rteMouseOutFontFaceMenu) {
  1526.                         kids[i].onmouseout = rteMouseOutFontFaceMenu;
  1527.                     }
  1528.                 }
  1529.                 break;
  1530.             case "fontsize1":
  1531.                 if (kids[i].onmouseover != rteMouseOverFontSizeMenu) {
  1532.                     kids[i].onmouseover = rteMouseOverFontSizeMenu;
  1533.                 }
  1534.                 if (kids[i].onmousedown != rteMouseDownFontSizeMenu) {
  1535.                     kids[i].onmousedown = rteMouseDownFontSizeMenu;
  1536.                 }
  1537.                 if (kids[i].onmouseout != rteMouseOutFontSizeMenu) {
  1538.                     kids[i].onmouseout = rteMouseOutFontSizeMenu;
  1539.                 }
  1540.                 if (kids[i].className == "rtedropdown6") {
  1541.                     if (kids[i].onmouseout != rteMouseDownFontSizeMenu) {
  1542.                         kids[i].onmouseout = rteMouseDownFontSizeMenu;
  1543.                     }
  1544.                 } else {
  1545.                     if (kids[i].onmouseout != rteMouseOutFontSizeMenu) {
  1546.                         kids[i].onmouseout = rteMouseOutFontSizeMenu;
  1547.                     }
  1548.                 }
  1549.                 break;
  1550.             case "fontsize2":
  1551.                 if (kids[i].onmouseover != rteMouseOverFontSizeMenu) {
  1552.                     kids[i].onmouseover = rteMouseOverFontSizeMenu;
  1553.                 }
  1554.                 if (kids[i].onmousedown != rteMouseDownFontSizeMenu) {
  1555.                     kids[i].onmousedown = rteMouseDownFontSizeMenu;
  1556.                 }
  1557.                 if (kids[i].onmouseout != rteMouseOutFontSizeMenu) {
  1558.                     kids[i].onmouseout = rteMouseOutFontSizeMenu;
  1559.                 }
  1560.                 if (kids[i].className == "rtedropdown6") {
  1561.                     if (kids[i].onmouseout != rteMouseDownFontSizeMenu) {
  1562.                         kids[i].onmouseout = rteMouseDownFontSizeMenu;
  1563.                     }
  1564.                 } else {
  1565.                     if (kids[i].onmouseout != rteMouseOutFontSizeMenu) {
  1566.                         kids[i].onmouseout = rteMouseOutFontSizeMenu;
  1567.                     }
  1568.                 }
  1569.                 break;
  1570.             case "fontcolor1":
  1571.                 if (kids[i].onmouseover != rteMouseOverFontColorMenu) {
  1572.                     kids[i].onmouseover = rteMouseOverFontColorMenu;
  1573.                 }
  1574.                 if (kids[i].onmousedown != rteMouseDownFontColorMenu) {
  1575.                     kids[i].onmousedown = rteMouseDownFontColorMenu;
  1576.                 }
  1577.                 if (kids[i].onmouseout != rteMouseOutFontColorMenu) {
  1578.                     kids[i].onmouseout = rteMouseOutFontColorMenu;
  1579.                 }
  1580.                 if (kids[i].className == "rtedropdown9") {
  1581.                     if (kids[i].onmouseout != rteMouseDownFontColorMenu) {
  1582.                         kids[i].onmouseout = rteMouseDownFontColorMenu;
  1583.                     }
  1584.                 } else {
  1585.                     if (kids[i].onmouseout != rteMouseOutFontColorMenu) {
  1586.                         kids[i].onmouseout = rteMouseOutFontColorMenu;
  1587.                     }
  1588.                 }
  1589.                 break;
  1590.             case "fontcolor2":
  1591.                 if (kids[i].onmouseover != rteMouseOverFontColorMenu) {
  1592.                     kids[i].onmouseover = rteMouseOverFontColorMenu;
  1593.                 }
  1594.                 if (kids[i].onmousedown != rteMouseDownFontColorMenu) {
  1595.                     kids[i].onmousedown = rteMouseDownFontColorMenu;
  1596.                 }
  1597.                 if (kids[i].onmouseout != rteMouseOutFontColorMenu) {
  1598.                     kids[i].onmouseout = rteMouseOutFontColorMenu;
  1599.                 }
  1600.                 if (kids[i].className == "rtedropdown9") {
  1601.                     if (kids[i].onmouseout != rteMouseDownFontColorMenu) {
  1602.                         kids[i].onmouseout = rteMouseDownFontColorMenu;
  1603.                     }
  1604.                 } else {
  1605.                     if (kids[i].onmouseout != rteMouseOutFontColorMenu) {
  1606.                         kids[i].onmouseout = rteMouseOutFontColorMenu;
  1607.                     }
  1608.                 }
  1609.                 break;
  1610.             case "formatblock":
  1611.                 if (kids[i].onmouseover != rteMouseOverMenuContents) {
  1612.                     kids[i].onmouseover = rteMouseOverMenuContents;
  1613.                 }
  1614.                 if (kids[i].onmouseout != rteMouseOutMenuContents) {
  1615.                     kids[i].onmouseout = rteMouseOutMenuContents;
  1616.                 }
  1617.                 if (kids[i].onmousedown != rteMouseDownMenuContents) {
  1618.                     kids[i].onmousedown = rteMouseDownMenuContents;
  1619.                 }
  1620.                 break;
  1621.             case "fontface":
  1622.                 if (kids[i].onmouseover != rteMouseOverMenuContents) {
  1623.                     kids[i].onmouseover = rteMouseOverMenuContents;
  1624.                 }
  1625.                 if (kids[i].onmouseout != rteMouseOutMenuContents) {
  1626.                     kids[i].onmouseout = rteMouseOutMenuContents;
  1627.                 }
  1628.                 if (kids[i].onmousedown != rteMouseDownMenuContents) {
  1629.                     kids[i].onmousedown = rteMouseDownMenuContents;
  1630.                 }
  1631.                 break;
  1632.             case "fontsize":
  1633.                 if (kids[i].onmouseover != rteMouseOverMenuContents) {
  1634.                     kids[i].onmouseover = rteMouseOverMenuContents;
  1635.                 }
  1636.                 if (kids[i].onmouseout != rteMouseOutMenuContents) {
  1637.                     kids[i].onmouseout = rteMouseOutMenuContents;
  1638.                 }
  1639.                 if (kids[i].onmousedown != rteMouseDownMenuContents) {
  1640.                     kids[i].onmousedown = rteMouseDownMenuContents;
  1641.                 }
  1642.                 break;
  1643.             case "fontcolor":
  1644.                 if (kids[i].onmouseover != rteMouseOverMenuFontColorContents) {
  1645.                     kids[i].onmouseover = rteMouseOverMenuFontColorContents;
  1646.                 }
  1647.                 if (kids[i].onmouseout != rteMouseOutMenuFontColorContents) {
  1648.                     kids[i].onmouseout = rteMouseOutMenuFontColorContents;
  1649.                 }
  1650.                 break;
  1651.             }
  1652.         }
  1653.         var tbl = false;
  1654.         var in_list = false;
  1655.         if (window.getSelection) {
  1656.             var selected_obj = document.getElementById(rteName).contentWindow.window.getSelection().focusNode;
  1657.         }
  1658.         else if (document.getSelection) {
  1659.             var selected_obj = document.getElementById(rteName).contentWindow.document.getSelection().focusNode;
  1660.         }
  1661.         else if (document.selection) {
  1662.             var selected_obj = document.getElementById(rteName).contentWindow.document.selection.createRange().parentElement();
  1663.         }
  1664.         var is_link = false;
  1665.         var is_table = false;
  1666.         var current_tag = selected_obj;
  1667.         if (current_tag != null) {
  1668.             var previous_tagName = selected_obj.tagName;
  1669.         } else {
  1670.             var previous_tagName = "HTML";
  1671.         }
  1672.         var textcolor = "";
  1673.         document.getElementById("fontcolor4").style.backgroundColor = "#000000";
  1674.         while (previous_tagName != "HTML") {
  1675.             if (previous_tagName == "B" || previous_tagName == "STRONG") {
  1676.                 document.getElementById("bold").className = "rtebtn4";
  1677.                 document.getElementById("bold").onmouseout = rteBtnMouseDown;
  1678.             }
  1679.             if (previous_tagName == "LI") {
  1680.                 in_list = true;
  1681.             }
  1682.             if (previous_tagName == "TD" && !is_table) {
  1683.                 is_table = true;
  1684.             }
  1685.             if (previous_tagName == "I" || previous_tagName == "EM") {
  1686.                 document.getElementById("italic").className = "rtebtn4";
  1687.                 document.getElementById("italic").onmouseout = rteBtnMouseDown;
  1688.             }
  1689.             if (previous_tagName == "U") {
  1690.                 document.getElementById("underline").className = "rtebtn4";
  1691.                 document.getElementById("underline").onmouseout = rteBtnMouseDown;
  1692.             }
  1693.             if (previous_tagName == "STRIKE") {
  1694.                 document.getElementById("strikethrough").className = "rtebtn4";
  1695.                 document.getElementById("strikethrough").onmouseout = rteBtnMouseDown;
  1696.             }
  1697.             if (previous_tagName == "A") {
  1698.                 is_link = true;
  1699.  
  1700.                 document.getElementById("editlink").className = "rtebtn4";
  1701.                 document.getElementById("editlink").onmouseout = rteBtnMouseDown;
  1702.             }
  1703.  
  1704.             if (previous_tagName == "UL") {
  1705.                 document.getElementById("insertunorderedlist").className = "rtebtn4";
  1706.                 document.getElementById("insertunorderedlist").onmouseout = rteBtnMouseDown;
  1707.             }
  1708.             if (previous_tagName == "OL") {
  1709.                 document.getElementById("insertorderedlist").className = "rtebtn4";
  1710.                 document.getElementById("insertorderedlist").onmouseout = rteBtnMouseDown;
  1711.             }
  1712.             if (previous_tagName == "SUB") {
  1713.                 document.getElementById("subscript").className = "rtebtn4";
  1714.                 document.getElementById("subscript").onmouseout = rteBtnMouseDown;
  1715.             }
  1716.             if (previous_tagName == "SUP") {
  1717.                 document.getElementById("superscript").className = "rtebtn4";
  1718.                 document.getElementById("superscript").onmouseout = rteBtnMouseDown;
  1719.             }
  1720.             if (previous_tagName == "H1") {
  1721.                 document.getElementById("format1").innerHTML = "Header 1";
  1722.             }
  1723.             if (previous_tagName == "H2") {
  1724.                 document.getElementById("format1").innerHTML = "Header 2";
  1725.             }
  1726.             if (previous_tagName == "H3") {
  1727.                 document.getElementById("format1").innerHTML = "Header 3";
  1728.             }
  1729.             if (previous_tagName == "H4") {
  1730.                 document.getElementById("format1").innerHTML = "Header 4";
  1731.             }
  1732.             if (previous_tagName == "H5") {
  1733.                 document.getElementById("format1").innerHTML = "Header 5";
  1734.             }
  1735.             if (previous_tagName == "H6") {
  1736.                 document.getElementById("format1").innerHTML = "Header 6";
  1737.             }
  1738.             if (previous_tagName == "BLOCKQUOTE") {
  1739.                 document.getElementById("indent").className = "rtebtn4";
  1740.                 document.getElementById("indent").onmouseout = rteBtnMouseDown;
  1741.             }
  1742.             if (is_table) {
  1743.                 document.getElementById("table_options_on").style.display = "";
  1744.                 document.getElementById("table_options_off").style.display = "none";
  1745.             } else {
  1746.                 document.getElementById("table_options_on").style.display = "none";
  1747.                 document.getElementById("table_options_off").style.display = "";
  1748.             }
  1749.             if (current_tag.align == "left") {
  1750.                 document.getElementById("justifyleft").className = "rtebtn4";
  1751.                 document.getElementById("justifyleft").onmouseout = rteBtnMouseDown;
  1752.             } else if (current_tag.align == "center") {
  1753.                 document.getElementById("justifycenter").className = "rtebtn4";
  1754.                 document.getElementById("justifycenter").onmouseout = rteBtnMouseDown;
  1755.             } else if (current_tag.align == "right") {
  1756.                 document.getElementById("justifyright").className = "rtebtn4";
  1757.                 document.getElementById("justifyright").onmouseout = rteBtnMouseDown;
  1758.             } else if (current_tag.align == "justify") {
  1759.                 document.getElementById("justifyfull").className = "rtebtn4";
  1760.                 document.getElementById("justifyfull").onmouseout = rteBtnMouseDown;
  1761.             } else if (current_tag.align == "") {
  1762.                 document.getElementById("justifyleft").className = "rtebtn1";
  1763.             } else {}
  1764.             if (current_tag.face == "arial") {
  1765.                 document.getElementById("fontface1").innerHTML = "Arial";
  1766.             } else if (current_tag.face == "arial black") {
  1767.                 document.getElementById("fontface1").innerHTML = "Arial Black";
  1768.             } else if (current_tag.face == "arial narrow") {
  1769.                 document.getElementById("fontface1").innerHTML = "Arial Narrow";
  1770.             } else if (current_tag.face == "courier new") {
  1771.                 document.getElementById("fontface1").innerHTML = "Courier New";
  1772.             } else if (current_tag.face == "century gothic") {
  1773.                 document.getElementById("fontface1").innerHTML = "Century Gothic";
  1774.             } else if (current_tag.face == "comic sans ms") {
  1775.                 document.getElementById("fontface1").innerHTML = "Comic Sans MS";
  1776.             } else if (current_tag.face == "impact") {
  1777.                 document.getElementById("fontface1").innerHTML = "Impact";
  1778.             } else if (current_tag.face == "tahoma") {
  1779.                 document.getElementById("fontface1").innerHTML = "Tahoma";
  1780.             } else if (current_tag.face == "times new roman") {
  1781.                 document.getElementById("fontface1").innerHTML = "Times New Roman";
  1782.             } else if (current_tag.face == "trebuchet ms") {
  1783.                 document.getElementById("fontface1").innerHTML = "Trebuchet MS";
  1784.             } else if (current_tag.face == "verdana") {
  1785.                 document.getElementById("fontface1").innerHTML = "Verdana";
  1786.             }
  1787.             if (current_tag.size == "1") {
  1788.                 document.getElementById("fontsize1").innerHTML = "1";
  1789.             } else if (current_tag.size == "2") {
  1790.                 document.getElementById("fontsize1").innerHTML = "2";
  1791.             } else if (current_tag.size == "3") {
  1792.                 document.getElementById("fontsize1").innerHTML = "3";
  1793.             } else if (current_tag.size == "4") {
  1794.                 document.getElementById("fontsize1").innerHTML = "4";
  1795.             } else if (current_tag.size == "5") {
  1796.                 document.getElementById("fontsize1").innerHTML = "5";
  1797.             } else if (current_tag.size == "6") {
  1798.                 document.getElementById("fontsize1").innerHTML = "6";
  1799.             } else if (current_tag.size == "7") {
  1800.                 document.getElementById("fontsize1").innerHTML = "7";
  1801.             } else {}
  1802.             if (current_tag.color != null) {
  1803.                 textcolor = current_tag.color;
  1804.             }
  1805.             current_tag = current_tag.parentNode;
  1806.             previous_tagName = current_tag.tagName;
  1807.         }
  1808.         if (in_list) {}
  1809.     }
  1810.     if (textcolor == "") {
  1811.         textcolor = "#000000";
  1812.     }
  1813.     if (is_table) {
  1814.         document.getElementById("edittable").className = "rtebtn4";
  1815.         document.getElementById("edittable").onmouseout = rteBtnMouseDown;
  1816.         document.getElementById("inserttable").style.display = "none";
  1817.         document.getElementById("edittable").style.display = "";
  1818.     }
  1819.     else {
  1820.         document.getElementById("edittable").className = "rtebtn1";
  1821.         document.getElementById("edittable").onmouseout = rteBtnMouseOut;
  1822.         document.getElementById("inserttable").style.display = "";
  1823.         document.getElementById("edittable").style.display = "none";
  1824.     }
  1825.     document.getElementById("fontcolor4").style.backgroundColor = textcolor;
  1826.     if (is_link) {
  1827.         document.getElementById("createlink").style.display = "none";
  1828.         document.getElementById("editlink").style.display = "";
  1829.     }
  1830.     else {
  1831.         document.getElementById("createlink").style.display = "";
  1832.         document.getElementById("editlink").style.display = "none";
  1833.     }
  1834. };
  1835. function rteSpellCheck() {
  1836.     alert('Not yet supported.');
  1837. };
  1838. function menuBuilder() {
  1839.     if (rteFormat) {
  1840.         document.getElementById("rteformat").style.display = "";
  1841.     } else {
  1842.         document.getElementById("rteformat").style.display = "none";
  1843.     }
  1844.     if (rteFontFace) {
  1845.         document.getElementById("rtefontface").style.display = "";
  1846.     } else {
  1847.         document.getElementById("rtefontface").style.display = "none";
  1848.     }
  1849.     if (rteFontSize) {
  1850.         document.getElementById("rtefontsize").style.display = "";
  1851.     } else {
  1852.         document.getElementById("rtefontsize").style.display = "none";
  1853.     }
  1854.     if (rteFontColor) {
  1855.         document.getElementById("rtefontcolor").style.display = "";
  1856.     } else {
  1857.         document.getElementById("rtefontcolor").style.display = "none";
  1858.     }
  1859.     if (rteBold) {
  1860.         document.getElementById("bold").style.display = "";
  1861.     } else {
  1862.         document.getElementById("bold").style.display = "none";
  1863.     }     
  1864.     if (rteItalic) {
  1865.         document.getElementById("italic").style.display = "";
  1866.     } else {
  1867.         document.getElementById("italic").style.display = "none";
  1868.     }
  1869.  
  1870.     if (rteUnderline) {
  1871.         document.getElementById("underline").style.display = "";
  1872.     } else {
  1873.         document.getElementById("underline").style.display = "none";
  1874.     }
  1875.     if (rteStrikeThrough) {
  1876.         document.getElementById("strikethrough").style.display = "";
  1877.     } else {
  1878.         document.getElementById("strikethrough").style.display = "none";
  1879.     }
  1880.  
  1881.     if (rteLeftAlign) {
  1882.         document.getElementById("justifyleft").style.display = "";
  1883.     } else {
  1884.         document.getElementById("justifyleft").style.display = "none";
  1885.     }
  1886.     if (rteCenterAlign) {
  1887.         document.getElementById("justifycenter").style.display = "";
  1888.     } else {
  1889.         document.getElementById("justifycenter").style.display = "none";
  1890.     }
  1891.     if (rteRightAlign) {
  1892.         document.getElementById("justifyright").style.display = "";
  1893.     } else {
  1894.         document.getElementById("justifyright").style.display = "none";
  1895.     }
  1896.     if (rteFullAlign) {
  1897.         document.getElementById("justifyfull").style.display = "";
  1898.     } else {
  1899.         document.getElementById("justifyfull").style.display = "none";
  1900.     }
  1901.     if (rteHorizontalRule) {
  1902.         document.getElementById("inserthorizontalrule").style.display = "";
  1903.     } else {
  1904.         document.getElementById("inserthorizontalrule").style.display = "none";
  1905.     }
  1906.     if (rteSubscript) {
  1907.         document.getElementById("subscript").style.display = "";
  1908.     } else {
  1909.         document.getElementById("subscript").style.display = "none";
  1910.     }
  1911.     if (rteSuperscript) {
  1912.         document.getElementById("superscript").style.display = "";
  1913.     } else {
  1914.         document.getElementById("superscript").style.display = "none";
  1915.     }
  1916.     if (rteLink) {
  1917.         document.getElementById("createlink").style.display = "";
  1918.     } else {
  1919.         document.getElementById("createlink").style.display = "none";
  1920.     }
  1921.     if (rteUnlink) {
  1922.     //    document.getElementById("unlink").style.display = "";
  1923.     } else {
  1924.         //document.getElementById("unlink").style.display = "none";
  1925.     }
  1926.     if (rteImages) {
  1927.       //  document.getElementById("insertimage").style.display = "";
  1928.     } else {
  1929.        // document.getElementById("insertimage").style.display = "none";
  1930.     }
  1931.     if (rteRemoveFormat) {
  1932.         document.getElementById("removeformat").style.display = "";
  1933.     } else {
  1934.        document.getElementById("removeformat").style.display = "none";
  1935.     }
  1936.     if (rteTables) {
  1937.         document.getElementById("tables").style.display = "";
  1938.     } else {
  1939.         document.getElementById("tables").style.display = "none";
  1940.     }
  1941.     if (rteOrderedList) {
  1942.         document.getElementById("insertorderedlist").style.display = "";
  1943.     } else {
  1944.         document.getElementById("insertorderedlist").style.display = "none";
  1945.     }
  1946.     if (rteUnorderedList) {
  1947.         document.getElementById("insertunorderedlist").style.display = "";
  1948.     } else {
  1949.         document.getElementById("insertunorderedlist").style.display = "none";
  1950.     }
  1951.     if (rteIndent) {
  1952.         document.getElementById("indent").style.display = "";
  1953.     } else {
  1954.         document.getElementById("indent").style.display = "none";
  1955.     }
  1956.     if (rteOutdent) {
  1957.         document.getElementById("outdent").style.display = "";
  1958.     } else {
  1959.         document.getElementById("outdent").style.display = "none";
  1960.     }
  1961.     if (rteUndo) {
  1962.         document.getElementById("undo").style.display = "";
  1963.     } else {
  1964.         document.getElementById("undo").style.display = "none";
  1965.     }
  1966.     if (rteRedo) {
  1967.         document.getElementById("redo").style.display = "";
  1968.     } else {
  1969.         document.getElementById("redo").style.display = "none";
  1970.     }
  1971.     if (rteCutCopyPaste) {
  1972.       //  document.getElementById("cutcopypaste").style.display = "";
  1973.     } else {
  1974.       //  document.getElementById("cutcopypaste").style.display = "none";
  1975.     }
  1976.     if (rteInsertForm) {
  1977.        // document.getElementById("insertform").style.display = "";
  1978.     } else {
  1979.       //  document.getElementById("insertform").style.display = "none";
  1980.     }
  1981.     if (rteInsertCheckbox) {
  1982.        // document.getElementById("form_checkbox").style.display = "";
  1983.     } else {
  1984.       //  document.getElementById("form_checkbox").style.display = "none";
  1985.     }
  1986.     if (rteInsertRadio) {
  1987.       //  document.getElementById("form_radio").style.display = "";
  1988.     } else {
  1989.       //  document.getElementById("form_radio").style.display = "none";
  1990.     }
  1991.     if (rteInsertTextArea) {
  1992.       //  document.getElementById("form_textarea").style.display = "";
  1993.     } else {
  1994.        // document.getElementById("form_textarea").style.display = "none";
  1995.     }
  1996.     if (rteInsertSubmit) {
  1997.        // document.getElementById("form_submit").style.display = "";
  1998.     } else {
  1999.        // document.getElementById("form_submit").style.display = "none";
  2000.     }
  2001.     if (rteInsertImageSubmit) {
  2002.        // document.getElementById("form_image_submit").style.display = "";
  2003.     } else {
  2004.         //document.getElementById("form_image_submit").style.display = "none";
  2005.     }
  2006.     if (rteInsertReset) {
  2007.        // document.getElementById("form_reset").style.display = "";
  2008.     } else {
  2009.        // document.getElementById("form_reset").style.display = "none";
  2010.     }
  2011.     if (rteInsertHidden) {
  2012.        // document.getElementById("form_hidden").style.display = "";
  2013.     } else {
  2014.       //  document.getElementById("form_hidden").style.display = "none";
  2015.     }
  2016.     if (rteInsertPassword) {
  2017.       //  document.getElementById("form_password").style.display = "";
  2018.     } else {
  2019.        // document.getElementById("form_password").style.display = "none";
  2020.     }
  2021.     if (rteInsertTextField) {
  2022.        // document.getElementById("form_textfield").style.display = "";
  2023.     } else {
  2024.        // document.getElementById("form_textfield").style.display = "none";
  2025.     }
  2026.     if (rtePrint) {
  2027.        // document.getElementById("printrte").style.display = "";
  2028.     } else {
  2029.        // document.getElementById("printrte").style.display = "none";
  2030.     }
  2031.     if (rteSelectAll) {
  2032.        // document.getElementById("selectall").style.display = "";
  2033.     } else {
  2034.         //document.getElementById("selectall").style.display = "none";
  2035.     }
  2036.     if (rteSpellCheck) {
  2037.         document.getElementById("spellchecker").style.display = "";
  2038.     } else {
  2039.         document.getElementById("spellchecker").style.display = "none";
  2040.     }
  2041.     if (!rteFormat && !rteFontFace && !rteFontSize && !rteFontColor) {
  2042.         document.getElementById("rtesep1").style.display = "none";
  2043.         document.getElementById("rtesep2").style.display = "none";
  2044.     }
  2045.     if (!rteBold && !rteItalic && !rteUnderline && !rteStrikeThrough && !rteDelete && !rteInsert) {
  2046.         document.getElementById("rtesep3").style.display = "none";
  2047.     }
  2048.     if (!rteLeftAlign && !rteCenterAlign && !rteRightAlign && !rteFullAlign && !rteHorizontalRule) {
  2049.         document.getElementById("rtesep4").style.display = "none";
  2050.     }
  2051.     if (!rteFormat && !rteFontFace && !rteFontSize && !rteBold && !rteItalic && !rteUnderline && !rteStrikeThrough && !rteLeftAlign && !rteCenterAlign && !rteRightAlign && !rteFullAlign && !rteHorizontalRule && !rteSuperscript && !rteSubscript) {
  2052.         document.getElementById("tb1").style.display = "none";
  2053.     }
  2054.     if (!rteLink && !rteUnlink && !rteImages && !rteRemoveFormat && !rteTables && !rteOrderedList && !rteUnorderedList && !rteIndent && !rteOutdent && !rteUndo && !rteRedo && !rteCutCopyPaste) {
  2055.         document.getElementById("tb2").style.display = "none";
  2056.     }
  2057.     if (!rteLink && !rteUnlink) {
  2058.         document.getElementById("rtesep5").style.display = "none";
  2059.     }
  2060.     if (!rteImages && !rteRemoveFormat) {
  2061.         document.getElementById("rtesep6").style.display = "none";
  2062.     }
  2063.     if (!rteTables) {
  2064.         document.getElementById("rtesep7").style.display = "none";
  2065.     }
  2066.     if (!rteOrderedList && !rteUnorderedList && !rteIndent && !rteOutdent) {
  2067.         document.getElementById("rtesep8").style.display = "none";
  2068.     }
  2069.     if (!rteUndo && !rteRedo) {
  2070.         document.getElementById("rtesep9").style.display = "none";
  2071.     }
  2072.     if (!rteInsertForm && !rteInsertCheckbox && !rteInsertRadio && !rteInsertTextArea && !rteInsertSubmit && !rteInsertImageSubmit && !rteInsertReset && !rteInsertHidden && !rteInsertPassword && !rteInsertTextField) {
  2073.         document.getElementById("rtesep10").style.display = "none";
  2074.     }
  2075.     if (!rtePrint && !rteSelectAll && !rteSpellCheck) {
  2076.         document.getElementById("rtesep11").style.display = "none";
  2077.     }
  2078. };
  2079. function initRTE(rtePreloadContent, rteCSS) {
  2080.  
  2081.     if (!document.designMode) {
  2082.         document.write('<textarea id="' + rteFormName + '" name="' + rteFormName + '" style="width:' + rteWidth + ';height:' + rteHeight + ';"></textarea>');
  2083.     } else {
  2084.         alert(rtePreloadContent);
  2085.         document.write('<style>');
  2086.         document.write('.rtebg {');
  2087.         document.write('    background-image:url(' + rteImagePath + 'bg.gif);');
  2088.         document.write('    font-family:Arial, Helvetica, sans-serif;');
  2089.         document.write('    font-size:10px;');
  2090.         document.write('}');
  2091.         document.write('.rtedropdown1 {');
  2092.         document.write('    height:16px;');
  2093.         document.write('    font-family:Arial, Helvetica, sans-serif;');
  2094.         document.write('    padding-left:3px;');
  2095.         document.write('    padding-right:3px;');
  2096.         document.write('    font-size:11px;');
  2097.         document.write('    border:1px solid #FFFFFF;');
  2098.         document.write('    cursor:default;');
  2099.         document.write('}');
  2100.         document.write('.rtedropdown2 {');
  2101.         document.write('    width:11px;');
  2102.         document.write('    background-image:url(' + rteImagePath + 'bg.gif);');
  2103.         document.write('    border-top:1px solid #FFFFFF;');
  2104.         document.write('    border-right:1px solid #FFFFFF;');
  2105.         document.write('    border-bottom:1px solid #FFFFFF;');
  2106.         document.write('    cursor:default;');
  2107.         if (document.all && !window.opera) {
  2108.             document.write('    height:20px;');
  2109.         }
  2110.         else {
  2111.             document.write('    height:16px;');
  2112.         }
  2113.         document.write('}');
  2114.         document.write('.rtedropdown4 {');
  2115.         document.write('    font-family:Arial, Helvetica, sans-serif;');
  2116.         document.write('    padding-left:3px;');
  2117.         document.write('    padding-right:3px;');
  2118.         document.write('    font-size:11px;');
  2119.         document.write('    border:1px solid #002D96;');
  2120.         document.write('    cursor:default;');
  2121.         if (document.all && !window.opera) {
  2122.             document.write('    line-height:18px;');
  2123.         }
  2124.         else {
  2125.             document.write('    height:16px;');
  2126.         }
  2127.         document.write('}');
  2128.         document.write('.rtedropdown5 {');
  2129.         document.write('    background-image:url(' + rteImagePath + 'bgover.gif);');
  2130.         document.write('    border-top:1px solid #000080;');
  2131.         document.write('    border-right:1px solid #000080;');
  2132.         document.write('    border-bottom:1px solid #000080;');
  2133.         document.write('    cursor:default;');
  2134.         if (document.all && !window.opera) {
  2135.             document.write('    height:20px;');
  2136.         }
  2137.         else {
  2138.             document.write('    height:16px;');
  2139.         }
  2140.         document.write('}');
  2141.         document.write('.rtedropdown5b {');
  2142.         document.write('    background-image:url(' + rteImagePath + 'bgover.gif);');
  2143.         document.write('    border-top:1px solid #000080;');
  2144.         document.write('    border-right:1px solid #000080;');
  2145.         document.write('    border-bottom:1px solid #000080;');
  2146.         document.write('    cursor:default;');
  2147.         if (document.all && !window.opera) {
  2148.             document.write('    height:21px;');
  2149.         }
  2150.         else {
  2151.             document.write('    height:19px;');
  2152.         }
  2153.         document.write('}');
  2154.         document.write('.rtedropdown6 {');
  2155.         document.write('    width:11px;');
  2156.         document.write('    background-image:url(' + rteImagePath + 'bgdown.gif);');
  2157.         document.write('    border-top:1px solid #000080;');
  2158.         document.write('    border-right:1px solid #000080;');
  2159.         document.write('    border-bottom:1px solid #000080;');
  2160.         document.write('    cursor:default;');
  2161.         if (document.all && !window.opera) {
  2162.             document.write('    height:20px;');
  2163.         }
  2164.         else {
  2165.             document.write('    height:16px;');
  2166.         }
  2167.         document.write('}');
  2168.         document.write('.rtedropdown7 {');
  2169.         document.write('    border:1px solid #002D96;');
  2170.         document.write('    background-color:#FFFFFF;');
  2171.         document.write('    font-family:Arial, Helvetica, sans-serif;');
  2172.         document.write('    cursor:default;');
  2173.         document.write('}');
  2174.         document.write('.rtedropdown8 {');
  2175.         document.write('    background-image:url(' + rteImagePath + 'bgover.gif);');
  2176.         document.write('    border:1px solid #002D96;');
  2177.         document.write('    cursor:default;');
  2178.         document.write('}');
  2179.         document.write('.rtedropdown9 {');
  2180.         document.write('    background-image:url(' + rteImagePath + 'bgdown.gif);');
  2181.         document.write('    border-top:1px solid #000080;');
  2182.         document.write('    border-right:1px solid #000080;');
  2183.         document.write('    border-bottom:1px solid #000080;');
  2184.         document.write('    cursor:default;');
  2185.         document.write('}');
  2186.         document.write('.rtedropdown9b {');
  2187.         document.write('    background-image:url(' + rteImagePath + 'bgdown.gif);');
  2188.         document.write('    border-top:1px solid #000080;');
  2189.         document.write('    border-right:1px solid #000080;');
  2190.         document.write('    border-bottom:1px solid #000080;');
  2191.         document.write('    cursor:default;');
  2192.         if (document.all && !window.opera) {
  2193.             document.write('    height:21px;');
  2194.         }
  2195.         else {
  2196.             document.write('    height:19px;');
  2197.         }
  2198.         document.write('}');
  2199.         document.write('.rtedropdown10 {');
  2200.         document.write('    border:0px solid transparent;');
  2201.         document.write('    cursor:default;');
  2202.         document.write('}');
  2203.         document.write('.rtedropdown11 {');
  2204.         document.write('    border-top:0px solid transparent;');
  2205.         document.write('    border-right:0px solid transparent;');
  2206.         document.write('    border-bottom:0px solid transparent;');
  2207.         document.write('    cursor:default;');
  2208.         document.write('}');
  2209.         document.write('.rtedropdown11b {');
  2210.         document.write('    border-top:0px solid transparent;');
  2211.         document.write('    border-right:0px solid transparent;');
  2212.         document.write('    border-bottom:0px solid transparent;');
  2213.         document.write('    cursor:default;');
  2214.         document.write('    height:19px;');
  2215.         document.write('}');
  2216.         document.write('.rtedropdown12 {');
  2217.         document.write('    background-image:url(' + rteImagePath + 'bgdown.gif);');
  2218.         document.write('    border:1px solid #000080;');
  2219.         document.write('    cursor:default;');
  2220.         document.write('}');
  2221.         document.write('.rtedropdown13 {');
  2222.         document.write('    padding:1px;');
  2223.         document.write('    border:1px solid #FFFFFF;');
  2224.         document.write('    background-color:#FFFFFF;');
  2225.         document.write('}');
  2226.         document.write('.rtedropdown14 {');
  2227.         document.write('    padding:1px;');
  2228.         document.write('    border:1px solid #000080;');
  2229.         document.write('    background-color:#FFEEC2;');
  2230.         document.write('}');
  2231.         document.write('.rtebtn1 {');
  2232.         document.write('    display:block;');
  2233.         document.write('    width:21px;');
  2234.         document.write('    height:20px;');
  2235.         document.write('    padding: 1px;');
  2236.         document.write('    background-image:url(' + rteImagePath + 'bg.gif);');
  2237.         document.write('}');
  2238.         document.write('.rtebtn2 {');
  2239.         document.write('    display:block;');
  2240.         document.write('    width:21px;');
  2241.         document.write('    height:20px;');
  2242.         document.write('    border:1px solid #000080;');
  2243.         document.write('    background-image:url(' + rteImagePath + 'bgover.gif);');
  2244.         document.write('}');
  2245.         document.write('.rtebtn3 {');
  2246.         document.write('    display:block;');
  2247.         document.write('    width:21px;');
  2248.         document.write('    height:20px;');
  2249.         document.write('    border:1px solid #000080;');
  2250.         document.write('    background-image:url(' + rteImagePath + 'bgselect.gif);');
  2251.         document.write('}');
  2252.         document.write('.rtebtn4 {');
  2253.         document.write('    display:block;');
  2254.         document.write('    width:21px;');
  2255.         document.write('    height:20px;');
  2256.         document.write('    border:1px solid #000080;');
  2257.         document.write('    background-image:url(' + rteImagePath + 'bgdown.gif);');
  2258.         document.write('}');
  2259.         document.write('.rtebtn5 {');
  2260.         document.write('    display:block;');
  2261.         document.write('    width:21px;');
  2262.         document.write('    height:20px;');
  2263.         document.write('    padding: 1px;');
  2264.         document.write('    background-image:url(' + rteImagePath + 'bg.gif);');
  2265.         document.write('}');
  2266.         document.write('.rtebtn6 {');
  2267.         document.write('    display:block;');
  2268.         document.write('    padding: 3px;');
  2269.         document.write('    cursor:default;');
  2270.         document.write('}');
  2271.         document.write('.rtebtn7 {');
  2272.         document.write('    display:block;');
  2273.         document.write('    border:1px solid #000080;');
  2274.         document.write('    background-image:url(' + rteImagePath + 'bgover.gif);');
  2275.         document.write('    cursor:default;');
  2276.         document.write('    padding: 2px;');
  2277.         document.write('}');
  2278.         document.write('.rtebtn8 {');
  2279.         document.write('    display:block;');
  2280.         document.write('    border:1px solid #000080;');
  2281.         document.write('    background-image:url(' + rteImagePath + 'bgselect.gif);');
  2282.         document.write('    cursor:default;');
  2283.         document.write('    padding: 2px;');
  2284.         document.write('}');
  2285.         document.write('.rtebtn9 {');
  2286.         document.write('    display:block;');
  2287.         document.write('    border:1px solid #000080;');
  2288.         document.write('    background-image:url(' + rteImagePath + 'bgdown.gif);');
  2289.         document.write('    cursor:default;');
  2290.         document.write('    padding: 2px;');
  2291.         document.write('}');
  2292.         document.write('</style>');
  2293.         document.write('<input type="hidden" id="preview_css" value="' + rteCSS + '">');
  2294.         document.write('<input type="hidden" id="iframe_name" value="' + rteName + '">');
  2295.         document.write('<table style="width:' + rteWidth + ';border-left:1px solid #3B619C;border-right:1px solid #3B619C;border-top:1px solid #3B619C;" cellpadding="0" cellspacing="0">');
  2296.         document.write('  <tr>');
  2297.         document.write('    <td bgcolor="#C3DAF9">');
  2298.         document.write('    <table cellpadding="0" cellspacing="0" id="tb1" onmousedown="return false;">');
  2299.         document.write('      <tr>');
  2300.         //document.write('        <td width="7"><img src="' + rteImagePath + 'start.gif" width="7" height="25"></td>');
  2301.         document.write('        <td class="rtebg" id="rtesep1"><img src="' + rteImagePath + 'blank.gif"></td>');
  2302.         document.write('        <td background="' + rteImagePath + 'bg.gif" id="rteformat">');
  2303.         document.write('        <table width="100%" cellpadding="0" cellspacing="0" id="format4" bgcolor="#FFFFFF" title="Style">');
  2304.         document.write('          <tr>');
  2305.         document.write('            <td nowrap><div unselectable="on" id="format1" class="rtedropdown1" style="width:58px;font-family:arial;font-size:11px;color:#000000;">Paragraph</div></td>');
  2306.         document.write('            <td><div unselectable="on" id="format2" class="rtedropdown2"><img src="' + rteImagePath + 'arrow.gif" width="11" height="16"></div></td>');
  2307.         document.write('          </tr>');
  2308.         document.write('        </table>');
  2309.         document.write('        <div id="format3" class="rtedropdown7" style="position:absolute;display:none;">');
  2310.         document.write('            <div unselectable="on" id="formatblock" style="font-size:24px; font-family:arial;color:#000000;font-weight:bold;padding:5px;" nowrap>Header 1</div>');
  2311.         document.write('            <div unselectable="on" id="formatblock" style="font-size:18px; font-family:arial;color:#000000;font-weight:bold;padding:5px;" nowrap>Header 2</div>');
  2312.         document.write('            <div unselectable="on" id="formatblock" style="font-size:16px; font-family:arial;color:#000000;font-weight:bold;padding:5px;" nowrap>Header 3</div>');
  2313.         document.write('            <div unselectable="on" id="formatblock" style="font-size:14px; font-family:arial;color:#000000;font-weight:bold;padding:5px;" nowrap>Header 4</div>');
  2314.         document.write('            <div unselectable="on" id="formatblock" style="font-size:12px; font-family:arial;color:#000000;font-weight:bold;padding:5px;" nowrap>Header 5</div>');
  2315.         document.write('            <div unselectable="on" id="formatblock" style="font-size:10px; font-family:arial;color:#000000;font-weight:bold;padding:5px;" nowrap>Header 6</div>');
  2316.         document.write('            <div unselectable="on" id="formatblock" style="font-size:12px; font-family:arial;color:#000000;font-weight:bold;padding:5px;" nowrap>Paragraph</div>');
  2317.         document.write('        </div>');
  2318.         document.write('        </td>');
  2319.         document.write('        <td class="rtebg"><img src="' + rteImagePath + 'blank.gif"></td>');
  2320.         document.write('        <td background="' + rteImagePath + 'bg.gif" id="rtefontface">');
  2321.         document.write('        <table style="width:110px;" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" title="Font">');
  2322.         document.write('          <tr>');
  2323.         document.write('            <td nowrap><div unselectable="on" id="fontface1" class="rtedropdown1" style="width:98px;font-family:arial;font-size:11px;color:#000000;">Verdana</div></td>');
  2324.         document.write('            <td><div unselectable="on" id="fontface2" class="rtedropdown2"><img src="' + rteImagePath + 'arrow.gif" width="11" height="16"></div></td>');
  2325.         document.write('          </tr>');
  2326.         document.write('        </table>');
  2327.         document.write('        <div id="fontface3" class="rtedropdown7" style="position:absolute;display:none;">');
  2328.         document.write('            <div unselectable="on" id="fontface" style="color:#000000;font-family:arial;padding:5px;" nowrap>Arial</div>');
  2329.         document.write('            <div unselectable="on" id="fontface" style="color:#000000;font-family:arial black;padding:5px;" nowrap>Arial Black</div>');
  2330.         document.write('            <div unselectable="on" id="fontface" style="color:#000000;font-family:arial narrow;padding:5px;" nowrap>Arial Narrow</div>');
  2331.         document.write('            <div unselectable="on" id="fontface" style="color:#000000;font-family:courier new;padding:5px;" nowrap>Courier New</div>');
  2332.         document.write('            <div unselectable="on" id="fontface" style="color:#000000;font-family:century gothic;padding:5px;" nowrap>Century Gothic</div>');
  2333.         document.write('            <div unselectable="on" id="fontface" style="color:#000000;font-family:comic sans ms;padding:5px;" nowrap>Comic Sans MS</div>');
  2334.         document.write('            <div unselectable="on" id="fontface" style="color:#000000;font-family:impact;padding:5px;" nowrap>Impact</div>');
  2335.         document.write('            <div unselectable="on" id="fontface" style="color:#000000;font-family:tahoma;padding:5px;" nowrap>Tahoma</div>');
  2336.         document.write('            <div unselectable="on" id="fontface" style="color:#000000;font-family:times new roman;padding:5px;" nowrap>Times New Roman</div>');
  2337.         document.write('            <div unselectable="on" id="fontface" style="color:#000000;font-family:trebuchet ms;padding:5px;" nowrap>Trebuchet MS</div>');
  2338.         document.write('            <div unselectable="on" id="fontface" style="color:#000000;font-family:verdana;padding:5px;" nowrap>Verdana</div>');
  2339.         document.write('        </div>');
  2340.         document.write('        </td>');
  2341.         document.write('        <td class="rtebg"><img src="' + rteImagePath + 'blank.gif"></td>');
  2342.         document.write('        <td background="' + rteImagePath + 'bg.gif" id="rtefontsize">');
  2343.         document.write('        <table width="100%" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" title="Font Size">');
  2344.         document.write('          <tr>');
  2345.         document.write('            <td><div unselectable="on" id="fontsize1" class="rtedropdown1" style="font-family:arial;font-size:11px;color:#000000;">2</div></td>');
  2346.         document.write('            <td><div unselectable="on" id="fontsize2" class="rtedropdown2"><img src="' + rteImagePath + 'arrow.gif" width="11" height="16"></div></td>');
  2347.         document.write('          </tr>');
  2348.         document.write('        </table>');
  2349.         document.write('        <div id="fontsize3" class="rtedropdown7" style="position:absolute;display:none;">');
  2350.         document.write('            <div unselectable="on" id="fontface" style="font-family:arial;color:#000000;font-size:7px;padding:5px;">1</div>');
  2351.         document.write('            <div unselectable="on" id="fontface" style="font-family:arial;color:#000000;font-size:10px;padding:5px;">2</div>');
  2352.         document.write('            <div unselectable="on" id="fontface" style="font-family:arial;color:#000000;font-size:12px;padding:5px;">3</div>');
  2353.         document.write('            <div unselectable="on" id="fontface" style="font-family:arial;color:#000000;font-size:13px;padding:5px;">4</div>');
  2354.         document.write('            <div unselectable="on" id="fontface" style="font-family:arial;color:#000000;font-size:17px;padding:5px;">5</div>');
  2355.         document.write('            <div unselectable="on" id="fontface" style="font-family:arial;color:#000000;font-size:23px;padding:5px;">6</div>');
  2356.         document.write('            <div unselectable="on" id="fontface" style="font-family:arial;color:#000000;font-size:35px;padding:5px;">7</div>');
  2357.         document.write('        </div>');
  2358.         document.write('        </td>');
  2359.         document.write('        <td class="rtebg"><img src="' + rteImagePath + 'blank.gif"></td>');
  2360.         document.write('        <td class="rtebg" id="rtefontcolor" title="Font Color">');
  2361.         document.write('            <table style="width:35px;" border="0" cellspacing="0" cellpadding="0">');
  2362.         document.write('                <tr>');
  2363.         if (!document.all || window.opera) {
  2364.             document.write('                    <td><div id="fontcolor1" align="center" class="rtedropdown5" style="padding-bottom:1px;"><img src="' + rteImagePath + 'fontcolor.gif"><br><img id="fontcolor4" src="' + rteImagePath + 'fontcolor2.gif" style="background-color:#FF0000;"></div></td>');
  2365.             document.write('                    <td><div align="center" id="fontcolor2" class="rtedropdown8"><img src="' + rteImagePath + 'arrow.gif"></div></td>');
  2366.         }
  2367.         else {
  2368.             document.write('                    <td><div id="fontcolor1" align="center" class="rtedropdown5" style="padding-bottom:1px;"><img src="' + rteImagePath + 'fontcolor.gif"><br><img id="fontcolor4" src="' + rteImagePath + 'fontcolor2.gif" style="background-color:#FF0000;"></div></td>');
  2369.             document.write('                    <td><div align="center" id="fontcolor2" class="rtedropdown8"><img src="' + rteImagePath + 'arrow.gif"></div></td>');
  2370.         }
  2371.         document.write('                </tr>');
  2372.         document.write('            </table>');
  2373.         document.write('        <div id="fontcolor3" class="rtedropdown7" style="position:absolute;display:none;padding:4px;border:1px solid #002D96;">');
  2374.         document.write('            <table border="0" cellspacing="1" cellpadding="0">');
  2375.         document.write('                <tr>');
  2376.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#000000;" onClick="rteColorClick(\'#000000\');"></div></td>');
  2377.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#993300;" onClick="rteColorClick(\'#993300\');"></div></td>');
  2378.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#333300;" onClick="rteColorClick(\'#333300\');"></div></td>');
  2379.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#003300;" onClick="rteColorClick(\'#003300\');"></div></td>');
  2380.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#003366;" onClick="rteColorClick(\'#003366\');"></div></td>');
  2381.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#000080;" onClick="rteColorClick(\'#000080\');"></div></td>');
  2382.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#333399;" onClick="rteColorClick(\'#333399\');"></div></td>');
  2383.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#333333;" onClick="rteColorClick(\'#333333\');"></div></td>');
  2384.         document.write('                </tr>');
  2385.         document.write('                <tr>');
  2386.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#800000;" onClick="rteColorClick(\'#800000\');"></div></td>');
  2387.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#FF6600;" onClick="rteColorClick(\'#FF6600\');"></div></td>');
  2388.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#808000;" onClick="rteColorClick(\'#808000\');"></div></td>');
  2389.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#008000;" onClick="rteColorClick(\'#008000\');"></div></td>');
  2390.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#008080;" onClick="rteColorClick(\'#008080\');"></div></td>');
  2391.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#0000FF;" onClick="rteColorClick(\'#0000FF\');"></div></td>');
  2392.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#666699;" onClick="rteColorClick(\'#666699\');"></div></td>');
  2393.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#808080;" onClick="rteColorClick(\'#808080\');"></div></td>');
  2394.         document.write('                </tr>');
  2395.         document.write('                <tr>');
  2396.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#FF0000;" onClick="rteColorClick(\'#FF0000\');"></div></td>');
  2397.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#FF9900;" onClick="rteColorClick(\'#FF9900\');"></div></td>');
  2398.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#99CC00;" onClick="rteColorClick(\'#99CC00\');"></div></td>');
  2399.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#339966;" onClick="rteColorClick(\'#339966\');"></div></td>');
  2400.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#33CCCC;" onClick="rteColorClick(\'#33CCCC\');"></div></td>');
  2401.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#3366FF;" onClick="rteColorClick(\'#3366FF\');"></div></td>');
  2402.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#800080;" onClick="rteColorClick(\'#800080\');"></div></td>');
  2403.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#999999;" onClick="rteColorClick(\'#999999\');"></div></td>');
  2404.         document.write('                </tr>');
  2405.         document.write('                <tr>');
  2406.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#FF00FF;" onClick="rteColorClick(\'#FF00FF\');"></div></td>');
  2407.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#FFCC00;" onClick="rteColorClick(\'#FFCC00\');"></div></td>');
  2408.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#FFFF00;" onClick="rteColorClick(\'#FFFF00\');"></div></td>');
  2409.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#00FF00;" onClick="rteColorClick(\'#00FF00\');"></div></td>');
  2410.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#00FFFF;" onClick="rteColorClick(\'#00FFFF\');"></div></td>');
  2411.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#00CCFF;" onClick="rteColorClick(\'#00CCFF\');"></div></td>');
  2412.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#993366;" onClick="rteColorClick(\'#993366\');"></div></td>');
  2413.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#C0C0C0;" onClick="rteColorClick(\'#C0C0C0\');"></div></td>');
  2414.         document.write('                </tr>');
  2415.         document.write('                <tr>');
  2416.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#FF99CC;" onClick="rteColorClick(\'#FF99CC\');"></div></td>');
  2417.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#FFCC99;" onClick="rteColorClick(\'#FFCC99\');"></div></td>');
  2418.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#FFFF99;" onClick="rteColorClick(\'#FFFF99\');"></div></td>');
  2419.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#CCFFCC;" onClick="rteColorClick(\'#CCFFCC\');"></div></td>');
  2420.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#CCFFFF;" onClick="rteColorClick(\'#CCFFFF\');"></div></td>');
  2421.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#99CCFF;" onClick="rteColorClick(\'#99CCFF\');"></div></td>');
  2422.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#CC99FF;" onClick="rteColorClick(\'#CC99FF\');"></div></td>');
  2423.         document.write('                    <td><div id="fontcolor" class="rtedropdown13"><img src="' + rteImagePath + 'fontcolor3.gif" style="background-color:#FFFFFF;" onClick="rteColorClick(\'#FFFFFF\');"></div></td>');
  2424.         document.write('                </tr>');
  2425.         document.write('            </table>');
  2426.         document.write('        </div>');
  2427.         document.write('        </td>');
  2428.         document.write('        <td class="rtebg" id="rtesep2"><img src="' + rteImagePath + 'seperator.gif"></td>');
  2429.         document.write('        <td class="rtebg" title="Bold"><div id="bold" class="rtebtn1"><img src="' + rteImagePath + 'bold.gif"></div></td>');
  2430.         document.write('        <td class="rtebg" title="Italic"><div id="italic" class="rtebtn1"><img src="' + rteImagePath + 'italic.gif"></div></td>');
  2431.         document.write('        <td class="rtebg" title="Underline"><div id="underline" class="rtebtn1"><img src="' + rteImagePath + 'underline.gif"></div></td>');
  2432.         document.write('        <td class="rtebg" title="Strikethrough"><div id="strikethrough" class="rtebtn1"><img src="' + rteImagePath + 'strikethrough.gif"></div></td>');
  2433.         document.write('        <td class="rtebg" title="Superscript"><div id="superscript" class="rtebtn1"><img src="' + rteImagePath + 'superscript.gif"></div></td>');
  2434.         document.write('        <td class="rtebg" title="Subscript"><div id="subscript" class="rtebtn1"><img src="' + rteImagePath + 'subscript.gif"></div></td>');        
  2435.         document.write('        <td class="rtebg" id="rtesep3"><img src="' + rteImagePath + 'seperator.gif"></td>');
  2436.         document.write('        <td class="rtebg" title="Align Left"><div id="justifyleft" class="rtebtn1"><img src="' + rteImagePath + 'leftalign.gif" width="21" height="20"></div></td>');
  2437.         document.write('        <td class="rtebg" title="Center"><div id="justifycenter" class="rtebtn1"><img src="' + rteImagePath + 'centeralign.gif"></div></td>');
  2438.         document.write('        <td class="rtebg" title="Align Right"><div id="justifyright" class="rtebtn1"><img src="' + rteImagePath + 'rightalign.gif"></div></td>');
  2439.         document.write('        <td class="rtebg" title="Justify"><div id="justifyfull" class="rtebtn1"><img src="' + rteImagePath + 'fullalign.gif"></div></td>');
  2440.  
  2441.         document.write('        <td class="rtebg" id="rtesep4"><img src="' + rteImagePath + 'seperator.gif"></td>');
  2442.         //document.write('        <td width="14"><img src="' + rteImagePath + 'finish.gif" width="14" height="25"></td>');
  2443.  
  2444.          document.write('        <td class="rtebg"><img src="' + rteImagePath + 'blank.gif"></td>');
  2445.          document.write('        <td class="rtebg" title="Horizontal Rule"><div id="inserthorizontalrule" class="rtebtn1"><img src="' + rteImagePath + 'hr.gif"></div></td>');
  2446.         document.write('        <td class="rtebg"><div id="createlink" class="rtebtn1" title="Insert Hyperlink"><a href="javascript:rteBtnCreateLink();" style="cursor:default;"><img src="' + rteImagePath + 'insertlink.gif" border="0"></a></div><div style="display:none;" id="editlink" class="rtebtn1" title="Edit Hyperlink"><a href="javascript:rteBtnEditLink();" style="cursor:default;"><img src="' + rteImagePath + 'insertlink.gif"border="0"></a></div></td>');
  2447.         //document.write('        <td class="rtebg" title="Remove Hyperlink"><div id="unlink" class="rtebtn1"><img src="' + rteImagePath + 'unlink.gif"></div></td>');
  2448.         document.write('        <td class="rtebg" id="rtesep5"><img src="' + rteImagePath + 'seperator.gif"></td>');
  2449.  
  2450.  
  2451.         //document.writeln('        <td><div id="table_' + rte + '"><img class="rteImage" src="' + imagesPath + 'Xtrans_22.gif" width="25" height="33" alt="Symbol" title="Symbol" onClick="dlgInsertSymbol(\'' + rte + '\', \'table\', \'\')"></div></td>');
  2452.         document.write('        <td class="rtebg" title="Insert Symbol"><div id="insertsymbol" class="rtebtn1"><a href="javascript:rteBtnInsertSymbol();" style="cursor:default;"><img src="' + rteImagePath + 'insertimage.gif" border="0"></a></div></td>');
  2453.  
  2454.         //document.write('        <td class="rtebg" title="Insert Image"><div id="insertimage" class="rtebtn1"><a href="javascript:rteBtnInsertImage();" style="cursor:default;"><img src="' + rteImagePath + 'insertimage.gif" border="0"></a></div></td>');        
  2455.         document.write('        <td class="rtebg" title="Remove Formatting"><div id="removeformat" class="rtebtn1"><img src="' + rteImagePath + 'format.gif"></div></td>');
  2456.         document.write('        <td class="rtebg" id="rtesep6"><img src="' + rteImagePath + 'seperator.gif"></td>');
  2457.         document.write('        <td class="rtebg" id="tables">');
  2458.         document.write('        <table border="0" width="0" cellspacing="0" cellpadding="0" id="table_options_on" style="display:none;">');
  2459.         document.write('        <tr>');
  2460.         document.write('        <td><div id="inserttable" class="rtebtn1" title="Insert Table"><a href="javascript:rteBtnInsertTable();" style="cursor:default;"><img src="' + rteImagePath + 'inserttable.gif" border="0"></a></div><div id="edittable" class="rtebtn1" title="Edit Table Properties"><a href="javascript:rteBtnEditTable();" style="cursor:default;"><img src="' + rteImagePath + 'inserttable.gif" border="0"></a></div></td>');
  2461.         document.write('        <td><div id="insertcolumnleft" class="rtebtn1" title="Insert Column to the left"><img src="' + rteImagePath + 'insertcolumnleft.gif" onClick="rteBtnInsertTableColumnBefore();"></div></td>');
  2462.         document.write('        <td><div id="insertcolumnright" class="rtebtn1" title="Insert Column to the right"><img src="' + rteImagePath + 'insertcolumnright.gif" onClick="rteBtnInsertTableColumnAfter();"></div></td>');
  2463.         document.write('        <td><div id="insertrowabove" class="rtebtn1" title="Insert Row above"><img src="' + rteImagePath + 'insertrowabove.gif" onClick="rteBtnInsertTableRowBefore();"></div></td>');
  2464.         document.write('        <td><div id="insertrowbelow" class="rtebtn1" title="Insert Row below"><img src="' + rteImagePath + 'insertrowbelow.gif" onClick="rteBtnInsertTableRowAfter();"></div></td>');
  2465.         document.write('        <td><div id="deletecolumn" class="rtebtn1" title="Delete Current column"><img src="' + rteImagePath + 'deletecolumn.gif" onClick="rteBtnDeleteTableColumn();"></div></td>');
  2466.         document.write('        <td><div id="deleterow" class="rtebtn1" title="Delete Current row"><img src="' + rteImagePath + 'deleterow.gif" onClick="rteBtnDeleteTableRow();"></div></td>');
  2467.         document.write('        </tr>');
  2468.         document.write('        </table>');
  2469.         document.write('        <table border="0" width="0" cellspacing="0" cellpadding="0" id="table_options_off">');
  2470.         document.write('        <tr>');
  2471.         document.write('        <td><div id="inserttable" class="rtebtn1" title="Insert Table"><a href="javascript:rteBtnInsertTable();" style="cursor:default;"><img src="' + rteImagePath + 'inserttable.gif" border="0"></div></a></td>');
  2472.         document.write('        <td><div class="rtebtn5" title="Insert Column to the left"><img src="' + rteImagePath + 'insertcolumnleftgrey.gif"></div></td>');
  2473.         document.write('        <td><div class="rtebtn5" title="Insert Column to the right"><img src="' + rteImagePath + 'insertcolumnrightgrey.gif"></div></td>');
  2474.         document.write('        <td><div class="rtebtn5" title="Insert Row above"><img src="' + rteImagePath + 'insertrowabovegrey.gif"></div></td>');
  2475.         document.write('        <td><div class="rtebtn5" title="Insert Row below"><img src="' + rteImagePath + 'insertrowbelowgrey.gif"></div></td>');
  2476.         document.write('        <td><div class="rtebtn5" title="Delete Current column"><img src="' + rteImagePath + 'deletecolumngrey.gif"></div></td>');
  2477.         document.write('        <td><div class="rtebtn5" title="Delete Current row"><img src="' + rteImagePath + 'deleterowgrey.gif"></div></td>');
  2478.         document.write('        </tr>');
  2479.         document.write('        </table>');
  2480.         document.write('        </td>');
  2481.         document.write('        <td class="rtebg" id="rtesep7"><img src="' + rteImagePath + 'seperator.gif"></td>');
  2482.         document.write('        <td class="rtebg" title="Numbering"><div id="insertorderedlist" class="rtebtn1"><img src="' + rteImagePath + 'orderedlist.gif"></div></td>');
  2483.         document.write('        <td class="rtebg" title="Bullets"><div id="insertunorderedlist" class="rtebtn1"><img src="' + rteImagePath + 'unorderedlist.gif"></div></td>');
  2484.         document.write('        <td class="rtebg" title="Decrease Indent"><div id="outdent" class="rtebtn1"><img src="' + rteImagePath + 'decreaseindent.gif"></div></td>');
  2485.         document.write('        <td class="rtebg" title="Increase Indent"><div id="indent" class="rtebtn1"><img src="' + rteImagePath + 'increaseindent.gif"></div></td>');
  2486.         document.write('        <td class="rtebg" id="rtesep8"><img src="' + rteImagePath + 'seperator.gif"></td>');
  2487.         document.write('        <td class="rtebg" title="Undo"><div id="undo" class="rtebtn1"><img src="' + rteImagePath + 'undo.gif"></div></td>');
  2488.         document.write('        <td class="rtebg" title="Redo"><div id="redo" class="rtebtn1"><img src="' + rteImagePath + 'redo.gif"></div></td>');
  2489.         document.write('        <td class="rtebg" id="rtesep9"><img src="' + rteImagePath + 'seperator.gif"></td>');
  2490.         //document.write('        <td class="rtebg" id="cutcopypaste">');
  2491.         //INSERT HERE
  2492.              if (!document.all || window.opera) {
  2493.             document.write('        <td id="spellchecker" class="rtebg" title="Spell Check"><div id="spellcheck" class="rtebtn5"><img src="' + rteImagePath + 'spellcheckgrey.gif"></div></td>');
  2494.         } else {
  2495.             document.write('        <td id="spellchecker" class="rtebg" title="Spell Check"><div id="spellcheck" class="rtebtn5"><img src="' + rteImagePath + 'spellcheckgrey.gif"></div></td>');
  2496.         }  
  2497.         document.write('        <td class="rtebg" title="About Free Rich Text Editor"><div id="aboutrte" class="rtebtn1"><a href="javascript:rteAbout();" style="cursor:default;"><img src="' + rteImagePath + 'about.gif" border="0"></a></div></td>');
  2498.         document.write('        <td width="100%"></td>');
  2499.         document.write('      </tr>');
  2500.         document.write('    </table></td>');
  2501.         document.write('  </tr>');
  2502.         document.write('  <tr>');
  2503.         document.write('    <td bgcolor="#C3DAF9">');
  2504.         document.write('    <table cellpadding="0" cellspacing="0" id="tb2" onmousedown="return false;">');
  2505.         document.write('      <tr>');
  2506.         //document.write('        <td width="7"><img src="' + rteImagePath + 'start.gif" width="7" height="25" /></td>');
  2507.  
  2508.  
  2509.         //END HERE
  2510.        // document.write('        <table border="0" width="0" cellspacing="0" cellpadding="0">');
  2511.         //document.write('        <tr>');
  2512.         //if (!document.all || window.opera) {
  2513.           //  document.write('        <td title="Cut"><div class="rtebtn5"><img src="' + rteImagePath + 'cutgrey.gif"></div></td>');
  2514.             //document.write('        <td title="Copy"><div class="rtebtn5"><img src="' + rteImagePath + 'copygrey.gif"></div></td>');
  2515.             //document.write('        <td title="Paste"><div class="rtebtn5"><img src="' + rteImagePath + 'pastegrey.gif"></div></td>');
  2516.         //}
  2517.         //else {
  2518.           //  document.write('        <td title="Cut"><div id="cut" class="rtebtn1"><img src="' + rteImagePath + 'cut.gif"></div></td>');
  2519.             //document.write('        <td title="Copy"><div id="copy" class="rtebtn1"><img src="' + rteImagePath + 'copy.gif"></div></td>');
  2520.             //document.write('        <td title="Paste"><div id="paste" class="rtebtn1"><img src="' + rteImagePath + 'paste.gif"></div></td>');
  2521.         //}
  2522.         //document.write('        </tr>');
  2523.       //  document.write('        </table>');
  2524.        // document.write('        </td>');
  2525.         //document.write('        <td width="14"><img src="' + rteImagePath + 'finish.gif" width="14" height="25" /></td>');
  2526.         document.write('        <td width="100%"></td>');
  2527.         document.write('      </tr>');
  2528.         document.write('    </table></td>');
  2529.         document.write('  </tr>');
  2530.         document.write('  <tr>');
  2531.         document.write('    <td bgcolor="#C3DAF9">');
  2532.         document.write('    <table cellpadding="0" cellspacing="0" id="tb3" onmousedown="return false;">');
  2533.         document.write('      <tr>');
  2534.         //document.write('        <td width="7"><img src="' + rteImagePath + 'start.gif" width="7" height="25" /></td>');
  2535.         //document.write('        <td class="rtebg" title="Form"><a href="javascript:rteBtnInsertForm();" style="cursor:default;"><div id="insertform" class="rtebtn1"><img src="' + rteImagePath + 'form.gif" border="0"></div></a></td>');
  2536.         //document.write('        <td class="rtebg" title="Check Box"><a href="javascript:rteBtnInsertCheckbox();" style="cursor:default;"><div id="form_checkbox" class="rtebtn1"><img src="' + rteImagePath + 'checkbox.gif" border="0"></div></a></td>');
  2537.         //document.write('        <td class="rtebg" title="Radio Button"><a href="javascript:rteBtnInsertRadio();" style="cursor:default;"><div id="form_radio" class="rtebtn1"><img src="' + rteImagePath + 'radio.gif" border="0"></div></a></td>');
  2538.         //document.write('        <td class="rtebg" title="Text Area"><a href="javascript:rteBtnInsertTextArea();" style="cursor:default;"><div id="form_textarea" class="rtebtn1"><img src="' + rteImagePath + 'textarea.gif" border="0"></div></a></td>');
  2539.         //document.write('        <td class="rtebg" title="Submit Button"><a href="javascript:rteBtnInsertSubmit();" style="cursor:default;"><div id="form_submit" class="rtebtn1"><img src="' + rteImagePath + 'submit.gif" border="0"></div></a></td>');
  2540.         //document.write('        <td class="rtebg" title="Image Button"><a href="javascript:rteBtnInsertImageSubmit();" style="cursor:default;"><div id="form_image_submit" class="rtebtn1"><img src="' + rteImagePath + 'imagesubmit.gif" border="0"></div></a></td>');
  2541.         //document.write('        <td class="rtebg" title="Reset Button"><a href="javascript:rteBtnInsertReset();" style="cursor:default;"><div id="form_reset" class="rtebtn1"><img src="' + rteImagePath + 'reset.gif" border="0"></div></a></td>');
  2542.         //document.write('        <td class="rtebg" title="Hidden Field"><a href="javascript:rteBtnInsertHidden();" style="cursor:default;"><div id="form_hidden" class="rtebtn1"><img src="' + rteImagePath + 'hidden.gif" border="0"></div></a></td>');
  2543.         //document.write('        <td class="rtebg" title="Password Field"><a href="javascript:rteBtnInsertPassword();" style="cursor:default;"><div id="form_password" class="rtebtn1"><img src="' + rteImagePath + 'password.gif" border="0"></div></a></td>');
  2544.         //document.write('        <td class="rtebg" title="Text Field"><a href="javascript:rteBtnInsertText();" style="cursor:default;"><div id="form_textfield" class="rtebtn1"><img src="' + rteImagePath + 'textfield.gif" border="0"></div></a></td>');
  2545.         //document.write('        <td class="rtebg" id="rtesep10"><img src="' + rteImagePath + 'seperator.gif"></td>');
  2546.         //document.write('        <td class="rtebg" title="Print"><div id="printrte" class="rtebtn1"><img src="' + rteImagePath + 'print.gif" onClick="rteBtnPrint();"></div></td>');
  2547.         //document.write('        <td class="rtebg" title="Select All"><div id="selectall" class="rtebtn1"><img src="' + rteImagePath + 'selectall.gif"></div></td>');
  2548.  
  2549.        // document.write('        <td class="rtebg" id="rtesep11"><img src="' + rteImagePath + 'seperator.gif"></td>');
  2550.        // document.write('        <td class="rtebg" title="About Free Rich Text Editor"><div id="aboutrte" class="rtebtn1"><a href="javascript:rteAbout();" style="cursor:default;"><img src="' + rteImagePath + 'about.gif" border="0"></a></div></td>');
  2551.         //document.write('        <td width="14"><img src="' + rteImagePath + 'finish.gif" width="14" height="25" /></td>');
  2552.         document.write('        <td width="100%"></td>');
  2553.         document.write('      </tr>');
  2554.         document.write('    </table>');
  2555.         document.write('    </td>');
  2556.         document.write('  <tr>');
  2557.         document.write('    <td style="border:1px solid #C3DAF9; ">');
  2558.         alert("Editorname is "+rteName);
  2559.         document.write('        <iframe name="' + rteName + '" id="' + rteName + '" style="width:100%; height:' + rteHeight + '; background-color:#FFFFFF;" frameborder="0" ></iframe>');
  2560.         document.write('        <textarea name="' + rteFormName + '" id="' + rteFormName + '" style="display:none;width:' + rteWidth + '; height:' + rteHeight + '; background-color:#FFFFFF; font-family:courier new; font-size:12px; color:#000000; border:0px;"></textarea>');
  2561.         document.write('        <iframe id="preview_' + rteName + '" style="width:' + rteWidth + '; height:' + rteHeight + '; background-color:#FFFFFF; display:none;" frameborder="0"></iframe>');
  2562.         document.write('    </td>');
  2563.         document.write('  </tr>');
  2564.         //here design
  2565.         document.write('  <tr>');
  2566.         document.write('    <td bgcolor="#C3DAF9" height="25" class="rtebg">');
  2567.         document.write('        <table width="100%" cellspacing="0" cellpadding="0" border="0" onmousedown="return false;">');
  2568.         document.write('            <tr>');
  2569.         document.write('                <td>')
  2570.         document.write('                    <table width="0" cellspacing="3" cellpadding="0" border="0" class="rtebg">');
  2571.         document.write('                        <tr>');
  2572.         if (rteDesignMode) {
  2573.             document.write('                            <td style="color:#000000; font-family:arial; font-size:11px;"><div class="rtebtn9" id="rte_design_mode" onclick="rteModeType(\'rte_design_mode\');"><img src="' + rteImagePath + 'design.gif">&nbsp;Design</div></td>');
  2574.         }
  2575.         else {
  2576.             document.write('                            <td style="display:none;color:#000000; font-family:arial; font-size:11px;"><div class="rtebtn9" id="rte_design_mode"><img src="' + rteImagePath + 'design.gif">&nbsp;Design</div></td>');
  2577.         }
  2578.         if (rteCodeMode) {
  2579.             document.write('                            <td style="color:#000000; font-family:arial; font-size:11px;"><div class="rtebtn6" id="rte_code_mode" onclick="rteModeType(\'rte_code_mode\');"><img src="' + rteImagePath + 'code.gif">&nbsp;Code</div></td>');
  2580.         }
  2581.         else {
  2582.             document.write('                            <td style="display:none;color:#000000; font-family:arial; font-size:11px;"><div class="rtebtn6" id="rte_code_mode"><img src="' + rteImagePath + 'code.gif">&nbsp;Code</div></td>');
  2583.         }
  2584.         if (rtePreviewMode) {
  2585.             document.write('                            <td style="color:#000000; font-family:arial; font-size:11px;"><div class="rtebtn6" id="rte_preview_mode" onclick="rteModeType(\'rte_preview_mode\');"><img src="' + rteImagePath + 'preview.gif">&nbsp;Preview</div></td>');
  2586.         }
  2587.         else {
  2588.             document.write('                            <td style="display:none;color:#000000; font-family:arial; font-size:11px;"><div class="rtebtn6" id="rte_preview_mode"><img src="' + rteImagePath + 'preview.gif">&nbsp;Preview</div></td>');
  2589.         }
  2590.         document.write('                        </tr>');
  2591.         document.write('                    </table>');
  2592.         document.write('                </td>');
  2593.         document.write('            </tr>');
  2594.         document.write('        </table>');
  2595.         document.write('    </td>');
  2596.         document.write('  </tr>');
  2597.        //here design end 
  2598.         document.write('</table>');
  2599.  
  2600.         startRTE(rtePreloadContent);
  2601.         menuBuilder();
  2602.     }
  2603. };
  2604.  
  2605. 2) config.js
  2606.  
  2607. // Width of the rich text editor.
  2608. rteWidth = "100%";
  2609. // Name of the IFRAME (content editor).
  2610. rteName = "EditorName";
  2611. // Name of the hidden form field.
  2612. rteFormName = "editor";
  2613. // Height of the rich text editor.
  2614. rteHeight = "500px";
  2615. // Path to the images folder.
  2616. rteImagePath = "./images/";
  2617. // Path to insert form popup.
  2618. rteHTMLPathInsertForm = "./html/insert_form.html";
  2619. // Path to insert checkbox popup.
  2620. rteHTMLPathInsertCheckbox = "./html/insert_checkbox.html";
  2621. // Path to insert radio button popup.
  2622. rteHTMLPathInsertRadiobutton = "./html/insert_radiobutton.html";
  2623. // Path to insert text area popup.
  2624. rteHTMLPathInsertTextArea = "./html/insert_textarea.html";
  2625. // Path to insert submit button popup.
  2626. rteHTMLPathInsertSubmit = "./html/insert_submit.html";
  2627. // Path to insert image submit button popup.
  2628. rteHTMLPathInsertImageSubmit = "./html/insert_image_submit.html";
  2629. // Path to reset form button popup.
  2630. rteHTMLPathInsertReset = "./html/insert_reset.html";
  2631. // Path to insert hidden form field popup.
  2632. rteHTMLPathInsertHidden = "./html/insert_hidden.html";
  2633. // Path to insert password field popup.
  2634. rteHTMLPathInsertPassword = "./html/insert_password.html";
  2635. // Path to insert text field popup.
  2636. rteHTMLPathInsertText = "./html/insert_text.html";
  2637. // Path to insert table popup.
  2638. rteHTMLPathInsertTable = "./html/insert_table.html";
  2639. // Path to edit table properties popup.
  2640. rteHTMLPathEditTable = "./html/edit_table.html";
  2641. // Path to insert link popup.
  2642. rteHTMLPathInsertLink = "./html/insert_link.html";
  2643. // Path to edit link popup.
  2644. rteHTMLPathEditLink = "./html/edit_link.html";
  2645. //Path to insert symbol popup
  2646. rteHTMLPathInsertSymbol = "./html/symbol.html";
  2647. // Path to insert image popup.
  2648. rteHTMLPathInsertImage = "./html/insert_image.html";
  2649. // Format Menu (H1, H2, H3 etc etc).
  2650. rteFormat = true;
  2651. // Font Face Menu (Arial, Verdana etc etc).
  2652. rteFontFace = true;
  2653. // Font Size Menu (1, 2, etc etc).
  2654. rteFontSize = true;
  2655. // Font Color Menu.
  2656. rteFontColor = true;
  2657. // Bold Text Button.
  2658. rteBold = true;
  2659. // Italicize Text Button.
  2660. rteItalic = true;
  2661. // Underline Text Button.
  2662. rteUnderline = true;
  2663. // Strikethrough Text Button.
  2664. rteStrikeThrough = true;
  2665. // Left Justify Button.
  2666. rteLeftAlign = true;
  2667. // Center Justify Button.
  2668. rteCenterAlign = true;
  2669. // Right Justify Button.
  2670. rteRightAlign = true;
  2671. // Full Justify Button.
  2672. rteFullAlign = true;
  2673. // Insert Horizontal Rule Button.
  2674. rteHorizontalRule = true;
  2675. // Superscript Text Button.
  2676. rteSuperscript = true;
  2677. // Subscript Text Button.
  2678. rteSubscript = true;
  2679. // Insert Hyperlink Button.
  2680. rteLink = true;
  2681. // Remove Hyperlink Button.
  2682. rteUnlink = true;
  2683. // Insert Image Button.
  2684. rteImages = true;
  2685. // Remove Formatting Button.
  2686. rteRemoveFormat = true;
  2687. // Table Formatting Buttons.
  2688. rteTables = true;
  2689. // Insert an ordered list Button.
  2690. rteOrderedList = true;
  2691. // Insert an unordered list Button.
  2692. rteUnorderedList = true;
  2693. // Indent Button.
  2694. rteIndent = true;
  2695. // Outdent Button.
  2696. rteOutdent = true;
  2697. // Undo Button.
  2698. rteUndo = true;
  2699. // Redo Button.
  2700. rteRedo = true;
  2701. // Cut, Copy & Paste Buttons.
  2702. rteCutCopyPaste = true;
  2703. // Insert form button.
  2704. rteInsertForm = true;
  2705. // Insert checkbox button.
  2706. rteInsertCheckbox = true;
  2707. // Insert radio button.
  2708. rteInsertRadio = true;
  2709. // Insert textarea.
  2710. rteInsertTextArea = true;
  2711. // Insert submit button.
  2712. rteInsertSubmit = true;
  2713. // Insert image submit button.
  2714. rteInsertImageSubmit = true;
  2715. // Insert reset button.
  2716. rteInsertReset = true;
  2717. // Insert hidden field.
  2718. rteInsertHidden = true;
  2719. // Insert password field.
  2720. rteInsertPassword = true;
  2721. // Insert text field.
  2722. rteInsertTextField = true;
  2723. // Print Rich Text Area Content.
  2724. rtePrint = true;
  2725. // Select All of Rich Text Area Content.
  2726. rteSelectAll = true;
  2727. // Spell Checker.
  2728. rteSpellCheck = true;
  2729. // Show Preview Button.
  2730. rtePreviewMode = true;
  2731. // Show Code Edit Button.
  2732. rteCodeMode = true;
  2733. // Show Design Mode Button.
  2734. rteDesignMode = true;
  2735.  
And in HTML page, i am initialising teh editor as follows

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <form method="post" name="frm">
  3. <script src="richtext.js" type="text/javascript" language="javascript"></script>
  4. <script src="config.js" type="text/javascript" language="javascript"></script>
  5. <script>
  6.     <!--
  7.         initRTE('This <span onmouseover="top.frames[0].test(\'Malathi\');">These </span>is an <del>example</del> <ins>of </ins>a', 'example.css');
  8.     //-->
  9.     </script>
  10.     <input type="submit">
  11. </form>
So in text editor, the content that i have placed will get dipslayed. onmouseover of the 'These' word it has to give an alert box with the string that i have passed to the function.
Apr 27 '09 #5

Ciary
Expert 100+
P: 247
ok, so if i understand it right, you want to display an iframe when you hover over a certain word. is that right or am i wrong?

to do this you simply need this:

Expand|Select|Wrap|Line Numbers
  1. function showbox(id){
  2.    document.getElementByID(id).style.display='block';
  3. }
  4. function hidebox(id){
  5.    document.getElementByID(id).style.display='none';
  6. }
  7.  
and this would be a piece of your html:

Expand|Select|Wrap|Line Numbers
  1. <p>hello, if you hover over <span onmouseover='showbox("here")' onmouseout='hidebox("here")' >here</span>, weird stuff happens</p>
  2. <iframe id="here" style="display: none"><p>'Elllooooo</p></iframe>
  3.  
hope this helps

EDIT: next time, you might consider placing a specific piece of code instead of your full code. it's confusing. also, try using code blocks. it makes it easier to read.
Apr 27 '09 #6

gits
Expert Mod 5K+
P: 5,370
@malathib: as Ciary already told you, you shouldn't post thousands of lines of code ... just post the relevant lines that are related to the problem ... posting such a bunch of code makes it really hard to follow the problem since the people that you want to have to help you with your problem need to search for the relevant lines for themselves and it might be that they just get annoyed by it and don't like to do so and thus just don't answer your question. it is always a good idea to ask your question as good as you can ... and using code-tags and preparing the code for the reader is one of the simplest ways to improve the quality of your question and thus the chance to get a quick and good help with your problem ...

kind regards,
MOD
Apr 27 '09 #7

P: 23
The text content will be inside the iframe. I have already mentioned that the editor will get initialised using one javascript function initRTE('text to be displayed in iframe','example.css') and this function is defined in js files.

when i mouseover on one of the word present in inframe, it has to give an alert box.
Please advice
Apr 27 '09 #8

Ciary
Expert 100+
P: 247
in that case you have to this:

you add a span tag around the words where you want the alert to appear.
Expand|Select|Wrap|Line Numbers
  1. <p>weird stuff happens if you move your mouse over <span onmouseover="showbox()">this</span> text</p>
and this needs to be in the content of the iframe too

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function showbox(){
  3. alert("hi");
  4. }
  5. </script>
  6.  
--OR--

you do this
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function showbox(){
  3. top.window.MyScript();
  4. }
  5. </script>
  6.  
then you need to this outside the iframe

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function MyScript(){
  3. alert("hi");
  4. }
  5. </script>
  6.  
i think the second option is the best since it gives you access to your previously defined arrays.
Apr 27 '09 #9

P: 23
I have tried it out. But its not working. its not giving any alert. Any browser settings i have to change
Apr 27 '09 #10

Ciary
Expert 100+
P: 247
what does firebug say?
Apr 27 '09 #11

P: 23
I have checked the error console of firefox whcih was located in Tools -> Error Console. It didn't show any error there
Apr 27 '09 #12

Ciary
Expert 100+
P: 247
try installing firebug, it's way more helpful then the errorconsole.
eg it shows javascript errors :) and ajax requests + it allows you to use breakpoints. then you can easy locate your problem. also try to alert some variables in various places, it also helps troubleshooting
Apr 27 '09 #13

P: 23
i have installed firebug and i have tested. but fierebug also is not giving any error in the console
Apr 27 '09 #14

Ciary
Expert 100+
P: 247
then try alerting variables at certain places. see which part of your code is/isnt executed and why it should/shouldnt be. then, you get the specific location of your error. also try using the breakpoints in firebug.
Apr 27 '09 #15

P: 23
Alert only is not working.Here i am not finding any error.

Expand|Select|Wrap|Line Numbers
  1. <form method="post" name="frm">
  2. <script src="richtext.js" type="text/javascript" language="javascript"></script>
  3. <script src="config.js" type="text/javascript" language="javascript"></script>
  4. <script>
  5.     <!--
  6.         initRTE('This <span onmouseover="top.frames[0].test()">These </span>is an <del>example</del> <ins>of </ins>a', 'example.css');
  7.     //-->
  8.     </script>
  9. </form>
here initRte will initialise the editor and load the content that i am passing as first parameter.
Apr 28 '09 #16

Ciary
Expert 100+
P: 247
then there must be a logical mistake in your initRte. normally, alert always works. if it doesnt, it means you never get to that point. so, i dont know where you placed your alert(s) but try putting it in other locations till you find a place where it does appear.
Apr 28 '09 #17

acoder
Expert Mod 15k+
P: 16,027
Have you got a link to your application?
Apr 28 '09 #18

Post your reply

Sign in to post your reply or Sign up for a free account.