// Funktion addfavorite
 function addfavorite() 
 { 
  if (navigator.appName=="Netscape") {
 alert (
   'To bookmark this site, click '
  +'<b>Bookmarks | Add bookmark</b> '
  +'or press <b>Ctrl+D</b>.'
    )
  }
  else if 
   (parseInt(navigator.appVersion)>3) {  window.external.AddFavorite(location.href, document.title); }  } 

	 
// Funktion printwindow
function printWindow(){
browserVersion = parseInt(navigator.appVersion)
if (browserVersion >= 4) window.print()
}


// Eigenes hohes Fenster öffnen
function fenster (appl, fenstername, eigen)
{
fenster2=window.open (appl, fenstername, eigen)
}

// Funktion CallHelp
function CallHelp(appl, fenstername, eigen)
{
    //window.location.hostname + window.location.pathname
    F1 = window.open(appl + "?back_page_url=" + window.location.hostname + window.location.pathname + window.location.search,fenstername,eigen); 
    
}


//Functions for HP
function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5 || this.dom)
	return this
}
var bw=new lib_bwcheck()
var clicked=false;

//Object constructor
function makeObj(obj)
{
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval('document.'+obj):0;
  	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval('document.'+obj):0;
    this.obj = obj + "Object"
    eval(this.obj + "=this")
    return this
}


function showMenu()
{
	var	menu = new makeObj('menu')
	menu.css.position='absolute';
	menu.css.visibility='visible';
	
}


function closeMenu()
{
	if (clicked) 
	{
		var	menu = new makeObj('menu')
		if (!((event.x>=595) && (event.x<=184+589) && (event.y>=78) && (event.y<=290))) 
			{
				menu.css.visibility='hidden';
				clicked=false
			}
	} else clicked=true
}

// Will insert the content from the url into the element with the specified id.
function fetchIntoId(id, url, idPreserveClassName) {
	if (document.getElementById(id) != null) {
		var originalClassName;
		if (idPreserveClassName != null) {
			var e = document.getElementById(idPreserveClassName);
			if (e != null) originalClassName = e.className;
		}
		var xmlHttp;
		try {    // Firefox, Opera 8.0+, Safari
			xmlHttp = new XMLHttpRequest();
		} catch (e) {    // Internet Explorer
			try {
				xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {      
				try {
					xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {
					alert("Your browser does not support AJAX!");
					return false;        
				}
			}
		}
		xmlHttp.onreadystatechange = function() {
    			if (xmlHttp.readyState == 4) {
      				document.getElementById(id).innerHTML = xmlHttp.responseText;
				if (idPreserveClassName != null) {
                        		var e = document.getElementById(idPreserveClassName);
                        		if (e != null) e.className = originalClassName;
                		}
    			}
    		}
    		xmlHttp.open("GET", url, true);
    		xmlHttp.send(null);
	}
}

function fetchIntoIdOnEnter(id, url, preserveClassName) {
	if (event.keyCode == 13 ) { fetchIntoId(id, url, preserveClassName); }	
}

function fetchIntoIdSync(id, url, idPreserveClassName) {
        if (document.getElementById(id) != null) {
                var originalClassName;
                if (idPreserveClassName != null) {
                        var e = document.getElementById(idPreserveClassName);
                        if (e != null) originalClassName = e.className;
                }
                var xmlHttp;
                try {    // Firefox, Opera 8.0+, Safari
                        xmlHttp = new XMLHttpRequest();
                } catch (e) {    // Internet Explorer
                        try {
                                xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
                        } catch (e) {
                                try {
                                        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                                } catch (e) {
                                        alert("Your browser does not support AJAX!");
                                        return false;
                                }
                        }
                }
                xmlHttp.open("GET", url, false);
                xmlHttp.send(null);
		if (xmlHttp.readyState == 4) {
                        document.getElementById(id).innerHTML = xmlHttp.responseText;
                        if (idPreserveClassName != null) {
                                var e = document.getElementById(idPreserveClassName);
                                if (e != null) e.className = originalClassName;
                        }
                }
        }
}

function focusFirstField() {
	if (document.forms.length != 0) document.forms[0].elements[0].focus();
}

function highlight(tag, id) {
	if (document.getElementById(id) != null) {
		var elements = document.getElementsByTagName(tag);
		for(i = 0; i < elements.length; i++) 
   			if (elements[i].className = 'highlighted') elements[i].className = '';
		document.getElementById(id).className = 'highlighted';
	}
}
