function isDefined(property) {
  return (typeof property != 'undefined');
}

var flashVersion = 0;
function getFlashVersion() {

	/************************************************************************
	 * Diese Zahl ändern, wenn eine neue FLash-Version auf dem Markt ist!
	 ************************************************************************/
	var latestFlashVersion = 10;

   var agent = navigator.userAgent.toLowerCase();

   // NS3 needs flashVersion to be a local variable
   if (agent.indexOf("mozilla/3") != -1 && agent.indexOf("msie") == -1) {
      flashVersion = 0;
   }

	// NS3+, Opera3+, IE5+ Mac (support plugin array):  check for Flash plugin in plugin array
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		var flashPlugin = navigator.plugins['Shockwave Flash'];
		if (typeof flashPlugin == 'object') {
			for (var i = latestFlashVersion; i >= 3; i--) {
            if (flashPlugin.description.indexOf(i + '.') != -1) {
               flashVersion = i;
               break;
            }
         }
		}
	}

	// IE4+ Win32:  attempt to create an ActiveX object using VBScript
	else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
	   var doc = '<scr' + 'ipt language="VBScript"\> \n';
      doc += 'On Error Resume Next \n';
      doc += 'Dim obFlash \n';
      doc += 'For i = ' + latestFlashVersion + ' To 3 Step -1 \n';
      doc += '   Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n';
      doc += '   If IsObject(obFlash) Then \n';
      doc += '      flashVersion = i \n';
      doc += '      Exit For \n';
      doc += '   End If \n';
      doc += 'Next \n';
      doc += '</scr' + 'ipt\> \n';
      document.write(doc);
   }

	// WebTV 2.5 supports flash 3
	else if (agent.indexOf("webtv/2.5") != -1) flashVersion = 3;

	// older WebTV supports flash 2
	else if (agent.indexOf("webtv") != -1) flashVersion = 2;

	// Can't detect in all other cases
	else {
		flashVersion = -1;
	}

	return flashVersion;
}

function addFlash(file, width, height, vars, langId, menu, bgColor, trans)
{
	if(getFlashVersion() >= 8)
	{
		document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"  + width + "' height='" + height + "' id='" + file + "' align='middle' style='vertical-align:text-top;margin:0;'>");
		document.write("<param name='allowScriptAccess' value='sameDomain' />");
	  document.write(((trans) ? "<param name='wmode' value='transparent' />":""));
		document.write("<param name='FlashVars' value='" + vars + "'/>");
		document.write("<param name='scale' value='noscale' />");
		document.write("<param name='Menu' value='" + menu + "'/>");
		document.write("<param name='quality' value='best' />");
		document.write("<param name='bgcolor' value='" + bgColor + "' />");
		document.write("<param name='movie' value='flash/" + file + ".swf?" + vars + "'/>");
		document.write("<embed src='flash/" + file + ".swf?" + vars + "' FlashVars='" + vars + "' quality='best'  bgcolor='" + bgColor + "' width='" + width + "' height='" + height + "' name='" + file + "' menu='" + menu + "' align='middle' allowScriptAccess='sameDomain' " + ((trans) ? "wmode='transparent'" : "") + " type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' scale='noscale' />");
		document.write("</object>");
	}
	else
	{
		document.write("<br /><br />Um den Fan-Kalender benutzen zu können, benötigen Sie den <b>Flash-Player</b> in Version 8.0 oder höher.");
		document.write(" Die aktuellste Version des <b>Flashplayers</b> können Sie kostenlos bei <a href='http://www.adobe.com/de/products/flashplayer/'>Adobe</a> herunterladen.<br /><br />");
		document.write("<center><a href='http://www.adobe.com/de/products/flashplayer/'><img src='/im/ftrb/getfl.jpg' border='0'></a></center>");
	}
}