/*
ecademy.js: plattformspezifische JavaScript-Datei fuer die 
E-Learning-Plattform

© 2003 ars navigandi GmbH        http://www.arsnavigandi.de
Erstellt: 14-Oct-2003            Geaendert: 13-Jan-2004
*/


// ------------------------------------------------------------------------------------------------
// Definition der MouseOver-Bilder (plattformspezifisch)
// ------------------------------------------------------------------------------------------------
function preload_images_ecademy() {
	if (document.images) {
	
	}
}


// ------------------------------------------------------------------------------------------------
// Script to detect os, browser and version with javascript
// ------------------------------------------------------------------------------------------------
// It can used to get the correct stylesheets. For example You can use the following names:
// win_ns.css, win_ie.css, mac_ns.css, mac_ie.css, std_std.css
var bp;
var s;

/* this class is used to detect os, browser and browser version.
Get the information like this:
bp.platform -> OS
bp.browser -> Browser
bp.version -> Browser version
if the detection fails, the retun will be some standard values (fallback - std, std, '')
You can set Your own strings for the detection so You may use less then 21 stylesheets ;-)
*/

function BP() {
	//Set here the strings for the os identification
	var win = 'win'; //Microsoft Windows; default: win
	var mac = 'mac'; //Macintosh; default: mac
	var lin = 'std'; //Linux; default: lin
	
	//Set the information for the browser identification strings
	var ie = 'ie'; //Internet Explorer; default: ie
	var mo = 'mo'; //Mozilla; default: mo
	var ns = 'ns'; //Netscape Navigator <= 4.x; default: ns
	var nn6 = 'mo'; //Netscape 6+; default: nn6
	var opera = 'ie'; //Opera; default: opera
	var konq = 'std'; //KDE Konqueror; default: konq
	var safari = 'safari'; //Apple Safari; default: safari
	
	//set some default variables
	this.browser = 'std';
	this.platform = 'std';
	this.version = '';
	
	//Check for the os used
	if (navigator.platform.indexOf('Mac') > -1) {
		this.platform = mac;
	} else if (navigator.platform.indexOf('Win') > -1) {
		this.platform = win;
	} else if (navigator.platform.indexOf('Linux') > -1) {
		this.platform = lin;
	}
	
	if (navigator.appName.indexOf('Microsoft') > -1) {
		if(navigator.userAgent.indexOf('Opera') > -1) {
			this.browser = opera;
			this.version = getVersion("Opera ");
		} else {
			this.browser = ie;
			this.version = getVersion("MSIE ");
		}
	} else if (navigator.appName.indexOf('Konqueror') > -1) {
		this.browser = konq;
		this.version = '';
	}else {
		if (navigator.appVersion.charAt(0) <= 4) {
			this.browser = ns;
			this.version = getVersion("Mozilla/");
		} else if (this.platform == mac && navigator.userAgent.indexOf('Safari') > -1) {
			this.browser = safari;
		} else {
			/*var ausgabe = '';
			for(var i in navigator) {
				ausgabe += i+": "+navigator[i]+"\n";
			}
			alert(ausgabe);*/
			if(navigator.vendor.indexOf('Netscape') > -1) {
				this.browser = nn6;
				this.version = navigator.vendorSub;
			} else {
				this.browser = mo;
				this.version = getVersion("rv:");
			}
		}
	}
	
	return this;
	
}

//Function to get the exact version of the browser
function getVersion(pattern) {
	var ua = window.navigator.userAgent
	var patternIndex = ua.indexOf (pattern);
	var version = ua.substring (patternIndex+pattern.length, (ua.indexOf (".", patternIndex+pattern.length ))+3);
	while(isNaN(version) && version.length > 0) {
		version = version.substring(0,version.length-1);
	} 
	return version;
}

bp = new BP();
//alert("Platform: "+bp.platform+"\nBrowser: "+bp.browser+"\nVersion: "+bp.version);
	
//alert ('<LINK HREF="/de/de/css/' + bp.platform + '_' + bp.browser + '.css" REL="styleSheet" TYPE="text/css">');
//Normale Auswahl css mit 4 Files
//document.write('<LINK HREF="/css/std_std.css" REL="styleSheet" TYPE="text/css">');
//document.write('<LINK HREF="/css/' + bp.platform + '_' + bp.browser + '.css" REL="styleSheet" TYPE="text/css">');
//Auswahl nur zwischem MAC und PC
//document.write('<LINK HREF="/de/css_achensee/' + bp.platform + '.css" REL="styleSheet" TYPE="text/css">');

//-----------------------------------------------------------------------------------------------------------