/** X-Browser Erkennung **/
isDOM   = (document.getElementById) ? 1 : 0;
isNS4   = (document.layers)? 1 : 0;
isOpera = (navigator.userAgent.toLowerCase().indexOf("opera") > -1) ? 1 : 0;
isIE    = (navigator.userAgent.toLowerCase().indexOf("msie") > -1) ? 1 : 0;
isIE    = isIE && !isOpera;
isIE5   = isIE && isDOM;
isIE4   = (document.all) ? 1 : 0;
isIE4   = isIE4 && isIE && !isDOM;

isWin   = (navigator.userAgent.toLowerCase().indexOf("win") > -1) ? 1 : 0;
isMac   = (navigator.userAgent.toLowerCase().indexOf("mac") > -1) ? 1 : 0;
isX11   = (navigator.userAgent.toLowerCase().indexOf("x11") > -1) ? 1 : 0;

/** error handling  **/
function stopError() { return true; }
window.onerror = stopError;

/** Stylesheet Voodoo **/

function getStyle(){
var str = "";

var winFontSizes = new Array();
winFontSizes[0] = 16;
winFontSizes[1] = 13;
winFontSizes[2] = 11;
winFontSizes[3] = 10;
winFontSizes[4] = 9;
winFontSizes[5] = 8;

var macFontSizes = new Array();
for(i=0;i<winFontSizes.length;i++){ macFontSizes[i] = Math.ceil(2.54/2*winFontSizes[i]) };

var xFontSizes = new Array();
xFontSizes[0] = "x-large";
xFontSizes[1] = "large";
xFontSizes[2] = "large";
xFontSizes[3] = "medium";
xFontSizes[4] = "medium";
xFontSizes[5] = "small";

if(isNS4||isIE4){
str  = '<style type="text/css">\n';
str += '#seite{ position: absolute; top: 0px; left: 0px; }\n';
str += 'p{ margin-left: 10px; }\n';
str += 'p.inline,p.datum{ margin-left: 10px; padding: 0px; }\n';
if(isWin){
   str += '#navigation{ font-size: '  + winFontSizes[4] + 'pt; }\n';
   str += '#copyright,small,ul .klein{ font-size: '  + winFontSizes[5] + 'pt; }\n';	
   str += 'h1{ font-size: ' + winFontSizes[1] + 'pt; }\n';
   str += 'h1.gross{ font-size: ' + winFontSizes[0] + 'pt; }\n';
   str += 'p,p.inline,ul{ font-size: '  + winFontSizes[4] + 'pt; }\n';
}
else if(isMac){
   str += '#navigation{ font-size: '  + macFontSizes[4] + 'pt; }\n';
   str += '#copyright,small,ul .klein{ font-size: '  + macFontSizes[5] + 'pt; }\n';	
   str += 'h1{ font-size: ' + macFontSizes[1] + 'pt; }\n';
   str += 'h1.gross{ font-size: ' + macFontSizes[0] + 'pt; }\n';
   str += 'p,p.inline,ul{ font-size: '  + macFontSizes[4] + 'pt; }\n';
}
else if(isX11){
   str += '#navigation{ font-size: '  + xFontSizes[4] + '; }\n';	
   str += '#copyright,small,ul .klein{ font-size: '  + xFontSizes[5] + '; }\n';	
   str += 'h1{ font-size: ' + xFontSizes[2] + '; }\n';
   str += 'h1.gross{ font-size: ' + xFontSizes[1] + '; }\n';
   str += 'p,p.inline,ul{ font-size: '  + xFontSizes[4] + '; }\n';
}
str += '</style>\n';

/**
if(isIE4){
   str += '\n<script type="text/javascript" src="/script/group_ie4.js"></script>';
}
**/
}
str += detectFlash();
return str;
}

/** Flash Detection **/

var MM_FlashCanPlay = 0;
var MM_contentVersion = 4;

function detectFlash(){	
  var str ='';
  var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
  if ( plugin ) {
	    var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	    for (var i = 0; i < words.length; ++i)
	    {
		if (isNaN(parseInt(words[i])))
		continue;
		var MM_PluginVersion = words[i]; 
	    }
	    MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
  }
  else if (isIE && isWin) {
  	str += '\n<script type="text/vbscript" src="/script/studioeins.vbs"></script>\n';
  }
  return str;
}

/** RealPlayer Detection **/

var RealCanPlay = 0;

function detectRealPlayerPlugin(){	
  var str ='';
  var plugin = (navigator.mimeTypes && navigator.mimeTypes["audio/x-pn-realaudio-plugin"]) ? navigator.mimeTypes["audio/x-pn-realaudio-plugin"].enabledPlugin : 0;
  if ( plugin ) { RealCanPlay = 1; }
  else if (isIE && isWin) {
  	str += '\n<script type="text/vbscript" src="/script/studioeins.vbs"></script>\n';
  }
  return str;
}
