



function addToFavourites(pagename, language){
	if(window.external){
		window.external.AddFavorite(location.href,pagename)
	}else{
		// this is not an Internet Explorer
		if(language=="DE"){
			alert("Ihr Browser unterstützt leider das automatische Hinzufügen zu den Favoriten nicht. Vermutlich handelt es sich nicht um den Internet Explorer. Bitte verwenden Sie das entsprechende Browser-Kommando um diese Seite manuell zu Ihren Bookmarks hinzuzufügen.");
		}else{
			alert("Your browser does not support automated adding to favourites, probably you are not using Internet Explorer. However, please yuse your browsers menu command for bookmarking instead. Thank you!");
		}
	}
	return false;
}



function openNewWindow(url,width,height,iDefaultPosTop,iDefaultPosLeft,Userparam){
var iPosLeft;
var iPosTop;
if (screen.width){
	iPosLeft=(screen.width/2)-width/2;
	iPosTop=(screen.height/2)-height/2;
}
else{
	iPosLeft=iDefaultPosLeft;
	iPosTop=iDefaultPosTop;
}
param=Userparam+",top="+String(iPosTop)+",left="+String(iPosLeft);
window.open(url, "", "width="+width+",height="+height+","+param);
}

/* javabased plus & minus size */

function incPageSize() {
	var body = document.body;
	var style = body.style;
	var fontsize = style.fontSize;
	
	if(fontsize=="") fontsize="1em";
	fontsize = ( parseFloat(fontsize) *1.1 ) + "em";
	document.body.style.fontSize = fontsize;
//	alert("fontsize (" + fontsize + ") = " + parseFloat(fontsize));
	return false;
}
function decPageSize() {
	var body = document.body;
	var style = body.style;
	var fontsize = style.fontSize;
	
	if(fontsize=="") fontsize="1em";
	fontsize = ( parseFloat(fontsize) *.9 ) + "em";
	document.body.style.fontSize = fontsize;
//	alert("fontsize (" + fontsize + ") = " + parseFloat(fontsize));
	return false;
}



function getFieldValue ( theField, vType){
	//this function will return the field value (or value list) based on the element type
	theValue=""; 
	sep=";"; 
	hits=0;
	vType=vType.toLowerCase();
	//text is the user-entered value as a string
	if(vType=="text" ) return(theField.value); 
	//textarea is the user-entered value as a string array of one element
	if(vType=="textarea" ) return(theField.value);
	//select is an array of selection pointers to an array of strings representing the choices
	if(vType=="select"){
		for ( i=0; i<theField.options.length; i++){
			if(theField.options[i].selected){
				hits++;
				if(theField.options[i].value==""){
					e=theField.options[i].text;
				}else{ 
					e=theField.options[i].value;
				}
				if(hits==1){
					theValue=e;
				}else{
					theValue+= sep+e;
				}
			}
		}
		return(theValue);
	}
	if(vType=="dropdown"){
		if(theField.options[0].selected){
			return("");
		}
		return("True");
	}
	// check Emailaddress
	if(vType=="mail"){
		var mail=theField.value;
		if(mail==""){
			return ("");
		}else{
			var erg =mail.search(/.+@..+\...+/);
			if(erg==-1){
				return ("");
			}
			var erg=mail.search(/\s/);
			if(erg!=-1){
				return ("");
			}
		}
		return (mail);
	}
	//checkboxes & radio buttons
	if(vType=="checkbox"||vType=="radiobutton"){
		if(theField.value==null){
			//if we're here, we are validating a radio button or a nn multi-element checkbox
			for ( i=0; i<theField.length; i++){
				if(theField[i].checked){
					hits++;
					if(hits==1){
						theValue=theField[i].value;
					}else{
						theValue+= sep+theField[i].value;
					}
				} 
			}
		} 
		return(theValue);
	}else{
		return(theField.value);
	}
}



