function podcast(url) {
	window.open(url,'','width=300,height=120,resizable=no,scrollbars=no');
}

function insertUBB(aTag, eTag, tarea) {
  var input = document.getElementById(tarea);
  input.focus();

  /* für Internet Explorer */
  if(typeof document.selection != 'undefined') {
 /* Einfügen des Formatierungscodes */
     var range = document.selection.createRange();
     if(range.text.length>0){
       if (range.text.charAt(range.text.length-1)==" "){
         range.moveEnd("character" ,-1);
       }
     }
     var insText = range.text;
     range.text = aTag + insText + eTag;
    /* Anpassen der Cursorposition */
    range = document.selection.createRange();
    if (insText.length == 0) {
      range.move('character', -eTag.length);
    } else {
      range.moveStart('character', aTag.length + insText.length);
    }
    range.select();
  }
  /* für neuere auf Gecko basierende Browser */
  else if(typeof input.selectionStart != 'undefined')
  {
         /* Einfügen des Formatierungscodes */
     var start = input.selectionStart;
     var end = input.selectionEnd;
     if(start!= end){
      if (input.value.substring(end-1, end)==" "){
         var end = input.selectionEnd-1;
       }
     }
     var insText = input.value.substring(start, end);
     //console.log("-",insText,"-",start,end);
     input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);
    /* Anpassen der Cursorposition */
    var pos;
    if (insText.length == 0) {
      pos = start + aTag.length;
    } else {
      pos = start + aTag.length + insText.length;
    }
    input.selectionStart = pos;
    input.selectionEnd = pos;
  }
  /* für die übrigen Browser */
  else
  {
    /* Abfrage der Einfügeposition */
    var pos;
    var re = new RegExp('^[0-9]{0,3}$');
    while(!re.test(pos)) {
      pos = prompt(_("Insert at position")+" (0.." + input.value.length + "):", "0");
    }
    if(pos > input.value.length) {
      pos = input.value.length;
    }
    /* Einfügen des Formatierungscodes */
    var insText = prompt(_("Enter a text")+":");
    input.value = input.value.substr(0, pos) + aTag + insText + eTag + input.value.substr(pos);
  }
  return false;
}

function ubb(tag, tarea){
  var input = document.getElementById(tarea);
  input.focus();
  // Browser ermitteln, Auswahl auswerten -------------
  //ie
  if(typeof document.selection != 'undefined') {
    var browser = "ie"
    var range = document.selection.createRange();
    if (range.text.charAt(range.text.length-1)==" "){
      range.moveEnd("character" ,-1);
    }
    var selection = range.text;
  }
  //gecko
  else if(typeof input.selectionStart != 'undefined'){
    var browser = "gecko"
    var start = input.selectionStart;
    var end = input.selectionEnd;
	  if (input.value.substring(end-1, end)==" " && start!=end){
      var end = input.selectionEnd-1;
    }
    var selection = input.value.substring(start, end);
  } else {
    var browser = "other"
  }
  // Code erstellen ------------------------------------------
  switch(tag){

    case "link":
    var URL = prompt('URL' , 'http://');
    var URLTITEL = prompt('Link text' , '');
    if (URL && URLTITEL) {
      code = '[url=' + URL + ']' + URLTITEL + '[/url]';
    }
    break;

    case "color":
    var COL = prompt('Text color (red or #ff0000):' , '');
    var COLVAL = prompt('Text' , '');
    if (COL && COLVAL) {
      code = '[color=' + COL + ']' + COLVAL + '[/color]';
    }
    break;
  }
  // Code einfügen ------------------------------------------
  if (code.length > 0) {
    switch (browser){
      case "ie":
        range.select();
        range.text = code;
      break
      case "gecko":
        input.value = input.value.substr(0, start) + code + input.value.substr(end);
      break
      case "other":
        document.getElementById(tarea).value += code+" ";
      break
    }
  }
  document.getElementById(tarea).focus();
}

