function getXHTML(a) { return new Html2Xhtml(a).parse() } function Html2Xhtml(a) { this.data = a || "" } Html2Xhtml.prototype.setHTML = function(a) { this.data = a || this.data }; Html2Xhtml.prototype.parse = function() { var b = 0; var a = ""; var d = 0; var k = false; var s = ""; var h = ""; var q = ""; var g = ""; var m = this.data; var o = m.length; var f = ""; var n = 0; var l = false; while (1) { if (d >= o && !k) { return a } if (k) { k = false } else { var r = m.substr(d++, 1) } switch (b) { case 0: if (r == "<") { b = 1; break } var e = r.charCodeAt(); if (Html2Xhtml.charEntities[e]) { a += "&" + Html2Xhtml.charEntities[e] + ";" } else { a += r } break; case 1: if (/[a-zA-Z]/.test(r)) { b = 2; n = 1; s = r.toLowerCase(); break } if (r == "/") { b = 2; n = -1; break } if (r == "!") { if (m.substr(d, 2) == "--") { a += "<!--"; d += 2; b = 9; break } a += "<!"; b = 10; break } if (r == "?") { b = 11; a += "<?"; break } a += "&lt;"; k = true; b = 0; break; case 2: if (Html2Xhtml.isSpaceChar[r]) { a += (!l && n > 0 && Html2Xhtml.hasNLBefore[s] && a.length && a.substr(a.length - 1, 1) != "\n" ? "\n" : "") + (n > 0 ? "<" : "</") + s; b = 3; break } if (r == "/") { a += (!l && n > 0 && Html2Xhtml.hasNLBefore[s] && a.length && a.substr(a.length - 1, 1) != "\n" ? "\n" : "") + (n > 0 ? "<" : "</") + s; if (m.substr(d, 1) != ">") { b = 3; break } b = 4; break } if (r == ">") { a += (!l && n > 0 && Html2Xhtml.hasNLBefore[s] && a.length && a.substr(a.length - 1, 1) != "\n" ? "\n" : "") + (n > 0 ? "<" : "</") + s; k = true; b = 4; break } s += r.toLowerCase(); break; case 3: if (Html2Xhtml.isSpaceChar[r]) { break } if (r == "/") { if (m.substr(d, 1) != ">") { break } b = 4; break } if (r == ">") { k = true; b = 4; break } h = r.toLowerCase(); q = ""; b = 5; break; case 4: a += (Html2Xhtml.isEmptyTag[s] ? " />" : ">") + (!l && n < 0 && Html2Xhtml.hasNLAfter[s] && d < o && m.substr(d, 1) != "\n" ? "\n" : ""); if (n > 0 && Html2Xhtml.dontAnalyzeContent[s]) { b = 13; h = q = g = ""; n = 0; break } if (s == "pre") { l = !l } b = 0; s = h = q = g = ""; n = 0; break; case 5: if (Html2Xhtml.isSpaceChar[r]) { a += " " + h; if (Html2Xhtml.isEmptyAttr[h]) { a += '="' + h + '"' } b = 3; break } if (r == "/") { a += " " + h; if (Html2Xhtml.isEmptyAttr[h]) { a += '="' + h + '"' } if (m.substr(d, 1) != ">") { b = 3; break } b = 4; break } if (r == ">") { a += " " + h; if (Html2Xhtml.isEmptyAttr[h]) { a += '="' + h + '"' } k = true; b = 4; break } if (r == "=") { a += " " + h + "="; b = 6; break } if (r == '"' || r == "'") { h += "?" } else { h += r.toLowerCase() } break; case 6: if (Html2Xhtml.isSpaceChar[r]) { a += (Html2Xhtml.isEmptyAttr[h] ? '"' + h + '"' : '""'); b = 3; break } if (r == ">") { a += (Html2Xhtml.isEmptyAttr[h] ? '"' + h + '"' : '""'); k = true; b = 4; break } if (r == "/" && m.substr(d, 1) == ">") { a += (Html2Xhtml.isEmptyAttr[h] ? '"' + h + '"' : '""'); b = 4; break } if (r == '"' || r == "'") { g = r; b = 8; break } q = r; b = 7; break; case 7: if (Html2Xhtml.isSpaceChar[r]) { a += '"' + Html2Xhtml.escapeQuot(q, '"') + '"'; b = 3; break } if (r == "/" && m.substr(d, 1) == ">") { a += '"' + Html2Xhtml.escapeQuot(q, '"') + '"'; b = 4; break } if (r == ">") { k = true; a += '"' + Html2Xhtml.escapeQuot(q, '"') + '"'; b = 4; break } q += r; break; case 8: if (r == g) { a += '"' + Html2Xhtml.escapeQuot(q, '"') + '"'; b = 3; break } q += r; break; case 9: if (r == "-" && m.substr(d, 2) == "->") { d += 2; a += "-->"; b = 0; break } a += r; break; case 10: if (r == ">") { b = 0 } a += r; break; case 11: if (r == "'" || r == '"') { g = r; b = 12; break } if (r == "?" && m.substr(d, 1) == ">") { b = 0; a += "?>"; d++; break } a += r; break; case 12: if (r == g) { b = 11; a += g + Html2Xhtml.escapeQuot(f, g) + g; f = g = ""; break } f += r; break; case 13: if (r == "<" && m.substr(d, s.length + 1).toLowerCase() == "/" + s) { k = true; b = 0; s = ""; break } if (s == "textarea") { a += Html2Xhtml.escapeHTMLChar(r) } else { a += r } break } } return a }; Html2Xhtml.escapeQuot = function(b, a) { if (!a) { a = '"' } if (a == '"') { return b.replace(/"/ig, '\\"') } return b.replace(/'/ig, "\\'") }; Html2Xhtml.escapeHTMLChar = function(b) { if (b == "&") { return "&amp;" } if (b == "<") { return "&lt;" } if (b == ">") { return "&gt;" } var a = b.charCodeAt(); if (Html2Xhtml.charEntities[a]) { return "&" + Html2Xhtml.charEntities[a] + ";" } else { return b } }; Html2Xhtml.isSpaceChar = { " ": 1, "\r": 1, "\n": 1, "\t": 1 }; Html2Xhtml.isEmptyTag = { area: 1, base: 1, basefont: 1, br: 1, hr: 1, img: 1, input: 1, link: 1, meta: 1, param: 1 }; Html2Xhtml.isEmptyAttr = { checked: 1, compact: 1, declare: 1, defer: 1, disabled: 1, ismap: 1, multiple: 1, noresize: 1, nosave: 1, noshade: 1, nowrap: 1, readonly: 1, selected: 1 }; Html2Xhtml.hasNLBefore = { div: 1, p: 1, table: 1, tbody: 1, tr: 1, td: 1, th: 1, title: 1, head: 1, body: 1, script: 1, comment: 1, li: 1, meta: 1, h1: 1, h2: 1, h3: 1, h4: 1, h5: 1, h6: 1, hr: 1, ul: 1, ol: 1, option: 1, link: 1 }; Html2Xhtml.hasNLAfter = { html: 1, head: 1, body: 1, p: 1, th: 1, style: 1 }; Html2Xhtml.dontAnalyzeContent = { textarea: 1, script: 1, style: 1 }; Html2Xhtml.charEntities = { 160: "nbsp", 161: "iexcl", 162: "cent", 163: "pound", 164: "curren", 165: "yen", 166: "brvbar", 167: "sect", 168: "uml", 169: "copy", 170: "ordf", 171: "laquo", 172: "not", 173: "shy", 174: "reg", 175: "macr", 176: "deg", 177: "plusmn", 178: "sup2", 179: "sup3", 180: "acute", 181: "micro", 182: "para", 183: "middot", 184: "cedil", 185: "sup1", 186: "ordm", 187: "raquo", 188: "frac14", 189: "frac12", 190: "frac34", 191: "iquest", 192: "agrave", 193: "aacute", 194: "acirc", 195: "atilde", 196: "auml", 197: "aring", 198: "aelig", 199: "ccedil", 200: "egrave", 201: "eacute", 202: "ecirc", 203: "euml", 204: "igrave", 205: "iacute", 206: "icirc", 207: "iuml", 208: "eth", 209: "ntilde", 210: "ograve", 211: "oacute", 212: "ocirc", 213: "otilde", 214: "ouml", 215: "times", 216: "oslash", 217: "ugrave", 218: "uacute", 219: "ucirc", 220: "uuml", 221: "yacute", 222: "thorn", 223: "szlig", 224: "agrave", 225: "aacute", 226: "acirc", 227: "atilde", 228: "auml", 229: "aring", 230: "aelig", 231: "ccedil", 232: "egrave", 233: "eacute", 234: "ecirc", 235: "euml", 236: "igrave", 237: "iacute", 238: "icirc", 239: "iuml", 240: "eth", 241: "ntilde", 242: "ograve", 243: "oacute", 244: "ocirc", 245: "otilde", 246: "ouml", 247: "divide", 248: "oslash", 249: "ugrave", 250: "uacute", 251: "ucirc", 252: "uuml", 253: "yacute", 254: "thorn", 255: "yuml", 338: "oelig", 339: "oelig", 352: "scaron", 353: "scaron", 376: "yuml", 710: "circ", 732: "tilde", 8194: "ensp", 8195: "emsp", 8201: "thinsp", 8204: "zwnj", 8205: "zwj", 8206: "lrm", 8207: "rlm", 8211: "ndash", 8212: "mdash", 8216: "lsquo", 8217: "rsquo", 8218: "sbquo", 8220: "ldquo", 8221: "rdquo", 8222: "bdquo", 8224: "dagger", 8225: "dagger", 8240: "permil", 8249: "lsaquo", 8250: "rsaquo", 8364: "euro", 402: "fnof", 913: "alpha", 914: "beta", 915: "gamma", 916: "delta", 917: "epsilon", 918: "zeta", 919: "eta", 920: "theta", 921: "iota", 922: "kappa", 923: "lambda", 924: "mu", 925: "nu", 926: "xi", 927: "omicron", 928: "pi", 929: "rho", 931: "sigma", 932: "tau", 933: "upsilon", 934: "phi", 935: "chi", 936: "psi", 937: "omega", 945: "alpha", 946: "beta", 947: "gamma", 948: "delta", 949: "epsilon", 950: "zeta", 951: "eta", 952: "theta", 953: "iota", 954: "kappa", 955: "lambda", 956: "mu", 957: "nu", 958: "xi", 959: "omicron", 960: "pi", 961: "rho", 962: "sigmaf", 963: "sigma", 964: "tau", 965: "upsilon", 966: "phi", 967: "chi", 968: "psi", 969: "omega", 977: "thetasym", 978: "upsih", 982: "piv", 8226: "bull", 8230: "hellip", 8242: "prime", 8243: "prime", 8254: "oline", 8260: "frasl", 8472: "weierp", 8465: "image", 8476: "real", 8482: "trade", 8501: "alefsym", 8592: "larr", 8593: "uarr", 8594: "rarr", 8595: "darr", 8596: "harr", 8629: "crarr", 8656: "larr", 8657: "uarr", 8658: "rarr", 8659: "darr", 8660: "harr", 8704: "forall", 8706: "part", 8707: "exist", 8709: "empty", 8711: "nabla", 8712: "isin", 8713: "notin", 8715: "ni", 8719: "prod", 8721: "sum", 8722: "minus", 8727: "lowast", 8730: "radic", 8733: "prop", 8734: "infin", 8736: "ang", 8743: "and", 8744: "or", 8745: "cap", 8746: "cup", 8747: "int", 8756: "there4", 8764: "sim", 8773: "cong", 8776: "asymp", 8800: "ne", 8801: "equiv", 8804: "le", 8805: "ge", 8834: "sub", 8835: "sup", 8836: "nsub", 8838: "sube", 8839: "supe", 8853: "oplus", 8855: "otimes", 8869: "perp", 8901: "sdot", 8968: "lceil", 8969: "rceil", 8970: "lfloor", 8971: "rfloor", 9001: "lang", 9002: "rang", 9426: "copy", 9674: "loz", 9824: "spades", 9827: "clubs", 9829: "hearts", 9830: "diams" }; var MessageMax = parseInt("1024000"); var Override = ""; var g_CHARSET = "iso-8859-1"; var text_enter_url = "Enter the complete URL for the hyperlink"; var text_enter_url_name = "Enter the title of the webpage"; var text_enter_image = "Enter the complete URL for the image"; var text_enter_video = "Enter the complete URL for the You-Tube clip"; var text_enter_email = "Enter the email address"; var jsfile_errorc_lang = "Error:"; var jsfile_alert1 = "Some revisions of Mozilla/Firefox do not support programatic "; var jsfile_alert2 = "access to cut/copy/paste functions, for security reasons.  "; var jsfile_alert3 = "Your browser is one of them.  Please use the standard key combinations:"; var jsfile_alert4 = "CTRL-X for cut, CTRL-C for copy, CTRL-V for paste."; var jsfile_highlight_lang = "You must highlight some text before making it a link"; var is_fs_mode = 0; var g_rte_hcontent = "rte_html"; var g_rte_tcontent = "rte_text"; var g_rte_2_hcontent = "rte_html2"; var g_rte_2_tcontent = "rte_text2"; var ips_primary_fonts = new Array("arial", "arial black", "arial narrow", "book antiqua", "century gothic", "comic sans ms", "courier new", "fixedsys", "franklin gothic medium", "garamond", "georgia", "impact", "lucida console", "lucida sans unicode", "microsoft sans serif", "palatino linotype", "system", "tahoma", "times new roman", "trebuchet ms", "verdana"); var ips_fontsizes = { "8px": 1, "10pt": 2, "12pt": 3, "14pt": 4, "18pt": 5, "24pt": 6, "36pt": 7 }; var ips_font_sizes = new Array(1, 2, 3, 4, 5, 6, 7); var ips_reverse_primary_fonts = new Array(); var ips_reverse_font_sizes = new Array(); var ips_reverse_fontsizes = new Array(); for (var i in ips_primary_fonts) { ips_reverse_primary_fonts[ips_primary_fonts[i]] = i } for (var i in ips_font_sizes) { ips_reverse_font_sizes[ips_font_sizes[i]] = i } for (var i in ips_fontsizes) { ips_reverse_fontsizes[ips_fontsizes[i]] = i } function write_fontface_box() { var c = ""; for (var b in ips_primary_fonts) { option = ips_primary_fonts[b]; display = ips_primary_fonts[b]; var a = display.split(" "); var d = new Array; for (var e in a) { d[e] = a[e].substr(0, 1).toUpperCase() + a[e].substr(1) } display = d.join(" "); c += "\n<option style='font-family:" + display + "' value='" + display + "'>" + display + "</option>" } return c } function write_fontsize_box() { var b = ""; for (var a in ips_font_sizes) { if (typeof ips_font_sizes[a] != "function") { option = ips_font_sizes[a]; display = ips_font_sizes[a]; b += "\n<option value='" + display + "'>" + display + "</option>" } } return b } var emowindow = ""; function emo_pop() { emowindow = window.open("emoticons.html", "Legends", "width=250,height=500,resizable=yes,scrollbars=yes") } function getOffsetTop(d) { var b = d.offsetTop; var a = d.offsetParent; var c = 2; while (c > 0) { b += a.offsetTop; a = a.offsetParent; c-- } return b } function getOffsetLeft(d) { var b = d.offsetLeft; var a = d.offsetParent; var c = 2; while (c > 0) { b += a.offsetLeft; a = a.offsetParent; c-- } return b } var i_am = "rte"; var isRichText = false; var css_off = false; var rng; var currentRTE; var allRTEs = ""; var rte = ""; var rtewindow; var rtedocument; var rteready; var isIE; var isGecko; var isSafari; var isKonqueror; var isOpera; var imagesPath; var includesPath; var g_buttons; var g_rte; var g_tablewidth; var g_width_unit; var g_imagesPath; var g_width; var g_height; var g_readOnly; var g_includesPath; var g_imagesPath; var g_html; var g_MaxLength = 10000; var g_SafariSelect = null; var currentfont; var currentsize; var button_status = new Array(); var isError = false; var viewingHTML = 0; var viewingFS = 0; var buttons_update = new Array("bold", "italic", "underline", "strikethrough", "justifyleft", "justifycenter", "justifyright", "insertorderedlist", "insertunorderedlist"); var opentags = { bold: 0, italic: 0, strikethrough: 0, underline: 0, forecolor: 0, fontname: 0, fontsize: 0 }; function init_rte(c, b) { var a = navigator.userAgent.toLowerCase(); isIE = (((a.indexOf("msie") != -1) || (a.indexOf("opera") != -1)) && (a.indexOf("webtv") == -1)); isGecko = (a.indexOf("gecko") != -1); isSafari = (a.indexOf("safari") != -1); isKonqueror = (a.indexOf("konqueror") != -1); if (document.getElementById && document.designMode && !isKonqueror) { isRichText = true } if (isIE) { document.onmouseover = ie_raise_button; document.onmouseout = ie_normal_button; document.onmousedown = ie_lower_button; document.onmouseup = ie_raise_button } imagesPath = c; includesPath = b } function write_rte_editor(b, c, d, a, e, f) { rte = b; if (isRichText) { if (allRTEs.length > 0) { allRTEs += ";" } allRTEs += rte; write_rte(c, d, a, e, f) } else { write_default(c, d, a, e, f) } } function write_default(b, c, a, d, e) { if (!e) { document.writeln('<textarea name="' + rte + '" id="' + rte + '" style="width: ' + c + "px; height: " + a + 'px;">' + b + "</textarea>") } else { document.writeln('<textarea name="' + rte + '" id="' + rte + '" style="width: ' + c + "px; height: " + a + 'px;" readonly>' + b + "</textarea>") } } function write_rte(d, a, m, g, l) { if (l) { g = false } var f = a; var c = m; a = parseInt(a); m = parseInt(m); if (isIE) { if (!f.match(/%/)) { if (g && (a < 400)) { a = 400 } g_width_unit = "px"; var h = a + 4 } else { g_width_unit = "%"; var h = a; a = a } } else { if (!f.match(/%/)) { if (g && (a < 400)) { a = 400 } g_width_unit = "px"; var h = a + 2 } else { g_width_unit = "%"; var h = a; a = a } } g_buttons = g; g_rte = rte; g_tablewidth = h; g_imagesPath = imagesPath; g_width = a; g_height = m; g_readOnly = l; g_includesPath = includesPath; g_imagesPath = imagesPath; g_html = d; boo_to_int = isRichText == true ? 1 : 0; write_rte_html(); document.getElementById(g_rte_hcontent).value = d; document.getElementById(g_rte_tcontent).value = ""; enable_design_mode(make_newlines_safe(d), l); poss_images = document.getElementsByTagName("img"); if (poss_images.length) { for (var b in poss_images) { if (poss_images[b].className == "rteimage") { poss_images[b].unselectable = true } } } rtewindow = frames[rte]; if (rtewindow.document.addEventListener) { rtewindow.document.addEventListener("keydown", function(n) { return k(n) }, false) } else { rtewindow.document.onkeydown = function(n) { if (!n) { n = rtewindow.event } return k(n) } } function k(o) { var q; var n = "0".charCodeAt(0); var p = "z".charCodeAt(0); if (rtewindow.event) { q = o.keyCode } else { if (o.which) { q = o.which } } if (rtewindow.document.body.innerHTML.length > g_MaxLength && ((n <= q && q <= p) || q == 13 || q == 32)) { alert("Exeeded maximum message length, plese delete some text"); return false } } var e = false; if (isIE && e) { rtewindow = frames[rte]; rtewindow.document.onkeydown = function() { if (rtewindow.event.keyCode == 13) { if (rtewindow.event.returnValue == false) { return } if (button_status.insertunorderedlist == true || button_status.insertorderedlist == true) { return } var o = rtewindow.document.selection; var n = rtewindow.document.selection.createRange(); if ((o.type == "Text" || o.type == "None")) { n.pasteHTML("<br />\n") } else { rtewindow.document.body.innerHTML += "<br />\n" } rtewindow.event.returnValue = false; n.select(); rtewindow.focus() } } } } function enable_design_mode(d, g) { var c = ""; try { c = g_CHARSET } catch (f) { } c = c ? c : "iso-8859-1"; var a = '<html id="' + rte + '">\n'; a += "<head>\n"; a += '<meta http-equiv="content-type" content="text/html; charset=' + c + '" />\n'; a += "<style type='text/css' media='all'>\n"; a += "body {\n"; a += "	background: #FFFFFF;\n"; a += "	margin: 0px;\n"; a += "	padding: 4px;\n"; a += "	font-family: arial, verdana, sans-serif;\n"; a += "	font-size: 10pt;\n"; a += "}\n"; a += "p {\n"; a += "	margin:0px;\n"; a += "	padding:0px;\n"; a += "}\n"; a += ".spwrap\n"; a += "{\n"; a += "background: transparent url(" + G_CDN1_PATH + "/wysiwyg_rte2/misspell.gif) repeat-x scroll center bottom;\n"; a += "}\n"; a += "</style>\n"; a += "</head>\n"; a += "<body>\n"; a += d + "\n"; a += "</body>\n"; a += "</html>"; if (isIE || isSafari) { try { rtewindow = frames[rte]; rtewindow.document.open("text/html", "replace"); rtewindow.document.write(a); rtewindow.document.close() } catch (f) { } if (!g) { rtewindow.document.designMode = "On" } rtewindow.document.onmouseup = rte_button_update; rtewindow.document.onkeyup = rte_button_update } else { try { rtewindow = document.getElementById(rte).contentWindow; rtedocument = document.getElementById(rte).contentDocument; try { rtewindow.document.open("text/html", "replace"); rtewindow.document.write(a); rtewindow.document.close(); rtewindow.document.body.style.fontSize = "10pt"; rtewindow.document.addEventListener("mouseup", rte_button_update, false); rtewindow.document.addEventListener("keyup", rte_button_update, false); if (isGecko && !g) { rtewindow.document.addEventListener("keypress", kb_handler, false) } } catch (f) { } if (!g) { rtewindow.document.designMode = "on" } } catch (f) { if (isGecko) { setTimeout("enable_design_mode('" + make_newlines_safe(d) + "', " + g + ");", 10) } else { return false } } } for (var b in buttons_update) { if (typeof buttons_update[b] == "string") { button_status[buttons_update[b]] = false } } rteready = 1 } function update_rte() { isError = false; if (document.getElementById("tempRte") != null) { document.getElementById("tempRte").style.display = "block" } try { $("imgFocusMe").focus() } catch (c) { } var a = document.getElementById(g_rte_hcontent); var d = document.getElementById(g_rte_tcontent); var h = false; isRichText = true; if (isRichText && !h) { if (viewingHTML) { toggleHTMLSrc() } if (a.value == null) { a.value = "" } if (rtewindow.document.body.innerHTML.length > g_MaxLength) { a.value = rtewindow.document.body.innerHTML; return } if (rtewindow.document.body.innerHTML.indexOf('src="http') != -1) { if ($("Buttons1") != null) { if ($("Buttons1").className == "rtebuttonbar3") { alert("You cannot upload images here.  Please remove them and proceed.") } else { alert("Posted images are not allowed. Please use the Image Upload Tool located in the toolbar of the edit box") } isError = true; return false } } var g = document.getElementById("rte_html_bu"); if (g != null) { g.value = rtewindow.document.body.innerHTML } var e = rtewindow.document.body.innerHTML.replace(/<br><br><!\-\-remove\-start\-\->[^!]*<!\-\-remove\-end\-\->/ig, ""); e = e.replace(/<!\-\-remove\-start\-\->[^!]*<!\-\-remove\-end\-\-><br><br><br>/ig, ""); e = e.replace(/<!\-\-remove\-start\-\->[^!]*<!\-\-remove\-end\-\->/ig, ""); e = e.replace(/<!\-\-\[unremark\-start\]/ig, ""); e = e.replace(/\[unremark\-end\]\-\->/ig, ""); e = e.replace(/<\?xml:namespac[^>]+>/ig, ""); e = e.replace(/<p[^>]+>/ig, "<p>"); e = e.replace(/<\/p/ig, "</p"); e = e.replace(/<font[^>]+>([^<]*)<\/font>/ig, "$1"); e = e.replace(/<div[^>]+>([^<]*)<\/div>/ig, "$1"); e = e.replace(/<img/ig, "<img"); e = e.replace(/<a/ig, "<a"); e = e.replace(/<\/a/ig, "</a"); e = e.replace(/<(\/)?o:p>/ig, ""); e = e.replace(/(<img[^>]+[^\/])>/ig, "$1 />"); e = e.replace(/<p><\/p>/ig, "<br>"); e = e.replace(/<p>&nbsp;<\/p>/ig, "<br>"); e = e.replace(/<p>/ig, ""); e = e.replace(/(<img[^>]+>)<\/p>/ig, "$1"); e = e.replace(/(br>)<\/p>/ig, "$1"); e = e.replace(/(\/>)<\/p>/ig, "$1"); e = e.replace(/<\/p>/ig, "<br>"); e = e.replace(/<(\/?)em>/ig, "<$1i>"); e = e.replace(/<(\/?)strong>/ig, "<$1b>"); e = e.replace(/<([a-z]+)><\/\1>/ig, ""); e = e.replace(/<([a-z]+)>&nbsp;<\/\1>/ig, ""); e = e.replace(/&nbsp;/ig, " "); e = e.replace(/(<br>)+$/i, ""); a.value = getXHTML(e); if (strip_html(a.value.replace("&nbsp;", " ")) == "" && a.value.toLowerCase().search("<hr") == -1 && a.value.toLowerCase().search("<img") == -1 && a.value.toLowerCase().search("<obj") == -1 && a.value.toLowerCase().search("<utube") == -1) { a.value = "" } if (escape(a.value) == "%3Cbr%3E%0D%0A%0D%0A%0D%0A") { a.value = "" } var f = $i("hdntxtconverter"); f.innerHTML = a.value; if (a.value != "") { a.value = a.value + "<!-- from fixya rte -->" } f.innerHTML = f.innerHTML.replace(/<p>/ig, "<p> "); f.innerHTML = f.innerHTML.replace(/(\S)<br>(\S)/ig, "$1 <br>$2"); if (f.innerText != undefined && !isSafari) { var b = f.innerText.replace(/You-Tube video "[^"]+" placeholder \(do not delete\)/g, "") } else { f.innerHTML = f.innerHTML.replace(/<li>(\S)/ig, "<li> $1"); var b = f.textContent.replace(/You-Tube video "[^"]+" placeholder \(do not delete\)/g, "") } b = b.replace(/^\s+|\s+$/g, ""); f.innerHTML = b; if (rtewindow.document.body.innerText != undefined && !isSafari) { d.value = f.innerText } else { d.value = f.textContent } } } function toggleHTMLSrc() { if (viewingHTML == 0) { document.getElementById("Buttons1").style.visibility = "hidden"; document.getElementById("Buttons2").style.visibility = "hidden"; viewingHTML = 1; try { document.getElementById("chkSrc").className = "rtebottombuttonon" } catch (b) { } if (isIE) { rtewindow.document.body.innerText = rtewindow.document.body.innerHTML } else { if (isGecko) { rtewindow.document.designMode = "off" } var c = rtewindow.document.createTextNode(rtewindow.document.body.innerHTML); rtewindow.document.body.innerHTML = ""; rtewindow.document.body.appendChild(c); rtewindow.document.body.innerHTML = clean_up_html_to_show(rtewindow.document.body.innerHTML) } } else { document.getElementById("Buttons1").style.visibility = "visible"; document.getElementById("Buttons2").style.visibility = "visible"; viewingHTML = 0; try { document.getElementById("chkSrc").className = "rtebottombutton" } catch (b) { } if (isIE) { var a = escape(rtewindow.document.body.innerText); a = a.replace("%3CP%3E%0D%0A%3CHR%3E", "%3CHR%3E"); a = a.replace("%3CHR%3E%0D%0A%3C/P%3E", "%3CHR%3E"); rtewindow.document.body.innerHTML = unescape(a) } else { if (isGecko) { rtewindow.document.designMode = "on" } var c = rtewindow.document.body.ownerDocument.createRange(); c.selectNodeContents(rtewindow.document.body); rtewindow.document.body.innerHTML = c.toString() } } } function clean_up_html_to_show(a) { if (a == "" || a == "undefined") { return a } a = a.replace(/&lt;br&gt;/ig, "&lt;br /&gt;"); a = a.replace(/&lt;p&gt;(\s+?)?&lt;\/p&gt;/ig, ""); a = a.replace(/&lt;p&gt;&lt;hr \/&gt;&lt;\/p&gt;/ig, "&lt;hr /&gt;"); a = a.replace(/&lt;p&gt;&nbsp;&lt;\/p&gt;&lt;hr \/&gt;&lt;p&gt;&nbsp;&lt;\/p&gt;/ig, "&lt;hr /&gt;"); a = a.replace(/&lt;(p|div)([^&]*)&gt;/ig, "<br />&lt;$1$2&gt;<br />"); a = a.replace(/&lt;\/(p|div)([^&]*)&gt;/ig, "<br />&lt;/$1$2&gt;<br />"); a = a.replace(/&lt;br \/&gt;(?!&lt;\/td)/ig, "&lt;br /&gt;<br />"); a = a.replace(/&lt;\/(td|tr|tbody|table)&gt;/ig, "&lt;/$1&gt;<br />"); a = a.replace(/&lt;(tr|tbody|table(.+?)?)&gt;/ig, "&lt;$1&gt;<br />"); a = a.replace(/&lt;(td(.+?)?)&gt;/ig, "    &lt;$1&gt;"); a = a.replace(/&lt;p&gt;&nbsp;&lt;\/p&gt;/ig, "&lt;br /&gt;"); return a } function rte_button_update(h) { if (!isIE && !isSafari) { try { size_context = rtewindow.document.queryCommandValue("fontsize") } catch (f) { try { var b = rtewindow.document.body.innerHTML; var d = ""; try { d = g_CHARSET } catch (f) { } d = d ? d : "iso-8859-1"; var a = '<html id="' + rte + '">\n'; a += "<head>\n"; a += '<meta http-equiv="content-type" content="text/html; charset=' + d + '" />\n'; a += "<style type='text/css' media='all'>\n"; a += "body {\n"; a += "	background: #FFFFFF;\n"; a += "	margin: 0px;\n"; a += "	padding: 4px;\n"; a += "	font-family: arial, verdana, sans-serif;\n"; a += "	font-size: 10pt;\n"; a += "}\n"; a += "p {\n"; a += "	margin:0px;\n"; a += "	padding:0px;\n"; a += "}\n"; a += ".spwrap\n"; a += "{\n"; a += "background: transparent url(" + G_CDN1_PATH + "/wysiwyg_rte2/misspell.gif) repeat-x scroll center bottom;\n"; a += "}\n"; a += "</style>\n"; a += "</head>\n"; a += "<body>\n"; a += b + "\n"; a += "</body>\n"; a += "</html>"; rtewindow.document.open("text/html", "replace"); rtewindow.document.write(a); rtewindow.document.close(); rtewindow.document.body.style.fontSize = "10pt"; rtewindow.document.addEventListener("mouseup", rte_button_update, false); rtewindow.document.addEventListener("keyup", rte_button_update, false); if (isGecko) { rtewindow.document.addEventListener("keypress", kb_handler, false) } rtewindow.document.designMode = "on" } catch (g) { alert("Unable to activate design mode " + g) } } } if (isSafari) { if (rtewindow.getSelection() + "" != "") { g_SafariSelect = rtewindow.getSelection() } } if (viewingHTML) { return false } if (!rteready) { return false } try { var k; for (var c in buttons_update) { if (typeof buttons_update[c] == "string") { k = rtewindow.document.queryCommandState(buttons_update[c]); if (typeof (button_status[buttons_update[c]]) != "undefined" && button_status[buttons_update[c]] != k) { prev_state = button_status[buttons_update[c]]; button_status[buttons_update[c]] = k; rte_button_context(document.getElementById("do_" + buttons_update[c]), prev_state == true ? "mouseout" : "mouseover") } } } } catch (f) { } try { size_context = rtewindow.document.queryCommandValue("fontsize") } catch (f) { size_context = "" } if (size_context == "") { if (!isIE) { size_context = ips_fontsizes[rtewindow.document.body.style.fontSize] } } else { if (size_context == null) { size_context = "" } } if (size_context != currentsize) { document.getElementById("fontsize").selectedIndex = ips_reverse_font_sizes[size_context]; currentsize = size_context } if (!h) { h = rtewindow.event } if (h) { if (h.keyCode == 18) { return } } } function rte_window_resize(a, c) { var e = document.getElementById(a); var d = parseInt(e.style.height); d = d ? d : g_height; var b = d + c; if (b > 0) { e.style.height = b + "px" } return false } function rte_button_context(a, b) { if (a == null) { return } command = a.id.toString(); command = command.replace(/do_/, ""); if (typeof (button_status[command]) == "undefined") { button_status[command] = null } try { switch (b) { case "click": case "mouseout": a.className = "rteimage"; break; case "mouseup": case "mouseover": a.className = "rteImageRaised"; break; case "mousedown": a.className = "rteImageRaised"; break } } catch (c) { } } function format_text(h, d) { if (isIE) { var c = rtewindow.document.selection; if (c != null) { rng = c.createRange() } } else { if (isSafari) { var c = g_SafariSelect } else { var c = rtewindow.getSelection(); rng = c.getRangeAt(c.rangeCount - 1).cloneRange() } } try { if ((h == "forecolor") || (h == "hilitecolor")) { parent.command = h; buttonElement = document.getElementById("Buttons1"); var f = getOffsetLeft(buttonElement) * 0.5; if (isIE) { var b = 253 } else { var b = 265 } var a = getOffsetTop(buttonElement) + (buttonElement.offsetHeight) - b; document.getElementById("cp").style.left = (f) + "px"; document.getElementById("cp").style.top = (a) + "px"; if (document.getElementById("cp").style.visibility == "hidden") { document.getElementById("cp").style.visibility = "visible"; document.getElementById("cp").style.display = "inline" } else { document.getElementById("cp").style.visibility = "hidden"; document.getElementById("cp").style.display = "none" } } else { if (h == "cut" || h == "copy" || h == "paste") { try { rtewindow.document.execCommand(h, false, null) } catch (g) { if (isGecko) { alert(jsfile_alert1 + jsfile_alert2 + jsfile_alert3 + "\n" + jsfile_alert4) } } } else { if (h == "createlink") { if (isIE) { var k = rng.htmlText } else { var k = _gecko_get_html() } if (!k) { alert(jsfile_highlight_lang); return false } else { window.open("/link_prompt.html", "lp", "height=162,width=460,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no") } } else { rtewindow.focus(); _gecko_kill_css(); rtewindow.document.execCommand(h, false, null); rte_button_update(h); rtewindow.focus() } } } } catch (g) { } } function add_link(b) { try { var a = 0; if (b.substring(0, 7) == "http://" && b.length > 10) { a = 1 } if (b.substring(0, 8) == "https://" && b.length > 11) { a = 1 } if (b.substring(0, 6) == "ftp://" && b.length > 9) { a = 1 } if (a == 0) { b = null } rtewindow.document.execCommand("Unlink", false, null); rtewindow.document.execCommand("CreateLink", false, b) } catch (c) { } } function show_smilies() { buttonElement = document.getElementById("popsmilies"); var b = getOffsetLeft(buttonElement); var a = getOffsetTop(buttonElement) + (buttonElement.offsetHeight + 30); document.getElementById("smiliestable").style.left = (b) + "px"; document.getElementById("smiliestable").style.top = (a) + "px"; if (document.getElementById("smiliestable").style.visibility == "hidden") { document.getElementById("smiliestable").style.visibility = "visible"; document.getElementById("smiliestable").style.display = "inline" } else { document.getElementById("smiliestable").style.visibility = "hidden"; document.getElementById("smiliestable").style.display = "none" } } function setColor(a) { var c = parent.command; if (isIE) { var d = rtewindow.document.selection; if (c == "hilitecolor") { c = "backcolor" } if (d != null) { var b = d.createRange(); b = rng; b.select() } } rtewindow.focus(); _gecko_kill_css(); rtewindow.document.execCommand(c, false, a); rtewindow.focus(); document.getElementById("cp").style.visibility = "hidden"; document.getElementById("cp").style.display = "none" } function add_email() { if (isIE) { var a = rtewindow.document.selection; if (a != null) { rng = a.createRange() } } else { var a = rtewindow.getSelection(); rng = a.getRangeAt(a.rangeCount - 1).cloneRange() } emailaddress = prompt(text_enter_email, ""); if ((emailaddress != null) && (emailaddress != "")) { rtewindow.focus(); _gecko_kill_css(); rtewindow.document.execCommand("createlink", false, "mailto:" + emailaddress); rtewindow.focus() } } function _add_image(a) { window.open("/fl_upload.aspx?f=" + a, "fl", "height=217,width=500,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no") } function _set_image(a, c) { var b = '<img src="/uploads/' + c + "/" + a + '" />'; add_html_string(b) } function add_image() { if (isIE) { var b = rtewindow.document.selection; if (b != null) { rng = b.createRange() } } else { var b = rtewindow.getSelection(); rng = b.getRangeAt(b.rangeCount - 1).cloneRange() } imagePath = prompt(text_enter_image, "http://"); var a = 0; if (imagePath.substring(0, 7) == "http://") { a = 1 } if (imagePath.substring(0, 8) == "https://") { a = 1 } if (imagePath.substring(0, 6) == "ftp://") { a = 1 } if (a == 0) { imagePath = null } if ((imagePath != null) && (imagePath != "")) { rtewindow.focus(); _gecko_kill_css(); rtewindow.document.execCommand("InsertImage", false, imagePath); rtewindow.focus() } } function add_html_string(d) { if (isIE) { var c = rtewindow.document.selection; if (c != null) { rng = c.createRange(); var a = rtewindow.document.body.createTextRange(); if (!a.inRange(rng)) { rng = a; rng.moveStart("textedit") } } } else { var c = rtewindow.getSelection(); rng = c.getRangeAt(c.rangeCount - 1).cloneRange(); var a = rtewindow.document.createRange(); a.selectNode(rtewindow.document.body.firstChild); if (a.compareBoundaryPoints(Range.START_TO_START, rng) > 0) { rng = a; rng.collapse(false) } } if ((d != null) && (d != "")) { rtewindow.focus(); _gecko_kill_css(); if (isIE) { rng.pasteHTML(d) } else { var b = rtewindow.document.createElement("span"); b.innerHTML = d; rng.deleteContents(); while (b.lastChild) { rng.insertNode(b.lastChild) } } rtewindow.focus() } } function add_video() { window.open("/youtube_prompt.html", "yt", "height=162,width=460,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no") } function _add_video(c) { var a = 0; if (!c) { return } if (c.indexOf("http://www.youtube.com/watch?v=") == 0) { var b = c.replace(/http:\/\/www\.youtube\.com\/watch\?v=/ig, ""); if (b != "") { a = 1; c = '<utube src="' + b + '" />'; c = '<br /><br /><!--remove-start--><img src="' + G_CDN1_PATH + '/wysiwyg_rte2/utube.png" /><b><i><font color="green" size="2"> You-Tube video "' + b + '" placeholder <!--remove-end--><!--[unremark-start]' + c + '[unremark-end]--><!--remove-start-->(do not delete) </font></i></b><img src="' + G_CDN1_PATH + '/wysiwyg_rte2/utube.png" /><!--remove-end--><br /><br /><br />' } } if (a == 0) { c = null } if ((c != null) && (c != "")) { add_html_string(c) } } function emoticon(b, g, f) { rtewindow.focus(); try { if (!f) { f = document.getElementById(g).src } if (!isIE) { rtewindow.focus(); _gecko_kill_css(); rtewindow.document.execCommand("InsertImage", false, f); rtewindow.focus(); var a = rtewindow.document.getElementsByTagName("img"); for (var c = 0; c <= a.length; c++) { if (a[c].src == f) { if (!a[c].getAttribute("emoid")) { a[c].setAttribute("emoid", b); a[c].setAttribute("border", "0"); a[c].style.verticalAlign = "middle" } } } } else { smilieHTML = '<img src="' + f + '" border="0" alt="" emoid="' + b + '" />'; wrap_tags("" + smilieHTML, "") } } catch (d) { } rtewindow.focus(); if (emowindow != "" && emowindow != "undefined") { emowindow.focus() } } function wrap_tags(g, f) { var a = false; if (!isRichText) { return } if (isIE) { var e = rtewindow.document.selection; var d = rtewindow.document.selection.createRange(); var b = d.htmlText.replace(/<p([^>]*)>(.*)<\/p>/i, "$2"); if ((e.type == "Text" || e.type == "None")) { a = true; d.pasteHTML(g + b + f) } else { a = true; rtewindow.document.body.innerHTML += g + f } } else { var h = rtewindow.document.createDocumentFragment(); var c = rtewindow.document.createElement("span"); sel_html = _gecko_get_html(); if (sel_html) { a = true; c.innerHTML = g + sel_html + f } else { c.innerHTML = g + f } while (c.firstChild) { h.appendChild(c.firstChild) } _gecko_insert_node_at_selection(h) } rtewindow.focus(); return a } function do_select(b) { if (isIE) { var d = rtewindow.document.selection; if (d != null) { rng = d.createRange() } } else { var d = rtewindow.getSelection(); rng = d.getRangeAt(d.rangeCount - 1).cloneRange() } var a = document.getElementById(b).selectedIndex; var c = document.getElementById(b).options[a].value; rtewindow.focus(); _gecko_kill_css(); rtewindow.document.execCommand(b, false, c); rte_button_update(b); rtewindow.focus() } function launch_rte_fs() { if (viewingFS) { } if (viewingHTML) { toggleHTMLSrc() } viewingFS = 1; window.open(ipb_var_base_url + "&act=rtefs", "RTEFS", "width=640,height=480,resizable=yes,scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no") } function launch_div() { window.open(includesPath + "insert_div.html", "DIV", "width=550,height=340,resizable=yes,scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no") } function write_div(k, b) { try { if (b) { b.close() } } catch (g) { } if (!k) { return false } var a = { f_fontfamily: "font-family", f_fontsize: "font-size", f_color: "color", f_backgroundimage: "background-image", f_backgroundrepeat: "background-repeat", f_backgroundcolor: "background-color", f_border: "border", f_padding: "padding", f_margin: "margin" }; var h = k.f_type; var c = ""; if (!k.f_classes || k.f_classes == "__none") { c += "style='"; for (var f in k) { var d = k[f]; if (!d || d == "undefined" || f == "undefined" || !a[f]) { continue } if (a[f] && d) { c += a[f] + ":" + d + ";" } } c += k.f_other + "'" } else { c += "class='" + k.f_classes + "'" } if (c) { wrap_tags("<" + h + " " + c + ">", "</" + h + ">") } else { wrap_tags("<" + h + ">", "</" + h + ">") } return true } function launch_table() { window.open(includesPath + "insert_table.html", "TABLE", "width=450,height=220,resizable=yes,scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no") } function write_tables(b, d) { try { if (d) { d.close() } } catch (l) { } var a = _my_getselection(); var k = _my_createrange(a); if (!b) { return false } var p = rtewindow.document; var q = p.createElement("table"); for (var n in b) { var o = b[n]; if (!o) { continue } switch (n) { case "f_width": q.style.width = o + b.f_unit; break; case "f_align": q.align = o; break; case "f_border": q.border = parseInt(o); break; case "f_spacing": q.cellspacing = parseInt(o); break; case "f_padding": q.cellpadding = parseInt(o); break } } var h = p.createElement("tbody"); q.appendChild(h); for (var g = 0; g < b.f_rows; ++g) { var m = p.createElement("tr"); h.appendChild(m); for (var f = 0; f < b.f_cols; ++f) { var c = p.createElement("td"); m.appendChild(c); if (!isIE) { c.appendChild(p.createElement("br")) } } } if (isIE) { k.pasteHTML(q.outerHTML) } else { _gecko_insert_node_at_selection(q) } return true } function kb_handler(a) { var c = a.target.id; if (a.ctrlKey) { var b = String.fromCharCode(a.charCode).toLowerCase(); var d = ""; switch (b) { case "b": d = "bold"; break; case "i": d = "italic"; break; case "u": d = "underline"; break } if (d) { format_text(d, true); a.preventDefault(); a.stopPropagation() } } } function docChanged(a) { } function _my_getselection() { if (isIE) { return rtewindow.document.selection } else { return rtewindow.getSelection() } } function _my_createrange(a) { if (isIE) { return a.createRange() } else { rtewindow.focus(); return a ? a.getRangeAt(0) : rtewindow.document.createRange() } } function _gecko_get_html() { var c = _my_getselection(); var b = _my_createrange(c); var a = b.cloneContents(); return _gecko_read_nodes(a, false) } function _gecko_read_nodes(d, k) { var g = ""; var h = /_moz/i; switch (d.nodeType) { case Node.ELEMENT_NODE: case Node.DOCUMENT_FRAGMENT_NODE: var e; if (k) { e = !d.hasChildNodes(); g = "<" + d.tagName.toLowerCase(); var b = d.attributes; for (f = 0; f < b.length; ++f) { var c = b.item(f); if (!c.specified || c.name.match(h) || c.value.match(h)) { continue } g += " " + c.name.toLowerCase() + '="' + c.value + '"' } g += e ? " />" : ">" } for (var f = d.firstChild; f; f = f.nextSibling) { g += _gecko_read_nodes(f, true) } if (k && !e) { g += "</" + d.tagName.toLowerCase() + ">" } break; case Node.TEXT_NODE: g = htmlspecialchars(d.data); break } return g } function _gecko_insert_node_at_selection(f) { var e = _my_getselection(); var b = _my_createrange(e); e.removeAllRanges(); b.deleteContents(); var c = b.startContainer; var g = b.startOffset; switch (c.nodeType) { case Node.ELEMENT_NODE: if (f.nodeType == Node.DOCUMENT_FRAGMENT_NODE) { d = f.firstChild } else { d = f } c.insertBefore(f, c.childNodes[g]); _gecko_add_range(d); break; case Node.TEXT_NODE: if (f.nodeType == Node.TEXT_NODE) { var a = g + f.length; c.insertData(g, f.data); b = rtewindow.document.createRange(); b.setEnd(c, a); b.setStart(c, a); e.addRange(b) } else { c = c.splitText(g); var d; if (f.nodeType == Node.DOCUMENT_FRAGMENT_NODE) { d = f.firstChild } else { d = f } c.parentNode.insertBefore(f, c); _gecko_add_range(d) } break } } function _gecko_kill_css() { if (!isIE) { try { rtewindow.document.execCommand("useCSS", false, true); css_off = true } catch (a) { css_off = false } } } function _gecko_add_range(b) { rtewindow.focus(); var c = rtewindow.getSelection(); var a = null; a = rtewindow.document.createRange(); a.selectNodeContents(b); c.removeAllRanges(); c.addRange(a) } function ie_raise_button(b) { var a = window.event.srcElement; className = a.className; if (className == "rteimage" || className == "rteImageLowered") { a.className = "rteImageRaised" } } function ie_normal_button(b) { var a = window.event.srcElement; className = a.className; var c; try { if (a.id) { c = a.id.toString(); if (c == "spellButton" || c == "spellbutton" || c == "spelldiv") { return } c = c.replace(/do_/, "") } } catch (b) { } if (className == "rteImageRaised" || className == "rteImageLowered") { if (!c || button_status[c] != true) { a.className = "rteimage" } else { a.className = "rteImageRaised" } } } function ie_lower_button(b) { var a = window.event.srcElement; className = a.className; if (className == "rteimage" || className == "rteImageRaised") { a.className = "rteImageLowered" } } function strip_html(a) { var b = a.replace(/(<([^>]+)>)/ig, ""); b = b.replace(/\r\n/g, " "); b = b.replace(/\n/g, " "); b = b.replace(/\r/g, " "); b = trim(b); return b } function make_newlines_safe(a) { return a } function trim(c) { if (typeof c != "string") { return c } var b = c; var a = b.substring(0, 1); while (a == " ") { b = b.substring(1, b.length); a = b.substring(0, 1) } a = b.substring(b.length - 1, b.length); while (a == " ") { b = b.substring(0, b.length - 1); a = b.substring(b.length - 1, b.length) } while (b.indexOf("  ") != -1) { b = b.substring(0, b.indexOf("  ")) + b.substring(b.indexOf("  ") + 1, b.length) } return b } function htmlspecialchars(a) { a = a.replace(/"/, "&quot;"); a = a.replace(/</, "&lt;"); a = a.replace(/>/, "&gt;"); return a } function write_rte_html() { size_select = '<select class="rteselectbox" unselectable="on" id="fontsize" onchange="do_select(this.id);">'; size_select += write_fontsize_box(); size_select += "</select>"; document.getElementById("size_select_td").innerHTML = size_select } function tryTip() { if (typeof showTip != "undefined") { showTip(2) } } var i_am_2 = "rte_2"; var isRichText_2 = false; var css_off_2 = false; var rng_2; var currentrte_2_2; var allrte_2s_2 = ""; var rte_2 = ""; var rte_2window; var rte_2document; var rte_2ready; var isIE; var isGecko; var isSafari; var isKonqueror; var isOpera; var imagesPath_2; var includesPath_2; var g_buttons_2; var g_rte_2; var g_tablewidth_2; var g_width_2_unit_2; var g_imagesPath_2; var g_width_2; var g_height_2; var g_readOnly_2; var g_includesPath_2; var g_imagesPath_2; var g_html_2; var g_MaxLength_2 = 10000; var g_SafariSelect_2 = null; var isError = false; var currentfont_2; var currentsize_2; var button_status_2 = new Array(); var viewingHTML_2 = 0; var viewingFS_2 = 0; var buttons_update_2 = new Array("bold", "italic", "underline", "strikethrough", "justifyleft", "justifycenter", "justifyright", "insertorderedlist", "insertunorderedlist"); var opentags_2 = { bold: 0, italic: 0, strikethrough: 0, underline: 0, forecolor_02: 0, fontname: 0, fontsize: 0 }; function init_rte_2(c, b) { var a = navigator.userAgent.toLowerCase(); isIE = (((a.indexOf("msie") != -1) || (a.indexOf("opera") != -1)) && (a.indexOf("webtv") == -1)); isGecko = (a.indexOf("gecko") != -1); isSafari = (a.indexOf("safari") != -1); isKonqueror = (a.indexOf("konqueror") != -1); if (document.getElementById && document.designMode && !isKonqueror) { isRichText_2 = true } if (isIE) { document.onmouseover = ie_raise_button2; document.onmouseout = ie_normal_button2; document.onmousedown = ie_lower_button2; document.onmouseup = ie_raise_button2 } imagesPath_2 = c; includesPath_2 = b } function write_rte_2_editor(b, c, d, a, e, f) { rte_2 = b; if (isRichText_2) { if (allrte_2s_2.length > 0) { allrte_2s_2 += ";" } allrte_2s_2 += rte_2; write_rte_2(c, d, a, e, f) } else { write_default2(c, d, a, e, f) } } function write_default2(b, c, a, d, e) { if (!e) { document.writeln('<textarea name="' + rte_2 + '" id="' + rte_2 + '" style="width: ' + c + "px; height: " + a + 'px;">' + b + "</textarea>") } else { document.writeln('<textarea name="' + rte_2 + '" id="' + rte_2 + '" style="width: ' + c + "px; height: " + a + 'px;" readonly>' + b + "</textarea>") } } function write_rte_2(e, a, m, g, l) { if (l) { g = false } var f = a; var d = m; a = parseInt(a); m = parseInt(m); if (isIE) { if (!f.match(/%/)) { if (g && (a < 400)) { a = 400 } g_width_2_unit_2 = "px"; var h = a + 4 } else { g_width_2_unit_2 = "%"; var h = a; a = a } } else { if (!f.match(/%/)) { if (g && (a < 400)) { a = 400 } g_width_2_unit_2 = "px"; var h = a + 2 } else { g_width_2_unit_2 = "%"; var h = a; a = a } } g_buttons_2 = g; g_rte_2 = rte_2; g_tablewidth_2 = h; g_imagesPath_2 = imagesPath_2; g_width_2 = a; g_height_2 = m; g_readOnly_2 = l; g_includesPath_2 = includesPath_2; g_imagesPath_2 = imagesPath_2; g_html_2 = e; boo_to_int2 = isRichText_2 == true ? 1 : 0; write_rte_2_html(); document.getElementById(g_rte_2_hcontent).value = e; document.getElementById(g_rte_2_tcontent).value = ""; enable_design_mode2(make_newlines_safe(e), l); poss_images_2 = document.getElementsByTagName("img"); if (poss_images_2.length) { for (var c in poss_images_2) { if (poss_images_2[c].className == "rte_2image") { poss_images_2[c].unselectable = true } } } rte_2window = frames[rte_2]; if (rte_2window.document.addEventListener) { rte_2window.document.addEventListener("keydown", function(n) { return k(n) }, false) } else { rte_2window.document.onkeydown = function(n) { if (!n) { n = rte_2window.event } return k(n) } } function k(o) { var q; var n = "0".charCodeAt(0); var p = "z".charCodeAt(0); if (rte_2window.event) { q = o.keyCode } else { if (o.which) { q = o.which } } if (rte_2window.document.body.innerHTML.length > g_MaxLength_2 && ((n <= q && q <= p) || q == 13 || q == 32)) { alert("Exeeded maximum message length, plese delete some text"); return false } } var b = false; if (isIE && b) { rte_2window = frames[rte_2]; rte_2window.document.onkeydown = function() { if (rte_2window.event.keyCode == 13) { if (rte_2window.event.returnValue == false) { return } if (button_status_2.insertunorderedlist == true || button_status_2.insertorderedlist == true) { return } var o = rte_2window.document.selection; var n = rte_2window.document.selection.createRange(); if ((o.type == "Text" || o.type == "None")) { n.pasteHTML("<br />\n") } else { rte_2window.document.body.innerHTML += "<br />\n" } rte_2window.event.returnValue = false; n.select(); rte_2window.focus() } } } } function enable_design_mode2(d, g) { var c = ""; try { c = g_CHARSET } catch (f) { } c = c ? c : "iso-8859-1"; var a = '<html id="' + rte_2 + '">\n'; a += "<head>\n"; a += '<meta http-equiv="content-type" content="text/html; charset=' + c + '" />\n'; a += "<style type='text/css' media='all'>\n"; a += "body {\n"; a += "	background: #FFFFFF;\n"; a += "	margin: 0px;\n"; a += "	padding: 4px;\n"; a += "	font-family: arial, verdana, sans-serif;\n"; a += "	font-size: 10pt;\n"; a += "}\n"; a += "p {\n"; a += "	margin:0px;\n"; a += "	padding:0px;\n"; a += "}\n"; a += ".spwrap\n"; a += "{\n"; a += "background: transparent url(" + G_CDN1_PATH + "/wysiwyg_rte2/misspell.gif) repeat-x scroll center bottom;\n"; a += "}\n"; a += "</style>\n"; a += "</head>\n"; a += "<body>\n"; a += d + "\n"; a += "</body>\n"; a += "</html>"; if (isIE || isSafari) { try { rte_2window = frames[rte_2]; rte_2window.document.open("text/html", "replace"); rte_2window.document.write(a); rte_2window.document.close() } catch (f) { } if (!g) { rte_2window.document.designMode = "On" } rte_2window.document.onmouseup = rte_2_button_update; rte_2window.document.onkeyup = rte_2_button_update } else { try { rte_2window = document.getElementById(rte_2).contentWindow; rte_2document = document.getElementById(rte_2).contentDocument; try { rte_2window.document.open("text/html", "replace"); rte_2window.document.write(a); rte_2window.document.close(); rte_2window.document.body.style.fontSize = "10pt"; rte_2window.document.addEventListener("mouseup", rte_2_button_update, false); rte_2window.document.addEventListener("keyup", rte_2_button_update, false); if (isGecko && !g) { rte_2window.document.addEventListener("keypress", kb_handler, false) } } catch (f) { } if (!g) { rte_2window.document.designMode = "on" } } catch (f) { if (isGecko) { setTimeout("enable_design_mode2('" + make_newlines_safe(d) + "', " + g + ");", 10) } else { return false } } } for (var b in buttons_update_2) { if (typeof buttons_update_2[b] == "string") { button_status_2[buttons_update_2[b]] = false } } rte_2ready = 1 } function update_rte_2() { isError = false; if (document.getElementById("temprte_2") != null) { document.getElementById("temprte_2").style.display = "block" } try { $("imgFocusMe2").focus() } catch (c) { } var a = document.getElementById(g_rte_2_hcontent); var d = document.getElementById(g_rte_2_tcontent); var h = false; isRichText_2 = true; if (isRichText_2 && !h) { if (viewingHTML_2) { toggleHTMLSrc() } if (a.value == null) { a.value = "" } if (rte_2window.document.body.innerHTML.length > g_MaxLength_2) { a.value = rte_2window.document.body.innerHTML; return } if (rte_2window.document.body.innerHTML.indexOf('src="http') != -1) { if ($("Buttons1_02") != null) { if ($("Buttons1_02").className == "rtebuttonbar3") { alert("You cannot upload images here.  Please remove them and proceed.") } else { alert("Posted images are not allowed. Please use the Image Upload Tool located in the toolbar of the edit box") } isError = true; return false } } var g = document.getElementById("rte_2_html_bu"); if (g != null) { g.value = rte_2window.document.body.innerHTML } var e = rte_2window.document.body.innerHTML.replace(/<br><br><!\-\-remove\-start\-\->[^!]*<!\-\-remove\-end\-\->/ig, ""); e = e.replace(/<!\-\-remove\-start\-\->[^!]*<!\-\-remove\-end\-\-><br><br><br>/ig, ""); e = e.replace(/<!\-\-remove\-start\-\->[^!]*<!\-\-remove\-end\-\->/ig, ""); e = e.replace(/<!\-\-\[unremark\-start\]/ig, ""); e = e.replace(/\[unremark\-end\]\-\->/ig, ""); e = e.replace(/<\?xml:namespac[^>]+>/ig, ""); e = e.replace(/<p[^>]+>/ig, "<p>"); e = e.replace(/<\/p/ig, "</p"); e = e.replace(/<font[^>]+>([^<]*)<\/font>/ig, "$1"); e = e.replace(/<div[^>]+>([^<]*)<\/div>/ig, "$1"); e = e.replace(/<img/ig, "<img"); e = e.replace(/<a/ig, "<a"); e = e.replace(/<\/a/ig, "</a"); e = e.replace(/<(\/)?o:p>/ig, ""); e = e.replace(/(<img[^>]+[^\/])>/ig, "$1 />"); e = e.replace(/<p><\/p>/ig, "<br>"); e = e.replace(/<p>&nbsp;<\/p>/ig, "<br>"); e = e.replace(/<p>/ig, ""); e = e.replace(/(<img[^>]+>)<\/p>/ig, "$1"); e = e.replace(/(br>)<\/p>/ig, "$1"); e = e.replace(/(\/>)<\/p>/ig, "$1"); e = e.replace(/<\/p>/ig, "<br>"); e = e.replace(/<(\/?)em>/ig, "<$1i>"); e = e.replace(/<(\/?)strong>/ig, "<$1b>"); e = e.replace(/<([a-z]+)><\/\1>/ig, ""); e = e.replace(/<([a-z]+)>&nbsp;<\/\1>/ig, ""); e = e.replace(/&nbsp;/ig, " "); e = e.replace(/(<br>)+$/i, ""); a.value = getXHTML(e); if (strip_html(a.value.replace("&nbsp;", " ")) == "" && a.value.toLowerCase().search("<hr") == -1 && a.value.toLowerCase().search("<img") == -1 && a.value.toLowerCase().search("<obj") == -1 && a.value.toLowerCase().search("<utube") == -1) { a.value = "" } if (escape(a.value) == "%3Cbr%3E%0D%0A%0D%0A%0D%0A") { a.value = "" } var f = $i("hdntxtconverte_2r"); f.innerHTML = a.value; if (a.value != "") { a.value = a.value + "<!-- from fixya rte -->" } f.innerHTML = f.innerHTML.replace(/<p>/ig, "<p> "); f.innerHTML = f.innerHTML.replace(/(\S)<br>(\S)/ig, "$1 <br>$2"); if (f.innerText != undefined && !isSafari) { var b = f.innerText.replace(/You-Tube video "[^"]+" placeholder \(do not delete\)/g, "") } else { f.innerHTML = f.innerHTML.replace(/<li>(\S)/ig, "<li> $1"); var b = f.textContent.replace(/You-Tube video "[^"]+" placeholder \(do not delete\)/g, "") } b = b.replace(/^\s+|\s+$/g, ""); f.innerHTML = b; if (rte_2window.document.body.innerText != undefined && !isSafari) { d.value = f.innerText } else { d.value = f.textContent } } } function toggleHTMLSrc() { if (viewingHTML_2 == 0) { document.getElementById("Buttons1_02").style.visibility = "hidden"; document.getElementById("Buttons2_02").style.visibility = "hidden"; viewingHTML_2 = 1; try { document.getElementById("chkSrc").className = "rte_2bottombuttonon" } catch (b) { } if (isIE) { rte_2window.document.body.innerText = rte_2window.document.body.innerHTML } else { if (isGecko) { rte_2window.document.designMode = "off" } var c = rte_2window.document.createTextNode(rte_2window.document.body.innerHTML); rte_2window.document.body.innerHTML = ""; rte_2window.document.body.appendChild(c); rte_2window.document.body.innerHTML = clean_up_html_to_show(rte_2window.document.body.innerHTML) } } else { document.getElementById("Buttons1_02").style.visibility = "visible"; document.getElementById("Buttons2_02").style.visibility = "visible"; viewingHTML_2 = 0; try { document.getElementById("chkSrc").className = "rte_2bottombutton" } catch (b) { } if (isIE) { var a = escape(rte_2window.document.body.innerText); a = a.replace("%3CP%3E%0D%0A%3CHR%3E", "%3CHR%3E"); a = a.replace("%3CHR%3E%0D%0A%3C/P%3E", "%3CHR%3E"); rte_2window.document.body.innerHTML = unescape(a) } else { if (isGecko) { rte_2window.document.designMode = "on" } var c = rte_2window.document.body.ownerDocument.createRange(); c.selectNodeContents(rte_2window.document.body); rte_2window.document.body.innerHTML = c.toString() } } } function clean_up_html_to_show(a) { if (a == "" || a == "undefined") { return a } a = a.replace(/&lt;br&gt;/ig, "&lt;br /&gt;"); a = a.replace(/&lt;p&gt;(\s+?)?&lt;\/p&gt;/ig, ""); a = a.replace(/&lt;p&gt;&lt;hr \/&gt;&lt;\/p&gt;/ig, "&lt;hr /&gt;"); a = a.replace(/&lt;p&gt;&nbsp;&lt;\/p&gt;&lt;hr \/&gt;&lt;p&gt;&nbsp;&lt;\/p&gt;/ig, "&lt;hr /&gt;"); a = a.replace(/&lt;(p|div)([^&]*)&gt;/ig, "<br />&lt;$1$2&gt;<br />"); a = a.replace(/&lt;\/(p|div)([^&]*)&gt;/ig, "<br />&lt;/$1$2&gt;<br />"); a = a.replace(/&lt;br \/&gt;(?!&lt;\/td)/ig, "&lt;br /&gt;<br />"); a = a.replace(/&lt;\/(td|tr|tbody|table)&gt;/ig, "&lt;/$1&gt;<br />"); a = a.replace(/&lt;(tr|tbody|table(.+?)?)&gt;/ig, "&lt;$1&gt;<br />"); a = a.replace(/&lt;(td(.+?)?)&gt;/ig, "    &lt;$1&gt;"); a = a.replace(/&lt;p&gt;&nbsp;&lt;\/p&gt;/ig, "&lt;br /&gt;"); return a } function rte_2_button_update(h) { if (!isIE && !isSafari) { try { size_context = rte_2window.document.queryCommandValue("fontsize") } catch (f) { try { var b = rte_2window.document.body.innerHTML; var d = ""; try { d = g_CHARSET } catch (f) { } d = d ? d : "iso-8859-1"; var a = '<html id="' + rte_2 + '">\n'; a += "<head>\n"; a += '<meta http-equiv="content-type" content="text/html; charset=' + d + '" />\n'; a += "<style type='text/css' media='all'>\n"; a += "body {\n"; a += "	background: #FFFFFF;\n"; a += "	margin: 0px;\n"; a += "	padding: 4px;\n"; a += "	font-family: arial, verdana, sans-serif;\n"; a += "	font-size: 10pt;\n"; a += "}\n"; a += "p {\n"; a += "	margin:0px;\n"; a += "	padding:0px;\n"; a += "}\n"; a += ".spwrap\n"; a += "{\n"; a += "background: transparent url(" + G_CDN1_PATH + "/wysiwyg_rte2/misspell.gif) repeat-x scroll center bottom;\n"; a += "}\n"; a += "</style>\n"; a += "</head>\n"; a += "<body>\n"; a += b + "\n"; a += "</body>\n"; a += "</html>"; rte_2window.document.open("text/html", "replace"); rte_2window.document.write(a); rte_2window.document.close(); rte_2window.document.body.style.fontSize = "10pt"; rte_2window.document.addEventListener("mouseup", rte_2_button_update, false); rte_2window.document.addEventListener("keyup", rte_2_button_update, false); if (isGecko) { rte_2window.document.addEventListener("keypress", kb_handler, false) } rte_2window.document.designMode = "on" } catch (g) { alert("Unable to activate design mode " + g) } } } if (isSafari) { if (rte_2window.getSelection() + "" != "") { g_SafariSelect_2 = rte_2window.getSelection() } } if (viewingHTML_2) { return false } if (!rte_2ready) { return false } try { var k; for (var c in buttons_update_2) { if (typeof buttons_update_2[c] == "string") { k = rte_2window.document.queryCommandState(buttons_update_2[c]); if (typeof (button_status_2[buttons_update_2[c]]) != "undefined" && button_status_2[buttons_update_2[c]] != k) { prev_state = button_status_2[buttons_update_2[c]]; button_status_2[buttons_update_2[c]] = k; rte_2_button_context(document.getElementById("do_" + buttons_update_2[c]), prev_state == true ? "mouseout" : "mouseover") } } } } catch (f) { } try { size_context = rte_2window.document.queryCommandValue("fontsize") } catch (f) { size_context = "" } if (size_context == "") { if (!isIE) { size_context = ips_fontsizes[rte_2window.document.body.style.fontSize] } } else { if (size_context == null) { size_context = "" } } if (size_context != currentsize_2) { document.getElementById("fontsize").selectedIndex = ips_reverse_font_sizes[size_context]; currentsize_2 = size_context } if (!h) { h = rte_2window.event } if (h) { if (h.keyCode == 18) { return } } } function rte_2_window_resize(a, c) { var e = document.getElementById(a); var d = parseInt(e.style.height); d = d ? d : g_height_2; var b = d + c; if (b > 0) { e.style.height = b + "px" } return false } function rte_2_button_context(a, b) { if (a == null) { return } command = a.id.toString(); command = command.replace(/do_/, ""); if (typeof (button_status_2[command]) == "undefined") { button_status_2[command] = null } try { switch (b) { case "click": case "mouseout": a.className = "rte_2image"; break; case "mouseup": case "mouseover": a.className = "rte_2ImageRaised"; break; case "mousedown": a.className = "rte_2ImageRaised"; break } } catch (c) { } } function format_text_2(h, d) { if (isIE) { var c = rte_2window.document.selection; if (c != null) { rng_2 = c.createRange() } } else { if (isSafari) { var c = g_SafariSelect_2 } else { var c = rte_2window.getSelection(); rng_2 = c.getRangeAt(c.rangeCount - 1).cloneRange() } } try { if ((h == "forecolor_02") || (h == "hilitecolor")) { parent.command = h; buttonElement = document.getElementById("Buttons1_02"); var f = getOffsetLeft(buttonElement) * 0.5; if (isIE) { var b = 253 } else { var b = 265 } var a = getOffsetTop(buttonElement) + (buttonElement.offsetHeight) - b; document.getElementById("cp2").style.left = (f) + "px"; document.getElementById("cp2").style.top = (a) + "px"; if (document.getElementById("cp2").style.visibility == "hidden") { document.getElementById("cp2").style.visibility = "visible"; document.getElementById("cp2").style.display = "inline" } else { document.getElementById("cp2").style.visibility = "hidden"; document.getElementById("cp2").style.display = "none" } } else { if (h == "cut" || h == "copy" || h == "paste") { try { rte_2window.document.execCommand(h, false, null) } catch (g) { if (isGecko) { alert(jsfile_alert1 + jsfile_alert2 + jsfile_alert3 + "\n" + jsfile_alert4) } } } else { if (h == "createlink") { if (isIE) { var k = rng_2.htmlText } else { var k = _gecko_get_html2() } if (!k) { alert(jsfile_highlight_lang); return false } else { window.open("/link_prompt2.html", "lp", "height=162,width=460,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no") } } else { rte_2window.focus(); _gecko_kill_css(); rte_2window.document.execCommand(h, false, null); rte_2_button_update(h); rte_2window.focus() } } } } catch (g) { } } function add_link2(b) { try { var a = 0; if (b.substring(0, 7) == "http://" && b.length > 10) { a = 1 } if (b.substring(0, 8) == "https://" && b.length > 11) { a = 1 } if (b.substring(0, 6) == "ftp://" && b.length > 9) { a = 1 } if (a == 0) { b = null } rte_2window.document.execCommand("Unlink", false, null); rte_2window.document.execCommand("CreateLink", false, b) } catch (c) { } } function show_smilies() { buttonElement = document.getElementById("popsmilies"); var b = getOffsetLeft(buttonElement); var a = getOffsetTop(buttonElement) + (buttonElement.offsetHeight + 30); document.getElementById("smiliestable").style.left = (b) + "px"; document.getElementById("smiliestable").style.top = (a) + "px"; if (document.getElementById("smiliestable").style.visibility == "hidden") { document.getElementById("smiliestable").style.visibility = "visible"; document.getElementById("smiliestable").style.display = "inline" } else { document.getElementById("smiliestable").style.visibility = "hidden"; document.getElementById("smiliestable").style.display = "none" } } function setColor(a) { var b = parent.command; if (isIE) { var c = rte_2window.document.selection; if (b == "hilitecolor") { b = "backcolor" } if (c != null) { var d = c.createRange(); d = rng_2; d.select() } } rte_2window.focus(); _gecko_kill_css(); rte_2window.document.execCommand(b, false, a); rte_2window.focus(); document.getElementById("cp2").style.visibility = "hidden"; document.getElementById("cp2").style.display = "none" } function add_email() { if (isIE) { var a = rte_2window.document.selection; if (a != null) { rng_2 = a.createRange() } } else { var a = rte_2window.getSelection(); rng_2 = a.getRangeAt(a.rangeCount - 1).cloneRange() } emailaddress = prompt(text_enter_email, ""); if ((emailaddress != null) && (emailaddress != "")) { rte_2window.focus(); _gecko_kill_css(); rte_2window.document.execCommand("createlink", false, "mailto:" + emailaddress); rte_2window.focus() } } function _add_image_2(a) { window.open("/fl_upload2.aspx?f=" + a, "fl", "height=217,width=500,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no") } function _set_image_2(a, c) { var b = '<img src="/uploads/' + c + "/" + a + '" />'; add_html_string_2(b) } function add_image_2() { if (isIE) { var b = rte_2window.document.selection; if (b != null) { rng_2 = b.createRange() } } else { var b = rte_2window.getSelection(); rng_2 = b.getRangeAt(b.rangeCount - 1).cloneRange() } imagePath = prompt(text_enter_image, "http://"); var a = 0; if (imagePath.substring(0, 7) == "http://") { a = 1 } if (imagePath.substring(0, 8) == "https://") { a = 1 } if (imagePath.substring(0, 6) == "ftp://") { a = 1 } if (a == 0) { imagePath = null } if ((imagePath != null) && (imagePath != "")) { rte_2window.focus(); _gecko_kill_css(); rte_2window.document.execCommand("InsertImage", false, imagePath); rte_2window.focus() } } function add_html_string_2(d) { if (isIE) { var b = rte_2window.document.selection; if (b != null) { rng_2 = b.createRange(); var c = rte_2window.document.body.createTextRange(); if (!c.inRange(rng_2)) { rng_2 = c; rng_2.moveStart("textedit") } } } else { var b = rte_2window.getSelection(); rng_2 = b.getRangeAt(b.rangeCount - 1).cloneRange(); var c = rte_2window.document.createRange(); c.selectNode(rte_2window.document.body.firstChild); if (c.compareBoundaryPoints(Range.START_TO_START, rng_2) > 0) { rng_2 = c; rng_2.collapse(false) } } if ((d != null) && (d != "")) { rte_2window.focus(); _gecko_kill_css(); if (isIE) { rng_2.pasteHTML(d) } else { var a = rte_2window.document.createElement("span"); a.innerHTML = d; rng_2.deleteContents(); while (a.lastChild) { rng_2.insertNode(a.lastChild) } } rte_2window.focus() } } function add_video2() { window.open("/youtube_prompt2.html", "yt", "height=162,width=460,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no") } function _add_video2(c) { var a = 0; if (!c) { return } if (c.indexOf("http://www.youtube.com/watch?v=") == 0) { var b = c.replace(/http:\/\/www\.youtube\.com\/watch\?v=/ig, ""); if (b != "") { a = 1; c = '<utube src="' + b + '" />'; c = '<br /><br /><!--remove-start--><img src="' + G_CDN1_PATH + '/wysiwyg_rte2/utube.png" /><b><i><font color="green" size="2"> You-Tube video "' + b + '" placeholder <!--remove-end--><!--[unremark-start]' + c + '[unremark-end]--><!--remove-start-->(do not delete) </font></i></b><img src="' + G_CDN1_PATH + '/wysiwyg_rte2/utube.png" /><!--remove-end--><br /><br /><br />' } } if (a == 0) { c = null } if ((c != null) && (c != "")) { add_html_string_2(c) } } function emoticon(b, g, f) { rte_2window.focus(); try { if (!f) { f = document.getElementById(g).src } if (!isIE) { rte_2window.focus(); _gecko_kill_css(); rte_2window.document.execCommand("InsertImage", false, f); rte_2window.focus(); var a = rte_2window.document.getElementsByTagName("img"); for (var c = 0; c <= a.length; c++) { if (a[c].src == f) { if (!a[c].getAttribute("emoid")) { a[c].setAttribute("emoid", b); a[c].setAttribute("border", "0"); a[c].style.verticalAlign = "middle" } } } } else { smilieHTML = '<img src="' + f + '" border="0" alt="" emoid="' + b + '" />'; wrap_tags("" + smilieHTML, "") } } catch (d) { } rte_2window.focus(); if (emowindow != "" && emowindow != "undefined") { emowindow.focus() } } function wrap_tags(g, f) { var a = false; if (!isRichText_2) { return } if (isIE) { var e = rte_2window.document.selection; var d = rte_2window.document.selection.createRange(); var b = d.htmlText.replace(/<p([^>]*)>(.*)<\/p>/i, "$2"); if ((e.type == "Text" || e.type == "None")) { a = true; d.pasteHTML(g + b + f) } else { a = true; rte_2window.document.body.innerHTML += g + f } } else { var h = rte_2window.document.createDocumentFragment(); var c = rte_2window.document.createElement("span"); sel_html = _gecko_get_html2(); if (sel_html) { a = true; c.innerHTML = g + sel_html + f } else { c.innerHTML = g + f } while (c.firstChild) { h.appendChild(c.firstChild) } _gecko_insert_node_at_selection2(h) } rte_2window.focus(); return a } function do_select(b) { if (isIE) { var d = rte_2window.document.selection; if (d != null) { rng_2 = d.createRange() } } else { var d = rte_2window.getSelection(); rng_2 = d.getRangeAt(d.rangeCount - 1).cloneRange() } var a = document.getElementById(b).selectedIndex; var c = document.getElementById(b).options[a].value; rte_2window.focus(); _gecko_kill_css(); rte_2window.document.execCommand(b, false, c); rte_2_button_update(b); rte_2window.focus() } function launch_rte_2_fs() { if (viewingFS_2) { } if (viewingHTML_2) { toggleHTMLSrc() } viewingFS_2 = 1; window.open(ipb_var_base_url + "&act=rte_2fs", "rte_2FS", "width=640,height=480,resizable=yes,scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no") } function launch_div() { window.open(includesPath_2 + "insert_div.html", "DIV", "width=550,height=340,resizable=yes,scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no") } function write_div(k, b) { try { if (b) { b.close() } } catch (g) { } if (!k) { return false } var a = { f_fontfamily: "font-family", f_fontsize: "font-size", f_color: "color", f_backgroundimage: "background-image", f_backgroundrepeat: "background-repeat", f_backgroundcolor: "background-color", f_border: "border", f_padding: "padding", f_margin: "margin" }; var h = k.f_type; var c = ""; if (!k.f_classes || k.f_classes == "__none") { c += "style='"; for (var f in k) { var d = k[f]; if (!d || d == "undefined" || f == "undefined" || !a[f]) { continue } if (a[f] && d) { c += a[f] + ":" + d + ";" } } c += k.f_other + "'" } else { c += "class='" + k.f_classes + "'" } if (c) { wrap_tags("<" + h + " " + c + ">", "</" + h + ">") } else { wrap_tags("<" + h + ">", "</" + h + ">") } return true } function launch_table() { window.open(includesPath_2 + "insert_table.html", "TABLE", "width=450,height=220,resizable=yes,scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no") } function write_tables(b, d) { try { if (d) { d.close() } } catch (l) { } var a = _my_getselection2(); var k = _my_createrange2(a); if (!b) { return false } var p = rte_2window.document; var q = p.createElement("table"); for (var n in b) { var o = b[n]; if (!o) { continue } switch (n) { case "f_width": q.style.width = o + b.f_unit; break; case "f_align": q.align = o; break; case "f_border": q.border = parseInt(o); break; case "f_spacing": q.cellspacing = parseInt(o); break; case "f_padding": q.cellpadding = parseInt(o); break } } var h = p.createElement("tbody"); q.appendChild(h); for (var g = 0; g < b.f_rows; ++g) { var m = p.createElement("tr"); h.appendChild(m); for (var f = 0; f < b.f_cols; ++f) { var c = p.createElement("td"); m.appendChild(c); if (!isIE) { c.appendChild(p.createElement("br")) } } } if (isIE) { k.pasteHTML(q.outerHTML) } else { _gecko_insert_node_at_selection2(q) } return true } function kb_handler(a) { var c = a.target.id; if (a.ctrlKey) { var b = String.fromCharCode(a.charCode).toLowerCase(); var d = ""; switch (b) { case "b": d = "bold"; break; case "i": d = "italic"; break; case "u": d = "underline"; break } if (d) { format_text_2(d, true); a.preventDefault(); a.stopPropagation() } } } function docChanged(a) { } function _my_getselection2() { if (isIE) { return rte_2window.document.selection } else { return rte_2window.getSelection() } } function _my_createrange2(a) { if (isIE) { return a.createRange() } else { rte_2window.focus(); return a ? a.getRangeAt(0) : rte_2window.document.createRange() } } function _gecko_get_html2() { var c = _my_getselection2(); var b = _my_createrange2(c); var a = b.cloneContents(); return _gecko_read_nodes2(a, false) } function _gecko_read_nodes2(d, k) { var g = ""; var h = /_moz/i; switch (d.nodeType) { case Node.ELEMENT_NODE: case Node.DOCUMENT_FRAGMENT_NODE: var e; if (k) { e = !d.hasChildNodes(); g = "<" + d.tagName.toLowerCase(); var b = d.attributes; for (f = 0; f < b.length; ++f) { var c = b.item(f); if (!c.specified || c.name.match(h) || c.value.match(h)) { continue } g += " " + c.name.toLowerCase() + '="' + c.value + '"' } g += e ? " />" : ">" } for (var f = d.firstChild; f; f = f.nextSibling) { g += _gecko_read_nodes2(f, true) } if (k && !e) { g += "</" + d.tagName.toLowerCase() + ">" } break; case Node.TEXT_NODE: g = htmlspecialchars(d.data); break } return g } function _gecko_insert_node_at_selection2(f) { var e = _my_getselection2(); var b = _my_createrange2(e); e.removeAllRanges(); b.deleteContents(); var c = b.startContainer; var g = b.startOffset; switch (c.nodeType) { case Node.ELEMENT_NODE: if (f.nodeType == Node.DOCUMENT_FRAGMENT_NODE) { d = f.firstChild } else { d = f } c.insertBefore(f, c.childNodes[g]); _gecko_add_range(d); break; case Node.TEXT_NODE: if (f.nodeType == Node.TEXT_NODE) { var a = g + f.length; c.insertData(g, f.data); b = rte_2window.document.createRange(); b.setEnd(c, a); b.setStart(c, a); e.addRange(b) } else { c = c.splitText(g); var d; if (f.nodeType == Node.DOCUMENT_FRAGMENT_NODE) { d = f.firstChild } else { d = f } c.parentNode.insertBefore(f, c); _gecko_add_range(d) } break } } function _gecko_kill_css() { if (!isIE) { try { rte_2window.document.execCommand("useCSS", false, true); css_off_2 = true } catch (a) { css_off_2 = false } } } function _gecko_add_range(b) { rte_2window.focus(); var c = rte_2window.getSelection(); var a = null; a = rte_2window.document.createRange(); a.selectNodeContents(b); c.removeAllRanges(); c.addRange(a) } function ie_raise_button2(b) { var a = window.event.srcElement; className = a.className; if (className == "rte_2image" || className == "rte_2ImageLowered") { a.className = "rte_2ImageRaised" } } function ie_normal_button2(b) { var a = window.event.srcElement; className = a.className; var c; try { if (a.id) { c = a.id.toString(); if (c == "spellButton" || c == "spellbutton" || c == "spelldiv") { return } c = c.replace(/do_/, "") } } catch (b) { } if (className == "rte_2ImageRaised" || className == "rte_2ImageLowered") { if (!c || button_status_2[c] != true) { a.className = "rte_2image" } else { a.className = "rte_2ImageRaised" } } } function ie_lower_button2(b) { var a = window.event.srcElement; className = a.className; if (className == "rte_2image" || className == "rte_2ImageRaised") { a.className = "rte_2ImageLowered" } } function strip_html(a) { var b = a.replace(/(<([^>]+)>)/ig, ""); b = b.replace(/\r\n/g, " "); b = b.replace(/\n/g, " "); b = b.replace(/\r/g, " "); b = trim(b); return b } function make_newlines_safe(a) { return a } function trim(c) { if (typeof c != "string") { return c } var b = c; var a = b.substring(0, 1); while (a == " ") { b = b.substring(1, b.length); a = b.substring(0, 1) } a = b.substring(b.length - 1, b.length); while (a == " ") { b = b.substring(0, b.length - 1); a = b.substring(b.length - 1, b.length) } while (b.indexOf("  ") != -1) { b = b.substring(0, b.indexOf("  ")) + b.substring(b.indexOf("  ") + 1, b.length) } return b } function htmlspecialchars(a) { a = a.replace(/"/, "&quot;"); a = a.replace(/</, "&lt;"); a = a.replace(/>/, "&gt;"); return a } function write_rte_2_html() { size_select = '<select class="rte_2selectbox" unselectable="on" id="fontsize" onchange="do_select(this.id);">'; size_select += write_fontsize_box(); size_select += "</select>"; document.getElementById("size_select_td_02").innerHTML = size_select } function tryTip() { if (typeof showTip != "undefined") { showTip(2) } } var IE = document.all ? true : false; var SCtryCount = 0; var SCtryCount2 = 0; var SC_timer = 0; var SC_timer2 = 0; function SpellCheck(a, c, b) { this.URL = "/a_spell.aspx"; this.sourceText = a; this.resultsArea = c; this.button = b; this.selected = -1; this.resultsArray = new Array(); this.selectedmenu = null; this.showMenu = false; this.active = false; this.rteWindow = null; if (arguments.length > 4) { this.rteWindow = arguments[4] } this.init() } SpellCheck.prototype.init = function() { var a = this; if (this.rteWindow === null) { if (typeof (rtewindow) != "undefined") { this.rteWindow = rtewindow } } if (this.rteWindow === null) { return } if (typeof Function.bind == "undefined") { return } if (typeof this.rteWindow.document == "undefined") { return } this.button.onclick = function() { a.callback() }; if (this.rteWindow.document.addEventListener) { this.rteWindow.document.addEventListener("keydown", function(b) { a.menuaction(b); return false } .bind(this), true) } else { this.sourceText.onkeydown = function(b) { if (!b) { b = this.rteWindow.event } return a.menuaction(b) } .bind(this) } }; SpellCheck.prototype.reset = function() { this.active = false; this.button.parentNode.className = "rteImage"; this.resultsArea.innerHTML = ""; this.selected = -1; this.selectedmenu = null; this.showMenu = false }; SpellCheck.prototype.callback = function() { if (this.active) { this.removemarks(); this.reset(); return } var c = this; if (this.sourceText == null) { return } var a = ""; if (typeof this.sourceText.innerText != "undefined") { a = this.sourceText.innerText } else { a = this.sourceText.textContent } if (a != "") { this.button.parentNode.className = "rteImageRaised"; this.active = true; var b = new Ajax.Request(this.URL, { method: "post", onSuccess: function(d) { c.statechange(d) }, postBody: "q=" + a, contentType: "application/x-www-form-urlencoded" }) } }; SpellCheck.prototype.statechange = function(oHttp) { var res = oHttp.responseText; var iend = res.lastIndexOf("}"); res = res.substring(0, iend + 1); res = res.replace(/\n\r/gi, " ").replace(/\n/gi, " ").replace(/\r/gi, " "); var resultMap; var sp = this; if (res != "") { resultMap = eval("(" + res + ")") } else { alert("no spelling problems!"); this.reset() } if (typeof resultMap.words != "undefined") { this.resultsArray = resultMap.words } if (this.resultsArray.length > 0) { this.markWords() } else { alert("no spelling problems!"); this.reset() } return true }; SpellCheck.prototype.debugResult = function() { var a = { words: [{ word: "hello", spellings: ["hell", "hollow", "moshe"] }, { word: "world", spellings: ["word", "worth", "haim"]}] }; this.resultsArray = a.words; if (this.resultsArray.length > 0) { this.markWords() } }; SpellCheck.prototype.markWords = function() { var d = 0; var b = this; var n = ""; for (d = 0; d < this.resultsArray.length; d++) { if (this.resultsArray[d].spellings.length > 0) { n = '<span class="spwrap" id="sp' + this.resultsArray[d].word + '" >' + this.resultsArray[d].word + "</span>"; var l = new RegExp("([\\s>\\-])" + this.resultsArray[d].word + "([<\\s,\\.\\-\\?!])", ["gi"]); var e = new RegExp("([\\s>\\-])" + this.resultsArray[d].word + "([<\\s\\-][^/])", ["gi"]); var c = new RegExp("(/span>)" + this.resultsArray[d].word + "(</)", ["gi"]); var k = new RegExp("^" + this.resultsArray[d].word + "([<\\s,\\.\\-\\?!])", ["gi"]); var h = new RegExp("([>\\s\\-])" + this.resultsArray[d].word + "$", ["gi"]); var g = new RegExp("^" + this.resultsArray[d].word + "$", ["gi"]); this.sourceText.innerHTML = this.sourceText.innerHTML.replace(l, "$1" + n + "$2"); this.sourceText.innerHTML = this.sourceText.innerHTML.replace(e, "$1" + n + "$2"); this.sourceText.innerHTML = this.sourceText.innerHTML.replace(c, "$1" + n + "$2"); this.sourceText.innerHTML = this.sourceText.innerHTML.replace(k, n + "$1"); this.sourceText.innerHTML = this.sourceText.innerHTML.replace(h, "$1" + n); this.sourceText.innerHTML = this.sourceText.innerHTML.replace(g, n) } } var a = this.rteWindow.document.getElementsByTagName("span"); var m = ""; var f = ""; for (d = 0; d < a.length; d++) { if (a[d].className == "spwrap") { a[d].id = "sp" + d + a[d].id; if (a[d].addEventListener) { a[d].addEventListener("click", function(o) { b.clickword(o) } .bind(this), false) } else { if (a[d].attachEvent) { a[d].attachEvent("onclick", function(o) { b.clickword(o) } .bind(this)) } } } } }; SpellCheck.prototype.clickword = function(g) { var k = ""; var d = ""; var b = this; if (g.target) { k = g.target["id"]; theName = g.target["id"].replace(/^sp[0-9]+sp/, "") } else { k = g.srcElement["id"]; theName = g.srcElement["id"].replace(/^sp[0-9]+sp/, "") } for (i = 0; i < this.resultsArray.length; i++) { if (this.resultsArray[i].word == theName) { var c; if (document.getElementById("cl" + k) == null) { newDiv = document.createElement("div"); newDiv.className = "correctlist"; newDiv.id = "cl" + k; for (j = 0; j < this.resultsArray[i].spellings.length; j++) { newSubDiv = document.createElement("div"); newSubDiv.innerHTML = this.resultsArray[i].spellings[j]; newSubDiv.onmouseover = function(l) { if (!l) { l = window.event } b.highlightme(l) }; newSubDiv.onclick = function() { b.select() }; newDiv.appendChild(newSubDiv) } newSubDiv = document.createElement("div"); newSubDiv.innerHTML = "Ignore"; newSubDiv.style.borderTop = "1px solid black"; newSubDiv.onmouseover = function(l) { if (!l) { l = window.event } b.highlightme(l) }; newSubDiv.onclick = function() { b.select() }; newDiv.appendChild(newSubDiv); this.resultsArea.innerHTML = ""; this.selected = -1; this.resultsArea.appendChild(newDiv); c = newDiv; var h = getTopLeftObj(c); var f = -15; var a = 45; if (!IE) { a -= this.rteWindow.pageYOffset } h.left = (sp_getMouseXY(g).x + f) + "px"; h.top = (sp_getMouseXY(g).y + a) + "px"; this.selectedmenu = c; this.showMenu = true } else { var e = document.getElementById("cl" + k); if (this.showMenu) { e.style.display = "none"; this.showMenu = false } else { e.style.display = "block"; this.showMenu = true } } } } }; SpellCheck.prototype.menuaction = function(a) { if (this.selectedmenu == null || !this.showMenu) { return true } var b; if (this.rteWindow.event) { b = a.keyCode } else { if (a.which) { b = a.which } } switch (b) { case 38: this.goUp(); if (a.which) { a.preventDefault() } return false; break; case 40: this.goDown(); if (a.which) { a.preventDefault() } return false; break; case 13: this.select(); if (a.which) { a.preventDefault() } else { a.returnValue = false } return false; break } return true }; SpellCheck.prototype.select = function() { if (this.selected == -1) { return } var c = this.selectedmenu; var e = c.id.replace(/^cl/, ""); var f = c.childNodes; var b = f[this.selected]; var a = this.rteWindow.document.getElementById(e); if (this.selected == (f.length - 1) && a) { var d = a.innerHTML } else { if (a) { var d = b.innerHTML } } if (a) { a.innerHTML = d; a.onclick = ""; a.style.background = ""; a.className = ""; a.id = "" } c.style.display = "none"; this.showMenu = false; if (this.sourceText.innerHTML.indexOf('class="spwrap"') == -1 && this.sourceText.innerHTML.indexOf("class=spwrap") == -1) { this.reset() } }; SpellCheck.prototype.removemarks = function() { var a = new RegExp("<span[^>]*spwrap[^>]*>([^<]*)</span>", ["gi"]); this.sourceText.innerHTML = this.sourceText.innerHTML.replace(a, "$1") }; SpellCheck.prototype.goDown = function() { var a = this.selectedmenu; var c = a.childNodes; if (c.length > 0 && this.selected < c.length - 1) { var b = c[++this.selected]; this.highlight(a, b) } }; SpellCheck.prototype.highlight = function(b, a) { for (var c = 0; c < b.childNodes.length; c++) { var d = b.childNodes[c]; if (d == a) { this.selected = c; d.className = "selected" } else { if (d.className == "selected") { d.className = "" } } } }; SpellCheck.prototype.highlightme = function(a) { var b; if (a.target) { b = a.target } else { b = a.srcElement } this.highlight(this.selectedmenu, b) }; SpellCheck.prototype.goUp = function() { var a = this.selectedmenu; var c = a.childNodes; if (c.length > 0 && this.selected > 0) { var b = c[--this.selected]; this.highlight(a, b) } }; function getTopLeftObj(el) { if (document.all) { var dimObj = el.style } else { if (document.layers) { var dimObj = eval("(document." + el_id + ")") } else { var dimObj = el.style } } return dimObj } function _wwidth() { if (window.innerWidth) { return window.innerWidth } if (document.documentElement && document.documentElement.clientWidth) { return document.documentElement.clientWidth } return document.body.clientWidth } function getWidth() { var a = _wwidth(); if (!a) { return 1024 } else { return parseInt(a) - 20 } } function sp_getMouseXY(c) { var b; var a; if (IE) { b = c.clientX; a = c.clientY } else { b = c.pageX; a = c.pageY } if (b < 0) { b = 0 } if (a < 0) { a = 0 } return { x: b, y: a} } SpellCheck.prototype.hideResults = function() { this.resultsArea.className = "noresults"; this.selected = -1; this.overResults = false }; function castspell() { SC_timer = setInterval(function() { if (SCtryCount > 30) { clearInterval(SC_timer); return } if (typeof rtewindow != "undefined") { if (typeof rtewindow.document != "undefined") { if (typeof rtewindow.document.body != "undefined") { var c = rtewindow.document.body; var b = document.getElementById("resultsdiv"); var a = document.getElementById("spellbutton"); if (c != null && b != null && a != null) { clearInterval(SC_timer); var d = new SpellCheck(c, b, a) } } } } SCtryCount++ }, 100) } function castspell2() { SC_timer22 = setInterval(function() { if (SCtryCount2 > 30) { clearInterval(SC_timer22); return } if (typeof rte_2window != "undefined") { if (typeof rte_2window.document != "undefined") { if (typeof rte_2window.document.body != "undefined") { var c = rte_2window.document.body; var b = document.getElementById("resultsdiv_02"); var a = document.getElementById("spellbutton2"); if (c != null && b != null && a != null) { clearInterval(SC_timer2); var d = new SpellCheck(c, b, a, rte_2window) } } } } SCtryCount2++ }, 100) } function addLoadEvent(a) { var b = window.onload; if (typeof window.onload != "function") { window.onload = a } else { window.onload = function() { if (b) { b() } a() } } } addLoadEvent(castspell); addLoadEvent(castspell2);