

var MM_contentVersion = 6;
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]; 
	    }
	var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
}


htmlElements = new Array("h1","h5");

function insertFlashes()
{
	if(MM_FlashCanPlay)
	{
		for(i=0;i<htmlElements.length;i++)
		{
			replaceHeading(htmlElements[i]);
		}
	}
}

function URLEncode(s) {
     if (window.encodeURIComponent) {
        return encodeURIComponent(s);
     }
     else if (window.escape) {
        return escape(s); 
     }
     return s;
}


function replaceHeading(htmltag) {
	
	for(var i = 0; i < document.getElementsByTagName(htmltag).length; i++) 	
	{
		// Ersetzen des Menues
		if(htmltag == "h5")
		{
			myValue = document.getElementsByTagName(htmltag)[i].getElementsByTagName("a")[0].innerHTML;
			mylink = document.getElementsByTagName(htmltag)[i].getElementsByTagName("a")[0].href;
			pos = document.getElementsByTagName(htmltag)[i].className;
			
			if(document.getElementsByTagName(htmltag)[i].getElementsByTagName("a")[0].className == "active")
			{
				flashVars = 'position=' + pos + '&titel=' + myValue + '&link=' + mylink + '&active=true';
			}
			else
			{
				flashVars = 'position=' + pos + '&titel=' + myValue + '&link=' + mylink;
			}
			
			
			myHeight = 20;
			myWidth = 150;
			myName = "menuitem_" + i;
				
			
		}
		else if (htmltag == "h1")
		{
			
				myValue = document.getElementsByTagName(htmltag)[i].innerHTML;
				myValuePrint = myValue;
				myValue = URLEncode(myValue);
											
				myHeight = 26;
				myWidth = 555;
				myName = "headline_" + i;
				flashVars = 'position=' + position + '&headline=' + myValue;
		}
		
		if (myValue != undefined) 
		{
				
				myObj = document.getElementsByTagName(htmltag)[i];
				myParent = myObj.parentNode;
				
				myFlash = ( ' ' +
				'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + myWidth + '" height="' + myHeight + '">' +
				  '<param name="movie" value="/static/swf/' + htmltag + '.swf" />' +
				  '<param name="quality" value="high" />' +
				  '<param name="wmode" value="transparent" />' +
				  '<param name="scale" value="noscale" />' +
				  '<param name="flashVars" value="' + flashVars + '" />' +
				  '<embed src="/static/swf/' + htmltag + '.swf" wmode="transparent" scale="noscale" flashvars="' + flashVars + '" quality="high" pluginspage="https://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + myWidth + '" height="' + myHeight + '"></embed>' +
				'</object>' +
				' ');
				
				
				replaceDiv = document.createElement('div');
				
				/*if(htmltag != "i")
				{
					myFlash = myFlash + '<span class="' + htmltag + '">' + myValuePrint + '</span>';
				}*/
				
				replaceDiv.innerHTML = myFlash;
				
				/*if(htmltag == "h1")
				{
					replaceDiv.style.height = h1height + "px";
					replaceDiv.style.overflow = "hidden";
				}*/
				
				replaceDiv.className="flashheadline";
				//replaceDiv.innerHTML = myFlash;
				myParent.replaceChild(replaceDiv, myObj);
				i--;

		}
	
	}
	
}

insertFlashes();