function list(tarea)
{
  listentry = "init";
  thelist = "";
  entries = "";
  cnt = 1;
  while ((listentry != "") && (listentry != null))
{
  listentry = prompt(+cnt+". "+_("Item (Finish the list with 'Cancel')")+":", "");
  if ( (listentry != "") && (listentry != null) )
{
  listentry = "[*] "+listentry+"\n";
  entries = entries+listentry;
  thelist = "[li]\n"+entries+"[/li] ";
}
  cnt++;
}
  document.getElementById(tarea).value += thelist;
  document.getElementById(tarea).focus();
}

function changevis(divid) {
	if(document.getElementById(divid).style.display == 'block') {
		document.getElementById(divid).style.display = 'none';
	} else {
		document.getElementById(divid).style.display = 'block';
	}
}

function showit(divid) {
	if(document.getElementById(divid)) {
		document.getElementById(divid).style.display = 'block';
	}
}

function hideit(divid) {
	if(document.getElementById(divid)) {
		document.getElementById(divid).style.display = 'none';
	}
}

function confirmSend() {
	return window.confirm("Are you sure you want to delete this posting? // Sind Sie sicher, dieses Kommentar unwiederruflich zu entfernen?");
}

function confirmGBDel(msg) {
	return window.confirm(msg);
}

function emoticon(textfeldid, smilie) {
	var field = document.getElementById(textfeldid);
	field.value = field.value + smilie;
	field.focus();
}


/**************************************************/
/*START: browser detection*/
function BrowserDetection()
{
	var sUserAgent = navigator.userAgent.toLowerCase();

	// browser name
	this.isIE = (sUserAgent.indexOf('msie') != -1);
	this.isOpera = (sUserAgent.indexOf('opera') != -1 || window.opera);
	this.isFirefoxEinsNull =(sUserAgent.indexOf('firefox\/1.0') != -1);
}

var oBrowser = new BrowserDetection();
/*END: browser detection*/
/**************************************************/

/**************************************************/
/*START: flash functions */
function writeFlash()
{
	var ret = getArgs(arguments);
	generateObj(ret.src, ret.params, ret.styles);
}

function generateObj(src, params, styles)
{
	var str = '<object type="application/x-shockwave-flash"' ;
	str += getStyles(styles);
	if (oBrowser.isIE && !oBrowser.isOpera) {
		str += '>';
		str += '<param name="movie" value="'+ src +'" \/>';
	} else {
		str += ' data="'+ src +'">';
	}

	//schreibe param tags
	for (var i in params) {
		str += '<param name="' + i + '" value="' + params[i] + '" />';
	}

	//schreibe embed tag, brauchts für transparenz im safari
	str += '<embed src="'+ src +'"';
	for (var j in params) {
		str += ' ' + j + '="' + params[j] + '"';
	}
	str += '></embed>';
	str += '</object>';
	document.write(str);
}

function getStyles(styles)
{
	str = ' style="';
	for (var i in styles)
		str += i + ': ' + styles[i] + 'px;';
	str += '"';
	return str;
}

function getArgs(args)
{
	var ret = new Array();
	ret.src = new Object();
	ret.params = new Object();
	ret.styles = new Object();
	
	for (var i=0; i < args.length; i=i+2)
	{
		var currArg = args[i].toLowerCase();
		switch (currArg)
		{
			case "src":
			ret.src = args[i+1];
			break;
			case "width":
			case "height":
			ret.styles[args[i]] = args[i+1];
			break;
			case "allowScriptAccess":
			case "wmode":
			ret.params[args[i]] = args[i+1];
			break;
			default:
			ret.params[args[i]] = args[i+1];
		}
	}
	return ret;
}
/*END: flash functions */
/**************************************************/

/*----------- Flash ------------*/
var flash2Installed = false;	// wahr wenn flash 2 installiert ist
var flash3Installed = false;	// wahr wenn flash 3 installiert ist
var flash4Installed = false;	// wahr wenn flash 4 installiert ist
var flash5Installed = false;	// wahr wenn flash 5 installiert ist
var flash6Installed = false;	// wahr wenn flash 6 installiert ist
var flash7Installed = false;	// wahr wenn flash 7 installiert ist
var flash8Installed = false;	// wahr wenn flash 7 installiert ist
var flash9Installed = false;	// wahr wenn flash 7 installiert ist
var flash10Installed = false;	// wahr wenn flash 7 installiert ist
var maxVersion 		= 10;		// die Version die momentan maximal gecheckt wird
var actualVersion 	= 0;		// die version die der User hat
var hasRightVersion = false;	// wahr wenn der User die richtige Version hat

