// swf = url des flashes
// id = eindeutige id, wird im js verwendet
function commonFlashInsert(swf, id, width, height, flashVars){
	var hasFlashVars=false;
	if (flashVars!=null && String(flashVars).length>0){
		hasFlashVars=true;
	}
    //AC_FL_RunContent(  "src", swf,...    
    //Funktioniert leider nicht weil der wmode parameter nicht weitergegeben wird
  document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,65,0" width="' + width + '" height="' + height + '" id="' + id + '" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<param name="movie" value="' + swf + '" />');		
	document.write('<param name="quality" value="high" />');
	if(hasFlashVars){
		document.write('<param name="FlashVars" value="' + flashVars + '" />');
	}
	var appender = "";
	if(hasFlashVars){
		appender = ' FlashVars="' + flashVars + '" ';
	}
	document.write('<embed src="' + swf + '" wmode="transparent" ' + appender + ' quality="high" width="' + width + '" height="' + height +'" name="' + id + '" id="' + id + '" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer"/>');		
	document.write('</object>');
	
}		

// linktag = der eröffnende <a ...> Tag ohne Ende (</a> ist hardcoded!).
// positionsElementId die ID eines HTML Elements (zb. td tag, div tag) der die Position des Flashes angibt (siehe unten)
// es ist notwendig das ein elternelement und auf gleicher position wie das flash befindliche tag (zb. der umgebende) eine positionierung ungleich statisch aufweist (siehe Doku, contentdelivery, funktion unten)
function commonFlashInsertWithDivLinkPos(swf, id, width, height, flashVars, linkTag, positionsElementId){							
  commonFlashInsert(swf, id, width,height,flashVars);

  document.write('<DIV id="' + id + 'DIV" style="VISIBILITY: visible; POSITION: absolute; TOP: 0px; left:0px;">' + linkTag + '<IMG title="" height="' + height + '" width="' + width + '" src="/images/CO_px.gif"  border=0 /></A></DIV>');
}

// Hier muss die Position nicht angegeben werden, es wird eigenständig ein umgebender div tag erzeugt, dieser kann jedoch das Layout beinflussen
function commonFlashInsertWithDivLink(swf, id, width, height, flashVars, linkTag){			
	// Flash mit Link, flash wird durch div gefunden
  // Firefox findet das object selbst nicht, aber ein darum liegendes div/td bspw. schon. 		
	document.write('<div id="' + id + 'span" style="position:relative; top:0px;left:0px;">');		
  commonFlashInsertWithDivLinkPos(swf, id, width,height,flashVars,linkTag, id+'span');
	document.write('</div>');

}

var bodyOnloadArray = new Array();
function commonOnLoad(){
  var i = 0;
  for(i=0;i<bodyOnloadArray.length;i++){
    bodyOnloadArray[i]();
  }
}