// ***************************
//	Funktionen
// 	--------------------------
//  by Andy Haeberli
//  www.crealogix.com
//  vs. 0.1  2003-11-21
// ***************************
//
// 	--------------------------
//	Browser / Plattform identifikation
// 	--------------------------
	function BrowserIdent() {
		var b = navigator.appName;
		if(b == 'Netscape') this.b = 'ns';
		else if(navigator.userAgent.toLowerCase().indexOf('opera') > -1) this.b = 'opera';
		else if(b == 'Microsoft Internet Explorer') this.b = 'ie';
		else this.b = b;
		this.version = navigator.appVersion;
		this.v = parseInt(this.version);
		this.vNo = parseFloat(navigator.appVersion);
		this.ns = (this.b == 'ns' && this.v >= 4);
		this.nsMinor406 = (this.b == 'ns' && this.vNo <= 4.05);
		this.ns4 = (this.b == 'ns' && this.v == 4);
		this.ns5 = (this.b == 'ns' && this.v == 5);
		this.ns6 = (parseInt(navigator.productSub) >= 20010131 && parseInt(navigator.productSub) < 20030208);
		this.ns7 = (parseInt(navigator.productSub) >= 20030208);
		this.ie = (this.b == 'ie' && this.v >= 4);
		this.ie4 = (this.version.indexOf('MSIE 4') > 0);
		this.ie5 = (this.version.indexOf('MSIE 5') > 0);
		this.ie55 = (this.version.indexOf('MSIE 5.5') > 0);
		this.ie6 = (this.version.indexOf('MSIE 6') > 0);
		this.opera = (this.b == 'opera');
		this.dom = ((document.createRange && (document.createRange().createContextualFragment) || document.getElementById) ? true:false);
		this.min = (this.ns || this.ie);
		var ua = navigator.userAgent.toLowerCase();
		if(ua.indexOf('win') > -1) this.platform = 'win32';
		else if(ua.indexOf('mac') > -1) this.platform = 'mac';
		else this.platform = 'other';
		this.win95 = (this.platform == 'win32' && (ua.indexOf('windows 95') > -1  || ua.indexOf('win95') > -1));
		this.win98 = (this.platform == 'win32' && (ua.indexOf('windows 98') > -1 || ua.indexOf('win98') > -1));
		this.winNT = (this.platform == 'win32' && (ua.indexOf('windows nt') > -1 || ua.indexOf('winnt') > -1) && (ua.indexOf('5.0') == -1 || ua.indexOf('5.1') == -1));
		this.win2000 = (this.platform == 'win32' && (ua.indexOf('windows nt') > -1 || ua.indexOf('winnt') > -1) && ua.indexOf('5.0') > -1);
		this.winXP = (this.platform == 'win32' && (ua.indexOf('windows nt') > -1 || ua.indexOf('winnt') > -1) && ua.indexOf('5.1') > -1);
		this.isSP2 = (this.platform == 'win32' && ua.indexOf("SV1") != -1);
	}
	var iSystem = new BrowserIdent();
	
//
// ***************************
//
// 	--------------------------
//	Screen identifikation
// 	--------------------------
	function ScreenIdent() {
		this.screenWidth = screen.availWidth;
		this.screenHeight = screen.availHeight;
		if(iSystem.ns4 == true) {
			this.windowWidth = screen.availWidth-12;
			if(iSystem.winXP == true) {
				this.windowHeight =	screen.availHeight-72
			} else {
				this.windowHeight = screen.availHeight-31;
			}
		} else {
			this.windowWidth = screen.availWidth
			this.windowHeight =	screen.availHeight
		}
	}	
	var iScreen = new ScreenIdent();
//
// 	--------------------------
// 	Open Window
// 	--------------------------
	function openWindow(whichFile){
		if (whichFile.indexOf(".htm")>-1 || whichFile.indexOf(".html")>-1 || whichFile.indexOf("http://")>-1) {
			// Web-Seite
	   		openPopUp(whichFile,"win_document","","","","","1","1","1","1","0","1","1");
		} else if (whichFile.indexOf(".pdf")>-1) {
			// PDF-Dokument
	   		openPopUp(whichFile,"win_document","","","","","1","1","1","1","0","1","1");
		} else {
			if (iSystem.isSP2) {
				// XP SP2
				tFile = whichFile.split("../")
				tFile = tFile[tFile.length-1]
				openPopUp("../_assets/documents/document_"+language+".htm?"+tFile,"win_document","","","","","1","1","1","1","0","1","1");
	   		} else {
				// nicht XP SP2
				if (iSystem.ns) {
					// Netscape
					window.location.href = whichFile;
	   			} else {
					// Internet Explorer / Andere
	   				openPopUp(whichFile,"win_document","","","","","1","1","1","1","0","1","1");
				}
			}
		}
	}