var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;    	// TRUE wenn IE
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false; // TRUE wenn auf Windows


/* VB-Script Detection beim MsIe auf Windows, da MsIe bei Windows
-- regular JavaScript Plugins nicht unterstützt
-------------------------------------------------------------------*/
if(isIE && isWin){
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
	document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
	document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
	document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
	document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');
	document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');  
	document.write('flash8Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');  
	document.write('flash9Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9"))) \n');  
	document.write('flash10Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.10"))) \n');  
	document.write('</SCR' + 'IPT\> \n');
}


/* Detect Flash
---------------*/
function detectFlash(flV) {  
	// existiert navigator.plugins
	if (navigator.plugins) {
		// check für flash 2 oder flash 3+
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var isVersion2 			= navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription 	= navigator.plugins["Shockwave Flash" + isVersion2].description;

			//alert("Flash plugin: " + flashDescription);
			
			var flashVersionArr		= flashDescription.split(".");
			var flashVersionString	= flashVersionArr[0];
			var flashVersion		= flashVersionString.replace("Shockwave Flash ","");
			
//			alert("Flash-Version: " + flashVersion);
//			var flashVersion 		= parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));

     		flash2Installed 		= flashVersion == 2;    
			flash3Installed 		= flashVersion == 3;
			flash4Installed 		= flashVersion == 4;
			flash5Installed 		= flashVersion == 5;
			flash6Installed 		= flashVersion == 6;
			flash7Installed 		= flashVersion == 7;
			flash8Installed 		= flashVersion == 8;
			flash9Installed 		= flashVersion == 9;
			flash10Installed 		= flashVersion >= 10;
		}
	}

	for (var i = 2; i <= maxVersion; i++) {  
		if (eval("flash" + i + "Installed") == true) actualVersion = i;
	}

	if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 3;  

	//alert("version: " + actualVersion);

	if (actualVersion >= flV) {
		hasRightVersion = true;                
	} else {  
		hasRightVersion = false;
	}
}

/* Schreibe Flash für Counter
-----------------*/
function writeFlashCounter(flashfile, imagefile, country, tyear, tmonth, tday, thoure, tmin, tsec, timediff) {
	// detect flash version
	detectFlash(8);

	if(hasRightVersion) {
		// schreibe flash-string
		writeFlash('src',''+flashfile+'?country='+country+'&tyear='+tyear+'&tmonth='+tmonth+'&tday='+tday+'&thoure='+thoure+'&tmin='+tmin+'&tsec='+tsec+'&timediff='+timediff+'','width','405','height','100','allowScriptAccess','sameDomain','wmode','transparent');
	} else {
		// schreibe kein-Flash-String
		var imageobject = "<img src='"+imagefile+"' alt='' />";
		document.write(imageobject);
	}
}

/* Schreibe Flash für Banner
-----------------*/
function writeFlashItem(flashfile, imagefile, linkurl, width, height) {
	// detect flash version
	detectFlash(8);

	if(hasRightVersion) {
		// schreibe flash-string
		writeFlash('src',''+flashfile+'?linkurl='+linkurl+'','width',''+width+'','height',''+height+'','allowScriptAccess','sameDomain','wmode','transparent');
	} else {
		// schreibe kein-Flash-String
		var imageobject = '<a href="'+linkurl+'"><img src="'+imagefile+'" alt="" /></a>';
		document.write(imageobject);
	}
}

/* Schreibe Flash für Flashnavi
-----------------*/
function writeFlashNav(title, subtitle, linkurl, active) {
	// detect flash version
	detectFlash(8);

	if(hasRightVersion) {
		// schreibe flash-string
		writeFlash('src','/swf/flashnav.swf?active='+active+'&title='+title+'&subtitle='+subtitle+'&linkurl='+linkurl+'','width','130','height','35','allowScriptAccess','sameDomain','wmode','transparent');
	} else {
		// schreibe kein-Flash-String
		var imageobject = '<span>'+subtitle+'</span><h2><a href="'+linkurl+'">'+title+'</a></h2>';
		document.write(imageobject);
	}
}

