
/* 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">');
//-----------------------------------------------------



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


//An image preloader
function imagePreloader(preLoadImages) {
	for(var i = 0; i < preLoadImages.length; i++) {
		this['myImage'+i] = new Image();
		this['myImage'+i].src = preLoadImages[i];
	}
}


//-----------------------------------------------------
//Image rotation function
//Version 1.0 - Copyright 2003 Johannes Hauf, ars naviagndi GmbH, jh@arsmail.de
//This allows image rotation in a more sophisticated way.
//In Your html document You can integrate this by using this syntax:
//changeImage('[image identifier]','[status_identifier]');
//i.e. onMouseOver="changeImage('praxis_philosophie','over');"


if (document.images) {
	//Set Your poperties here--------------------------------------------------
	//imgStati allows You to set Your image status
	//c is the default image-status (never change this from the default: '')
	//if You have an image named myimage.gif, the other statuses look like i.e. myimage-over.gif, myimage-deact.gif
	imgStati = {
			c:'',
			over:'_over',
			deact:'_over'
	};
	//In the array images You define Your images
	//The key of every value must be the same as the if of the image tag in HTML
	//The 1st value in '[]' ist the path to the "c"-image
	images = { 
		stonenav1:['/images/stonenav1.jpg',imgStati],
		stonenav2:['/images/stonenav2.jpg',imgStati],
		stonenav3:['/images/stonenav3.jpg',imgStati],
		stonenav4:['/images/stonenav4.jpg',imgStati],
		stonenav5:['/images/stonenav5.jpg',imgStati],
		stonenav6:['/images/stonenav6.jpg',imgStati],
		stonenav7:['/images/stonenav7.jpg',imgStati],
		stonenav8:['/images/stonenav8.jpg',imgStati],
		stonenav9:['/images/stonenav9.jpg',imgStati],
		nextbutton:['/images/next.gif',imgStati],
		backbutton:['/images/back.gif',imgStati]
	};
	//end of set Your propersies-----------------------------------------------
	var myImg, imgSuffix;
	for(var i in images) {
		images[i][2] = new Object();
		if(imgSuffix = images[i][0].match(/\.gif$|\.jpg$|\.png$/i)) {
			myImg = images[i][0].split(imgSuffix)[0];
		}
		for(var j in images[i][1]) {
			images[i][2][j] = new Image();
			images[i][2][j].src = myImg+images[i][1][j]+imgSuffix;
		}
	}
}


/*changes pictures when mouseover
changes pictures when mouseover and displays text in defined Layer here id="info" -- 
Function is called by /html/index.shtml and /html/texte/leistungen.html*/
function changeImage(imgName, imgStatus, text_id) {
	if(document[imgName]) {
		document[imgName].src = images[imgName][2][imgStatus].src;
	}
}


/*
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);
}


//Close Popup-Layer
function hidePopupLayer(layerid) {
	if (document.getElementById)
	{
	// this is the way the standards work
	var style2 = document.getElementById(layerid).style;
	style2.display = style2.display? "none":"none";	
	}
	else if (document.all)
	{
	// this is the way old msie versions work
	var style2 = document.all[layerid].style;
	style2.display = style2.display? "none":"none";
	}
	else if (document.layers)
	{
	// this is the way nn4 works
	var style2 = document.layers[layerid].style;
	style2.display = style2.display? "none":"none";
	}
}



if(window.navigator.systemLanguage && !window.navigator.language) {
  function hoverIE() {
    var LI = document.getElementById("Navigation").firstChild;
    do {
      if (sucheUL(LI.firstChild)) {
        LI.onmouseover=einblenden; LI.onmouseout=ausblenden;
      }
      LI = LI.nextSibling;
    }
    while(LI);
  }

  function sucheUL(UL) {
    do {
      if(UL) UL = UL.nextSibling;
      if(UL && UL.nodeName == "UL") return UL;
    }
    while(UL);
    return false;
  }

  function einblenden() {
    var UL = sucheUL(this.firstChild);
    UL.style.display = "inline";
  }
  function ausblenden() {
    sucheUL(this.firstChild).style.display = "none";
  }

  window.onload=hoverIE;
}
