/*
version 2003.11.06
*/
/*
-do not change this file
-do not put this code in a html-file! must be js-file.
-copy the commented code below into html-file.
-duplicate the function if you have multiple swf's.
-do not forget <noscript> tags in html.
-reqflashVersion is the required flash-version.
-params that are not set are not used.
noflash-version:
-'altPage' or 'altImg' should be URL's. 
-when both are not set no alternativ-version is provided.
-the 'altImg' has the size of the flash.
ask raphi if you have a problem
*/
/*
var f=new function(){
this.reqflashVersion = 7;
this.flashName="test.swf";
this.flashId="myname"; //identification name
this.flashWidth=100;
this.flashHeight=100;
this.flashBgcolor="#FFFFFF";
this.flashScale="noborder"; //noborder, exactfit, noscale
this.flashAlign="top"; //top, bottom, left, right
this.flashSalign="TL"; // TL, TR, BL, BR
this.flashQuality="high"; // low, medium, high, autolow, autohigh
this.flashMenu="false"; //true, false
this.flashPlay=""; //true, false
this.flashLoop=""; //true, false
this.flashWmode="opaque"; //transparent, opaque
//this.altPage="noflash.php";
this.altImg="noflash.gif";
this.moreParams="?sessid=1&lang=de";
this.flash();
}
*/
////////////////////////////
////////////////////////////
var debug=false;
var flashVersion = 0;
var flashVersion_DONTKNOW = -1;
Object.prototype.flash=flash;

function flash(){
	this.moreParams=(typeof(this.moreParams)!="undefined")? this.moreParams: "";
	this.flashVersion=(flashVersion==0)? getFlashVersion() : flashVersion;
	if(this.flashVersion >= this.reqflashVersion){
		var htmltags="";
		htmltags+="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab' ";
		htmltags+=(typeof(this.flashId)!="undefined")? "id='"+this.flashId+"' ": "";
		htmltags+=(typeof(this.flashId)!="undefined")? "name='"+this.flashId+"' ": "";
		htmltags+=(typeof(this.flashWidth)!="undefined")? "width='"+this.flashWidth+"' ": "";
		htmltags+=(typeof(this.flashHeight)!="undefined")? "height='"+this.flashHeight+"' ": "";
		htmltags+=(typeof(this.flashAlign)!="undefined")? "align='"+this.flashAlign+"'": "";
		htmltags+=">\n";
		htmltags+="<param name=movie value='"+this.flashName+this.moreParams+"'>\n";
		htmltags+=(typeof(this.flashMenu)!="undefined")? "<param name=menu value='"+this.flashMenu+"'>\n": "";
		htmltags+=(typeof(this.flashSalign)!="undefined")? "<param name=salign value='"+this.flashSalign+"'>\n": "";
		htmltags+=(typeof(this.flashScale)!="undefined")? "<param name=scale value='"+this.flashScale+"'>\n": "";
		htmltags+=(typeof(this.flashQuality)!="undefined")? "<param name=quality value='"+this.flashQuality+"'>\n": "";
		htmltags+=(typeof(this.flashBgcolor)!="undefined")? "<param name=bgcolor value='"+this.flashBgcolor+"'>\n": "";
		htmltags+=(typeof(this.flashPlay)!="undefined")? "<param name=play value='"+this.flashPlay+"'>\n": "";
		htmltags+=(typeof(this.flashLoop)!="undefined")? "<param name=loop value='"+this.flashLoop+"'>\n": "";
		htmltags+=(typeof(this.flashWmode)!="undefined")? "<param name=wmode value='"+this.flashWmode+"'>\n": "";

		htmltags+="<embed src='"+this.flashName+this.moreParams+"' ";
		htmltags+=(typeof(this.flashId)!="undefined")? "name='"+this.flashId+"' ": "";
		htmltags+=(typeof(this.flashMenu)!="undefined")? "menu='"+this.flashMenu+"' ": "";
		htmltags+=(typeof(this.flashWidth)!="undefined")? "width='"+this.flashWidth+"' ": "";
		htmltags+=(typeof(this.flashHeight)!="undefined")? "height='"+this.flashHeight+"' ": "";
		htmltags+=(typeof(this.flashQuality)!="undefined")? "quality='"+this.flashQuality+"' ": "";
		htmltags+=(typeof(this.flashScale)!="undefined")? "scale='"+this.flashScale+"' ": "";
		htmltags+=(typeof(this.flashAlign)!="undefined")? "align='"+this.flashAlign+"' ": "";
		htmltags+=(typeof(this.flashSalign)!="undefined")? "salign='"+this.flashSalign+"' ": "";
		htmltags+=(typeof(this.flashBgcolor)!="undefined")? "bgcolor='"+this.flashBgcolor+"' ": "";
		htmltags+=(typeof(this.flashPlay)!="undefined")? "play='"+this.flashPlay+"' ": "";
		htmltags+=(typeof(this.flashLoop)!="undefined")? "loop='"+this.flashLoop+"' ": "";
		htmltags+=(typeof(this.flashWmode)!="undefined")? "wmode='"+this.flashWmode+"' ": "";
		htmltags+="pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash'";
		htmltags+="></embed>";
		htmltags+="</object>";
		document.write();
		document.write(htmltags);
	} else{
		if(this.altPage!="" && typeof(this.altPage)!="undefined"){
		location.href=this.altPage+this.moreParams;
		}
		else if(this.altImg!="" && typeof(this.altImg)!="undefined"){
		document.write("<img src='"+this.altImg+"' width='"+this.flashWidth+"' height='"+this.flashHeight+"' border='0'>");
		}
	}
	if(debug){
	alert(htmltags);
	}
}