/* Schreibe Flash für Sidetitle
-----------------*/
function writeFlashSidetitle(title) {
	// detect flash version
	detectFlash(8);

	if(hasRightVersion) {
		// schreibe flash-string
		writeFlash('src','/swf/sidetitle.swf?title='+title+'','width','40','height','180','allowScriptAccess','sameDomain','wmode','transparent');
	}
}

/* Schreibe Flash für StartNewsSpacer
-----------------*/
function writeFlashStartNewsSpacer(title, subtitle) {
	// detect flash version
	detectFlash(8);

	if(hasRightVersion) {
		// schreibe flash-string
		writeFlash('src','/swf/startnewsspacer.swf?title='+title+'&subtitle='+subtitle+'','width','85','height','180','allowScriptAccess','sameDomain','wmode','transparent');
	} else {
		// schreibe kein-Flash-String
		var imageobject = '<h3>'+subtitle+'</h3><h2>'+title+'</h2>';
		document.write(imageobject);
	}
}

/* Schreibe Flash für StartDiary
-----------------*/
function writeFlashStartDiary(title, subtitle) {
	// detect flash version
	detectFlash(8);

	if(hasRightVersion) {
		// schreibe flash-string
		writeFlash('src','/swf/startdiarytitle.swf?title='+title+'&subtitle='+subtitle+'','width','260','height','60','allowScriptAccess','sameDomain','wmode','transparent');
	} else {
		// schreibe kein-Flash-String
		var imageobject = '<h3>'+subtitle+'</h3><h2>'+title+'</h2>';
		document.write(imageobject);
	}
}

/* Schreibe Flash für Gallery-Morebutton
-----------------*/
function writeFlashMoreGalleryButton(title, subtitle, linkurl) {
	// detect flash version
	detectFlash(8);

	if(hasRightVersion) {
		// schreibe flash-string
		writeFlash('src','/swf/galleryspecialbutton.swf?title='+title+'&subtitle='+subtitle+'&linkurl='+linkurl+'','width','175','height','62','allowScriptAccess','sameDomain','wmode','transparent');
	} else {
		// schreibe kein-Flash-String
		var imageobject = '<h3><a href="'+linkurl+'">'+subtitle+'</a></h3><h2><a href="'+linkurl+'">'+title+'</a></h2>';
		document.write(imageobject);
	}
}

/* Schreibe Flash für Gallery-Morebutton (Track)
-----------------*/
function writeFlashMoreGalleryTrackButton(title, subtitle, linkurl) {
	// detect flash version
	detectFlash(8);

	if(hasRightVersion) {
		// schreibe flash-string
		writeFlash('src','/swf/galleryspecialbutton_track.swf?title='+title+'&subtitle='+subtitle+'&linkurl='+linkurl+'','width','89','height','100','allowScriptAccess','sameDomain','wmode','transparent');
	} else {
		// schreibe kein-Flash-String
		var imageobject = '<h3><a href="'+linkurl+'">'+subtitle+'</a></h3><h2><a href="'+linkurl+'">'+title+'</a></h2>';
		document.write(imageobject);
	}
}

/* Schreibe Flash für Gallery-Morebutton (Track)
-----------------*/
function writeFlashMoreGalleryProfileButton(title, subtitle, linkurl) {
	// detect flash version
	detectFlash(8);

	if(hasRightVersion) {
		// schreibe flash-string
		writeFlash('src','/swf/galleryprofile.swf?title='+title+'&subtitle='+subtitle+'&linkurl='+linkurl+'','width','130','height','65','allowScriptAccess','sameDomain','wmode','transparent');
	} else {
		// schreibe kein-Flash-String
		var imageobject = '<h3><a href="'+linkurl+'">'+subtitle+'</a></h3><h2><a href="'+linkurl+'">'+title+'</a></h2>';
		document.write(imageobject);
	}
}

