// Mouseover JavaScript
<!-- <![CDATA[
// The following code is used to support the small popups that
// give the full description of an event when the user move the
// mouse over it.
// Thanks to Klaus Knopper (www.knoppix.com) for this script.
// It has been modified to work with the existing WebCalendar
// architecture on 02/25/2005
//
// 03/05/2005 Prevent popup from going off screen by setting
// maximum width, which is cnfigurable
//
// Bubblehelp infoboxes, (C) 2002 Klaus Knopper <infobox@knopper.net>
// You can copy/modify and distribute this code under the conditions
// of the GNU GENERAL PUBLIC LICENSE Version 2.
//
var ns4            // Are we using Netscape4?
var ie4            // Are we using Internet Explorer Version 4?
var ie5            // Are we using Internet Explorer Version 5 and up?
var kon            // Are we using KDE Konqueror?
var x,y,winW,winH  // Current help position and main window size
var idiv=null      // Pointer to infodiv container
var px="px"        // position suffix with "px" in some cases
var popupW         // width of popup
var popupH         // height of popup
var xoffset = -138    // popup distance from cursor x coordinate
var yoffset = -155   // popup distance from cursor y coordinate
var followMe = 1   // allow popup to follow cursor...turn off for better performance
var maxwidth = 300 // maximum width of popup window

function away(){
	document.getElementsByTagName("dl")[0].className = "popup0";
}
 
function nsfix(){setTimeout("window.onresize = rebrowse", 2000);}

function rebrowse(){window.location.reload();}

function infoinit(){
  ns4=(document.layers)?true:false, ie4=(document.all)?true:false;
  ie5=((ie4)&&((navigator.userAgent.indexOf('MSIE 5')>0)||(navigator.userAgent.indexOf('MSIE 6')>0)))?true:false;
  kon=(navigator.userAgent.indexOf('konqueror')>0)?true:false;
  x=0;y=0;winW=800;winH=600;
  idiv=null;
  if (followMe) {
    document.onmousemove = mousemove;
    if(ns4&&document.captureEvents) document.captureEvents(Event.MOUSEMOVE);
  }
  // Workaround for just another netscape bug: Fix browser confusion on resize
  // obviously conqueror has a similar problem :-(
  if(ns4||kon){ nsfix() }
  if(ns4) { px=""; }
}

function hide(name){
  if(idiv){
	  idiv.visibility=ns4?"hide":"hidden";
	  idiv=null;
  } 
}

function gettip(name){return (document.layers&&document.layers[name])?document.layers[name]:(document.all&&document.all[name]&&document.all[name].style)?document.all[name].style:document[name]?document[name]:(document.getElementById(name)?document.getElementById(name).style:0);}

function show(evt, name){
  if(idiv) hide(name);
  idiv=gettip(name);
  if(idiv){
   scrollX =0; scrollY=0;
   winW=(window.innerWidth)? window.innerWidth+window.pageXOffset-16:document.body.offsetWidth-20;
   winH=(window.innerHeight)?window.innerHeight+window.pageYOffset  :document.body.offsetHeight;
   scrollX=(typeof window.pageXOffset == "number")? window.pageXOffset:(document.documentElement && document.documentElement.scrollLeft)?document.documentElement.scrollLeft:(document.body && document.body.scrollLeft)?document.body.scrollLeft:window.scrollX;
   scrollY=(typeof window.pageYOffset == "number")? window.pageYOffset:(document.documentElement && document.documentElement.scrollTop)?document.documentElement.scrollTop:(document.body && document.body.scrollTop)?document.body.scrollTop:window.scrollY;
   popupW = document.getElementById(name).offsetWidth;
   popupH = document.getElementById(name).offsetHeight;   

   showtip(evt);
  }
}

function showtip(e){
  e = e? e: window.event;
  if(idiv) {
    if(e)   {
      x=e.pageX?e.pageX:e.clientX?e.clientX + scrollX:0; 
      y=e.pageY?e.pageY:e.clientY?e.clientY + scrollY:0;
    }
    else {
      x=0; y=0;
    }
    // MAke sure we don't go off screen
    if ( popupW > maxwidth ) { 
      popupW = maxwidth;
      idiv.width = maxwidth + px;
    }  
    idiv.left=(((x + popupW + xoffset)>winW)?x - popupW - xoffset:x + xoffset)+px;
    if ((popupH + yoffset)>winH) {
      idiv.top= yoffset + px;
    } else {
      idiv.top=(((y + popupH + yoffset)>winH)?winH - popupH - yoffset:y + yoffset)+px;
    }
    idiv.visibility=ns4?"show":"visible";
    }
}

function mousemove(e){
  showtip(e);
}


//==============================================================================
// Function : Cookies Fontsize
// Comment  : Cooky used to store status of font resizing script 
// Arguments: -
//==============================================================================

// name = string equal to the name of the instance of the object
// defaultExpiration = number of units to make the default expiration date for the cookie
// expirationUnits = 'seconds' | 'minutes' | 'hours' | 'days' | 'months' | 'years' (default is 'days')
// defaultDomain = string, default domain for cookies; default is current domain minus the server name
// defaultPath = string, default path for cookies; default is '/'
function Cookiemanager(name,defaultExpiration,expirationUnits,defaultDomain,defaultPath) {
	// remember our name
	this.name = name;
	// get the default expiration
	this.defaultExpiration = this.getExpiration(defaultExpiration,expirationUnits);
	// set the default domain to defaultDomain if supplied; if not, set it to document.domain
	// if document.domain is numeric, otherwise strip off the server name and use the remainder
	this.defaultDomain = (defaultDomain)?defaultDomain:(document.domain.search(/[a-zA-Z]/) == -1)?document.domain:document.domain.substring(document.domain.indexOf('.') + 1,document.domain.length);
	// set the default path
	this.defaultPath = (defaultPath)?defaultPath:'/';
	// initialize an object to hold all the document's cookies
	this.cookies = new Object();
	// initialize an object to hold expiration dates for the doucment's cookies
	this.expiration = new Object();
	// initialize an object to hold domains for the doucment's cookies
	this.domain = new Object();
	// initialize an object to hold paths for the doucment's cookies
	this.path = new Object();
	// set an onlunload function to write the cookies
	window.onunload = new Function (this.name+'.setDocumentCookies();');
	// get the document's cookies
	this.getDocumentCookies();
	}
// gets an expiration date for a cookie as a GMT string
// expiration = integer expressing time in units (default is 7 days)
// units = 'miliseconds' | 'seconds' | 'minutes' | 'hours' | 'days' | 'months' | 'years' (default is 'days') 
Cookiemanager.prototype.getExpiration = function(expiration,units) {
	// set default expiration time if it wasn't supplied
	expiration = (expiration)?expiration:7;
	// supply default units if units weren't supplied
	units = (units)?units:'days';
	// new date object we'll use to get the expiration time
	var date = new Date();
	// set expiration time according to units supplied
	switch(units) {
		case 'years':
			date.setFullYear(date.getFullYear() + expiration);
			break;
		case 'months':
			date.setMonth(date.getMonth() + expiration);
			break;
		case 'days':
			date.setTime(date.getTime()+(expiration*24*60*60*1000));
			break;
		case 'hours':
			date.setTime(date.getTime()+(expiration*60*60*1000));
			break;
		case 'minutes':
			date.setTime(date.getTime()+(expiration*60*1000));
			break;
		case 'seconds':
			date.setTime(date.getTime()+(expiration*1000));
			break;
		default:
			date.setTime(date.getTime()+expiration);
			break;
		}
	// return expiration as GMT string
	return date.toGMTString();
	};
// gets all document cookies and populates the .cookies property with them
Cookiemanager.prototype.getDocumentCookies = function() {
	var cookie,pair;
	// read the document's cookies into an array
	var cookies = document.cookie.split(';');
	// walk through each array element and extract the name and value into the cookies property
	var len = cookies.length;
	var i;
	for(i=0;i < len;i++) {
		cookie = cookies[i];
		// strip leading whitespace
		while (cookie.charAt(0)===' '){
			cookie = cookie.substring(1,cookie.length);
		}
		// split name/value pair into an array
		pair = cookie.split('=');
		// use the cookie name as the property name and value as the value
		this.cookies[pair[0]] = pair[1];
		}
	};
// sets all document cookies
Cookiemanager.prototype.setDocumentCookies = function() {
	var expires = '';
	var cookies = '';
	var domain = 'Empirica.biz';
	var path = '';
	var name;
	for(name in this.cookies) {
		// see if there's a custom expiration for this cookie; if not use default
		expires = (this.expiration[name])?this.expiration[name]:this.defaultExpiration;
		// see if there's a custom path for this cookie; if not use default
		path = (this.path[name])?this.path[name]:this.defaultPath;
		// see if there's a custom domain for this cookie; if not use default
		domain = (this.domain[name])?this.domain[name]:this.defaultDomain;
		// add to cookie string
		cookies = name + '=' + this.cookies[name] + '; expires=' + expires + '; path=' + path + '; domain=' + domain;
		
		if(name!="mystyle") {document.cookie = cookies;}
				
		}
	return true;
	};
// gets cookie value
// cookieName = string, cookie name
Cookiemanager.prototype.getCookie = function(cookieName) {
	var cookie = this.cookies[cookieName];
	return (cookie)?cookie:false;
};
// stores cookie value, expiration, domain and path

// cookieName = string, cookie name
// cookieValue = string, cookie value
// expiration = number of units in which the cookie should expire
// expirationUnits = 'miliseconds' | 'seconds' | 'minutes' | 'hours' | 'days' | 'months' | 'years' (default is 'days')
// domain = string, domain for cookie
// path = string, path for cookie
Cookiemanager.prototype.setCookie = function(cookieName,cookieValue,expiration,expirationUnits,domain,path) {
	this.cookies[cookieName] = cookieValue;
	// set the expiration if it was supplied 
	if (expiration){ 
		this.expiration[cookieName] = this.getExpiration(expiration,expirationUnits);
	}
	// set path if it was supplied
	if (domain){
		this.domain[cookieName] = Empirica.biz;
	}
	if (path){
		this.path[cookieName] = path;
	}
	return true;
	};

var cookieManager = new Cookiemanager('cookieManager',1,'years');





//==============================================================================
// Function : Fontsize Switch
// Comment  : Stepwise increase/decrease font size 
// Arguments: -
//==============================================================================
var efa_default = 100;
var efa_increment = 10;
var efa_bigger = ['<b>Fontsize:</b>',
	' A<sup>+</sup>',
	'bigger font',
	'',
	'',
	'',
	'',
	'',
	'',
	'',
	'-'
	]

var efa_setz = ['',
	' A',
	'reset font',
	'',
	'',
	'',
	'',
	'',
	'',
	'',
	'-'
	]

var efa_smaller = ['',
	' A<sup>-</sup>',
	'smaller font',
	'',
	'',
	'',
	'',
	'',
	'',
	'',
	''
	]

function Efa_Fontsize06(increment,bigger,setz,smaller,def) {
	this.w3c = (document.getElementById);
	this.ms = (document.all);
	this.userAgent = navigator.userAgent.toLowerCase();
	this.isMacIE = ((this.userAgent.indexOf('msie') != -1) && (this.userAgent.indexOf('mac') != -1) && (this.userAgent.indexOf('opera') == -1));
	this.isOldOp = ((this.userAgent.indexOf('opera') != -1)&&(parseFloat(this.userAgent.substr(this.userAgent.indexOf('opera')+5)) <= 7));

	if ((this.w3c || this.ms) && !this.isOldOp && !this.isMacIE) {
		this.name = "efa_fontSize06";
		this.cookieName = 'efaSize06';
		this.increment = increment;
		this.def = def;
		this.defPx = Math.round(16*(def/100))
		this.base = 1;
		this.pref = this.getPref();
		this.testHTML = '<div id="efaTest" style="position:absolute;visibility:hidden;line-height:1em;"></div>';
		this.biggerLink = this.getLinkHtml(1,bigger);
		this.setzLink = this.getLinkHtml(0,setz);
		this.smallerLink = this.getLinkHtml(-1,smaller);
	} 
	else {
		this.biggerLink = '';
		this.setzLink = '';
		this.smallerLink = '';
		this.efaInit = new Function('return true;');
	}
	this.allLinks = this.biggerLink + this.setzLink + this.smallerLink;
}

Efa_Fontsize06.prototype.efaInit = function() {
	document.writeln(this.testHTML);
	this.body = (this.w3c)?document.getElementsByTagName('body')[0].style:document.all.tags('body')[0].style;
	this.efaTest = (this.w3c)?document.getElementById('efaTest'):document.all['efaTest'];
	var h = (this.efaTest.clientHeight)?parseInt(this.efaTest.clientHeight):(this.efaTest.offsetHeight)?parseInt(this.efaTest.offsetHeight):999;
	if (h < this.defPx) this.base = this.defPx/h;
	this.body.fontSize = Math.round(this.pref*this.base) + '%';
}

Efa_Fontsize06.prototype.getLinkHtml = function(direction,properties) {
	var html = properties[0] + '<b><span style="cursor:pointer" onclick="efa_fontSize06.setSize(' + direction + '); return false;"';
	html += (properties[2])?'title="' + properties[2] + '"':'';
	html += (properties[3])?'class="' + properties[3] + '"':'';
	html += (properties[4])?'id="' + properties[4] + '"':'';
	html += (properties[5])?'name="' + properties[5] + '"':'';
	html += (properties[6])?'accesskey="' + properties[6] + '"':'';
	html += (properties[7])?'onmouseover="' + properties[7] + '"':'';
	html += (properties[8])?'onmouseout="' + properties[8] + '"':'';
	html += (properties[9])?'onfocus="' + properties[9] + '"':'';
	return html += '>'+ properties[1] + '</span></b>' + properties[10];
}

Efa_Fontsize06.prototype.getPref = function() {
	var pref = this.getCookie(this.cookieName);
	if (pref) return parseInt(pref);
	else return this.def;
}

Efa_Fontsize06.prototype.setSize = function(direction) {
	this.pref = (direction)?this.pref+(direction*this.increment):this.def;
	this.setCookie(this.cookieName,this.pref);
	this.body.fontSize = Math.round(this.pref*this.base) + '%';
}

Efa_Fontsize06.prototype.getCookie = function(cookieName) {
	var cookie = cookieManager.getCookie(cookieName);
	return (cookie)?cookie:false;
}

Efa_Fontsize06.prototype.setCookie = function(cookieName,cookieValue) {
	return cookieManager.setCookie(cookieName,cookieValue);
}

var  efa_fontSize06 = new Efa_Fontsize06(efa_increment,efa_bigger,efa_setz,efa_smaller,efa_default);
 


//==============================================================================
// Function : Alternate Stylesheet Switch
// Comment  : Switches between alternate stylesheets
// Arguments: -
//=============================================================================
var Stil = "Standard";
var Keks = "Layout";
var Tage = 30;

//gets infos about the last times used style
function teststyle(){
	var aktuell = readCookie("mystyle");
	//first load cookie = null
	if (aktuell!="norm" && aktuell!="inv") {
		aktuell="norm";
	}
	setStyle(aktuell);
	change_link(aktuell);
}

function setStyle(s) {
	var newstyle;
	var tcookie=readCookie("mystyle");
	//set cookie is non exists
	if (tcookie===null || tcookie==="") {
		tcookie="norm"
	}
	//cookie exists
	if(s=="inv"){
		newstyle="inv";
		post="inv";
		setCookie("mystyle", "inv" , 365);
	}
	if( s=="norm"){
		newstyle="norm";	
		post="norm";
		setCookie("mystyle", "norm" , 365);
	}
	change_pics(post);
	if(newstyle){
		switchStyle(newstyle);
		change_link(s);
	}
}
/*wird zweimal ausgeführt da es einmal für den gekladenen content und einmal für die header genutzt wird*/
function change_pics(post){
	var pic_add = "../images/"
	var change;
	var e = document.images;
	for(i=0;i<e.length;i++){
		change = e[i].getAttribute("name");
		if (change == 'change') {
			var type = e[i].src.substr(e[i].src.lastIndexOf("."));
			var temp= e[i].src.substr(e[i].src.lastIndexOf("/")+1);
			var name = temp.substr(0, temp.lastIndexOf("."));
			if (temp.lastIndexOf("_inv")>0) 
				name = temp.substr(0, temp.lastIndexOf("_inv"));
			
			if (e[i]!=undefined){
				if(post=="inv"){
					e[i].src= pic_add+name+"_"+post+type;
				}
				else{
					e[i].src= pic_add+name+type;
				}
			}
		}
	}
}


function change_link(post){
	if (post=="inv") {
		document.getElementById("high").style.display = 'none';
		document.getElementById("normal").style.display = 'inline';
	}
	if (post=="norm") {
		document.getElementById("normal").style.display = 'none';
		document.getElementById("high").style.display = 'inline';
	}
}

function switchStyle(s) {
	if (!document.getElementsByTagName){
		return;
	}
	var el = document.getElementsByTagName("link");
	for (var i = 0; i < el.length; i++ ) {
		if (el[i].getAttribute("rel").indexOf("style") != -1 && el[i].getAttribute("title")) {
			el[i].disabled = true;
			if (el[i].getAttribute("title") == s){
				el[i].disabled = false;
			}
		}
	}
}


// Set the cookie
function setCookie(name,value,days) {
	var domain = 'Empirica.biz';
	var path = '/';

	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else{ 
		var expires = "";
	}
	document.cookie = name+"="+value+expires+"; path=/";
}

// Read the cookie
function readCookie(name) {
	var needle = name + "=";
	var cookieArray = document.cookie.split(';');
	for(var i=0;i < cookieArray.length;i++) {
		var pair = cookieArray[i];
		while (pair.charAt(0)==' ') {
			pair = pair.substring(1, pair.length);
		}
		if (pair.indexOf(needle) == 0) {
			return pair.substring(needle.length, pair.length);
		}
	}
	return null;
}

// Initialize after loading the page
window.onload=infoinit;
//]]> -->