//
//
// 	--------------------------
//	Popup (create / open / close)
// 	--------------------------
	function openPopUp(url,popName,windowWidth,windowHeight,top,left,toolbar,scrollbars,resizable,location,directories,status,menubar) {
		/*
  		var url = '';
  		var popName = '';
  		var windowWidth = 0 ; 
  		var windowHeight = 0;
  		var top = 0;
  		var left = 0;
  		var toolbar = '0';
 		var scrollbars = '0';
  		var resizable = '0';
  		var location = '0';
  		var directories = '0';
  		var status = '0'
  		var menubar = '0';
		*/		
  		var windowWidth = 900 ; 
  		var windowHeight = 600;
  		if(window.popup){
    		if (!(popup.closed)) { 
      			popup.close(); 
    		}
    		openWin(url,popName,windowWidth,windowHeight,top,left,toolbar,scrollbars,resizable,location,directories,status,menubar);
  		}
  		else{
    		openWin(url,popName,windowWidth,windowHeight,top,left,toolbar,scrollbars,resizable,location,directories,status,menubar);
  		}
	}
// 	--------------------------
//	Popup (create / open / close)
// 	--------------------------
	function openPopUp1(url,popName,windowWidth,windowHeight,top,left,toolbar,scrollbars,resizable,location,directories,status,menubar) {
  		if(window.popup){
    		if (!(popup.closed)) { 
      			popup.close(); 
    		}
    		openWin(url,popName,windowWidth,windowHeight,top,left,toolbar,scrollbars,resizable,location,directories,status,menubar);
  		}
  		else{
    		openWin(url,popName,windowWidth,windowHeight,top,left,toolbar,scrollbars,resizable,location,directories,status,menubar);
  		}
	}
	function openWin(url,popName,windowWidth,windowHeight,top,left,toolbar,scrollbars,resizable,location,directories,status,menubar){
		popup = window.open(url,popName,'toolbar='+toolbar+',location='+location+',directories='+directories+',status='+status+',menubar='+menubar+',scrollbars='+scrollbars+',resizable='+resizable+',width='+windowWidth+',height='+windowHeight+',top='+top+',left='+left);
	}
	function closeWin(){
		if (typeof(popup) != 'undefined') {
			popup.close();
		}
	}
//
// ***************************
//
// 	--------------------------
//	Resize Windows
// 	--------------------------
	function resizeWin() {
		if (iSystem.ns4 == false) {
			window.resizeTo(iScreen.windowWidth,iScreen.windowHeight);
			window.moveTo(0,0);
			window.focus;
		}
	}
//
// ***************************
//
// 	--------------------------
//	Reload Windows
// 	--------------------------
	function reloadWin() {
		if (iSystem.ns4 == true) {
			document.location.reload();		 	
		}
	}
//
// 	--------------------------
//	close / reload Windows
// 	--------------------------	
	function openerRefresh() {
		if(opener != undefined){
			opener.submitForm('page','learningcenter','overview');
			opener.focus();
		}
		window.close();
	}
// 	--------------------------
//	Send an action to the Tracking Modul
// 	--------------------------	
	function sendAction(page, pid, aid) {
		opener.submitForm(page, pid, aid);
		opener.focus();
	}
//
// ***************************
//
// 	--------------------------
//	Mouseover
// 	--------------------------
	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_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_findObj(n, d) { //v4.0
  		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 && document.getElementById) x=document.getElementById(n); return x;
	}
	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];}
	}