/* Popup */
function NewWindow10(z)
{
z = z.replace(/.nsf\/Graph/,".nsf/id");
z = z.replace(/!/,"?");
z += "&popup=1";

 window.open(z,  "", "width=570,height=700,scrollbars=yes,resizable=yes");
}


function NewWindow(z)
{
 window.open(z,  "", "width=400,height=400,scrollbars=auto,resizable=yes");

}

function NewWindow2(z)
{
 window.open(z,  "", "width=500,height=700,scrollbars=yes,resizable=yes");

}

function NewWindow3(z)
{
 window.open(z,  "", "width=640,height=400,scrollbars=yes,resizable=yes");

}

function NewWindow4(z)
{
 window.open(z,  "", "width=400,height=600,scrollbars=no,resizable=yes");

}





/**
* LI-Menu-Functions
* (c)2005 TIMETOACT Software & Consulting, Cologne, Germany
* author: Michael Gollmick (MGO)
* requires a DOM compatible browser!
*/

var menuwidth="12em"; // describes the width of the pulldowns
var generalHoffset=-1; // a general horizontal offset for all pulldowns
var inactiveCSSText="";
var activeCSSText="";

var timetohide=100;		// the time for hiding a menu in mili seconds - should only be adjusted when experiencing problems
var loopmax=1000;		// safety var for breaking loops if they run wild for whatever reason, only modify if you think loops are really running all this loops and your app is too slow

var openmainmenu=null;	// objectstore for function dPD()
var openparent=null;		// objectstore for submenus in function dPD()

var timeoutstore=null;		// the object that can be killed by clearTimeout()
var timeoutobject=null;		// the object that shall be worked with by setTimeout()

var STARTOPACITY=99;		// the minimum opacity the menu starts when faded in in %; use 100 to show the menu completely
var ENDOPACITY=100;		// the maximum opacity the menu reaches when faded in in %; use 100 to show the menu completely
var FADESPEED=1;		// the speed of fading
var FADESTEPPING=100;		// change this, if FADESPEED is not fast enough

function setActiveStyle(style,active){
	if(style){
		(active)?style.cssText=activeCSSText:style.cssText=inactiveCSSText;
	}
}

function getULandStyleFromHere(o){
	// returns a style subobject form a links parent LI if available
	if(!o)return null;
	if(!o.parentNode)return null;
	var navroot=o.parentNode.getElementsByTagName("div");
	if(!navroot.length)return null;
	if(navroot[0].style)return(navroot[0].style);
	return null;
}

function getLeftPos(o){
	return 0; // in a div layout you dont need more tan a 0...
	if(!o) return null;
	var leftpos=(getRealOffsetH(o.parentNode)+generalHoffset);
	var minleft=getLeftMostPosition()+generalHoffset;
	var minright=(getRightMostPosition()-menuwidth-generalHoffset);
	if(leftpos<minleft){
		leftpos=minleft;
	}else if(leftpos>minright){
		leftpos=minright;
	}
alert("minleft: "+minleft+ "\nminright: "+minright+ "\nrealOffset: "+(getRealOffsetH(o.parentNode)+generalHoffset)+ "\ngetLeftMostPosition(): "+getLeftMostPosition()+"\ngetRightMostPosition(): "+getRightMostPosition()+"\nleftpos: "+leftpos);
	return leftpos;
}

function dPD(o){
	// shows the first sublevel and registers the menu in the object storage, so it is called only from the uppermost entries in the whole UL/LI bunch
	// ->ususally var o is only a HTML A, so we have to work with its parentNode if possible, which should be the surrounding LI

	// if there has been a mouseoutevent before, a call to hideSub is in the pipe, we should kill it right now!
	if(timeoutstore){
		window.clearTimeout(timeoutstore);
		timeoutstore=null;
	}

	// if there's another main menu open, we should kill it right now - looks very strange if this two possible menus are open
	// we need to get the current li and have to compare it with the one stored in the objectstore (openmainmenu)
	var thismenu=(o.parentNode); // get the LI to our A tag
	if(thismenu!=openmainmenu){
		// so now we are sure, the current object is another than the one opened
		// we should now hide the other menu without the time lap
		if(openmainmenu)hideSub(openmainmenu.firstChild);
		// now we look for the first UL below ou LI - since getULandStyleFromHere(o) searches for parentNode itself, we need our o var
		var pd=getULandStyleFromHere(o);
		if(pd){
			pd.left=getLeftPos(o);
			pd.top=getRealOffsetV(o.parentNode);
			pd.top=o.offsetHeight;
//			pd.top=0;
			pd.width=menuwidth;
			pd.display="block";
			fadeIn(pd);
			setActiveStyle(o.style, true);
	}
		// now set this menu as the active one
		openmainmenu=thismenu;
	}
}

