// JavaScript Document

function PrintPage() {
	for(i = 0; i < document.forms[0].length; i++) {
		if (document.forms[0].elements[i].type == 'button') document.forms[0].elements[i].style.visibility = 'hidden';
	}
    // Do print the page
    if (typeof(window.print) != 'undefined') {
        window.print();
    }
	for(i = 0; i < document.forms[0].length; i++) {
		if (document.forms[0].elements[i].type == 'button') document.forms[0].elements[i].style.visibility = '';
	}
}

function NewColor(obj,fgcol,bgcol,bratt)
{
if(obj.style)
{
obj.style.color=fgcol; //Forground-Color
obj.style.backgroundColor=bgcol; //Background-Color
obj.style.border=bratt; //Border-Attribute
}
}

function NewWindow(mypage,myname,w,h,pos,infocus, scroll) {
	if(pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}
	else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=20}
	settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=" + scroll + ",location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";win=window.open(mypage,myname,settings);
	if (infocus == 'true') win.focus();
}


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; 
  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) 
  	x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function SwapImage(obj, picture) {
	
	if(!obj.oSrc) 
	  obj.oSrc=obj.src; 	
	obj.src = picture;
	
}

function SwapImageArea(objname, picture) {
	
	if ((x=MM_findObj(objname))!=null)
	  {
		  if(!x.oSrc) 
		    x.oSrc=x.src;  
		x.src=picture;
	  }
} 

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; 
  document.MM_sr=new Array; 
  
  for(i=0;i<(a.length-2);i+=3)
    if ((x=MM_findObj(a[i]))!=null)
	  {
		  document.MM_sr[j++]=x; 
		  if(!x.oSrc) 
		    x.oSrc=x.src; 
		x.src=a[i+2];
	  }
}

var imageHandler = { 
    path:"images/", // path to images
    imgs:[], preload:function() { for(var i=0;arguments[i];i++) {
    var img=new Image(); img.src=this.path+arguments[i]; this.imgs[this.imgs.length]=img;}}
}

/* System
----------------------------------------------------------------------------------------------------------*/
var requiredVersion = 5;
var flash2Installed = false;	// wahr wenn flash 2 installiert ist
var flash3Installed = false;	// wahr wenn flash 3 installiert ist
var flash4Installed = false;	// wahr wenn flash 4 installiert ist
var flash5Installed = false;	// wahr wenn flash 5 installiert ist
var flash6Installed = false;	// wahr wenn flash 6 installiert ist
var flash7Installed = false;	// wahr wenn flash 7 installiert ist
var maxVersion 		= 7;		// die Version die momentan maximal gecheckt wird
var actualVersion 	= 0;		// die version die der User hat
var hasRightVersion = false;	// wahr wenn der User die richtige Version hat

isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;    	// TRUE wenn IE
isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false; // TRUE wenn auf Windows


/* VB-Script Detection beim MsIe auf Windows, da MsIe bei Windows
-- regular JavaScript Plugins nicht unterstützt
-------------------------------------------------------------------*/
if(isIE && isWin){
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
	document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
	document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
	document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
	document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');
	document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
	document.write('</SCR' + 'IPT\> \n');
}



function detectFlash() {  
	// existiert navigator.plugins
	if (navigator.plugins) {
		// check für flash 2 oder flash 3+
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var isVersion2 			= navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription 	= navigator.plugins["Shockwave Flash" + isVersion2].description;

			//alert("Flash plugin description: " + flashDescription);

			var flashVersion 		= parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
     		flash2Installed 		= flashVersion == 2;    
			flash3Installed 		= flashVersion == 3;
			flash4Installed 		= flashVersion == 4;
			flash5Installed 		= flashVersion == 5;
			flash6Installed 		= flashVersion == 6;
			flash7Installed 		= flashVersion >= 7;
		}
	}

	for (var i = 2; i <= maxVersion; i++) {  
		if (eval("flash" + i + "Installed") == true) actualVersion = i;
	}

	if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 3;  	
	

if (actualVersion >= requiredVersion) { 		// user has a new enough version
		hasRightVersion = true;						// flag: it's okay to write out the object/embed tags later
}

}





detectFlash();	// call our detector now that it's safely loaded.
	
	
	
function writeflash (flash,theimage,w,h,themap)
{

if(hasRightVersion && isIE && flash != '') {	
// if we've detected an acceptable version
		var oeTags = '<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
		+ 'WIDTH="' + w + '" HEIGHT="' + h +'"'
		+ 'CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
		+ '<PARAM NAME="MOVIE" VALUE="'+ flash + '">'
		+ '<PARAM NAME="PLAY" VALUE="true">'
		+ '<PARAM NAME="LOOP" VALUE="true">'
		+ '<PARAM NAME="QUALITY" VALUE="high">'
		+ '<PARAM NAME="MENU" VALUE="false">'
        + '<PARAM NAME="wmode" VALUE="transparent">'
		+ '<EMBED SRC="' + flash + '"'
		+ 'WIDTH="' + w + '" HEIGHT="' + h +'"'
		+ 'PLAY="true"'
		+ 'LOOP="true"'
		+ 'QUALITY="high"'
		+ 'MENU="false"'
		+ 'TYPE="application/x-shockwave-flash"'
		+ 'PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'
		+ '</EMBED>'
		+ '</OBJECT>';

		document.write(oeTags); 	// embed the flash movie
	} 
else {	
		// flash is too old or we can't detect the plugin or can't detect MSIE
		var alternateContent = '<img src="' + theimage+ '" height="' + h + '" width="' + w + '" border="0" alt="" />'	// height, width required!
		document.write(alternateContent);	// insert non-flash content

	}
}	