//
// ***************************
//
// 	--------------------------
// 	Flash-Plugin check 
// 	--------------------------
	function checkFlashPlugin(requiredFlashVersion) {
		if (requiredFlashVersion == 0) {
			return true;
		} else {
			if (checkPlugin('application/x-shockwave-flash', requiredFlashVersion, 'ShockwaveFlash.ShockwaveFlash.'+requiredFlashVersion)) {
				// wenn Plugin vorhanden
				return true;
			} else {
				return false;
			}
		}
	}
//
// ***************************
//
// 	--------------------------
// 	Plugin check
// 	--------------------------
	function checkPlugin(mime_type, plugin_version, active_x_name) {
		/* Abfrage für MS Internet Explorer auf mac	*/
		if( (navigator.userAgent.toLowerCase().indexOf( "mac" )!=-1)&&(navigator.appName.indexOf( "Microsoft" )!=-1 ) ) {
			return confirm("Klicken Sie OK, wenn mindestens" + active_x_name + "-Plugin\nauf Ihrem Browser installiert ist!");
		}
		/* Abfrage für Netscape Navigator */
		if((navigator.appName.indexOf("Netscape") !=-1)){
			navigator.plugins.refresh(false);
			for (i = 0; i < navigator.plugins.length; i++){
				plugin = navigator.plugins[i];
				for (j = 0; j < plugin.length; j++){
					mimetype = plugin[j];
					if(mimetype){   
						if(mimetype.type == mime_type){
							enabled = (mimetype.enabledPlugin && (mimetype.enabledPlugin.name == plugin.name))?true:false;
							expr = /\d.*/;
							version = (parseFloat(expr.exec(plugin.description)) >= plugin_version)?true:false;
							if(enabled && version) return true;
						}
					}
				}
			}
			return false;
		}
		/*	Abrfage für MS Internet Explorer */
		if(navigator.appName == "Microsoft Internet Explorer") { 
			return chkie(active_x_name);
		}
		checkPlugin = false;
	}
	if(navigator.appName == "Microsoft Internet Explorer") {
		document.writeln('<script language="VBScript">');
		document.writeln('function chkie(active_x_name)');
		document.writeln('Err.Clear');
		document.writeln('On Error Resume Next');
		document.writeln('Dim plugin');
		document.writeln('set plugin = CreateObject(active_x_name)');
		document.writeln('if Err.Number <> 0 then');
		document.writeln('chkie = false');
		document.writeln('else');
		document.writeln('chkie = true');
		document.writeln('end if');
		document.writeln('end function');
		document.writeln('</script>');
	}
