
/* 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 return 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 ;-)
*/
var bp;

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 {
			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;
}

var bp = new BP();

//Write the css for special requirements of the browser
document.write('<LINK HREF="/css/' + bp.platform + '_' + bp.browser + '.css" REL="styleSheet" TYPE="text/css">');
//-----------------------------------------------------


/*
this method opens a pop-up window
-> method call: 
   <a href="JavaScript:NewWindow('url','Example name',width,height,xpos,ypos)" class="smaller">Link</a>
-> example for method call: 
   <a href="JavaScript:NewWindow('/imprint.html','Imprint',450,610,150,10)" class="smaller">[Imprint]</a>
*/
var isNav4, isNav6, isIE4;
function NewWindow(FileURL,WindowName,WindowWidth,WindowHeight,XPos,YPos) {
	if (isNav6) {
		fWindowWidth = WindowWidth +  8; fWindowHeight = WindowHeight + 27;
	} else if (isNav4) {
		fWindowWidth = WindowWidth + 15; fWindowHeight = WindowHeight + 15;
	} else {
		fWindowWidth = WindowWidth + 12; fWindowHeight = WindowHeight + 31;
	}
	Fenster = window.open(FileURL,WindowName,'width='+fWindowWidth+',height='+fWindowHeight+',screenX='+XPos+',screenY='+YPos+',dependent=yes,scrollbars=auto,resizable=yes');
	Fenster.moveTo(XPos,YPos);
	Fenster.resizeTo(fWindowWidth,fWindowHeight);
}