function getFlashVersion() {
	br=new verifyCompatibleBrowser();
	var agent = navigator.userAgent.toLowerCase();
   if (br.ns3 == 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') { 
			if (flashPlugin.description.indexOf('12.') != -1) flashVersion = 12;
			else if (flashPlugin.description.indexOf('11.') != -1) flashVersion = 11;
			else if (flashPlugin.description.indexOf('10.') != -1) flashVersion = 10;
			else if (flashPlugin.description.indexOf('9.') != -1) flashVersion = 9;
			else if (flashPlugin.description.indexOf('8.') != -1) flashVersion = 8;
			else if (flashPlugin.description.indexOf('7.') != -1) flashVersion = 7;
			else if (flashPlugin.description.indexOf('6.') != -1) flashVersion = 6;
			else if (flashPlugin.description.indexOf('5.') != -1) flashVersion = 5;
			else if (flashPlugin.description.indexOf('4.') != -1) flashVersion = 4;
			else if (flashPlugin.description.indexOf('3.') != -1) flashVersion = 3;
			else if (flashPlugin.description.indexOf('2.') != -1) flashVersion = 2;
			else if (flashPlugin.description.indexOf('1.') != -1) flashVersion = 1;
			else flashVersion=99;
		}
	}

	// 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) {
	   document.write('<scr' + 'ipt language="VBScript"\> \n');
		document.write('on error resume next \n');
		document.write('dim obFlash \n');
		document.write('set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.12") \n');
		document.write('if IsObject(obFlash) then \n');
		document.write('flashVersion = 12 \n');
		document.write('else set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.11") end if \n');
		document.write('if flashVersion < 12 and IsObject(obFlash) then \n');
		document.write('flashVersion = 11 \n');
		document.write('else set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.10") end if \n');
		document.write('if flashVersion < 11 and IsObject(obFlash) then \n');
		document.write('flashVersion = 10 \n');
		document.write('else set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.9") end if \n');
		document.write('if flashVersion < 10 and IsObject(obFlash) then \n');
		document.write('flashVersion = 9 \n');
		document.write('else set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.8") end if \n');
		document.write('if flashVersion < 9 and IsObject(obFlash) then \n');
		document.write('flashVersion = 8 \n');
		document.write('else set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.7") end if \n');
		document.write('if flashVersion < 8 and IsObject(obFlash) then \n');
		document.write('flashVersion = 7 \n');
		document.write('else set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.6") end if \n');
		document.write('if flashVersion < 7 and IsObject(obFlash) then \n');
		document.write('flashVersion = 6 \n');
		document.write('else set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.5") end if \n');
		document.write('if flashVersion < 6 and IsObject(obFlash) then \n');
		document.write('flashVersion = 5 \n');
		document.write('else set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.4") end if \n');
		document.write('if flashVersion < 5 and IsObject(obFlash) then \n');
		document.write('flashVersion = 4 \n');
		document.write('else set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.3") end if \n');
		document.write('if flashVersion < 4 and IsObject(obFlash) then \n');
		document.write('flashVersion = 3 \n');
		document.write('end if');
		document.write('</scr' + 'ipt\> \n');
  }
		
	// 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 = flashVersion_DONTKNOW;
	}
	if(debug){
	alert("flashversion: "+flashVersion);
	}
	//if (!br.ok) flashVersion=flashVersion_DONTKNOW;
	return flashVersion;
}

function verifyCompatibleBrowser(){
    this.agt=navigator.userAgent.toLowerCase();
    this.pc = this.agt.indexOf("win")!=-1 || this.agt.indexOf("16bit")!=-1;
    this.ver=navigator.appVersion;
    this.dom=document.getElementById?1:0;
    this.ie5=(this.ver.indexOf("MSIE")>-1 && this.dom)?1:0;
    this.ie4=(document.all && !this.dom)?1:0;
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
    this.ns4=(document.layers && !this.dom)?1:0;
    this.ns3=(this.agt.indexOf("mozilla/3") && !this.ie4)?1:0;
    this.opera = (window.opera)?1:0;
    this.ok=((this.ie5 || this.ie4 || this.ns4 || this.ns5) && !this.opera);
    	if(debug){
	alert("browser: "+this.agt);
	}
    
    return this;
}
