
window.onload = init;
function init() {
	if (document.getElementById('start'))	MM_timelinePlay('Timeline1');
	if (document.getElementById('diashow'))	diashow();
	if (ie)									menu();
	if (document.getElementById('popup')) {
		var images = document.getElementById('popup').getElementsByTagName("img");
		for ( var i=0; i<images.length; i++ ) {
			if (images[i].parentNode.nodeName != "A") {
				images[i].onclick = function () {showimg(this.src,this.alt)};
				images[i].style.cursor="pointer";
}	}	}	}
var bilder = '';
var curimg=0;
function diashow() {
	bilder = document.getElementById('diashow').getElementsByTagName('img');
	if (bilder.length>1) {
		rotateimages();
		setInterval("rotateimages()", 5000);
}	}
function rotateimages() {
	for (i=0;i<bilder.length;i++) {
		bilder[i].style.display="none";
	}
	bilder[curimg].style.display="block";
	window.curimg=(window.curimg<bilder.length-1)? window.curimg+1 : 0;
} 
function showimg(src,alt) {
	var bild_window = window.open("","Bild","toolbar=no,width=700,height=500,directories=no,scrollbars,status=no,menubar=no,resizable=yes");
	bild_window.document.writeln('<html><head>');
	bild_window.document.writeln('<title>'+alt+'</title>');
	bild_window.document.writeln('</head><body onblur="self.close()" style="height:90%;background: url('+src.replace('thumbs/','')+') no-repeat center">');
	bild_window.document.writeln('<div style="position:absolute;right:3px;bottom:3px;"><a href="javascript:" onclick="self.close()">Schliessen</a></div>');
	bild_window.document.writeln('</body></html>');
	bild_window.document.close();
	bild_window.focus();
}
function menu(){
	var menu = document.getElementById('menu').getElementsByTagName('li');
	for (i=0;i<menu.length;i++) {
		if (menu[i].lastChild.nodeName == "UL") {
			menu[i].onmouseover = function () {
				this.lastChild.style.display = "block";
			}
			menu[i].onmouseout = function () {
				this.lastChild.style.display = "none";
	}	}	}
	var menu2 = document.getElementById('menu2').getElementsByTagName('li');
	for (j=0;j<menu2.length;j++) {
		if (menu2[j].lastChild.nodeName == "UL") {
			menu2[j].onmouseover = function () {
				this.lastChild.style.display = "block";
			}
			menu2[j].onmouseout = function () {
				this.lastChild.style.display = "none";
}	}	}	}
function addSmiley(id) {
	if (document.selection && document.selection.createRange().text != '') {
		document.selection.createRange().text = document.selection.createRange().text + "["+id+"]";
	}
	else {
		document.getElementsByTagName('textarea')[0].value += "["+id+"]";
		document.getElementsByTagName('textarea')[0].focus();
	}
}
function header(id)	{edit("[h]","[/h]","header",id);}
function fett(id)	{edit("[b]","[/b]","fett",id);}
function italic(id)	{edit("[i]","[/i]","italic",id);}
function uline(id) 	{edit("[u]","[/u]","uline",id);}
function addSmiley(smiley,id) {edit("","["+smiley+"]",smiley,id);}
function url(id) {
	addurl = prompt("Bitte geben Sie die gewünschte URL ein:", "http://");
	edit("[url="+addurl+"]","[/url]","url",id);
}
function edit(start,end,id) {
	var textfield = document.getElementsByTagName('textarea')[0];
	if (textfield.selectionStart || textfield.selectionStart == '0') {
		textfield.focus();
		var startPos = textfield.selectionStart;
		var endPos = textfield.selectionEnd;
		strSelection = start + textfield.value.substring(startPos, endPos)+ end;
		textfield.value = textfield.value.substring(0, startPos) + strSelection + textfield.value.substring(endPos, textfield.value.length);
	}
	else if (document.selection && document.selection.createRange().text != '') {
		document.selection.createRange().text = start + document.selection.createRange().text + end;
	}
	else {
		if (document.getElementById(id).style.color=="#aaa") {
			textfield.value += end;
			document.getElementById(id).style.color="blue";
		}
		else {
			textfield.value += start;
			document.getElementById(id).style.color="#aaa";
}	}	}
function vorschau() {
	var textarea = document.getElementsByTagName('textarea')[0].value.split('[');
	vorschautext = textarea[0];
	for (var i=0; i<textarea.length; i++) {
		bracket = textarea[i].split(']')[0];
		if (bracket == 'b')		vorschautext += '<span style="font-weight: bolder;">' + textarea[i].split('b]')[1].split('/b]')[0];
		if (bracket == 'i')		vorschautext += '<span style="font-style: italic;">' + textarea[i].split('i]')[1].split('/i]')[0];
		if (bracket == 'u')		vorschautext += '<span style="text-decoration: underline;">' + textarea[i].split('u]')[1].split('/u]')[0];
		if (bracket == '/b' || bracket == '/i' || bracket == '/u') 	vorschautext += '</span>' + textarea[i].split(']')[1];
		else {
			if (document.getElementById(bracket) && bracket != '') {
				vorschautext +=  '<img src="'+document.getElementById(bracket).src+'">'+textarea[i].split(']')[1];
	}	}	}
	vorschau_window = window.open('',"Vorschau","toolbar=no,width=500,height=200,directories=no,scrollbars,status=no,menubar=no,resizable=yes");
	vorschau_window.document.open();
	vorschau_window.document.writeln('<html><head>');
	vorschau_window.document.writeln('<title>Vorschau</title>');
	vorschau_window.document.writeln('</head><body onblur="self.close()">');
	vorschau_window.document.writeln('<p>'+vorschautext.replace('\n','<br />')+'</p>');
	vorschau_window.document.writeln('<div style="position:absolute;right:3px;bottom:3px;"><a href="javascript:" onclick="self.close()">Schließen</a></div>');
	vorschau_window.document.writeln('</body></html>');
	vorschau_window.document.close();
	vorschau_window.focus();
}
function MM_timelinePlay(tmLnName, myID) { //v1.2
  //Copyright 1997, 2000 Macromedia, Inc. All rights reserved.
  var i,j,tmLn,props,keyFrm,sprite,numKeyFr,firstKeyFr,propNum,theObj,firstTime=false;
  if (document.MM_Time == null) MM_initTimelines(); //if *very* 1st time
  tmLn = document.MM_Time[tmLnName];
  if (myID == null) { myID = ++tmLn.ID; firstTime=true;}//if new call, incr ID
  if (myID == tmLn.ID) { //if Im newest
    setTimeout('MM_timelinePlay("'+tmLnName+'",'+myID+')',tmLn.delay);
    fNew = ++tmLn.curFrame;
    for (i=0; i<tmLn.length; i++) {
      sprite = tmLn[i];
      if (sprite.charAt(0) == 's') {
        if (sprite.obj) {
          numKeyFr = sprite.keyFrames.length; firstKeyFr = sprite.keyFrames[0];
          if (fNew >= firstKeyFr && fNew <= sprite.keyFrames[numKeyFr-1]) {//in range
            keyFrm=1;
            for (j=0; j<sprite.values.length; j++) {
              props = sprite.values[j]; 
              if (numKeyFr != props.length) {
                if (props.prop2 == null) sprite.obj[props.prop] = props[fNew-firstKeyFr];
                else        sprite.obj[props.prop2][props.prop] = props[fNew-firstKeyFr];
              } else {
                while (keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]) keyFrm++;
                if (firstTime || fNew==sprite.keyFrames[keyFrm-1]) {
                  if (props.prop2 == null) sprite.obj[props.prop] = props[keyFrm-1];
                  else        sprite.obj[props.prop2][props.prop] = props[keyFrm-1];
        } } } } }
      } else if (sprite.charAt(0)=='b' && fNew == sprite.frame) eval(sprite.value);
      if (fNew > tmLn.lastFrame) tmLn.ID = 0;
} } }
function MM_initTimelines() { //v4.0
    //MM_initTimelines() Copyright 1997 Macromedia, Inc. All rights reserved.
    var ns = navigator.appName == "Netscape";
    var ns4 = (ns && parseInt(navigator.appVersion) == 4);
    var ns5 = (ns && parseInt(navigator.appVersion) > 4);
    document.MM_Time = new Array(1);
    document.MM_Time[0] = new Array(1);
    document.MM_Time["Timeline1"] = document.MM_Time[0];
    document.MM_Time[0].MM_Name = "Timeline1";
    document.MM_Time[0].fps = 15;
    document.MM_Time[0][0] = new String("sprite");
    document.MM_Time[0][0].slot = 1;
    if (ns4)		document.MM_Time[0][0].obj = document["Layer1"];
    else if (ns5)	document.MM_Time[0][0].obj = document.getElementById("Layer1");
    else			document.MM_Time[0][0].obj = document.all ? document.all["Layer1"] : null;
    document.MM_Time[0][0].keyFrames = new Array(1, 30);
    document.MM_Time[0][0].values = new Array(2);
    if (ns5)		document.MM_Time[0][0].values[0] = new Array("34px", "39px", "43px", "48px", "53px", "57px", "62px", "67px", "71px", "76px", "81px", "85px", "90px", "95px", "99px", "104px", "108px", "113px", "118px", "122px", "127px", "132px", "136px", "141px", "146px", "150px", "155px", "160px", "164px", "169px");
    else			document.MM_Time[0][0].values[0] = new Array(34,39,43,48,53,57,62,67,71,76,81,85,90,95,99,104,108,113,118,122,127,132,136,141,146,150,155,160,164,169);
    document.MM_Time[0][0].values[0].prop = "left";
    if (ns5)		document.MM_Time[0][0].values[1] = new Array("31px", "40px", "50px", "59px", "68px", "78px", "87px", "96px", "105px", "115px", "124px", "133px", "143px", "152px", "161px", "171px", "180px", "189px", "199px", "208px", "217px", "227px", "236px", "245px", "254px", "264px", "273px", "282px", "292px", "301px");
    else			document.MM_Time[0][0].values[1] = new Array(31,40,50,59,68,78,87,96,105,115,124,133,143,152,161,171,180,189,199,208,217,227,236,245,254,264,273,282,292,301);
    document.MM_Time[0][0].values[1].prop = "top";
    if (!ns4) {
        document.MM_Time[0][0].values[0].prop2 = "style";
        document.MM_Time[0][0].values[1].prop2 = "style";
    }
    document.MM_Time[0].lastFrame = 30;
    for (i=0; i<document.MM_Time.length; i++) {
        document.MM_Time[i].ID = null;
        document.MM_Time[i].curFrame = 0;
        document.MM_Time[i].delay = 1000/document.MM_Time[i].fps;
} 	}