//
// ***************************
//
// 	--------------------------
// 	displayContent
// 	--------------------------	
	function displayContent(id,language,rightFlashVersion,strParam) {
		var strContent ='';
		if (rightFlashVersion == true) {
			// 	--------------------------
			//	Parameter für Flashmovie
			//	Breite
    		var sizeX = "990";
			// 	Höhe
			var sizeY = "672";
			// 	Startdatei inkl. Pfadangabe
			var strFlashStartFile = "../_framework/framework.swf";
			// Flash-Variablen: werden dem Flashmovie übergeben
			var strFlashVars  = 'id='+id;
				strFlashVars += '&language='+language;
				strFlashVars += '&browser='+iSystem.b;
				strFlashVars += '&browserversion='+iSystem.v;
				strFlashVars += '&'+strParam;
			// 	--------------------------
			strContent += '<object width="'+sizeX+'" height="'+sizeY+'" name="learning_module" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">';
    		strContent += '<param name="movie" value="'+strFlashStartFile+'?'+strFlashVars+'">';
    		strContent += '<param name="FlashVars" value="'+strFlashVars+'">';
			strContent += '<param name="quality" value="high">';
			strContent += '<param name="menu" value="false">';
    		strContent += '<embed src="'+strFlashStartFile+'?'+strFlashVars+'" FlashVars="'+strFlashVars+'" width="'+sizeX+'" height="'+sizeY+'" menu="false" name="learning_module" ID="learning_module" quality="high" type="application/x-shockwave-flash">';
    		strContent += '</embed>';
    		strContent += '</object>';			
  		} else {
			var flashDownloadLink = new Array();
				flashDownloadLink['de'] = 'http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&Lang=German&P5_Language=German';
				flashDownloadLink['en'] = 'http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&P5_Language=English';
 				flashDownloadLink['fr'] = 'http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash?Lang=French&P5_Language=French';
 				flashDownloadLink['it'] = 'http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash?Lang=Italian&P5_Language=Italian';
			strContent += '<table border="0" cellspacing="0" cellpadding="0" width="780" bgcolor="#FFFFFF">';
			strContent += '<tr>';
			strContent += '<td align="left" valign="top"><img src="../_assets/media/img/pic/pic_ph.gif" width="20" height="75" border="0" alt="" title=""></td>';
			strContent += '<td align="left" valign="middle">';
			strContent += '<h1><font face="Verdana, Arial, Helvetica, sans-serif" color="#000000">Flash Error</font></h1>';
			strContent += '</td>';
			strContent += '<td align="left" valign="top"><img src="../_assets/media/img/pic/pic_ph.gif" width="20" height="75" border="0" alt="" title=""></td>';
			strContent += '</tr>';
			strContent += '<tr>';
			strContent += '<td align="left" valign="top" bgcolor="#CCCCCC"><img src="../_assets/media/img/pic/pic_ph.gif" width="20" height="15" border="0" alt="" title=""></td>';
			strContent += '<td align="left" valign="top" bgcolor="#CCCCCC"><img src="../_assets/media/img/pic/pic_ph.gif" width="950" height="15" border="0" title=""></td>';
			strContent += '<td align="left" valign="top" bgcolor="#CCCCCC"><img src="../_assets/media/img/pic/pic_ph.gif" width="20" height="15" border="0" alt="" title=""></td>';
			strContent += '</tr>';
			strContent += '<tr>';
			strContent += '<td align="left" valign="top"><img src="../_assets/media/img/pic/pic_ph.gif" width="20" height="20" border="0" alt="" title=""></td>';
			strContent += '<td align="left" valign="top"><img src="../_assets/media/img/pic/pic_ph.gif" width="950" height="20" border="0" alt="" title=""></td>';
			strContent += '<td align="left" valign="top"><img src="../_assets/media/img/pic/pic_ph.gif" width="20" height="20" border="0" alt="" title=""></td>';
			strContent += '</tr>';
			strContent += '<tr>';
			strContent += '<td align="left" valign="top"><img src="../_assets/media/img/pic/pic_ph.gif" width="20" height="580" border="0" alt="" title=""></td>';
			strContent += '<td align="left" valign="top">';
			strContent += '<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">';
			strContent += '<tr>';
			strContent += '<td align="left" valign="top"><img src="../_assets/media/img/pic/pic_fp.gif" width="32" height="32" border="0" alt="Flash Player" title="Flash Player"></td>';
			strContent += '<td align="left" valign="top"><img src="../_assets/media/img/pic/pic_ph.gif" width="10" height="1" border="0" alt="" title=""></td>';
			strContent += '<td width="100%" align="left" valign="top"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Um das Lernmodul zu &ouml;ffnen, ben&ouml;tigen Sie die Browsererweiterung Flash 6 oder h&ouml;her (Plug-in). F&uuml;r die Installation von Software-Komponenten (Flash) kontaktieren Sie bitte Ihre IT-Abteilung. Falls Sie Installationsberechtigungen haben, k&ouml;nnen Sie hier den aktuellen Flash-Player gleich kostenlos installieren.</font></td>';
			strContent += '<td align="left" valign="top"><img src="../_assets/media/img/pic/pic_ph.gif" width="20" height="1" border="0" alt="" title=""></td>';
			strContent += '<td align="left" valign="top"><a href="'+flashDownloadLink['de']+'" target="_blank"><img src="../_assets/media/img/pic/pic_get_fp.gif" width="88" height="31" border="0" alt="Get Flash Player (deutsch)" title="Get Flash Player (deutsch)"></a></td>';
			strContent += '</tr>';
			strContent += '</table>';
			strContent += '<br>';
			strContent += '<br>';
			strContent += '<hr width="100%" size="1">';
			strContent += '<br>';
			strContent += '<br>';
			strContent += '<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">';
			strContent += '<tr>';
			strContent += '<td align="left" valign="top"><img src="../_assets/media/img/pic/pic_fp.gif" width="32" height="32" border="0" alt="Flash Player" title="Flash Player"></td>';
			strContent += '<td align="left" valign="top"><img src="../_assets/media/img/pic/pic_ph.gif" width="10" height="1" border="0" alt="" title=""></td>';
			strContent += '<td width="100%" align="left" valign="top"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">To open the E-Learning module you need the Flash 6 or higher plug-in. For the installation of software components (Flash) please contact your IT-departement. If you have the authorisation for installing software, you may install this plug-in right here free of charge.</font></td>';
			strContent += '<td align="left" valign="top"><img src="../_assets/media/img/pic/pic_ph.gif" width="20" height="1" border="0" alt="" title=""></td>';
			strContent += '<td align="left" valign="top"><a href="'+flashDownloadLink['en']+'" target="_blank"><img src="../_assets/media/img/pic/pic_get_fp.gif" width="88" height="31" border="0" alt="Get Flash Player (english)" title="Get Flash Player (english)"></a></td>';
			strContent += '</tr>';
			strContent += '</table>';
			strContent += '<br>';
			strContent += '<br>';
			strContent += '<hr width="100%" size="1">';
			strContent += '<br>';
			strContent += '<br>';
			strContent += '<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">';
			strContent += '<tr>';
			strContent += '<td align="left" valign="top"><img src="../_assets/media/img/pic/pic_fp.gif" width="32" height="32" border="0" alt="Flash Player" title="Flash Player"></td>';
			strContent += '<td align="left" valign="top"><img src="../_assets/media/img/pic/pic_ph.gif" width="10" height="1" border="0" alt="" title=""></td>';
			strContent += '<td width="100%" align="left" valign="top"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Pour ouvrir le module d&acute;apprentissage, vous avez besoin de l&acute;extension du navigateur Flash 6 ou plus haut (Plug-in). Pour l&acute;installation d&acute&eacute;l&eacute;ments de logiciels (Flash), veuillez contacter votre service informatique. Si vous avez l&acuteautorisation d&acute;installation, vous pouvez installer la version actuelle de Flash-Player ici, gratuitement.</font></td>';
			strContent += '<td align="left" valign="top"><img src="../_assets/media/img/pic/pic_ph.gif" width="20" height="1" border="0" alt="" title=""></td>';
			strContent += '<td align="left" valign="top"><a href="'+flashDownloadLink['fr']+'" target="_blank"><img src="../_assets/media/img/pic/pic_get_fp.gif" width="88" height="31" border="0" alt="Get Flash Player (fran&ccedil;ais)" title="Get Flash Player (fran&ccedil;ais)"></a></td>';
			strContent += '</tr>';
			strContent += '</table>';
			strContent += '<br>';
			strContent += '<br>';
			strContent += '<hr width="100%" size="1">';
			strContent += '<br>';
			strContent += '<br>';
			strContent += '<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">';
			strContent += '<tr>';
			strContent += '<td align="left" valign="top"><img src="../_assets/media/img/pic/pic_fp.gif" width="32" height="32" border="0" alt="Flash Player" title="Flash Player"></td>';
			strContent += '<td align="left" valign="top"><img src="../_assets/media/img/pic/pic_ph.gif" width="10" height="1" border="0" alt="" title=""></td>';
			strContent += '<td width="100%" align="left" valign="top"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Per avviare il modulo d&acute;apprendimento &egrave; necessario il plug in di Flash 6 o superiore. Per l&acute;installazione di componenti software (Flash) vi preghiamo di contattare il vostro servizio IT. Se siete in possesso di diritti d&acute;installazione, potete scaricare gratuitamente qui la versione attuale di Flash Player.</font></td>';
			strContent += '<td align="left" valign="top"><img src="../_assets/media/img/pic/pic_ph.gif" width="20" height="1" border="0" alt="" title=""></td>';
			strContent += '<td align="left" valign="top"><a href="'+flashDownloadLink['it']+'" target="_blank"><img src="../_assets/media/img/pic/pic_get_fp.gif" width="88" height="31" border="0" alt="Get Flash Player (italiano)" title="Get Flash Player (italiano)"></a></td>';
			strContent += '</tr>';
			strContent += '</table>';
			strContent += '</td>';
			strContent += '<td align="left" valign="top"><img src="../_assets/media/img/pic/pic_ph.gif" width="20" height="580" border="0" alt="" title=""></td>';
			strContent += '</tr>';
			strContent += '</table>';
 		}
		document.writeln(strContent);
	}