
function listbbcode(where){
document.write('<span class="bbcode">');
document.write('<button name="bold"  type="button" value="fett" title="fett" onclick="addform(\'[b] [/b]\',\''+where+'\')" class="bbbutton"><img src="images/icons/text_bold.png" alt="fett" /></button>');
document.write('<button name="italic"  type="button" value="kursiv" title="kursiv" onclick="addform(\'[i] [/i]\',\''+where+'\')" class="bbbutton"><img src="images/icons/text_italic.png" alt="kursiv" /></button>');
document.write('<button name="underline"  type="button" value="unterstrichen" title="unterstrichen" onclick="addform(\'[u] [/u]\',\''+where+'\')" class="bbbutton"><img src="images/icons/text_underline.png" alt="unterstrichen" /></button>');
document.write('<button name="strike"  type="button" value="durchgestrichen" title="durchgestrichen" onclick="addform(\'[s] [/s]\',\''+where+'\')" class="bbbutton"><img src="images/icons/text_strikethrough.png" alt="durchgestrichen" /></button>');
document.write('<button name="pic"  type="button" value="Bild" title="Bild" onclick="addform(\'[img] [/img]\',\''+where+'\')" class="bbbutton"><img src="images/icons/picture.png" alt="Bild" /></button>');
document.write('<button name="link"  type="button" value="Link" title="Link" onclick="addform(\'[url] [/url]\',\''+where+'\')" class="bbbutton"><img src="images/icons/world_link.png" alt="Link" /></button>');
document.write('<button name="quote"  type="button" value="Zitat" title="Zitat" onclick="addform(\'[quote] [/quote]\',\''+where+'\')" class="bbbutton"><img src="images/icons/page_white_copy.png" alt="Zitat" /></button>');

document.write('<select name="farbe" size="1" title="Schriftfarbe" onchange="addform(\'[color=\'+this.form.farbe.options[this.form.farbe.selectedIndex].value+\'] [/color]\',\''+where+'\')" >');
document.write('<option>Farbe</option>');
document.write('<option value="red" style="color: red;">Rot</option>');
document.write('<option value="blue" style="color: blue;">Blau</option>');
document.write('<option value="orange" style="color: orange;">Orange</option>');
document.write('<option value="green" style="color: green;">Gr&uuml;n</option>');
document.write('<option value="lime" style="color: lime;">Gr&uuml;n 2</option>');
document.write('<option value="yellow" style="color: yellow;">Gelb</option>');
document.write('</select>');

document.write('<select name="bgfarbe" size="1" title="Hintergrundfarbe" onchange="addform(\'[bgcolor=\'+this.form.bgfarbe.options[this.form.bgfarbe.selectedIndex].value+\'] [/bgcolor]\',\''+where+'\')" >');
document.write('<option>BG-Farbe</option>');
document.write('<option value="red" style="background-color: red;">Rot</option>');
document.write('<option value="blue" style="background-color: blue;">Blau</option>');
document.write('<option value="orange" style="background-color: orange;">Orange</option>');
document.write('<option value="green" style="background-color: green;">Gr&uuml;n</option>');
document.write('<option value="lime" style="background-color: lime;">Gr&uuml;n 2</option>');
document.write('<option value="yellow" style="background-color: yellow;">Gelb</option>');
document.write('</select>');

//document.write('</span>');

}

function listsmiley(where){
var sc = new Array ("grins","grinsgrins","hehe","biggrins","zwinker","cool","oh","ahha","quiet","sad","cry","angry","kiss","kiss2");
        for (var i=1;i<sc.length+1;++i)
        {
                document.write('<a href="javascript:addform(\'*'+sc[i-1]+'*\',\''+where+'\')"><img src="images/smiley/'+sc[i-1]+'.gif" alt="'+sc[i-1]+'" title="'+sc[i-1]+'" /></a>');
                document.write(' ');
        }
}

function addform(text,where) {
        var message=document.getElementById(where);
        message.value=message.value+''+text;
}

function smallerTextarea(where){
	var message=document.getElementById(where);
	
	var rows_old=message.rows;
	var rows_new=rows_old-10;
	message.rows=rows_new;
}

function greaterTextarea(where){
        var message=document.getElementById(where);

        var rows_old=message.rows;
        var rows_new=rows_old+10;
        message.rows=rows_new;
}

function checkall(which,where){
	var list = document.getElementById(where);
	var len = list.elements.length;
	
	for (var i = 0; i < len; i++)
	{
        	var e = list.elements[i];
		if (e.name == which) {
	        	e.checked = true;
	        }
    	}
}

function decheckall(which,where){
        var list = document.getElementById(where);
        var len = list.elements.length;

        for (var i = 0; i < len; i++)
        {
                var e = list.elements[i];
                if (e.name == which) {
                        e.checked = false;
                }
        }
}

var XMLHTTP = null;
var old_c0 = null;
var old_c1 = null;
var c = null;
var tmp_i = 0;
var phpsid = null;
var time = null;
var start = null;

function XMLHTTPinit(){
	if (window.XMLHttpRequest) {
		XMLHTTP = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
  		try {
    			XMLHTTP = new ActiveXObject("Msxml2.XMLHTTP");
  		} catch (ex) {
   			try { 
				XMLHTTP =  new ActiveXObject("Microsoft.XMLHTTP");
			} catch (ex) {
    			}
  		}
	}
}

function procPNCOUNT(){
	timer=window.setTimeout("abortPNCOUNT();",5000);
        if(XMLHTTP!=null){
	if(XMLHTTP.readyState == 4 || XMLHTTP.readyState=="complete") {
                c = XMLHTTP.responseText.split("#");

//               	document.getElementById("pns").innerHTML = c[1];
                document.getElementById("upns").innerHTML = c[0];
		
		if(c[0] == "X" || c[1] == "X"){
			window.location.replace('http://abi2009rbg.de/logoutpool2-x'); 
		}

                if(old_c1 < c[1] && tmp_i>0){
       	                document.getElementById("allpns").style.color="red";
               	}

		old_c0 = c[0];
                old_c1 = c[1];
                tmp_i++;
		window.clearTimeout(timer);
        }
	}
}

function requestPNCOUNT(phpsid) {
        XMLHTTPinit();
        XMLHTTP.open("POST", "http://abi2009rbg.de/pncount.php?PHPSESSID="+phpsid);
        XMLHTTP.onreadystatechange = procPNCOUNT;
        XMLHTTP.send(null);
        refreshPNCOUNTrequest(phpsid);
}

function refreshPNCOUNTrequest(phpsid){
        start=window.setTimeout(function(){requestPNCOUNT(phpsid)}, 10000);
}

function abortPNCOUNT(){
//	XMLHTTP.abort();
	XMLHTTP=null;
//	window.clearTimeout(start);
}