var fadeStyle=null;
var fadeOpacity=0;
function fadeIn(style,currentOpacity){
	// fades in an object, style must be an html style object
	if(style){
		if(currentOpacity){
			currentOpacity=(currentOpacity>ENDOPACITY)?ENDOPACITY:currentOpacity;
			style.opacity=(currentOpacity/100);
			style.filter="alpha(opacity="+currentOpacity+")";
		}else{
			currentOpacity=STARTOPACITY;
			fadeIn(style,(currentOpacity+FADESTEPPING));
		}
		if(currentOpacity<ENDOPACITY){
			fadeStyle=style;
			fadeOpacity=currentOpacity+FADESTEPPING;
			window.setTimeout("fadeIn(fadeStyle,(fadeOpacity));",FADESPEED);
		}
	}
}

function fadeOut(style,currentOpacity){
	// fades in an object, style must be an html style object
	if(style){
		if(currentOpacity){
			currentOpacity=(currentOpacity<STARTOPACITY)?STARTOPACITY:currentOpacity;
			style.opacity=(currentOpacity/100);
			style.filter="alpha(opacity="+currentOpacity+")";
		}else{
			currentOpacity=ENDOPACITY;
			fadeOut(style,(currentOpacity-FADESTEPPING));
		}
		if(currentOpacity>STARTOPACITY){
			fadeStyle=style;
			fadeOpacity=currentOpacity-FADESTEPPING;
			window.setTimeout("fadeOut(fadeStyle,(fadeOpacity));",FADESPEED);
		}else{hideSub(timeoutobject);}
	}
}

function dPDs(o){

	// like in dPD(o) we get just a HTML A
	window.clearTimeout(timeoutstore);
var thismenu=(o.parentNode); // get the parent object
openparent=thismenu;
if(!isChildOf(thismenu,openmainmenu)){
		hideSub(openmainmenu);
	}
}


function hPD(o){
	// starts to hide the menu as a timed process (which can be killed by other mouseovers)
timeoutobject=o;

if(timeoutstore) window.clearTimeout(timeoutstore); // If there is already a timeout in store -> clear it
timeoutstore=window.setTimeout("hideSub(timeoutobject);",timetohide);
return;
// das folgende macht noch Probleme
if(!getULandStyleFromHere(o)){
		// we are possibly in a submenu now
		// pd is an A in an LI in an UL in an LI -> we need the UL
		timeoutobject=o.parentNode.parentNode.parentNode.parentNode.firstChild;
}else{
		timeoutobject=o;
	}

timeoutstore=window.setTimeout("fadeOut(getULandStyleFromHere(timeoutobject));",timetohide);
}

function isChildOf(child, parent){
//sucht, ob ein Object zum gleichen Baum geh&ouml;rt

var cob=child;
var a=0;
	while (cob&&a<loopmax){
		if(cob==parent) return(true);
		cob=cob.parentNode;
	}
	return false;
}

