var debugMode=false;var isRichText=false;var allRTEs="";var currentRTE="";var selectionText="";var rng;var lastCommand;var maxLoops=20;var loopCnt=0;var baseUrl=window.parent.document.location.protocol+"//"+document.domain+"/";var embedVideoItems=0;var embedVideo=new Array();var imagesPath="";var includesPath="";var cssFile="";var ua=navigator.userAgent.toLowerCase();var isIE=((ua.indexOf("msie")!=-1)&&(ua.indexOf("opera")==-1)&&(ua.indexOf("webtv")==-1));var ieVersion=parseFloat(ua.substring(ua.indexOf("msie ")+5));var isGecko=(ua.indexOf("gecko")!=-1);var isSafari=(ua.indexOf("safari")!=-1);var isIphone=(ua.indexOf("iphone")!=-1);var webkitVersion=get_webkit_version();if(webkitVersion){webkitVersion=webkitVersion.major}else{webkitVersion=null}var isKonqueror=(ua.indexOf("konqueror")!=-1);var konquerorVersion=parseFloat(ua.substring(ua.indexOf("konqueror/")+10));var isOpera=(ua.indexOf("opera")!=-1);var isNetscape=(ua.indexOf("netscape")!=-1);var netscapeVersion=parseFloat(ua.substring(ua.lastIndexOf("/")+1));var toolbar1Enabled=true;var cmdInsertHTMLEnabled=true;var cmdCreateLinkEnabled=true;var cmdInsertImageEnabled=true;function initRTE(d,b,a){try{imagesPath=d;includesPath=b;cssFile=a;if(document.designMode){if(document.getElementById&&!isIE&&!isSafari&&!isKonqueror){isRichText=true;if(isNetscape&&netscapeVersion<8){cmdInsertHTMLEnabled=false}}else{if(isIE&&ieVersion>=5.5){isRichText=true}else{if(isSafari){if(!isIphone){if(webkitVersion>=420){isRichText=true}else{if(webkitVersion>=312){isRichText=true;toolbar1Enabled=false;cmdInsertImageEnabled=false;cmdInsertHTMLEnabled=false;cmdCreateLinkEnabled=false}}}}}}}if(isRichText){if(isIE){document.onmouseover=raiseButton;document.onmouseout=normalButton;document.onmousedown=lowerButton;document.onmouseup=raiseButton}}}catch(c){if(debugMode){alert(c)}}}function richTextEditor(a){this.rteID=a;this.html="";if(a=="rte1"){this.containerElem=$("add_profile_comment")}else{if(a=="rte2"){this.containerElem=$("send_message")}else{if(a=="rte3"){this.containerElem=$("message_reply")}else{if(a=="rte4"){this.containerElem=$("update_blackboard")}else{if(a=="rte5"){this.containerElem=$("upload_article")}else{if(a=="rte6"){this.containerElem=$("edit_article")}else{if(a=="rte7"||a=="rte9"){this.containerElem=$("add_comment")}else{if(a=="rte8"||a=="rte10"){this.containerElem=$("add_reply")}}}}}}}}this.build=build}function build(){with(this){if(isRichText){var cp='<iframe width="150" height="100" id="cp" src="'+includesPath+'palette.htm" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" style="visibility:hidden; position: absolute;"></iframe>';if(this.rteID=="rte1"||this.rteID=="rte2"){appendToBody(this.containerElem,cp)}else{this.containerElem.innerHTML=this.containerElem.innerHTML+cp}writeRichText(this);enableDesignMode(this.rteID,htmlDecode(this.html));if(isGecko){currentRTE=this.rteID;insertHTML("<br>");rteCommand(this.rteID,"undo")}}else{writePlainText(this)}}}function writePlainText(b){var a="";if(b.rteID=="rte1"){a+='<input type=hidden id=touserid name=touserid value="">';a+='<input type=hidden id=tousername name=tousername value="">';a+='<input type=hidden id=replytouserid name=replytouserid value="">';a+='<input type=hidden id=pid name=pid value="">';a+='<input type=hidden id=gid name=gid value="">';a+='<div style="text-align:left; font:12px Verdana, Arial, sans-serif; padding:0 3px 0 3px; color:#444">Please help us keep this website clean and nonsense free. In that respect please do NOT: thank people for the add, for the point, for the comment, etc. You deserved it! Abusing this simple rule might get your account closed.</div>'}else{if(b.rteID=="rte2"){a+='<input type=hidden id=touserid2 name=touserid value="">';a+='<div style="width:516px; text-align:left; font:12px Verdana, Arial, sans-serif; margin:3px">To: <span id=tousername2></span></div>';a+='<div style="width:516px; text-align:left; font:12px Verdana, Arial, sans-serif; margin:3px">Subject: <input type=text maxlength="66" name="subject" id="subject2" style="width:420px"></div>'}else{if(b.rteID=="rte3"){a+="<h2>Your Reply:</h2>"}}}a+='<textarea name="'+b.rteID+'" id="hdn'+b.rteID+'" style="width:515px; height:260px">'+b.html+"</textarea>";if(b.rteID=="rte1"||b.rteID=="rte2"){a+='<div id="panel_buttons" style="position:absolute; left:4px; bottom:6px">';a+='<button class="button_black" onClick="rteSubmit(\''+b.rteID+"')\">";if(b.rteID=="rte1"){a+="ADD"}else{a+="SEND"}a+="</button>&nbsp;";a+='<button class="button_black" onClick="closePanel(';if(b.rteID=="rte1"){a+="'panel1'"}else{if(b.rteID=="rte2"){a+="'panel2'"}}a+=')">close</button>';a+="</div>";a+='<div id="panel_loading" class="hid" style="position:absolute; left:10px; bottom:8px">sending ...</div>'}else{if(b.rteID=="rte3"||b.rteID=="rte4"||b.rteID=="rte7"||b.rteID=="rte8"||b.rteID=="rte9"||b.rteID=="rte10"){if(b.rteID=="rte3"||b.rteID=="rte4"){var d="SEND";var c="sending ..."}else{var d="ADD COMMENT";var c="adding ..."}a+='<div id="panel_buttons" class="alignL" style="width:514px; padding:5px; margin: 0 auto"><button class="button_black" onClick="rteSubmit(\''+b.rteID+"')\">"+d+"</button></div>";a+='<div id="panel_loading" class="hid" style="width:514px; padding:5px; text-align:left; margin: 0 auto">'+c+"</div>"}}appendToBody(b.containerElem,a)}function rteSubmit(b){$("panel_buttons").className="hid";$("panel_loading").className="bg1";updateRTEs();for(var a=0;a<embedVideoItems;a++){$("hdn"+b).value=$("hdn"+b).value.replace(new RegExp('<br><img id="embed_'+a+'" src="/javascript/rte/images/videoreplacement.gif"><br>'),embedVideo[a]);$("hdn"+b).value=$("hdn"+b).value.replace(new RegExp('<br><img id="embed_'+a+'" src="/javascript/rte/images/videoreplacement.gif">'),embedVideo[a]);$("hdn"+b).value=$("hdn"+b).value.replace(new RegExp('<img id="embed_'+a+'" src="/javascript/rte/images/videoreplacement.gif"><br>'),embedVideo[a]);$("hdn"+b).value=$("hdn"+b).value.replace(new RegExp('<img id="embed_'+a+'" src="/javascript/rte/images/videoreplacement.gif">'),embedVideo[a]);$("hdn"+b).value=$("hdn"+b).value.replace(new RegExp("<BR><IMG id=embed_"+a+' src="/javascript/rte/images/videoreplacement.gif"><BR>'),embedVideo[a]);$("hdn"+b).value=$("hdn"+b).value.replace(new RegExp("<BR><IMG id=embed_"+a+' src="/javascript/rte/images/videoreplacement.gif">'),embedVideo[a]);$("hdn"+b).value=$("hdn"+b).value.replace(new RegExp("<IMG id=embed_"+a+' src="/javascript/rte/images/videoreplacement.gif"><BR>'),embedVideo[a]);$("hdn"+b).value=$("hdn"+b).value.replace(new RegExp("<IMG id=embed_"+a+' src="/javascript/rte/images/videoreplacement.gif">'),embedVideo[a]);$("hdn"+b).value=$("hdn"+b).value.replace(new RegExp("<BR><IMG id=embed_"+a+' src="http://www.heaven666.org/javascript/rte/images/videoreplacement.gif"><BR>'),embedVideo[a]);$("hdn"+b).value=$("hdn"+b).value.replace(new RegExp("<BR><IMG id=embed_"+a+' src="http://www.heaven666.org/javascript/rte/images/videoreplacement.gif">'),embedVideo[a]);$("hdn"+b).value=$("hdn"+b).value.replace(new RegExp("<IMG id=embed_"+a+' src="http://www.heaven666.org/javascript/rte/images/videoreplacement.gif"><BR>'),embedVideo[a]);$("hdn"+b).value=$("hdn"+b).value.replace(new RegExp("<IMG id=embed_"+a+' src="http://www.heaven666.org/javascript/rte/images/videoreplacement.gif">'),embedVideo[a]);$("hdn"+b).value=$("hdn"+b).value.replace(new RegExp("<BR><IMG id=embed_"+a+' src="http://heaven666.org/javascript/rte/images/videoreplacement.gif"><BR>'),embedVideo[a]);$("hdn"+b).value=$("hdn"+b).value.replace(new RegExp("<BR><IMG id=embed_"+a+' src="http://heaven666.org/javascript/rte/images/videoreplacement.gif">'),embedVideo[a]);$("hdn"+b).value=$("hdn"+b).value.replace(new RegExp("<IMG id=embed_"+a+' src="http://heaven666.org/javascript/rte/images/videoreplacement.gif"><BR>'),embedVideo[a]);$("hdn"+b).value=$("hdn"+b).value.replace(new RegExp("<IMG id=embed_"+a+' src="http://heaven666.org/javascript/rte/images/videoreplacement.gif">'),embedVideo[a])}if(b=="rte1"){addProfileComment()}else{if(b=="rte2"){sendMessage()}else{if(b=="rte3"){if($("hdnrte3").value.length<=0){Alert.show(undefined,"Error","You are not allowed to send an empty message",false);$("panel_buttons").className="bg1 alignL";$("panel_loading").className="hid"}else{if($("hdnrte3").value.length>65535){Alert.show(undefined,"Error","Your message is too long. 65535 is the max number of characters allowed",false);$("panel_buttons").className="bg1 alignL";$("panel_loading").className="hid"}else{$("message_body").value=$("hdnrte3").value;document.reply_message.submit()}}}else{if(b=="rte4"){if($("hdnrte4").value.length>10000){Alert.show(undefined,"Error","Your blackboard code is too long. 10000 is the max number of characters allowed",false);$("panel_buttons").className="bg1 alignL";$("panel_loading").className="hid"}else{$("field26").value=$("hdnrte4").value;document.blackboard_code.submit()}}else{if(b=="rte7"){if($("hdnrte7").value.length<=0){Alert.show(undefined,"Error","You are not allowed to add an empty comment",false);$("panel_buttons").className="bg1 alignL";$("panel_loading").className="hid"}else{if($("hdnrte7").value.length>10000){Alert.show(undefined,"Error","Your message is too long. 10000 is the max number of characters allowed",false);$("panel_buttons").className="bg1 alignL";$("panel_loading").className="hid"}else{$("comment").value=$("hdnrte7").value;addPost("adv")}}}else{if(b=="rte8"){if($("hdnrte8").value.length<=0){Alert.show(undefined,"Error","You are not allowed to add an empty comment",false);$("panel_buttons").className="bg1 alignL";$("panel_loading").className="hid"}else{if($("hdnrte8").value.length>10000){Alert.show(undefined,"Error","Your message is too long. 10000 is the max number of characters allowed",false);$("panel_buttons").className="bg1 alignL";$("panel_loading").className="hid"}else{$("reply").value=$("hdnrte8").value;replyPost("adv")}}}else{if(b=="rte9"){if($("hdnrte9").value.length<=0){Alert.show(undefined,"Error","You are not allowed to add an empty comment",false);$("panel_buttons").className="bg1 alignL";$("panel_loading").className="hid"}else{if($("hdnrte9").value.length>5000){Alert.show(undefined,"Error","Your message is too long. 5000 is the max number of characters allowed",false);$("panel_buttons").className="bg1 alignL";$("panel_loading").className="hid"}else{$("comment").value=$("hdnrte9").value;addComment("adv")}}}else{if(b=="rte10"){if($("hdnrte10").value.length<=0){Alert.show(undefined,"Error","You are not allowed to add an empty comment",false);$("panel_buttons").className="bg1 alignL";$("panel_loading").className="hid"}else{if($("hdnrte10").value.length>5000){Alert.show(undefined,"Error","Your message is too long. 5000 is the max number of characters allowed",false);$("panel_buttons").className="bg1 alignL";$("panel_loading").className="hid"}else{$("reply").value=$("hdnrte10").value;replyComment("adv")}}}}}}}}}}}function writeRichText(a){try{if(allRTEs.length>0){allRTEs+=";"}allRTEs+=a.rteID;html="";if(a.rteID=="rte1"){html+='<input type=hidden id=touserid name=touserid value="">';html+='<input type=hidden id=tousername name=tousername value="">';html+='<input type=hidden id=replytouserid name=replytouserid value="">';html+='<input type=hidden id=pid name=pid value="">';html+='<input type=hidden id=gid name=gid value="">';html+='<div style="text-align:left; font:12px Verdana, Arial, sans-serif; padding:0 3px 0 3px; color:#444">Please help us keep this website clean and nonsense free. In that respect please do NOT: thank people for the add, for the point, for the comment, etc. You deserved it! Abusing this simple rule might get your account closed.</div>'}else{if(a.rteID=="rte2"){html+='<input type=hidden id=touserid2 name=touserid value="">';html+='<div style="width:516px; text-align:left; font:12px Verdana, Arial, sans-serif; margin:3px">To: <span id=tousername2></span></div>';html+='<div style="width:516px; text-align:left; font:12px Verdana, Arial, sans-serif; margin:3px">Subject: <input type=text maxlength="66" name="subject" id="subject2" style="width:420px"></div>'}else{if(a.rteID=="rte3"){html+="<h2>Your Reply:</h2>"}}}html+="<table id=contain_"+a.rteID+' style="visibility:visible; width:516px; text-align:left; margin:0 auto" cellspacing="0">';html+="<tr><td>";html+='<table class="toolbar" cellpadding="0" cellspacing="0" id="toolbar1_'+a.rteID+'" width="100%">';html+="<tr>";if(toolbar1Enabled){html+="<td>";html+='<select id="fontname_'+a.rteID+'" onchange="selectFont(\''+a.rteID+"', this.id)\">";html+='<option value="Font" selected>[Font]</option>';html+='<option value="Arial, Helvetica, sans-serif">Arial</option>';html+='<option value="Courier New, Courier, mono">Courier New</option>';html+='<option value="Times New Roman, Times, serif">Times New Roman</option>';html+='<option value="Verdana, Arial, Helvetica, sans-serif">Verdana</option>';html+="</select>";html+="</td><td>";html+='<select id="fontsize_'+a.rteID+'" onchange="selectFont(\''+a.rteID+"', this.id)\">";html+='<option value="Size">[Size]</option>';html+='<option value="1">1</option>';html+='<option value="2">2</option>';html+='<option value="3">3</option>';html+='<option value="4">4</option>';html+='<option value="5">5</option>';html+='<option value="6">6</option>';html+='<option value="7">7</option>';html+="</select>";html+="</td>"}html+='<td><img src="http://static.networkpiece.com/c/pixel.gif" class="rteImage rteBold" alt="Bold" title="Bold" onmousedown="rteCommand(\''+a.rteID+"', 'bold')\"></td>";html+='<td><img src="http://static.networkpiece.com/c/pixel.gif" class="rteImage rteItalic" alt="Italic" title="Italic" onmousedown="rteCommand(\''+a.rteID+"', 'italic')\"></td>";html+='<td><img src="http://static.networkpiece.com/c/pixel.gif" class="rteImage rteUnderline" alt="Underline" title="Underline" onmousedown="rteCommand(\''+a.rteID+"', 'underline')\"></td>";html+='<td><div id="forecolor_'+a.rteID+'"><img src="http://static.networkpiece.com/c/pixel.gif" class="rteImage rteForecolor" alt="Text Color" title="Text Color" onmousedown="dlgColorPalette(\''+a.rteID+"', 'forecolor', ''); return false;\"></div></td>";html+='<td><div id="hilitecolor_'+a.rteID+'"><img src="http://static.networkpiece.com/c/pixel.gif" class="rteImage rteHilitecolor" alt="Background Color" title="Background Color" onmousedown="dlgColorPalette(\''+a.rteID+"', 'hilitecolor', ''); return false;\"></div></td>";html+='<td><img src="http://static.networkpiece.com/c/pixel.gif" class="rteImage rteLeft_just" alt="Align Left" title="Align Left" onmousedown="rteCommand(\''+a.rteID+"', 'justifyleft')\"></td>";html+='<td><img src="http://static.networkpiece.com/c/pixel.gif" class="rteImage rteCenter" alt="Center" title="Center" onmousedown="rteCommand(\''+a.rteID+"', 'justifycenter')\"></td>";html+='<td><img src="http://static.networkpiece.com/c/pixel.gif" class="rteImage rteRight_just" alt="Align Right" title="Align Right" onmousedown="rteCommand(\''+a.rteID+"', 'justifyright')\"></td>";if(cmdInsertHTMLEnabled||cmdCreateLinkEnabled){html+='<td><img src="http://static.networkpiece.com/c/pixel.gif" id=hyperLinkButton class="rteImage rteCreatelink" alt="Insert Link" title="Insert Link" onmousedown="dlgInsertLink(\''+a.rteID+"')\"></td>"}if(cmdInsertImageEnabled){html+='<td><img src="http://static.networkpiece.com/c/pixel.gif" id=addImageButton class="rteImage rteInsertimage" src="'+imagesPath+'insertimage.gif" alt="Add Image" title="Add Image" onmousedown="addImage(\''+a.rteID+"')\"></td>";html+='<td><img src="http://static.networkpiece.com/c/pixel.gif" id=embedVideoButton class="rteImage rteInsertvideo" alt="Embed Video" title="Embed Video" onmousedown="dlgEmbedVideo(\''+a.rteID+"')\"></td>"}html+='<td width="100%"></td>';html+="</tr>";html+="</table>";html+="</td>";html+="</tr>";html+="</table>";html+='<input type="hidden" id="hdn'+a.rteID+'" name="hdn'+a.rteID+'" value="">';html+='<iframe id="'+a.rteID+'" name="'+a.rteID+'" src="'+includesPath+'blank.htm" frameborder="0" style="visibility:visible; width:514px; height:260px; margin: 0; padding: 0; border: 1px solid #000;"></iframe>';if(a.rteID=="rte1"||a.rteID=="rte2"){html+='<div id="panel_buttons" style="position:absolute; left:4px; bottom:6px">';html+='<button class="button_black" onClick="rteSubmit(\''+a.rteID+"')\">";if(a.rteID=="rte1"){html+="ADD"}else{html+="SEND"}html+="</button>&nbsp;";html+='<button class="button_black" onClick="closePanel(';if(a.rteID=="rte1"){html+="'panel1'"}else{if(a.rteID=="rte2"){html+="'panel2'"}}html+=')">close</button>';html+="</div>";html+='<div id="panel_loading" class="hid" style="position:absolute; left:10px; bottom:8px">sending ...</div>'}else{if(a.rteID=="rte3"||a.rteID=="rte4"||a.rteID=="rte7"||a.rteID=="rte8"||a.rteID=="rte9"||a.rteID=="rte10"){if(a.rteID=="rte3"||a.rteID=="rte4"){var c="SEND";var b="sending ..."}else{var c="ADD COMMENT";var b="adding ..."}html+='<div id="panel_buttons" class="alignL" style="width:514px; padding:5px; margin: 0 auto"><button class="button_black" onClick="rteSubmit(\''+a.rteID+"')\">"+c+"</button></div>";html+='<div id="panel_loading" class="hid" style="width:514px; padding:5px; text-align:left; margin: 0 auto">'+b+"</div>"}}appendToBody(a.containerElem,html)}catch(d){if(debugMode){alert(d)}}}function enableDesignMode(d,c){try{if(cssFile.length>0){var a='<style type="text/css">@import url('+cssFile+");</style>\n"}else{var a='<style type="text/css">\n';a+="body {\n";a+="	background: #FFF;\n";a+="}\n";a+="</style>\n"}var b='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n';b+='<html id="'+d+'" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\n';b+="<head>\n";b+='<meta http-equiv="content-type" content="text/html; charset=UTF-8" />\n';b+='<base href="'+baseUrl+'" />\n';b+=a;b+="</head>\n";b+='<body style="margin: 0; padding: 0;">\n';b+=c+"\n";b+="</body>\n";b+="</html>";var h=$(d);try{if(isGecko){h.contentDocument.designMode="on";try{var f=h.contentWindow.document;f.open("text/html","replace");f.write(b);f.close();f.addEventListener("keypress",geckoKeyPress,true)}catch(g){alert("Error preloading content.")}loopCnt=0}else{if(h.contentWindow){try{var f=h.contentWindow.document;f.open("text/html","replace");f.write(b);f.close();if(isIE){f.attachEvent("onkeypress",evt_ie_keypress)}}catch(g){alert("Error preloading content.")}f.designMode="on";loopCnt=0}else{var f=h.document;f.open("text/html","replace");f.write(b);f.close();if(isIE){f.attachEvent("onkeypress",evt_ie_keypress)}f.designMode="on";loopCnt=0}}}catch(g){if(loopCnt<maxLoops){setTimeout("enableDesignMode('"+d+"', '"+c+"');",100);loopCnt+=1}else{alert("Error enabling designMode.")}}}catch(g){if(debugMode){alert(g)}}}function updateRTE(a){try{if(isRichText){setHiddenVal(a)}else{return}}catch(b){if(debugMode){alert(b)}}}function updateRTEs(){try{if(allRTEs!=""){var b=allRTEs.split(";");for(var a=0;a<b.length;a++){updateRTE(b[a])}}}catch(c){if(debugMode){alert(c)}}}function rteCommand(a,f,b){try{var d=$(a);if(d.contentWindow){d.contentWindow.focus();d.contentWindow.document.execCommand(f,false,b)}else{d.document.focus();d.document.execCommand(f,false,b)}loopCnt=0;return false}catch(c){if(debugMode){alert(c)}if(loopCnt<maxLoops){setTimeout("rteCommand('"+a+"', '"+f+"', '"+b+"');",100);loopCnt+=1}else{alert("Error executing command.")}}}function dlgColorPalette(b,h){try{setRange(b);var g=$(h+"_"+b);var c=findPosX(g,b);var a=findPosY(g,b)+g.offsetHeight;var d=$("cp");d.style.left=c+"px";d.style.top=a+"px";if((h==lastCommand)&&(b==currentRTE)){if(d.style.visibility=="hidden"){showHideElement("cp","show")}else{showHideElement("cp","hide")}}else{showHideElement("cp","show")}lastCommand=h;currentRTE=b}catch(f){if(debugMode){alert(f)}}}function dlgInsertLink(b){try{if(cmdInsertHTMLEnabled){setRange(b);currentRTE=b;Alert.show($("hyperLinkButton"),"Insert Hyperlink",'<table cellspacing="4" border="0" style="text-align:center; margin:0 auto"><tr><td align="right">URL:</td><td><input name="url" type="text" id="url" maxlength="250" style="width:250px"></td></tr><tr><td align="right">Text:</td><td><input name="linkText" type="text" id="linkText" style="width:250px"></td></tr></table>');$("hyperLinkButton").onAlertOk=function(f){if($("url").value.length>3&&$("linkText").value.length>0){var d='<a href="'+$("url").value+'" target="_blank">'+$("linkText").value+"</a>&nbsp;";insertHTML(d)}}}else{var a=prompt("Enter URL","http://");rteCommand(b,"createlink",a)}}catch(c){if(debugMode){alert(c)}}}function dlgEmbedVideo(a){try{setRange(a);currentRTE=a;Alert.show($("embedVideoButton"),"Embed Video",'Enter Video <b>Embed Code</b> (not restricted to YouTube):<br><input name="vidobject" type="text" id="vidobject" maxlength="1000" style="width:300px; font-size:12px">');$("embedVideoButton").onAlertOk=function(d){if($("vidobject").value.length>100){embedVideo[embedVideoItems]=$("vidobject").value;var c='<br><img id="embed_'+embedVideoItems+'" src="/javascript/rte/images/videoreplacement.gif"><br>';embedVideoItems++;insertHTML(c)}}}catch(b){if(debugMode){alert(b)}}}function setColor(a){try{var b=currentRTE;if(isSafari||isIE){if(lastCommand=="hilitecolor"){lastCommand="backcolor"}if(!isSafari){rng.select()}}rteCommand(b,lastCommand,a);showHideElement("cp","hide")}catch(c){if(debugMode){alert(c)}}}function addImage(a){try{Alert.show($("addImageButton"),"Insert Image",'Enter Image URL:<br><input type="text" id="imageUrl" name="imageUrl" style="width:275px">',true);$("addImageButton").onAlertOk=function(c){if($("imageUrl").value){rteCommand(a,"InsertImage",$("imageUrl").value)}}}catch(b){if(debugMode){alert(b)}}}function findPosX(b,a){var c=0;if(b.offsetParent.offsetParent.offsetParent){c=b.offsetLeft;while(b.offsetParent.offsetParent){c+=b.offsetLeft;b=b.offsetParent}}return c}function findPosY(c,a){var b=0;if(c.offsetParent.offsetParent.offsetParent){b=c.offsetTop;while(c.offsetParent.offsetParent){b+=c.offsetTop;c=c.offsetParent}}return b}function selectFont(c,b){try{var a=$(b).selectedIndex;if(a!=0){var d=$(b).options[a].value;var f=b.replace("_"+c,"");rteCommand(c,f,d);$(b).selectedIndex=$(b).selectedIndex}}catch(g){if(debugMode){alert(g)}}}function insertHTML(a){try{if(document.all&&!isOpera){rng.pasteHTML(a);rng.collapse(false);rng.select()}else{rteCommand(currentRTE,"inserthtml",a)}}catch(b){if(debugMode){alert(b)}}}function showHideElement(a,c){try{if($(a)){a=$(a);if(c=="show"){if(a.id.substring(0,7)=="toolbar"){a.style.display="block"}a.style.visibility="visible"}else{if(c=="hide"){if(a.id.substring(0,7)=="toolbar"){a.style.display="none"}a.style.visibility="hidden"}}}}catch(b){if(debugMode){alert(b)}}}function setRange(a){try{var d=$(a);if(d.contentWindow){var b=d.contentWindow.document;d.contentWindow.focus()}else{var b=d.document;b.focus()}if(document.all){sel=b.selection;rng=sel.createRange();selectionText=rng.text.toString()}else{if(window.getSelection){rng=b.createRange();selectionText=b.getSelection()}}}catch(c){if(debugMode){alert(c)}}}function stripHTML(a){try{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}catch(c){if(debugMode){alert(c)}}}function trim(b){try{b=b.replace(/^\s+/g,"");return b.replace(/\s+$/g,"")}catch(a){if(debugMode){alert(a)}}}function cleanWordContent(a){a=String(a).replace(/<\\?\?xml[^>]*>/g,"");a=String(a).replace(/<\/?o:p[^>]*>/g,"");a=String(a).replace(/<\/?v:[^>]*>/g,"");a=String(a).replace(/<\/?o:[^>]*>/g,"");return a}function setHiddenVal(b){try{var d=$("hdn"+b);if(d.value==null){d.value=""}var a=getHtmlSrc(b);a=cleanWordContent(a);if(stripHTML(a.replace("&nbsp;"," "))==""&&a.toLowerCase().search("<hr")==-1&&a.toLowerCase().search("<img")==-1){a=""}d.value=a}catch(c){if(debugMode){alert(c)}}}function getHtmlSrc(a){try{var d=document.getElementById(a);if(d.contentWindow){var b=d.contentWindow.document}else{var b=d.document}return b.body.innerHTML}catch(c){if(debugMode){alert(c)}}}function setHtmlSrc(c,b){try{var g=document.getElementById(c);if(g.contentWindow){var d=g.contentWindow.document}else{var d=g.document}if(isIE){var a=htmlEncode(b);a=a.replace("%3CP%3E%0D%0A%3CHR%3E","%3CHR%3E");a=a.replace("%3CHR%3E%0D%0A%3C/P%3E","%3CHR%3E");d.body.innerHTML=htmlDecode(a)}else{b=strip160(b);d.body.innerHTML=b}}catch(f){if(debugMode){alert(f)}}}function strip160(a){newString="";for(i=0;i<a.length;i++){if(a.charCodeAt(i)==160){newString=newString+" "}else{newString=newString+a.charAt(i)}}return newString}function htmlEncode(a){return a.replace(/\&/ig,"&amp;").replace(/\</ig,"&lt;").replace(/\>/ig,"&gt;").replace(/\"/ig,"&quot;")}function htmlDecode(a){return a.replace(/\&amp\;/ig,"&").replace(/\&lt\;/ig,"<").replace(/\&gt\;/ig,">").replace(/\&quot\;/ig,'"')}function parse_webkit_version(a){try{var d=a.split(".");var b=(a[a.length-1]=="+");if(b){var c="+"}else{var c=parseInt(d[1]);if(isNaN(c)){c=""}}return{major:parseInt(d[0]),minor:c,is_nightly:b}}catch(f){if(debugMode){alert(f)}}}function get_webkit_version(){try{var b=new RegExp("\\(.*\\) AppleWebKit/(.*) \\((.*)");var c=b.exec(navigator.userAgent);if(c){var a=parse_webkit_version(c[1]);return{major:a.major,minor:a.minor,is_nightly:a.is_nightly}}else{return false}}catch(d){}}function geckoKeyPress(a){try{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){rteCommand(c,d);a.preventDefault();a.stopPropagation()}}}catch(f){if(debugMode){alert(f)}}}function evt_ie_keypress(a){try{ieKeyPress(a,rte)}catch(b){if(debugMode){alert(b)}}}function ieKeyPress(a,c){try{var b=(a.which||a.charCode||a.keyCode);var d=String.fromCharCode(b).toLowerCase()}catch(f){if(debugMode){alert(f)}}}function raiseButton(b){try{var a=window.event.srcElement;className=a.className;if(className=="rteImage"||className=="rteImageLowered"){a.className="rteImageRaised"}}catch(b){if(debugMode){alert(b)}}}function normalButton(b){try{var a=window.event.srcElement;className=a.className;if(className=="rteImageRaised"||className=="rteImageLowered"){a.className="rteImage"}}catch(b){if(debugMode){alert(b)}}}function lowerButton(b){try{var a=window.event.srcElement;className=a.className;if(className=="rteImage"||className=="rteImageRaised"){a.className="rteImageLowered"}}catch(b){if(debugMode){alert(b)}}};