Function.prototype.bind=function(object){var method=this;return function(){return method.apply(object,arguments);};};var userAgent=navigator.userAgent.toLowerCase();var is_opera=(userAgent.indexOf('opera')!=-1);var is_saf=((userAgent.indexOf('applewebkit')!=-1)||(navigator.vendor=="Apple Computer, Inc."));var is_webtv=(userAgent.indexOf('webtv')!=-1);var is_ie=((userAgent.indexOf('msie')!=-1)&&(!is_opera)&&(!is_saf)&&(!is_webtv));var is_ie4=((is_ie)&&(userAgent.indexOf("msie 4.")!=-1));var is_moz=((navigator.product=='Gecko')&&(!is_saf));var is_kon=(userAgent.indexOf('konqueror')!=-1);var is_ns=((userAgent.indexOf('compatible')==-1)&&(userAgent.indexOf('mozilla')!=-1)&&(!is_opera)&&(!is_webtv)&&(!is_saf));var is_ns4=((is_ns)&&(parseInt(navigator.appVersion,10)==4));var fontoptions=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 sizeoptions=new Array(1,2,3,4,5,6,7);var coloroptions=Array(["#000000","Black"],["#9C502C","Sienna"],["#556A2F","DarkOliveGreen"],["#006400","DarkGreen"],["#483D8B","DarkSlateBlue"],["#000080","Navy"],["#4B0082","Indigo"],["#2F4F4F","DarkSlateGray"],["#8B0000","DarkRed"],["#FF8C00","DarkOrange"],["#808000","Olive"],["#008000","Green"],["#008080","Teal"],["#0000FF","Blue"],["#708090","SlateGray"],["#696969","DimGray"],["#FF0000","Red"],["#F4A460","SandyBrown"],["#9ACD32","YellowGreen"],["#2E8B57","SeaGreen"],["#48D1CC","MediumTurquoise"],["#4169E1","RoyalBlue"],["#800080","Purple"],["#C0C0C0","Silver"],["#FF00FF","Magenta"],["#FFA500","Orange"],["#FFFF00","Yellow"],["#00FF00","Lime"],["#00FFFF","Cyan"],["#00BFFF","DeepSkyBlue"],["#9932CC","DarkOrchid"],["#DDDDCC","UGRocks"],["#FFC0CB","Pink"],["#F5DEB3","Wheat"],["#FFFACD","LemonChiffon"],["#98FB98","PaleGreen"],["#AFEEEE","PaleTurquoise"],["#ADD8E6","LightBlue"],["#DDA0DD","Plum"],["#FFFFFF","White"]);var smilies=Array("smile|15x15|:)","frown|15x15|:(","biggrin|15x15|:D","wink|15x15|;)","tongue|15x15|:p","cool|15x15","rolleyes|15x15","mad|15x15","eek|15x15","redface|15x15|:o","golfclap|23x15","wtf|28x17","confused|15x15","liplick|15x15","nonono|22x19|:no:","baby|15x18","sad|15x15","grrr|16x16","idea|15x32","haha|15x17","wavey|25x29","angry|16x16","heart|16x15","bowdown|27x22|:down:","headbang|47x16","kiss|34x15","kissass|45x25","cheers|60x40","crying|16x16|:cry:","rant|31x20","bash|33x26","dance|32x32","finger|37x15","puke|64x32","devil|15x20","peace1|28x20|:peace:");var styles={imagebutton:"imagebutton",select:"select",font_option:"ofont",size_option:"ofont",color_option:"ocolor",smile:"osmile"};if(!is_ie)
{styles.select="select_op";}
var defaults={color:"#DDDDCC",font:"Verdana",size:2};function WYSIWYG_editor(obj_name)
{var is_opera=(userAgent.indexOf('opera')!=-1);var is_ie=((userAgent.indexOf('msie')!=-1)&&(!is_opera)&&(!is_saf)&&(!is_webtv));var is_moz=((navigator.product=='Gecko')&&(!is_saf));this.context_controls=["justifyleft","justifyright","justifycenter","bold","italic","underline","insertorderedlist","insertunorderedlist"];var ugphrase={"wysiwyg_please_wait":"Please wait for the WYSIWYG editor to finish loading...","wysiwyg_initialized":"WYSIWYG Editor initialized for %1$s in %2$s seconds.","wysiwyg_command_invalid":"This command is invalid or not implemented.","moz_must_select_text":"Mozilla requires that you must select some text for this function to work","moz_edit_config_file":"You need to edit your Mozilla config file to allow this action.","enter_tag_option":"Please enter the option for your %1$s tag:","must_select_text_to_use":"You must select some text to use this function.","browser_is_safari_no_wysiwyg":"","enter_option_x_tag":"Enter the option for the [%1$s] tag:","enter_text_to_be_formatted":"Enter the text to be formatted","enter_link_text":"Enter the text to be displayed for the link (optional):","enter_list_type":"What type of list do you want? Enter '1' for a numbered list, enter 'a' for an alphabetical list, or leave blank for a list with bullet points:","enter_list_item":"Enter a list item.\nLeave the box empty or press 'Cancel' to complete the list:","must_enter_subject":"You must enter a title / subject!","message_too_short":"The message you have entered is too short. Please lengthen your message to at least %1$s characters.","enter_link_url":"Please enter the URL of your link:","enter_image_url":"Please enter the URL of your image:","enter_email_link":"Please enter the email address for the link:"};this.groups={justify:["cmd_justifyleft","cmd_justifyright","cmd_justifycenter"],list:["cmd_insertorderedlist","cmd_insertunorderedlist"],colors:[],sizes:[],fonts:[]};this.popup_open=false;this.more_smilies=false;this.fontoptions=Array();this.sizeoptions=Array();this.coloroptions=Array();this.smilies=Array();this.styles={};this.format={};this.initialized=false;this.cur_height=0;this.limit_height=0;this.obj_name=obj_name;this.controla=false;var obj=this;var htmlwindow=new Object();var htmlbox=new Object();var css_off=false;this.onchange=null;this.set_editor_style=function()
{if(is_ie)
{htmlbox.createStyleSheet().cssText=' p { margin: 0px; }';htmlbox.body.className='wysiwyg';}};function moz_get_html()
{var sel=htmlwindow.getSelection();var range=null;htmlwindow.focus();range=sel?sel.getRangeAt(0):htmlbox.createRange();var root=range.cloneContents();return moz_read_nodes(root,false);}
function moz_read_nodes(root,toptag)
{var html="";var moz_check=/_moz/i;switch(root.nodeType)
{case Node.ELEMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:{var closed;if(toptag)
{closed=!root.hasChildNodes();html='<'+root.tagName.toLowerCase();var attr=root.attributes;for(i=0;i<attr.length;++i)
{var a=attr.item(i);if(!a.specified||a.name.match(moz_check)||a.value.match(moz_check))
{continue;}
html+=" "+a.name.toLowerCase()+'="'+a.value+'"';}
html+=closed?" />":">";}
for(var i=root.firstChild;i;i=i.nextSibling)
{html+=moz_read_nodes(i,true);}
if(toptag&&!closed)
{html+="</"+root.tagName.toLowerCase()+">";}}
break;case Node.TEXT_NODE:{html=htmlspecialchars(root.data);}
break;}
return html;}
function moz_insert_node_at_selection(text)
{var sel=htmlwindow.getSelection();var range=null;htmlwindow.focus();range=sel?sel.getRangeAt(0):htmlbox.createRange();sel.removeAllRanges();range.deleteContents();var node=range.startContainer;var pos=range.startOffset;switch(node.nodeType)
{case Node.ELEMENT_NODE:{if(text.nodeType==Node.DOCUMENT_FRAGMENT_NODE)
{selNode=text.firstChild;}
else
{selNode=text;}
node.insertBefore(text,node.childNodes[pos]);add_range(selNode);}
break;case Node.TEXT_NODE:{if(text.nodeType==Node.TEXT_NODE)
{var text_length=pos+text.length;node.insertData(pos,text.data);range=htmlbox.createRange();range.setEnd(node,text_length);range.setStart(node,text_length);sel.addRange(range);}
else
{node=node.splitText(pos);var selNode;if(text.nodeType==Node.DOCUMENT_FRAGMENT_NODE)
{selNode=text.firstChild;}
else
{selNode=text;}
node.parentNode.insertBefore(text,node);add_range(selNode);}}
break;}}
function add_range(node)
{htmlwindow.focus();var sel=htmlwindow.getSelection();var range=null;range=htmlbox.createRange();range.selectNodeContents(node);sel.removeAllRanges();sel.addRange(range);}
function show_popup(menu_name)
{obj.close_popups();obj.popup_open=menu_name;document.getElementById('popup_'+menu_name).style.display="";document.getElementById('popup_'+menu_name).style.top=getOffsetTop(document.getElementById('sel_'+menu_name))+document.getElementById('sel_'+menu_name).offsetHeight-1;document.getElementById('popup_'+menu_name).style.left=getOffsetLeft(document.getElementById('sel_'+menu_name));}
this.check_select_all=function()
{};function check_return(e)
{}
function insert_smilie(elm,smilieid)
{if(typeof(document.selection)!="undefined"&&document.selection.type!="Text"&&document.selection.type!="None")
{document.selection.clear();}
htmlwindow.focus();try
{if(is_ie)
{var smilieHTML='<img src="'+elm.getElementsByTagName("img")[0].src+'" border="0" alt="'+elm.getElementsByTagName("img")[0].alt+'" align=absmiddle>';htmlbox.selection.createRange().pasteHTML(smilieHTML);}
else
{htmlbox.execCommand('InsertImage',false,elm.getElementsByTagName("img")[0].src);}}
catch(e){}}
function do_format(formatcommand,showinterface,extraparameters)
{if(!is_ie)
{htmlwindow.focus();}
else
{htmlwindow.setActive();}
try{htmlbox.execCommand(formatcommand,showinterface,extraparameters);}
catch(e)
{switch(formatcommand.toLowerCase())
{case"cut":case"copy":case"paste":{alert(ugphrase["moz_edit_config_file"]);}
break;default:{alert(formatcommand);}
break;}}
if(!is_ie)
{htmlwindow.focus();}}
this.set_context=function()
{if(is_opera)
{document.getElementById("htmlbox").focus();}
var qcs;var elm;for(var i=0;i<this.context_controls.length;i++)
{if(!is_ie&&(this.context_controls[i]=="insertunorderedlist"||this.context_controls[i]=="insertorderedlist"))
{continue;}
qcs=htmlbox.queryCommandState(this.context_controls[i]);elm=document.getElementById('cmd_'+this.context_controls[i]);if(qcs!=elm.state)
{elm.state=qcs;elm.className=this.styles[elm.type]+(elm.state?"_active":"");}}
var fontcontext=htmlbox.queryCommandValue("fontname");if(fontcontext===null)
{fontcontext="";}
var sizecontext=htmlbox.queryCommandValue("fontsize");if(sizecontext===null)
{sizecontext="";}
var colorcontext=htmlbox.queryCommandValue("forecolor");colorcontext=colorcontext===null?"":colorcontext;if(is_ie)
{colorcontext=translate_ie_forecolor(colorcontext);}
if(is_moz||is_opera)
{colorcontext=translate_ff_forecolor(colorcontext);}
if(is_moz&&colorcontext=="")
{colorcontext=this.format.color;}
if(is_moz&&sizecontext=="")
{sizecontext=this.format.size;}
if(is_moz&&fontcontext=="")
{fontcontext=this.format.font;}
if(fontcontext!=this.format.font)
{this.format.font=fontcontext;document.getElementById('sel_font').innerHTML=this.format.font;document.getElementById('sel_font').style.fontFamily=this.format.font;var cells=document.getElementById('popup_font').getElementsByTagName("td");for(var i=0;i<cells.length;i++)
{cells[i].state=fontoptions[cells[i].value]==this.format.font;cells[i].className=this.styles[cells[i].type]+(cells[i].state?"_active":"");}}
if(sizecontext!=this.format.size)
{this.format.size=sizecontext;document.getElementById('sel_size').innerHTML=this.format.size;var cells=document.getElementById('popup_size').getElementsByTagName("td");for(var i=0;i<cells.length;i++)
{cells[i].state=cells[i].value==this.format.size;cells[i].className=this.styles[cells[i].type]+(cells[i].state?"_active":"");}}
if(colorcontext!=this.format.color)
{this.format.color=colorcontext;document.getElementById('sel_color').getElementsByTagName("td")[1].bgColor=this.format.color;var cells=document.getElementById('popup_color').getElementsByTagName("td");for(var i=0;i<cells.length;i++)
{cells[i].state=coloroptions[cells[i].value][0]==this.format.color;cells[i].className=this.styles[cells[i].type]+(cells[i].state?"_active":"");}}
this.close_popups();};function moz_intercept_keys(e)
{if(e.ctrlKey)
{var cmd=String.fromCharCode(e.charCode).toLowerCase();if(cmd=="b")
{htmlbox.execCommand("bold",false,null);}
if(cmd=="i")
{htmlbox.execCommand("italic",false,null);}
if(cmd=="u")
{htmlbox.execCommand("underline",false,null);}
if(cmd=="b"||cmd=="i"||cmd=="u")
{e.preventDefault();}}}
var div;var div_parent;var old_top;var old_width;var old_left;var old_parent_height;var old_box_width;var step;var target_left;var expanded=false;var speed=40;var proportion;var expanding=false;this.Expand=function()
{if(expanding)
{return false;}
old_parent_height=div_parent.offsetHeight;old_height=div.offsetHeight;old_width=div.offsetWidth;old_top=getOffsetTop(div);old_left=getOffsetLeft(div);proportion=0.5;if(is_ie)
{old_box_height=parseInt(document.getElementById("e_table").rows[2].cells[0].style.height,10);}
else
{old_box_width=document.getElementById('htmlbox').offsetWidth-2;old_box_height=document.getElementById('htmlbox').offsetHeight-2;}
div.style.width=old_width;div.style.position='absolute';div.style.top=old_top;div.style.left=old_left;div_parent.style.height=old_parent_height;document.getElementById('expand_td').getElementsByTagName("a")[0].onclick=function(){return obj.Minimize();};document.getElementById('expand_td').getElementsByTagName("a")[0].innerHTML="<img src=\"/i/ico_col_maximum.gif\" width=28 height=23 border=0 align=absmiddle>Collapse";step=0;expanded=true;expanding=true;setTimeout(this.obj_name+".ExpandStep();",10);return false;};this.ExpandStep=function()
{var width_add=(old_left-speed*step>target_left)?speed*step:old_left-target_left;div.style.left=old_left-width_add;div.style.width=old_width+width_add;if(is_ie)
{document.getElementById("e_table").rows[2].cells[0].style.height=old_box_height+Math.round(speed*proportion*step);}
else
{document.getElementById('htmlbox').style.width=old_box_width+width_add;document.getElementById('htmlbox').style.height=old_box_height+Math.round(speed*proportion*step);}
div_parent.style.height=old_parent_height+Math.round(speed*proportion*step);step++;if(target_left<parseInt(div.style.left,10))
{setTimeout(this.obj_name+".ExpandStep();",10);}
else
{expanding=false;}};this.AddLine=function()
{if(expanding)
{return false;}
if(is_ie)
{document.getElementById("e_table").rows[2].cells[0].style.height=parseInt(document.getElementById("e_table").rows[2].cells[0].style.height,10)+100;}
else
{document.getElementById('htmlbox').style.height=document.getElementById('htmlbox').offsetHeight-2+100;}
if(expanded)
{old_height+=100;old_box_height+=100;old_parent_height+=100;div_parent.style.height=div_parent.offsetHeight+100;}
return false;};var proportion_x,proportion_y;this.Minimize=function()
{if(expanding)
{return false;}
document.getElementById('expand_td').getElementsByTagName("a")[0].onclick=function(){return obj.Expand();};document.getElementById('expand_td').getElementsByTagName("a")[0].innerHTML="<img src=\"/i/ico_exp_maximum.gif\" width=28 height=23 border=0 align=absmiddle>Expand";old_height=start_height;old_parent_height=start_parent_height;old_box_height=start_box_height;if(show_smilies)
{old_parent_height+=this.limit_height;}
var dlt_x,dlt_y;if(is_ie)
{dlt_y=document.getElementById("e_table").rows[2].cells[0].offsetHeight-old_box_height;}
else
{dlt_y=document.getElementById('htmlbox').offsetHeight-old_box_height;}
dlt_x=div.offsetWidth-old_width;if(!dlt_x&&!dlt_y)
{proportion_y=proportion_x=1;}
else if(dlt_x>dlt_y)
{proportion_x=1;proportion_y=dlt_y/dlt_x;step=Math.round(dlt_x/speed);}
else
{proportion_y=1;proportion_x=dlt_x/dlt_y;step=Math.round(dlt_y/speed);}
setTimeout(this.obj_name+".MinimzeStep();",10);expanding=true;return false;};this.MinimzeStep=function()
{div.style.left=old_left-Math.round(speed*proportion_x*step);div.style.width=old_width+Math.round(speed*proportion_x*step);if(is_ie)
{document.getElementById("e_table").rows[2].cells[0].style.height=old_box_height+Math.round(speed*proportion_y*step);}
else
{document.getElementById('htmlbox').style.width=old_box_width+Math.round(speed*proportion_x*step);document.getElementById('htmlbox').style.height=old_box_height+Math.round(speed*proportion_y*step);}
div_parent.style.height=old_parent_height+Math.round(speed*proportion_y*step);step--;if(step>=0)
{setTimeout(this.obj_name+".MinimzeStep();",10);}
else
{div.style.position='static';expanded=false;expanding=false;div_parent.style.height=start_parent_height;}};this.StartDrag=function(ev)
{ev=!ev||is_ie?window.event:ev;if(expanding)
{return false;}
expanding=true;if(!expanded)
{old_parent_height=div_parent.offsetHeight;old_height=div.offsetHeight;old_width=div.offsetWidth;old_top=getOffsetTop(div);old_left=getOffsetLeft(div);div.style.left=old_left;if(is_ie)
{old_box_height=parseInt(document.getElementById("e_table").rows[2].cells[0].style.height,10);}
else
{old_box_width=document.getElementById('htmlbox').offsetWidth-2;old_box_height=document.getElementById('htmlbox').offsetHeight-2;}
div.style.position='absolute';div.style.top=old_top;div.style.left=old_left;div_parent.style.height=old_parent_height;document.getElementById('expand_td').getElementsByTagName("a")[0].onclick=function(){return obj.Minimize();};document.getElementById('expand_td').getElementsByTagName("a")[0].innerHTML="<img src=\"/i/ico_col_maximum.gif\" width=28 height=23 border=0 align=absmiddle>Collapse";step=0;expanded=true;}
click_top=getOffsetTop(div)+div.offsetHeight-mousePosition(ev).y;click_left=ev.clientX-getOffsetLeft(document.getElementById('expand_td'));document.onmousemove=function(ev)
{obj.Resize(ev);};document.onmouseup=function()
{obj.StopDrag();};if(is_moz)
{htmlbox.addEventListener("mouseup",function(){obj.StopDrag();},true);}
if(is_ie)
{var elms=document.getElementsByTagName("select");for(i=0;i<elms.length;i++)
{elms[i].style.visibility="hidden";}}
document.body.style.cursor="sw-resize";return false;};var click_top,click_left;this.StopDrag=function()
{if(!expanding)
{return;}
expanding=false;document.body.style.cursor="";document.onmousemove=null;document.onmouseup=null;if(is_ie)
{var elms=document.getElementsByTagName("select");for(i=0;i<elms.length;i++)
{elms[i].style.visibility="visible";}}
if(is_moz)
{tdiv.style.width=1;tdiv.style.height=1;}};var tdiv;this.Resize=function(ev)
{ev=this.do_an_e(ev);var clientX=ev.clientX-click_left;var width_add=(clientX>target_left)?old_left-clientX:old_left-target_left;width_add=width_add>0?width_add:0;step=width_add/speed;var height_add=mousePosition(ev).y+click_top-old_top-old_height;height_add=old_height-(show_smilies?this.cur_height:0)+height_add>start_height?height_add:start_height-old_height+(show_smilies?this.cur_height:0);div.style.left=old_left-width_add;div.style.width=old_width+width_add;if(is_ie)
{document.getElementById("e_table").rows[2].cells[0].style.height=old_box_height+height_add;}
else
{document.getElementById('htmlbox').style.width=old_box_width+width_add;document.getElementById('htmlbox').style.height=old_box_height+height_add;}
div_parent.style.height=old_parent_height+height_add;if(is_moz)
{tdiv.style.left=div.style.left;tdiv.style.top=div.style.top;tdiv.style.width=div.offsetWidth;tdiv.style.height=div.offsetHeight;}};this.init=function(dbg)
{if(this.initialized)
{return false;}
this.initialized=true;div=document.getElementById('w_editor_div');div_parent=div.offsetParent;if(!is_ie)
{tdiv=document.createElement("div");document.body.appendChild(tdiv);tdiv.style.position="absolute";}
target_left=150;var table=document.createElement("table");document.getElementById('popup_font').appendChild(table);table.cellpadding=0;table.cellspacing=0;table.width="100%";for(i=0;i<this.fontoptions.length;i++)
{var tr=table.insertRow(-1);var td=tr.insertCell(-1);td.slip=1;td.style.fontSize=13;td.style.fontFamily=this.fontoptions[i];td.innerHTML=this.fontoptions[i];td.type="font_option";td.value=i;td.state=this.format.font==this.fontoptions[i];td.className=this.styles[td.type]+(td.state?"_active":"");td.style.paddingLeft=3;td.onmouseover=td.onmouseout=td.onmouseup=td.onmousedown=this.eventhandler;td.onclick=this.buttonclick;}
set_unselectable(document.getElementById('popup_font'));var table=document.createElement("table");document.getElementById('popup_size').appendChild(table);table.cellpadding=0;table.cellspacing=0;table.width="100%";for(i=0;i<this.sizeoptions.length;i++)
{var tr=table.insertRow(-1);var td=tr.insertCell(-1);td.slip=1;td.style.fontSize=size_to_pt(this.sizeoptions[i]);td.align="center";td.innerHTML=this.sizeoptions[i];td.type="size_option";td.value=i+1;td.state=this.format.size==i+1;td.className=this.styles[td.type]+(td.state?"_active":"");td.onmouseover=td.onmouseout=td.onmouseup=td.onmousedown=this.eventhandler;td.onclick=this.buttonclick;}
set_unselectable(document.getElementById('popup_size'));var table=document.createElement("table");document.getElementById('popup_color').appendChild(table);table.cellPadding=1;table.cellSpacing=4;table.style.margin="6px 4px 6px 4px";for(var y=0;y<5;y++)
{var tr=table.insertRow(-1);for(var x=0;x<8;x++)
{var td=tr.insertCell(-1);td.align="center";td.innerHTML="<div style=\"background-color:"+this.coloroptions[y*8+x][0]+";width:13px;height:13px;margin:1px;vertical-align:middle\"></div>";td.type="color_option";td.slip=1;td.state=this.coloroptions[y*8+x][0]==this.format.color?true:false;td.className=this.styles[td.type]+(td.state?"_active":"");td.value=y*8+x;td.onmouseover=td.onmouseout=td.onmouseup=td.onmousedown=this.eventhandler;td.onclick=this.buttonclick;}}
set_unselectable(document.getElementById('popup_color'));var table=document.createElement("table");document.getElementById('smilies_td').appendChild(table);table.cellPadding=3;table.align="center";for(var y=0;y<2;y++)
{var tr=table.insertRow(-1);for(var x=0;x<12;x++)
{var td=tr.insertCell(-1);td.type="smile";td.className=this.styles[td.type];td.onclick=this.buttonclick;var img=document.createElement("img");td.appendChild(img);var img_arr=this.smilies[y*12+x].split('|');var img_size=img_arr[1].split('x');img.src="/i/smilies/"+img_arr[0]+".gif";if(img_arr.length>2)
{img.alt=img_arr[2];}
else
{img.alt=":"+img_arr[0]+":";}
img.width=img_size[0];img.height=img_size[1];}}
var controls=document.getElementById('w_editor_div').getElementsByTagName("div");for(var i=0;i<controls.length;i++)
{if(controls[i].id.substr(0,4)=="cmd_"||controls[i].id.substr(0,4)=="sel_")
{if(controls[i].id.substr(0,4)=="cmd_")
{controls[i].type="imagebutton";controls[i].cmd=controls[i].id.substr(4);}
if(controls[i].id.substr(0,4)=="sel_")
{controls[i].type="select";}
controls[i].className=this.styles[controls[i].type];controls[i].onmouseover=controls[i].onmouseout=controls[i].onmouseup=controls[i].onmousedown=this.eventhandler;controls[i].onclick=this.buttonclick;}
if(in_array(controls[i].id.substr(4),this.context_controls)!=-1)
{controls[i].slip=1;controls[i].state=false;}}
if(!is_ie)
{document.getElementById('sel_color').offsetParent.id="select_wysw_op";}
for(name in this.groups)
{for(i=0;i<this.groups[name].length;i++)
{document.getElementById(this.groups[name][i]).group=name;}}
document.onkeyup=this.close_popups;document.getElementById('smilies_td').offsetParent.rows[0].cells[1].getElementsByTagName("a")[0].onclick=function(){return obj.ShowMoreSmilies();};document.getElementById('expand_td').getElementsByTagName("a")[0].onclick=function(){return obj.Expand();};document.getElementById('expand_td').getElementsByTagName("a")[1].onclick=function(){return obj.AddLine();};document.getElementById('expand_td').getElementsByTagName("div")[2].onmousedown=function(ev){return obj.StartDrag(ev);};if(!this.text)
{this.text="";}
if(is_ie)
{document.getElementById("e_table").rows[2].cells[0].innerHTML="<div id=\"htmlbox\" class=\"wysiwyg\" tabindex=\"1\" style=\"width: 100%; height:100%; color:#DDDDCC; border:solid 1px #4F4C46; background-color: #000000\"><p></p></div>";htmlwindow=document.getElementById("htmlbox");htmlbox=document;htmlwindow.contentEditable=true;htmlwindow.hideFocus=true;htmlbox.execCommand("liveresize",false,null);htmlwindow.focus();htmlwindow.style.padding=4;this.set_text(this.text,true);htmlwindow.onmouseup=function()
{obj.set_context();};htmlwindow.onkeyup=function()
{obj.set_context();};htmlwindow.onkeypress=check_return;htmlwindow.onkeydown=function()
{if(obj.onchange)
{obj.onchange();}
return obj.check_select_all();};htmlwindow.onclick=function(){this.controla=false;};htmlwindow.style.fontSize=size_to_pt(this.format.size);htmlwindow.style.fontFamily=this.format.font;htmlwindow.style.color=this.format.color;document.onmouseup=function()
{obj.close_popups();};}
else
{document.getElementById("e_table").rows[2].cells[0].innerHTML="<iframe id=\"htmlbox\" tabindex=\"1\" style=\"height:200px; border:solid 1px #4F4C46;\"></iframe>";htmlwindow=document.getElementById("htmlbox").contentWindow;htmlbox=htmlwindow.document;htmlbox.designMode="on";if(is_moz)
{htmlbox.open();htmlbox.write("<html><head><title>Mozilla WYSIWYG</title></head><body></></body></html>");htmlbox.close();htmlbox.body.style.cursor="text";}
this.set_text(this.text,true);htmlbox.addEventListener("mouseup",function(){obj.set_context()},true);htmlbox.addEventListener("keyup",function(){obj.set_context()},true);htmlbox.addEventListener("keypress",moz_intercept_keys,true);htmlbox.addEventListener("keypress",function()
{if(obj.onchange)
{obj.onchange();}},true);htmlbox.body.style.backgroundColor="#000000";document.getElementById("htmlbox").style.width="100%";htmlbox.body.style.color=this.format.color;htmlbox.body.style.fontFamily=this.format.font;htmlbox.body.style.fontSize=size_to_pt(this.format.size);htmlbox.body.style.margin=4;do_format("fontsize",false,this.format.size);do_format("fontname",false,this.format.font);do_format("forecolor",false,this.format.color);}
this.set_editor_style();set_unselectable(document.getElementById('e_table').rows[0]);document.getElementById('sel_color').getElementsByTagName("td")[1].bgColor=this.format.color;document.getElementById('sel_size').innerHTML=this.format.size;document.getElementById('sel_font').innerHTML=this.format.font;document.getElementById('sel_font').style.fontFamily=this.format.font;this.set_context();start_parent_height=div_parent.offsetHeight;old_height=start_height=div.offsetHeight+(is_opera?23:0);if(is_ie)
{start_box_height=parseInt(document.getElementById("e_table").rows[2].cells[0].style.height,10);}
else
{start_box_height=document.getElementById('htmlbox').offsetHeight-2;}
return true;};var start_height,start_box_height;this.eventhandler=function(e,elm)
{e=obj.do_an_e(e);elm=elm?elm:this;if(!elm)
{return;}
switch(e.type)
{case"mouseout":{if(!elm.slip||!elm.state)
{elm.className=obj.styles[elm.type];}}
break;case"mouseover":{if(!elm.slip||!elm.state)
{elm.className=obj.styles[elm.type]+"_hover";}}
break;}};this.buttonclick=function(e,elm)
{elm=elm?elm:this;e=obj.do_an_e(e);switch(elm.type)
{case"select":{if(obj.popup_open==elm.id.substr(4))
{obj.close_popups();}
else
{show_popup(elm.id.substr(4));}}
break;case"color_option":{do_format("forecolor",false,obj.coloroptions[elm.value][0]);obj.set_context();}
break;case"size_option":{do_format("fontsize",false,elm.value);obj.set_context();}
break;case"font_option":{do_format("fontname",false,obj.fontoptions[elm.value]);obj.set_context();}
break;case"smile":{insert_smilie(elm);}
break;default:{switch(elm.cmd)
{case"insertimage":{var imgurl=new String(prompt(ugphrase["enter_image_url"],"")).replace(/javascript:/gi,'java_script:').replace(/"/g,'&quot;');if(imgurl!="http://"&&imgurl!=""&&imgurl!="undefined"&&imgurl!=null)
{if(imgurl.match(/^https?:\/\//))
{do_format("insertimage",false,imgurl);}}}
break;case"createlink":{if((is_ie&&document.selection.createRange().htmlText=="")||(is_moz&&moz_get_html()==""))
{alert("You must select some text first!");break;}
var linkurl="";var tmplink=prompt(ugphrase["enter_link_url"],linkurl);if(tmplink!="http://"&&tmplink!=""&&tmplink!="undefined"&&tmplink!=null)
{linkurl=tmplink;do_format("createlink",false,linkurl);}
else
{linkurl="http://";do_format("unlink",false,null);}}
break;case"unlink":{if(is_ie)
{do_format("unlink",true,null);}
else
{if(moz_get_html()=="")
{alert(ugphrase["must_select_text_to_use"]);break;}
do_format("unlink",false,null);}}
break;case"quote":{obj.insert_quote("");}
break;default:{do_format(elm.cmd,false,null);}
break;}
obj.set_context();}
break;}};this.do_an_e=function(eventobj)
{if(!eventobj||is_ie)
{window.event.returnValue=false;window.event.cancelBubble=true;return window.event;}
else
{eventobj.stopPropagation();eventobj.preventDefault();return eventobj;}};this.close_popups=function()
{if(this.popup_open)
{document.getElementById('popup_'+this.popup_open).style.display='none';}
this.popup_open=false;};this.ShowMoreSmilies=function()
{if(!this.more_smilies)
{var table=document.getElementById('smilies_td').getElementsByTagName("table")[0];var div=document.createElement("div");document.getElementById('smilies_td').appendChild(div);div.style.height=1;div.style.overflow="hidden";var table=document.createElement("table");div.appendChild(table);table.cellPadding=3;table.align="center";table.style.position="relative";table.style.width=document.getElementById('smilies_td').getElementsByTagName("table")[0].offsetWidth;for(var y=4;y<6;y++)
{var tr=table.insertRow(-1);for(var x=0;x<6;x++)
{var td=tr.insertCell(-1);td.type="smile";td.className=this.styles[td.type];td.onclick=this.buttonclick;var img=document.createElement("img");td.appendChild(img);var img_arr=this.smilies[y*6+x].split('|');var img_size=img_arr[1].split('x');img.src="/i/smilies/"+img_arr[0]+".gif";if(img_arr.length>2)
{img.alt=img_arr[2];}
else
{img.alt=":"+img_arr[0]+":";}
img.width=img_size[0];img.height=img_size[1];}}
this.limit_height=table.offsetHeight;this.more_smilies=true;}
var div=document.getElementById('smilies_td').getElementsByTagName("div")[0];var table=div.getElementsByTagName('table')[0];div.style.display='';div.style.height=1;this.cur_height=0;table.style.top=-this.limit_height;old_old_parent_height=old_parent_height;old_old_height=old_height;new_parent_height=div_parent.offsetHeight;setTimeout(this.obj_name+".EnlargeSmilies();",10);document.getElementById('smilies_td').offsetParent.rows[0].cells[1].getElementsByTagName("a")[0].innerHTML="<img src=\"/i/editor/more_smilies.gif\" width=18 height=13 border=0 align=absmiddle>Hide smilies";document.getElementById('smilies_td').offsetParent.rows[0].cells[1].getElementsByTagName("a")[0].onclick=function(){return obj.HideSmilies();};show_smilies=true;return false;};var old_old_height;this.HideSmilies=function()
{document.getElementById('smilies_td').getElementsByTagName("div")[0].style.height=1;document.getElementById('smilies_td').getElementsByTagName("div")[0].style.display="none";document.getElementById('smilies_td').offsetParent.rows[0].cells[1].getElementsByTagName("a")[0].innerHTML="<img src=\"/i/editor/more_smilies.gif\" width=18 height=13 border=0 align=absmiddle>More smilies";document.getElementById('smilies_td').offsetParent.rows[0].cells[1].getElementsByTagName("a")[0].onclick=function(){return obj.ShowMoreSmilies();};old_parent_height-=this.limit_height;old_height-=this.limit_height;div_parent.style.height=div_parent.offsetHeight-this.limit_height;show_smilies=false;return false;};var show_smilies=false;var new_parent_height;var old_old_parent_height;this.EnlargeSmilies=function()
{var div=document.getElementById('smilies_td').getElementsByTagName("div")[0];var table=div.getElementsByTagName('table')[0];var res_height=this.cur_height+10;res_height=res_height>this.limit_height?this.limit_height:res_height;old_height=old_old_height+res_height;old_parent_height=old_old_parent_height+res_height;if(expanded)
{div_parent.style.height=new_parent_height+res_height;}
div.style.height=this.cur_height=res_height;table.style.top=this.cur_height-this.limit_height;if(this.cur_height<this.limit_height)
{setTimeout(this.obj_name+".EnlargeSmilies();",10);}};this.get_text=function(dbg)
{if(is_ie)
{var str=htmlwindow.innerHTML;var pr1=/<p(?: style\s*=\s*"?margin\s*:\s*0\s*px\s*"?\s*)?>(.*)<\/p>/ig;var pr2=/<p\s+align\s*=\s*"?\s*((?:center)|(?:left)|(?:right))\s*"?\s*>/ig;str=str.replace(pr1,"$1<br>");str=str.replace(pr2,"<p align=\"$1\" style=\"margin:0px\">");return str;}
else
{return htmlbox.body.innerHTML;}};this.set_text=function(textvalue,is_wysiwyg)
{if(is_ie)
{htmlwindow.innerHTML=textvalue;}
else
{htmlbox.body.innerHTML=textvalue;}};this.insert_quote=function(textvalue)
{htmlwindow.focus();if(is_ie)
{var textselection=htmlbox.selection.createRange();var txt=textvalue?textvalue:textselection.htmlText.replace(/<p([^>]*)>(.*)<\/p>/i,'$2');if(txt.length==0)
{return;}
textselection.pasteHTML("[QUOTE]"+txt+"[/QUOTE]");}
else
{var frag=htmlbox.createDocumentFragment();var span=htmlbox.createElement("span");var txt=textvalue?textvalue:moz_get_html();if(!txt.length)
{return;}
span.innerHTML="[QUOTE]"+txt+"[/QUOTE]";while(span.firstChild)
{frag.appendChild(span.firstChild);}
moz_insert_node_at_selection(frag);}
htmlwindow.focus();};}
var WYSIWYG=new WYSIWYG_editor("WYSIWYG");WYSIWYG.fontoptions=fontoptions;WYSIWYG.sizeoptions=sizeoptions;WYSIWYG.coloroptions=coloroptions;WYSIWYG.smilies=smilies;WYSIWYG.styles=styles;WYSIWYG.format=defaults;function getOffsetTop(elm,topelm)
{var mOffsetParent=elm.offsetParent;var mOffsetTop=elm.offsetTop;while(mOffsetParent!=topelm&&mOffsetParent)
{if(mOffsetParent.tagName=="TD"&&is_ie&&mOffsetParent.currentStyle.borderTopWidth!="medium")
{mOffsetTop+=parseInt(mOffsetParent.currentStyle.borderTopWidth,10);}
mOffsetTop+=mOffsetParent.offsetTop;mOffsetParent=mOffsetParent.offsetParent;}
return mOffsetTop;}
function getOffsetLeft(elm,topelm)
{var mOffsetLeft=elm.offsetLeft;var mOffsetParent=elm.offsetParent;while(mOffsetParent!=topelm&&mOffsetParent)
{if(mOffsetParent.tagName=="TD"&&is_ie&&mOffsetParent.currentStyle.borderLeftWidth!="medium")
{mOffsetLeft+=parseInt(mOffsetParent.currentStyle.borderLeftWidth,10);}
mOffsetLeft+=mOffsetParent.offsetLeft;mOffsetParent=mOffsetParent.offsetParent;}
return mOffsetLeft;}
function set_unselectable(elm)
{if(is_ie4)
{return;}
else if(typeof(elm.tagName)!="undefined")
{if(elm.hasChildNodes())
{for(var i=0;i<elm.childNodes.length;i++)
{set_unselectable(elm.childNodes[i]);}}
elm.unselectable=true;}}
function in_array(ineedle,haystack,caseinsensitive)
{var needle=new String(ineedle);if(caseinsensitive)
{needle=needle.toLowerCase();for(i in haystack)
{if(haystack[i].toLowerCase()==needle)
{return i;}}}
else
{for(i in haystack)
{if(haystack[i]==needle)
{return i;}}}
return-1;}
function translate_ff_forecolor(forecolor)
{var r=/rgb\((\d+), ?(\d+), ?(\d+)\)/i;var res=forecolor.match(r);if(res===null)
{return forecolor;}
return"#"+(res[1]-0).toString(16)+(res[2]-0).toString(16)+(res[3]-0).toString(16);}
function translate_ie_forecolor(forecolor)
{if(is_ie)
{if((forecolor+"").substr(0,1)=="#")
{return forecolor;}
var r=(forecolor&0xFF).toString(16);r=r.length<2?("0"+r):r;var g=((forecolor>>8)&0xFF).toString(16);g=g.length<2?("0"+g):g;var b=((forecolor>>16)&0xFF).toString(16);b=b.length<2?("0"+b):b;return"#"+(r+g+b).toUpperCase();}
else
{return forecolor;}}
function pt_to_size(pointsize)
{switch(pointsize)
{case"7.5pt":case"10px":return 1;case"10pt":return 2;case"12pt":return 3;case"14pt":return 4;case"18pt":return 5;case"24pt":return 6;case"36pt":return 7;default:return"";}}
function size_to_pt(pointsize)
{switch(pointsize)
{case 1:return"7.5pt";case 2:return"10pt";case 3:return"12pt";case 4:return"14pt";case 5:return"18pt";case 6:return"24pt";case 7:return"36pt";default:return"";}}
function htmlspecialchars(html)
{html=html.replace(/"/,"&quot;");html=html.replace(/</,"&lt;");html=html.replace(/>/,"&gt;");return html;}
function mousePosition(e){return{x:e.clientX+document.body.scrollLeft,y:e.clientY+document.body.scrollTop};}