/* Schreibe Flash für Gallerybutton
-----------------*/
function writeFlashGalleryListbutton(title, subtitle, linkurl, active) {
	// detect flash version
	detectFlash(8);

	if(hasRightVersion) {
		// schreibe flash-string
		writeFlash('src','/swf/gallerylistbutton.swf?title='+title+'&subtitle='+subtitle+'&linkurl='+linkurl+'&active='+active+'','width','260','height','40','allowScriptAccess','sameDomain','wmode','transparent');
	} else {
		// schreibe kein-Flash-String
		var imageobject = '<div class="gallerylistitem"><h3><a href="'+linkurl+'">'+subtitle+'</a></h3><h2><a href="'+linkurl+'">'+title+'</a></h2></div>';
		document.write(imageobject);
	}
}

/* Schreibe Flash für Seitentitel
-----------------*/
function writeFlashTitle(flashfile, title, subtitle, width, height) {
	// detect flash version
	detectFlash(8);

	if(hasRightVersion) {
		// schreibe flash-string
		writeFlash('src','/swf/'+flashfile+'?title='+title+'&subtitle='+subtitle+'','width',''+width+'','height',''+height+'','allowScriptAccess','sameDomain','wmode','transparent');
	} else {
		// schreibe kein-Flash-String
		var imageobject = '<h2>'+subtitle+'</h2><h1>'+title+'</h1>';
		document.write(imageobject);
	}
}

/* Schreibe Flash für Content-Mitteltitel
-----------------*/
function writeFlashMidTitle(title) {
	// detect flash version
	detectFlash(8);

	if(hasRightVersion) {
		// schreibe flash-string
		writeFlash('src','/swf/contentmidtitle.swf?title='+title+'','width','390','height','45','allowScriptAccess','sameDomain','wmode','transparent');
	} else {
		// schreibe kein-Flash-String
		var imageobject = '<h3>'+title+'</h3>';
		document.write(imageobject);
	}
}

/* Schreibe Flash für Contentimage
-----------------*/
function writeFlashContentimage(image, title) {
	// detect flash version
	detectFlash(8);

	if(hasRightVersion) {
		// schreibe flash-string
		writeFlash('src','/swf/contentimage.swf?image='+image+'&title='+title+'','width','390','height','100','allowScriptAccess','sameDomain','wmode','transparent');
	}
}

/* Schreibe Flash für Strecke
-----------------*/
function writeFlashTrack(flashfile, imagefile, width, height) {
	// detect flash version
	detectFlash(8);

	if(hasRightVersion) {
		// schreibe flash-string
		writeFlash('src',''+flashfile+'','width',''+width+'','height',''+height+'','allowScriptAccess','sameDomain','wmode','transparent');
	} else {
		// schreibe kein-Flash-String
		var imageobject = '<p><img src="'+imagefile+'" alt="" /></p>';
		document.write(imageobject);
	}
}

/* Schreibe Flash für Forums-Kategorie
-----------------*/
function writeFlashBoardcatTitle(flashfile, title, subtitle, linkurl, width, height) {
	// detect flash version
	detectFlash(8);

	if(hasRightVersion) {
		// schreibe flash-string
		writeFlash('src','/swf/'+flashfile+'?title='+title+'&subtitle='+subtitle+'&linkurl='+linkurl+'','width',''+width+'','height',''+height+'','allowScriptAccess','sameDomain','wmode','transparent');
	} else {
		// schreibe kein-Flash-String
		var imageobject = '<h3><a href="'+linkurl+'">'+subtitle+'</a></h3><h2><a href="'+linkurl+'">'+title+'</a></h2>';
		document.write(imageobject);
	}
}

/* Schreibe Flash für Forums-Toplink
-----------------*/
function writeFlashBoardTopTitle(flashfile, title, linkurl, width, height) {
	// detect flash version
	detectFlash(8);

	if(hasRightVersion) {
		// schreibe flash-string
		writeFlash('src','/swf/'+flashfile+'?title='+title+'&linkurl='+linkurl+'','width',''+width+'','height',''+height+'','allowScriptAccess','sameDomain','wmode','transparent');
	} else {
		// schreibe kein-Flash-String
		var imageobject = '<h4><a href="'+linkurl+'">'+title+'</a></h4>';
		document.write(imageobject);
	}
}
