//
var forum_updatebuttons = new Array(); for(var i in document.getElementsByTagName('a')) forum_updatebuttons.push(document.getElementsByTagName('a')[i]); for(var i in document.getElementsByTagName('span')) forum_updatebuttons.push(document.getElementsByTagName('span')[i]); for(var i in document.getElementsByTagName('input')) forum_updatebuttons.push(document.getElementsByTagName('input')[i]); var counter = 0; for(var buttoncurr in forum_updatebuttons) { var but = forum_updatebuttons[buttoncurr]; if( (but && but.className && but.className.indexOf('button') > -1) || (but && but.type && (but.type=="submit" || but.type=="reset" || but.type=="button")) ) { counter++; if(!but.className) but.className=""; if(navigator.userAgent.toLowerCase().indexOf("opera") == -1) { but.forum_old_mouseover = but.onmouseover ? but.onmouseover : function(e) {}; but.forum_old_mouseout = but.onmouseout ? but.onmouseout : function(e) {}; but.forum_old_mousedown = but.onmousedown ? but.onmousedown : function(e) {}; but.forum_old_mouseup = but.onmouseclick ? but.onmouseup : function(e) {}; but.onmouseover = function(e) { this.className+=' f_hover'; this.forum_old_mouseover(e); }; but.onmouseout = function(e) { CommunitY_RemoveClassName(this, "f_mousedown"); CommunitY_RemoveClassName(this, "f_hover"); this.forum_old_mouseout(e); }; but.onmousedown = function(e) { if(!e) e=window.event; this.className+=' f_mousedown'; this.forum_old_mousedown(e); if(e.returnValue) e.returnValue=false; if(e.preventDefault) e.preventDefault(); return false; }; but.onmouseup = function(e) { CommunitY_RemoveClassName(this, "f_mousedown"); this.forum_old_mouseup(e); }; } else { but.forum_old_mousedown2 = but.onmousedown ? but.onmousedown : function(e) {}; but.onmousedown = function(e) { if(!e) e=window.event; this.forum_old_mousedown2(e); if(e.returnValue) e.returnValue=false; if(e.preventDefault) e.preventDefault(); return false; }; } but.onselectstart = function(e) { if(!e) e=window.event; if(e.returnValue) e.returnValue=false; if(e.preventDefault) e.preventDefault(); return false; }; but.ondragstart = function(e) { if(!e) e=window.event; if(e.returnValue) e.returnValue=false; if(e.preventDefault) e.preventDefault(); return false; }; but.onmousemove = function(e) { if(!e) e=window.event; if(e.returnValue) e.returnValue=false; if(e.preventDefault) e.preventDefault(); return false; }; } } function CommunitY_RemoveClassName(el, class) { if(!class || class.indexOf(" ") > 1) return false; if(class.substring(0,1) != " ") class = " "+class; while(el.className.indexOf(class) > -1) { var oc = el.className; el.className = oc.substring( 0 , oc.indexOf(class) ) + oc.substring( oc.indexOf(class)+class.length , oc.length ); } return true; } for(var i in document.getElementsByTagName('a')) { var a=document.getElementsByTagName('a')[i]; if(a && a.title && a.title=="__forum_checkhref") { //var h = a.getAttribute("href"); //if(h.indexOf('http://') == -1) //if(h && h.indexOf('?')!=0 && h.indexOf('#')!=0 && h.indexOf('/')!=0 && h.indexOf('\\')!=0 && h.indexOf('..')!=0 && ( h.indexOf('www.')==0 || h.indexOf('://')==-1 || h.indexOf('://')>6 )) // a.href = "http://" + h; a.title = a.href; } } function CommunitY_insertTag(btn, tag_open, tag_close, textarea_id) { var ta = document.getElementById(textarea_id); if(navigator.userAgent.toLowerCase().indexOf("msie") > -1) { ta.focus(); var s = document.selection.createRange(); var len = s.text.length; if(len==0 && ta.oldSelection) len = ta.oldSelection.length; var r = s.duplicate(); r.moveToElementText(ta); r.setEndPoint("EndToStart", s); ta.value = ta.value.substring(0,r.text.length) + tag_open + ta.value.substring(r.text.length, r.text.length+len) + tag_close + ta.value.substring(r.text.length + len, ta.value.length); document.title = r.text.length + " -- " + (r.text.length + len); //still doesn't select text :( //document.selection = r; } else { if(!ta.selectionStart || !ta.selectionEnd) ta.focus(); var oldStart = ta.selectionStart; var oldEnd = ta.selectionEnd; ta.value = ta.value.substring(0,ta.selectionStart) + tag_open + ta.value.substring(ta.selectionStart, ta.selectionEnd) + tag_close + ta.value.substring(ta.selectionEnd, ta.value.length); ta.selectionEnd = oldEnd + tag_open.length; ta.selectionStart = oldStart + tag_open.length; } } function CommunitY_messageTools_clear() { if(window.forum_message_tools_explain_scrollTimer1) clearTimeout(window.forum_message_tools_explain_scrollTimer1); if(window.forum_message_tools_explain_scrollTimer2) clearTimeout(window.forum_message_tools_explain_scrollTimer2); if(window.forum_message_tools_explain_scrollTimer3) clearTimeout(window.forum_message_tools_explain_scrollTimer3); if(window.forum_message_tools_explain_scrollPause) clearTimeout(window.forum_message_tools_explain_scrollPause); if(window.forum_message_tools_explain_scrollInterval) clearInterval(window.forum_message_tools_explain_scrollInterval); window.forum_message_tools_explain_scrollTimer1 = null; window.forum_message_tools_explain_scrollTimer2 = null; window.forum_message_tools_explain_scrollTimer3 = null; window.forum_message_tools_explain_scrollPause = null; window.forum_message_tools_explain_scrollInterval = null; var exp = document.getElementById("forum_message_tools_explain"); var msgs = new Array(); msgs[0] = "use the color tag to make your posts stand out: [color="#0033FF"]text[/color]"; msgs[1] = "use the specific code tag when posting code: [code="JavaScript"]function example() { };[/code]"; msgs[2] = "use the center tag to center text: [center]   centered text   [/center]"; msgs[3] = "Press the TAB key to indent the cursor or a block of selected text"; msgs[4] = "Hovering over each button will display that button's shortcut key. While typing, keys like "+(navigator.userAgent.toLowerCase().indexOf("macintosh")>-1?"command":"Ctrl")+"+B will insert codes for you ("+(navigator.userAgent.toLowerCase().indexOf("macintosh")>-1?"command":"Ctrl")+"+B inserts [b][/b])."; msgNum = Math.floor(Math.random()*msgs.length); var msg = document.createElement("span"); msg.style.position = "absolute"; msg.style.visibility = "hidden"; msg.style.fontSize = "10px"; msg.style.cssText = "position:absolute; visibility:hidden; font-size:10px;"; msg.innerHTML = "Tip: " + msgs[msgNum]; document.body.appendChild(msg); var width = msg.offsetWidth; document.body.removeChild(msg); exp.innerHTML = "Tip: " + msgs[msgNum] + ""; var expi = document.getElementById("forum_message_tools_explain_inner"); exp.onclick = function() { CommunitY_messageTools_clear(); /* var alert2 = document.createElement("div"); alert2.style.cssText = "position:absolute; top:"+(this.offsetTop+this.offsetHeight)+"px; left:"+(this.offsetLeft)+"px; width=100%; background:#000000; color:#88CCFF; border:1px solid #0066FF;"; alert2.onclick = function() { this.parentNode.removeChild(this); }; alert2.innerHTML = document.getElementById("forum_message_tools_explain_inner").innerHTML; this.parentNode.appendChild(alert2); */ }; window.forum_message_tools_explain_scrollReverseDir = false; window.forum_message_tools_explain_scroll = function() { var expi = document.getElementById("forum_message_tools_explain_inner"); var exp = document.getElementById("forum_message_tools_explain"); if(!expi || !exp || expi.offsetWidth <= exp.offsetWidth) { clearInterval(window.forum_message_tools_explain_scrollInterval); return false; } if(window.forum_message_tools_explain_scrollPause) return false; expi.style.position = "relative"; var rDir = window.forum_message_tools_explain_scrollReverseDir; if( (rDir==false && (expi.offsetLeft + expi.offsetWidth) <= exp.offsetWidth) || (rDir==true && expi.offsetLeft > 0) ) { window.forum_message_tools_explain_scrollPause = true; window.forum_message_tools_explain_scrollTimer1 = setTimeout("window.forum_message_tools_explain_scrollPause = null;", 5000); window.forum_message_tools_explain_scrollTimer2 = setTimeout("window.forum_message_tools_explain_scrollReverseDir = !window.forum_message_tools_explain_scrollReverseDir;", 5000); } if(rDir==true) expi.style.left = (expi.offsetLeft + 1) + "px"; else expi.style.left = (expi.offsetLeft - 1) + "px"; }; if(expi.offsetWidth > exp.offsetWidth) window.forum_message_tools_explain_scrollTimer3 = setTimeout("window.forum_message_tools_explain_scrollInterval = setInterval(\"window.forum_message_tools_explain_scroll();\", 50);", 5000); else expi.style.width = "auto"; } window.CommunitY_messageTools_stopEvt = function(e) { if(!e) e = window.event; if(e!=null) { if(e.stopPropagation != null) try{ e.stopPropagation(); }catch(err){}; if(e.preventDefault != null) try{ e.preventDefault(); }catch(err){}; try { e.cancelBubble(); } catch(err){}; try { e.cancelBubble = true; } catch(err){}; try { e.preventDefault = true; } catch(err){}; try { e.returnValue = false; } catch(err){}; } return false; }; function CommunitY_messageTools_init(textarea_id) { var ta = document.getElementById(textarea_id); ta.onmouseout = function() { if(document.selection && document.selection.createRange) { this.oldSelection = document.selection.createRange().text; } }; ta.selectRange = function (iStart, iLength) { if (this.createTextRange) { var oRange = this.createTextRange(); oRange.moveStart("character", iStart); oRange.moveEnd("character", iLength - this.value.length); oRange.select(); } else if (this.setSelectionRange) { this.setSelectionRange(iStart, iLength); } this.focus(); }; ta.onkeydown = function(e) { if(!e) e=window.event; var key = e.keyCode ? e.keyCode : e.which; var keyValue = String.fromCharCode(key); var ta = this; var prevent = window.CommunitY_messageTools_controlKeyDown ? true : false; if(key==17 || key==224) { window.CommunitY_messageTools_controlKeyDown = true; window.CommunitY_messageTools_controlKey_oldBorderColor = ta.style.borderColor; ta.style.borderColor = "#555"; prevent = true; } else if(keyValue.toLowerCase()=="b" && window.CommunitY_messageTools_controlKeyDown) document.getElementById("forum_message_tools_b").onclick(); else if(keyValue.toLowerCase()=="i" && window.CommunitY_messageTools_controlKeyDown) document.getElementById("forum_message_tools_i").onclick(); else if(keyValue.toLowerCase()=="u" && window.CommunitY_messageTools_controlKeyDown) document.getElementById("forum_message_tools_u").onclick(); else if(keyValue.toLowerCase()=="m" && window.CommunitY_messageTools_controlKeyDown) document.getElementById("forum_message_tools_img").onclick(); else if(keyValue.toLowerCase()=="l" && window.CommunitY_messageTools_controlKeyDown) document.getElementById("forum_message_tools_url").onclick(); else if(keyValue.toLowerCase()=="j" && window.CommunitY_messageTools_controlKeyDown) document.getElementById("forum_message_tools_url_complex").onclick(); else if(keyValue.toLowerCase()=="k" && window.CommunitY_messageTools_controlKeyDown) document.getElementById("forum_message_tools_url_complex_button").onclick(); else if(keyValue.toLowerCase()=="d" && window.CommunitY_messageTools_controlKeyDown) document.getElementById("forum_message_tools_code").onclick(); else if(keyValue.toLowerCase()=="o" && window.CommunitY_messageTools_controlKeyDown) document.getElementById("forum_message_tools_quote").onclick(); else if(key==9) { prevent = true; var SS = ta.selectionStart; var SE = ta.selectionEnd; ta.focus(); if(SS==SE) { ta.value = ta.value.substring(0, SS) + "\t" + ta.value.substring(SE, ta.value.length); ta.selectionStart = SS + 1; ta.selectionEnd = SE + 1; } else if(SS != SE) { var selected = ta.value.substring(SS, SE); selected = selected.split("\n").join("\n\t"); ta.value = ta.value.substring(0, SS) + "\t" + (selected.lastIndexOf("\t")>selected.length-2 ? selected.substring(0,selected.lastIndexOf("\t")) : selected) + ta.value.substring(SE, ta.value.length); ta.selectionStart = SS; ta.selectionEnd = SS + selected.length + (selected.lastIndexOf("\t")>selected.length-2 ? 0 : 1); } } else prevent = false; if(prevent == true) return window.CommunitY_messageTools_stopEvt(e); else return true; }; ta.onkeyup = function(e) { if(!e) e=window.event; var key = e.keyCode ? e.keyCode : e.which; var prevent = false; if(key==17 || key==224) { window.CommunitY_messageTools_controlKeyDown = null; ta.style.borderColor = window.CommunitY_messageTools_controlKey_oldBorderColor; window.CommunitY_messageTools_controlKey_oldBorderColor = null; prevent = true; } if(window.CommunitY_messageTools_controlKeyDown != null) { if(window.opera) window.stop(); prevent = true; } if(prevent == true) { return window.CommunitY_messageTools_stopEvt(e); } else return true; }; ta.onfocus = function() { this.className = this.className.replace(/ iefocus/mgi,"") + " iefocus"; window.CommunitY_adminControls_controlKeyHandled = true; window.CommunitY_messageTools_controlKeyDown = null; }; ta.onblur = function() { var ief = this.className.indexOf(" iefocus"); if(ief > -1) this.className = this.className.replace(/ iefocus/mgi,""); window.CommunitY_adminControls_controlKeyHandled = null; window.CommunitY_messageTools_controlKeyDown = null; if(window.CommunitY_messageTools_controlKey_oldBorderColor != null) this.style.borderColor = window.CommunitY_messageTools_controlKey_oldBorderColor; }; } if(window.CommunitY_messageTools_clearOnStartup==true) CommunitY_messageTools_clear(); if(window.CommunitY_messageTools_initOnStartup && window.CommunitY_messageTools_initOnStartup.length > 1) CommunitY_messageTools_init(window.CommunitY_messageTools_initOnStartup);