+// this function generates the actual toolbar buttons with localized text
+// we use it to avoid creating the toolbar where javascript is not enabled
+function addButton(imageFile, speedTip, tagOpen, tagClose, sampleText) {
+
+ speedTip=escapeQuotes(speedTip);
+ tagOpen=escapeQuotes(tagOpen);
+ tagClose=escapeQuotes(tagClose);
+ sampleText=escapeQuotes(sampleText);
+ var mouseOver="";
+
+ // we can't change the selection, so we show example texts
+ // when moving the mouse instead, until the first button is clicked
+ if(!document.selection) {
+ // filter backslashes so it can be shown in the infobox
+ var re=new RegExp("\\\\n","g");
+ tagOpen=tagOpen.replace(re,"");
+ tagClose=tagClose.replace(re,"");
+ mouseOver = "onMouseover=\"if(!noOverwrite){document.infoform.infobox.value='"+tagOpen+sampleText+tagClose+"'};\"";
+ }
+
+ document.write("<a href=\"#\" onclick=\"javascript:insertTags");
+ document.write("('"+tagOpen+"','"+tagClose+"','"+sampleText+"');\">");
+
+ document.write("<img width=\"23\" height=\"22\" src=\""+imageFile+"\" border=\"0\" ALT=\""+speedTip+"\" TITLE=\""+speedTip+"\""+mouseOver+">");
+ document.write("</a>");
+ return;
+}
+
+function addInfobox(infoText,text_alert,text_moz) {
+ alertText=text_alert;
+ var clientPC = navigator.userAgent.toLowerCase(); // Get client info
+ if(clientPC.indexOf('gecko')!=-1) { mozVote=text_moz; }
+
+ var re=new RegExp("\\\\n","g");
+ alertText=alertText.replace(re,"\n");
+ mozVote=mozVote.replace(re,"\n");
+
+ // if no support for changing selection, add a small copy & paste field
+ var clientPC = navigator.userAgent.toLowerCase(); // Get client info
+ /*var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
+ && (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
+ && (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1)
+ && (clientPC.indexOf('khtml')==-1));*/
+
+ // document.selection is an IE property. If it is not available, we generates
+ // an infobox used by the toolbar in other browsers.
+ if(!document.selection) {
+ infoText=escapeQuotesHTML(infoText);
+ document.write("<form name='infoform' id='infoform'>"+
+ "<input size=80 id='infobox' name='infobox' value=\""+
+ infoText+"\" READONLY></form>");
+ }
+
+}
+
+function escapeQuotes(text) {
+ var re=new RegExp("'","g");
+ text=text.replace(re,"\\'");
+ re=new RegExp('"',"g");
+ text=text.replace(re,'"');
+ re=new RegExp("\\n","g");
+ text=text.replace(re,"\\n");
+ return text;
+}
+
+function escapeQuotesHTML(text) {
+ var re=new RegExp('"',"g");
+ text=text.replace(re,""");
+ return text;
+}
+