function hideSub(o){
	// this is the real point of hiding a menu
	var pd=null; // the pulldown(=pd)
	var pdp=o; // the pulldowns parent(=pdp)
	if (o){
		pd=getULandStyleFromHere(o);
	}
	if(!pd){
		// we are possibly in a submenu now
		// pd is an A in an LI in an UL in an LI -> we need the UL
		if(o){
			if(o.parentNode){
				// but possibly we are in a topentry without childs:
				if(o.parentNode.parentNode.parentNode.id.toLowerCase()=="pullnav") return;
				// ok, we're not, so go on
				pd=getULandStyleFromHere(o.parentNode.parentNode.parentNode);
				pdp=o.parentNode.parentNode.parentNode.parentNode.firstChild; //  the a we are redefining is in the first child of the parental LI element
			}
		}
	}
	if(pd){
		pd.display="none";
		openmainmenu=null;
		openparent=null;
		setActiveStyle(pdp.style,false);
	}else return;
}

function getRealOffsetH(o){
	//tries to determine the real horizontal offset of an element, currently works only for the first sublevel!
	var offset=0;
	var hob=o;
	var a=0;
	var off=0;
	while (hob.offsetParent&&(a++)<loopmax){
		off = hob.offsetLeft;
		offset+=off;
		hob=hob.offsetParent;
	}
	return offset;
}

function getRealOffsetV(o){
	//tries to determine the real vertical offset of an element, Konqueror needs this!
	var offset=o.offsetHeight;
	var vob=o;
	var a=0;
	while (vob.offsetParent&&(a++)<loopmax){
//alert( "getRealOffsetV(o): Name: " + vob.tagName + ", top: " + vob.offsetTop + " offset:" + offset );
		offset+=vob.offsetTop;
		vob=vob.offsetParent;
	}
	return offset;
}

	var rightMostPosition=null;
function getRightMostPosition(){
	if(!document.getElementById)return null;
	var obj=document.getElementById("PDNavTDLast");
	if(obj){
		rightMostPosition=getRealOffsetH(obj)+obj.offsetWidth;
	}
	if(leftMostPosition==null)rightMostPosition=0;
 return rightMostPosition;
}

	var leftMostPosition=null;
function getLeftMostPosition(){
	if(!document.getElementById)return null;
var obj=document.getElementById("PDNavTDFirst");
	if(obj){
		leftMostPosition=getRealOffsetH(obj);
	}
	if(leftMostPosition==null)leftMostPosition=0;
 return leftMostPosition;
}

getLeftMostPosition();

/* end LI-Menu-Functions */


/* Menu-BG-Image Change */

   // Configuration
var imgOver = "../files/images/$file/HNav_Image_over.gif"; // Image for MouseOver
var imgOut = "../files/images/$file/HNav_Image_out.gif";  // Image for Mouseout




var timeoutstore2=new Array();
var activeImg = null; // The Menupoint mouseovered


// Mouseover
function mov(img_name, o){
// If there is another Menupoint mouseovered, change it to mouseout
  if(activeImg) {
    document[activeImg].src = imgOut;
  }
  activeImg = img_name;

   dPD(document.getElementById(o));  // Show the submenu
   clearTimeout(timeoutstore2[img_name]);  // If there is a timeout for this point - stop it
   document[img_name].src = imgOver;  // Change the Image
}

//Mouseout
function mou(img_name, o){
  hPD(document.getElementById(o));
  timeoutstore2[img_name] = window.setTimeout("document['"+img_name+"'].src = '"+imgOut+"';",timetohide);
}


/* MailTo-Scrambler */
// nur die Adresse
function ma(tld,old,to){
return(to+'@'+old+'.'+tld)
}

// eine einfache Methode nur die Adresse ins Dokument zu bekommen:
function MTScrambler(tld,old,to,d){
wmt(tld,old,to,"","","",d);
}

// ein kompletter link
function wmt(tld,old,to,ta,ti,c,d){
var t='<a href="mailto:'+ma(tld,old,to)+'"';
t+=(ta&&ta!="")?' target="'+ta+'"':'';
t+=(ti&&ti!="")?' title="'+ti+'"':'';
t+=(c&&c!="")?' class="'+c+'"':'';
t+='>';
t+=(d&&d!="")?d:ma(tld,old,to);
t+='</a>';
document.write(t)
}
