function AddText(addtext) {

        var current = document.post.message.value;

        var newtext = current + addtext;

        document.post.message.value = newtext;

        document.post.message.focus();

}



function AddImg() {

        inserttext = prompt("Enter the URL to the Image:" + "", "http://");

        if ((inserttext != "http://") && (inserttext != "")) addtext = "[IMG]" + inserttext + "[/IMG]";

        else addtext="";



        AddText(addtext);

}

function AddSlide() {

        inserttext = prompt("Enter the URL to the Image:" + "", "http://");

        if ((inserttext != "http://") && (inserttext != "")) addtext = "[slide]" + inserttext + "[/slide]";

        else addtext="";



        AddText(addtext);

}

function AddLink(thetype) {

        linktext = prompt("Enter a Linkname (optional):", "");

        var prompttext;

        if (thetype == "URL") linkurl = prompt("Enter the URL:", "http://");

        else linkurl = prompt("Enter the E-Mail Address:", "");



        if ((linkurl != "http://") && (linkurl != "")) {

                if ((linktext != null) && (linktext != "")) {

                        addtext = "[" + thetype + "=" + linkurl + "]" + linktext + "[/" + thetype + "]";

                }

                else {

                        addtext = "[" + thetype + "]" + linkurl + "[/" + thetype + "]";

                }

        }

        else addtext = "";



        AddText(addtext);

}



function AddList() {

        type = prompt("Enter '1' for a numbered List, 'a' for an alphabetic List or '' for a pointed List:", "");

        if ((type == "a") || (type == "1")) {

                list = "[LIST=" + type + "]\n";

                listend = "[/LIST=" + type + "]";

        }

        else {

                list = "[LIST]\n";

                listend = "[/LIST]";

        }

        entry = "start";

        while ((entry != "") && (entry != null)) {

                entry = prompt("Enter a List-Point. Enter nothing or click 'Cancel' to finish the list:", "");

                if ((entry != "") && (entry != null))

                        list = list + "[*]" + entry + "\n";

        }

        addtext = list + listend;



        AddText(addtext);

}



function AddCode(thecode) {

        addtext = "" + thecode + "";

        AddText(addtext);

}



function AddCodeFromWindow(thecode) {

        opener.document.post.message.value += thecode + "";

        opener.post.message.focus();

}



tags = new Array('[B]','[/B]','[U]','[/U]','[I]','[/I]','[CODE]','[/CODE]','[QUOTE]','[/QUOTE]','[TOGGLE=Read more]', '[/TOGGLE]');



function AddTag(thetag) {



        theSelection = document.selection.createRange().text;

        if (theSelection) {

                document.selection.createRange().text = tags[thetag] + theSelection + tags[thetag+1] + " ";

                theSelection = false;

                document.post.message.focus();

                return;

        }



        if(thetag<6) initial=1;

        if(thetag==6) initial=4;

        if(thetag==8) initial=5;

        if(thetag==10) initial=6;



        button = eval('document.post.addtag' + thetag + '.value');

        if(button.length == initial) {

                eval('document.post.addtag' + thetag + '.value += "*"');

                addtext = tags[thetag];

        }

        else {

                eval('document.post.addtag' + thetag + '.value = "' + button.substr(0,(button.length - 1)) + '"');

                addtext = tags[thetag+1] + "";

        }



        AddText(addtext);

}



function MM_jumpMenu(targ,selObj,restore){

  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");

  if (restore) selObj.selectedIndex=0;

}



function MM_findObj(n, d) {

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}



function MM_jumpMenuGo(selName,targ,restore){

  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);

}



function MM_confirm(msg, url) {

  if(confirm(msg)) location.replace(url);

}



function MM_openBrWindow(theURL,winName,features) {

  window.open(theURL,winName,features);

}



function MM_goToURL() {

  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;

  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");

}



function SelectAll() {

        for(var x=0;x<document.form.elements.length;x++) {

                var y=document.form.elements[x];

                if(y.name!='ALL') y.checked=document.form.ALL.checked;

        }

}



function MM_swapImgRestore() {

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

}



function MM_preloadImages() {

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}



function MM_findObj(n, d) {

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}



function MM_swapImage() {

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}

function Toggle(id) {

  spanid1 = "ToggleRow_"+id;
  spanid2 = "ToggleImg_"+id;
  val = document.getElementById(spanid1).style.display;
  if (val == "none")
  {
    document.getElementById(spanid1).style.display = "block";
    document.getElementById(spanid2).src = "images/icons/collapse.gif";
    document.getElementById(spanid2).alt = "read more";
  }
  else
  {
    document.getElementById(spanid1).style.display = "none";
    document.getElementById(spanid2).src = "images/icons/expand.gif"
    document.getElementById(spanid2).alt = "hide";
  }
}

