/*
PageId:         Common JavaScript-functions
Author:			10.07.2006, Marat Saitov, Unilog Avinci - a LogicaCMG company
Description:	Common JavaScript functions
Comments:	    
Last changes:   toggleTableCellsBG()		25.07.2006, Marco Feuchter, Activest Investmentgesellschaft mbH
Last changes:   showFastAccess()			25.07.2006, Marat Saitov, Unilog Avinci - a LogicaCMG company
Last changes:   show/hideElement()			01.08.2006, Marco Feuchter, Activest Investmentgesellschaft mbH
Last changes:   hideAllPGraphs				09.08.2006, Marat Saitov, Unilog Avinci - a LogicaCMG company
Last changes:   getSiteElement, hoverLogin	14.09.2006, Werner Butscher, abcona
*/


// Global runtime variables
var navitimer;
var iboxtimer;
var topnaviLevels = 10;		// max number of menus in the top navigation
var pGraphTabs = 10;		// max number of tabs in the performance graphs

var tableTdHighlightColor = '#b9c5d2';
var tableTdNormalColor    = '#ffffff';
var tableTdEvenColor    = '#ffffff';
var tableTdOddColor    = '#e6eaee';


/* **************************************************
 * The addLoadEvent function takes as an argument another function which should be executed once
 * the page has loaded. Unlike assigning directly to window.onload, the function adds the event
 * in such a way that any previously added onload functions will be executed first.
 *
 * Example:
 * addLoadEvent(nameOfSomeFunctionToRunOnPageLoad);
 *   or
 * addLoadEvent(function() {
 *     //more code to run on page load
 * });
 *
 * For details see: http://simon.incutio.com/archive/2004/05/26/addLoadEvent
 * **************************************************/
function addLoadEvent(func) {
	var oldonload = window.onload;
	
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload)
				oldonload();
			func();
		}
	}
}

//**************************************************
// Show a top navigation level
// l1 - selected menu of level1 
//**************************************************
function showLevel(l1) {
  var level;
  hideAllLevels();
  
	nameActive1 = "topmenu" + l1 + "_0";

	level = document.getElementById(nameActive1);
	if (level) {
		level.className = 'topnavi_lv1_active';
	}
	document.getElementById('horizontal_line_lv1_2').style.visibility = 'visible';
	/*
	level = document.getElementById('topnavi_lv2_' + l1);
	if (level) {
		level.style.display = 'inline';
	}
	*/
}

function showDropDown(l1) {
	showLevel(l1);
	var nameActive1 = "topmenu" + l1 + "_0";
	//**************************************************
	// Show drop down for top navigation level 2
	// l1 - selected menu of level1 
	//**************************************************
	var topNaviPos = document.getElementById('topnavi_pos').offsetLeft;
	var topPos = document.getElementById('fastaccess_pos').offsetTop;	
	var offsetHeight_lv1 = document.getElementById('topnavi_lv1').offsetHeight;
	var offsetHeight_fastaccess = document.getElementById('topnavi_lv1_fastaccess').offsetHeight;
	var itemWidth = document.getElementById(nameActive1).offsetWidth;
	var leftPos =document.getElementById(nameActive1).offsetLeft;
	if (l1 == 1) {
		leftPos = leftPos + 1;
	}

	document.getElementById(nameActive1).className = 'topnavi_lv1_active';
	document.getElementById('dropdown_lv2_sub_' + l1).style.left = topNaviPos + leftPos -1 + "px";
	document.getElementById('dropdown_lv2_sub_' + l1).style.top = topPos + "px";
	document.getElementById('dropdown_lv2_' + l1).style.visibility = 'visible';
}

function showHorizontalLineL1_1(l1) {
	if (l1 > 0) {
		var nameActive1 = "topmenu" + l1 + "_0";
		//**************************************************
		// Show horizontal line for top navigation level 1
		// l1 - selected menu of level1 
		//**************************************************
		var topNaviPos = document.getElementById('topnavi_pos').offsetLeft;
		var topPos = document.getElementById('fastaccess_pos').offsetTop;
		var offsetHeight = document.getElementById('topnavi_lv1_fastaccess').offsetHeight;
		var itemWidth = document.getElementById(nameActive1).offsetWidth;
		var leftPos =document.getElementById(nameActive1).offsetLeft;
		if (l1 == 1) {
			leftPos = leftPos + 1;
		}
		
		document.getElementById('horizontal_line_lv1_1').style.left = topNaviPos + leftPos - 1 + "px";
		document.getElementById('horizontal_line_lv1_1').style.top = topPos - offsetHeight + "px";
		document.getElementById('horizontal_line_lv1_1').style.width = itemWidth + 1 + "px";
		document.getElementById('horizontal_line_lv1_1').style.visibility = 'visible';
	}
}

function showHorizontalLineL1_2(l1) {
	var nameActive1 = "topmenu" + l1 + "_0";
	//**************************************************
	// Show horizontal line for top navigation level 1
	// l1 - selected menu of level1 
	//**************************************************
	var topNaviPos = document.getElementById('topnavi_pos').offsetLeft;
	var topPos = document.getElementById('fastaccess_pos').offsetTop;
	var offsetHeight = document.getElementById('topnavi_lv1_fastaccess').offsetHeight;
	var itemWidth = document.getElementById(nameActive1).offsetWidth;
	var leftPos =document.getElementById(nameActive1).offsetLeft;
	if (l1 == 1) {
		leftPos = leftPos + 1;
	}
	
	document.getElementById('horizontal_line_lv1_2').style.left = topNaviPos + leftPos -1 + "px";
	document.getElementById('horizontal_line_lv1_2').style.top = topPos - offsetHeight + "px";
	document.getElementById('horizontal_line_lv1_2').style.width = itemWidth + 1 + "px";
	document.getElementById('horizontal_line_lv1_2').style.visibility = 'visible';
}

function showHorizontalLineL2(l1,l2) {
	if (l2 > 0) {
		var nameActive1 = "topmenu" + l1 + "_" + l2;
		//**************************************************
		// Show horizontal line for top navigation level 1
		// l1 - selected menu of level1 
		//**************************************************
		var topNaviPos = document.getElementById('topnavi_pos').offsetLeft;
		var topPos = document.getElementById('fastaccess_pos').offsetTop;
		var offsetHeight_lv1 = document.getElementById('topnavi_lv1').offsetHeight;
		var offsetHeight_fastaccess = document.getElementById('topnavi_lv1_fastaccess').offsetHeight;
		var itemWidth = document.getElementById(nameActive1).offsetWidth;
		var leftPos =document.getElementById(nameActive1).offsetLeft;
		if (l2 == 1) {
			document.getElementById('horizontal_line_lv2_1').style.left = topNaviPos + leftPos + "px";
		}
		else {
			document.getElementById('horizontal_line_lv2_1').style.left = topNaviPos + leftPos - 1 + "px";
		}
		document.getElementById('horizontal_line_lv2_1').style.top = topPos + offsetHeight_lv1 - offsetHeight_fastaccess + "px";
		document.getElementById('horizontal_line_lv2_1').style.width = itemWidth + 1 + "px";
		document.getElementById('horizontal_line_lv2_1').style.visibility = 'visible';
	}
}

function showHorizontalLineL2_2(l1,l2) {
	if (l2 > 0) {
		var nameActive1 = "topmenu" + l1 + "_" + l2;
		//**************************************************
		// Show horizontal line for top navigation level 1
		// l1 - selected menu of level1 
		//**************************************************
		var topNaviPos = document.getElementById('topnavi_pos').offsetLeft;
		var topPos = document.getElementById('fastaccess_pos').offsetTop;
		var offsetHeight_lv1 = document.getElementById('topnavi_lv1').offsetHeight;
		var offsetHeight_fastaccess = document.getElementById('topnavi_lv1_fastaccess').offsetHeight;
		var itemWidth = document.getElementById(nameActive1).offsetWidth;
		var leftPos =document.getElementById(nameActive1).offsetLeft;
		if (l2 == 1) {
			document.getElementById('horizontal_line_lv2_2').style.left = topNaviPos + leftPos + "px";
		}
		else {
			document.getElementById('horizontal_line_lv2_2').style.left = topNaviPos + leftPos - 1 + "px";
		}
		document.getElementById('horizontal_line_lv2_2').style.top = topPos + offsetHeight_lv1 - offsetHeight_fastaccess + "px";
		document.getElementById('horizontal_line_lv2_2').style.width = itemWidth + 1 + "px";
		document.getElementById('horizontal_line_lv2_2').style.visibility = 'visible';
	}
}

//**************************************************
// Hide all top navigation levels
//**************************************************
function hideAllLevels() {
  var level;
  for (i=1; i<=topnaviLevels; i++) {
	nameActive1 = "topmenu" + i + "_0";
	
	level = document.getElementById(nameActive1);
	if (level && pageLevel1 != i) {
		level.className = 'topnavi_lv1';
	}
	document.getElementById('horizontal_line_lv1_2').style.visibility = 'hidden';
	document.getElementById('horizontal_line_lv2_2').style.visibility = 'hidden';
	/*
	level = document.getElementById('topnavi_lv2_' + i);
	if (level) {
		level.style.display = 'none';
	}
	*/
  }
}

//**************************************************
// Show fastaccess menu
//**************************************************
function showFastAccess() {
	var leftPos = document.getElementById('topnavi_pos').offsetLeft;
	var topPos = document.getElementById('fastaccess_pos').offsetTop;
	
	document.getElementById('fastaccess_sub').style.left = leftPos + 959 - 239 + "px";
	document.getElementById('fastaccess_sub').style.top = topPos + "px";
	document.getElementById('fastaccess').style.visibility = 'visible';
}

//**************************************************
// Hide all graph navigation tabs
// base - base for graph and tab names
//**************************************************
function hideAllPGraphs(base) {
  var obj;
  for (i=1; i<=pGraphTabs; i++) {
	
	// border
	obj = document.getElementById('border_' + base + '_' + i);
	if (obj) {
		obj.className = 'tab_bg_border';
	}

	// font
	obj = document.getElementById('tab_' + base + '_' + i);
	if (obj) {
		obj.className = 'tabgraph';
	}
	
	// graph
	obj = document.getElementById(base + '_' + i);
	if (obj) {
		obj.style.display = 'none';
	}
  }
}

//**************************************************
// Show the performance graph
// base - base for graph and tab names
// l1 - selected tab
//**************************************************
function showPGraph(base, l1) {
  var obj;
  hideAllPGraphs(base);
  
	// border
	obj = document.getElementById('border_' + base + '_' + l1);
	if (obj) {
		obj.className = 'tab_bg_border_none';
	}

	// font
	obj = document.getElementById('tab_' + base + '_' + l1);
	if (obj) {
		obj.className = 'tabgraph_active';
	}
	
	// graph
	obj = document.getElementById(base + '_' + l1);
	if (obj) {
		obj.style.display = '';
	}
}


//**************************************************
// Show Info box "Glossary"
//**************************************************
function showIbox(obj, posObj) {
	window.clearTimeout(iboxtimer);

	var objiBoxGlossary = document.getElementById('iboxglossary');
	var objiBoxGlossaryLink = document.getElementById('iboxGlossaryLink');

	if (objiBoxGlossary && objiBoxGlossaryLink) {
	
		objiBoxGlossaryLink.href = obj.href;
	
		var leftPos = document.getElementById(posObj).offsetLeft;
		var topPos = document.getElementById(posObj).offsetTop;
	
		objiBoxGlossary.style.left = leftPos + 0 + "px";
		objiBoxGlossary.style.top = topPos - 20 + "px";
		objiBoxGlossary.style.visibility = 'visible';
	}
}

//**************************************************
// Set Ibox Timeout
//**************************************************
function setIboxTimeout() {
	iboxtimer=window.setTimeout('hideIbox()', 200)
}
function hideIbox() {
	hideObj('iboxglossary');
	window.clearTimeout(iboxtimer);
}

//**************************************************
// Hide object
//**************************************************
function hideObj(objName) {
	var obj = document.getElementById(objName);
	if (obj) {
		obj.style.visibility = 'hidden';
	}
}

/* **************************************************
 *  Show/hide the login box
 * **************************************************/
function switchLoginBox() {
	if (!document.getElementById("eDepotForm"))
		return false;
	
	var loginForm = document.getElementById("eDepotForm");
	var DIV = loginForm.parentNode;

	if (DIV.style && DIV.style.display == "block") {
		DIV.style.display = "none";
		getSiteElement('loginSwitchImg').src='/common/media/ico_teaser_open.gif';
	} else {
		DIV.style.display = "block";
		getSiteElement('loginSwitchImg').src='/common/media/ico_teaser_close.gif';
		if (getSiteElement("login").value == "" && getSiteElement("passw").value == "") {
			getSiteElement("login").focus();
		}
	}
}

/*

function hoverLogin() {
	if (!document.getElementById("service"))
		return false;
		
	var DIV = document.getElementById("service").firstChild;
	
	while (DIV) {
		if (sucheDIV(DIV.firstChild)) {
			//DIV.onmouseover=einblenden;
			//DIV.onmouseout=ausblenden;
		}
		DIV = DIV.nextSibling;
	}
}

function sucheDIV(DIV) {
	do {
		if(DIV) DIV = DIV.nextSibling;
		if(DIV && DIV.nodeName == "DIV" && DIV.className == "rollover") return DIV;
	} while(DIV);
	return false;
}

function einblenden() {
	var DIV = sucheDIV(this.firstChild);
	DIV.style.display = "block";
	if (getSiteElement("login").value == "" && getSiteElement("passw").value == "") {
		getSiteElement("login").focus();
	}
}

function ausblenden() {
	if (getSiteElement("login").value == "" && getSiteElement("passw").value == "") {
		sucheDIV(this.firstChild).style.display = "none";
	}
}
	
// login box will be shown only by click now:	
//addLoadEvent(hoverLogin);
*/
/* **************************************************
 * Generic function that should return values by id 
 * in every more or less modern browser
 * **************************************************/
function getSiteElement(elementId) {

    if (document.getElementById) {
        return document.getElementById(elementId);
    } else if (document.all) {
    	return document.all[elementId];
    } else if (document.layers) {
    	return document.layers[elementId];
    }
}
/* **************************************************
 * Highlight Tablerows
 * **************************************************/
function toggleTableCellsBG(tr, highlight) {
	if (tr != null) {
		for (i = 0; i < tr.childNodes.length; i++) {
			var td = tr.childNodes[i];
			if (td.nodeName == "TD")
				td.style.backgroundColor = (highlight ? tableTdHighlightColor : tableTdNormalColor);
		}
	} // if (tableRow != null)
}
/* **************************************************
 * Highlight Odd Tablerows
 * **************************************************/
function toggleOddTableCellsBG(tr, highlight) {
	if (tr != null) {
		for (i = 0; i < tr.childNodes.length; i++) {
			var td = tr.childNodes[i];
			if (td.nodeName == "TD")
				td.style.backgroundColor = (highlight ? tableTdHighlightColor : tableTdEvenColor);
		}
	} // if (tableRow != null)
}

/* **************************************************
 * Highlight Even Tablerows
 * **************************************************/
function toggleEvenTableCellsBG(tr, highlight) {
	if (tr != null) {
		for (i = 0; i < tr.childNodes.length; i++) {
			var td = tr.childNodes[i];
			if (td.nodeName == "TD")
				td.style.backgroundColor = (highlight ? tableTdHighlightColor : tableTdOddColor);
		}
	} // if (tableRow != null)
}

/* **************************************************
 * Functions for displaying and hiding elements
 * especially in forms
 * **************************************************/
function showElement(element) {
	if (element != null) {
		element.style.display = '';
	}
}
function hideElement(element) {
	if (element != null) {
		element.style.display = 'none';
	}
}
function toggleView(element, show) {
	if (show)
		showElement(element);
	else
		hideElement(element);
		
	findInputs(element.firstChild, show);
}
function toggleView2(element, show) {
	if (show) {
		showElement(element);
	} else {
		hideElement(element);
	}	
}
function findInputs(element, show) {
	if (element != null) {
		var node = element;
		
		if (node.nodeType == 1 && node.nodeName == 'INPUT') {
			if (show)
				showElement(node);
			else
				hideElement(node);
		}
		while (node != null) {
			findInputs(node.firstChild, show);
			node = node.nextSibling;
		}
	}
}

//**************************************************
// Function to open the Tool (link type "tool")
//**************************************************
function popuptool(theURL,winName,width,height,left,top) {
	//Nur fuer das eGame keine Scrollbar
	if (winName.indexOf("eGame") == -1)
	{
	    popupref=open('',winName,'top=-999,left=-999,screenX=-999,screenY=-999,width=100,height=100');
		if(self.popupref && !popupref.closed) popupref.close();	
	    popupref=window.open(theURL,winName,"width="+width+",height="+height+",left=" + left + ",top=" + top + ",resizable=no,location=no,menubar=no,status=no,scrollbars=yes");
	    popupref.focus();
	}
	else
	{
		popupref=open('',winName,'top=-999,left=-999,screenX=-999,screenY=-999,width=100,height=100');
		if(self.popupref && !popupref.closed) popupref.close();	
	    popupref=window.open(theURL,winName,"width="+width+",height="+height+",left=" + left + ",top=" + top + ",location=no,menubar=no,status=no");
	    popupref.focus();
	}
}


//**************************************************
//*****************************************************
// Function opens 3 types PopUp windows
//*****************************************************
function popup(popURL, popName, popTyp, popParam) {

   param = "width=496,height=600,location=no,resizable=no,menubar=no,status=no,scrollbars=yes,toolbar=no";	// by default
   
   if (popTyp == "afpnews") {
   	   param = "location=no,resizable=no,menubar=no,status=no,scrollbars=no,toolbar=no" + popParam;
   }
   if (popTyp == "typ1") {
   	   param = "width=610,height=600,location=no,resizable=no,menubar=no,status=no,scrollbars=yes,toolbar=no";
   }
   if (popTyp == "typ2") {
   	   param = "width=740,height=600,location=no,resizable=no,menubar=no,status=no,scrollbars=yes,toolbar=no";
   }
   
   if ((popTyp == "") & (popParam != "")) {
   	   param = popParam;
   }

   popupref=open('',popName,'top=-999,left=-999,screenX=-999,screenY=-999,width=100,height=100');	
   if (self.popupref && !popupref.closed) popupref.close();
   popupref=window.open(popURL,popName,param);
   popupref.focus();
}

//*****************************************************
// Function opens PopUp windows without "location bar"
//*****************************************************
function popupnoaddr(name, param) {
   if(param!=""){ 
   	 param = param+",width=1000,height=650,location=no,resizable=yes,menubar=no,status=yes,scrollbars=yes,toolbar=no";
   }
   else {
   	 param = "width=1000,height=650,location=no,resizable=yes,menubar=no,status=yes,scrollbars=yes,toolbar=no";
   }
        popupref=open('','taf','top=-999,left=-999,screenX=-999,screenY=-999,width=100,height=100');	
        if(self.popupref && !popupref.closed) popupref.close();
        popupref=window.open(name,"taf",param);
        popupref.focus();
}


//*********************************************************************
// returns true if the enter key was pressed
//*********************************************************************
function enterPressed(Ereignis) {
	var key
	
	if (!Ereignis)
		Ereignis = window.event;
		
	if (Ereignis.which) {
		key = Ereignis.which;
	} else if (Ereignis.keyCode) {
		key = Ereignis.keyCode;
	}
	
	if (key == 13) {
		return true;
	} else {
		return false;	
	}
}
//*********************************************************************
// function opens specific page in opener (main) window.
// Used for references in popup windows
//*********************************************************************
function Ref(num){
  site= "index.jhtml"+sessionId+"?pageId="+num;
  if(window.opener)
    window.opener.document.location.href=site;
}

//*********************************************************************
// fakes a click on the default submit button, when the enter key is pressed.
//*********************************************************************
function formEnterHandler(e) {
	var defaultEnter = document.getElementById('defaultEnter');
	var theForm = null;
	
	if ( defaultEnter && enterPressed(e) ) {
		theForm = defaultEnter.form;
		theForm.action = theForm.action + "&" + defaultEnter.name + ".x=1" + "&" + defaultEnter.name + ".y=1";
		defaultEnter.click();
	}

}

//*********************************************************************
// If there is an element with id 'focusMe', it gets the focus
//*********************************************************************
function focusElement_focusMe() {
    if (document.getElementById) {
        if (document.getElementById("focusMe")) {
            document.getElementById("focusMe").focus();
        }
    } else if (document.all) {
    	if (document.all["focusMe"]) {
    		document.all["focusMe"].focus();
    	}    
    } else if (document.layers) {
    	if (document.layers["focusMe"]) {
    		document.layers["focusMe"].focus();
    	}
    }
}

//*********************************************************************
// If there is an element with id 'focusMe', it gets the focus
//*********************************************************************
function logInputFieldsOf(theForm) {

	var log_msg = new Array();
	
	for (i = 0; i < theForm.elements.length; i++) {
		var formElement = theForm.elements[i];
		
		log_msg.push('element[' + i + ']\n  name: ' + formElement.name + '\n  value: ' + formElement.value);
	} // for (i = 0; i < theForm.elements.length; i++) {
	
	log_msg = log_msg.join('<br />');
	
	log_wdw = window.open('', "Logfenster", "width=1024,height=680,left=0,top=0");
	log_wdw.document.open();
	log_wdw.document.writeln("<html><head></head><body><div style='width: 100%; position: absolute; top: 0; left: 0; background-color: #FFFFFF;'>" + log_msg + "</div></body></html>");
	log_wdw.document.close();
	log_wdw.focus();

	return true;
}

//*********************************************************************
// Flash Detection
//*********************************************************************
function isDefined(property) {
  return (typeof property != 'undefined');
}

var flashVersion = 0;
function getFlashVersion() {
	var latestFlashVersion = 15;
   var agent = navigator.userAgent.toLowerCase(); 
	
   // NS3 needs flashVersion to be a local variable
   if (agent.indexOf("mozilla/3") != -1 && agent.indexOf("msie") == -1) {
      flashVersion = 0;
   }
   
	// NS3+, Opera3+, IE5+ Mac (support plugin array):  check for Flash plugin in plugin array
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		var flashPlugin = navigator.plugins['Shockwave Flash'];
		if (typeof flashPlugin == 'object') { 
			for (var i = latestFlashVersion; i >= 3; i--) {
            if (flashPlugin.description.indexOf(i + '.') != -1) {
               flashVersion = i;
               break;
            }
         }
		}
	}

	// IE4+ Win32:  attempt to create an ActiveX object using VBScript
	else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
	   var doc = '<scr' + 'ipt language="VBScript"\> \n';
      doc += 'On Error Resume Next \n';
      doc += 'Dim obFlash \n';
      doc += 'For i = ' + latestFlashVersion + ' To 3 Step -1 \n';
      doc += '   Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n';
      doc += '   If IsObject(obFlash) Then \n';
      doc += '      flashVersion = i \n';
      doc += '      Exit For \n';
      doc += '   End If \n';
      doc += 'Next \n';
      doc += '</scr' + 'ipt\> \n';
      document.write(doc);
   }
		
	// WebTV 2.5 supports flash 3
	else if (agent.indexOf("webtv/2.5") != -1) flashVersion = 3;

	// older WebTV supports flash 2
	else if (agent.indexOf("webtv") != -1) flashVersion = 2;

	// Can't detect in all other cases
	else {
		flashVersion = flashVersion_DONTKNOW;
	}

	return flashVersion;
}

flashVersion_DONTKNOW = -1;


/* ************************************************************
 *  objClick - calling a click() function for the input object
 * ************************************************************/
function objClick(objName) {
	var obj = document.getElementById(objName);
	if (obj) {
		obj.click();
	}
}


/* ************************************************************
 *  ShowSitemapLayer
 * ************************************************************/

function showSitemapLayer(url) {
		var leftPos = document.getElementById('topnavi_pos').offsetLeft;
		var topPos = document.getElementById('fastaccess_pos').offsetTop;
		document.getElementById('fastaccess_sub').style.left = leftPos + "px";
		document.getElementById('fastaccess_sub').style.top = topPos + "px";
		loadExternalContent(url, 'fastaccess_sub');
		document.getElementById('fastaccess').style.visibility = 'visible';
}

function hideSitemapLayer(e) {
		document.getElementById('fastaccess').style.visibility = 'hidden';
}

/* ************************************************************
 *  Loading external content in DIV
 * ************************************************************/
function extLoad(url, target) {
	document.getElementById('topnavi_lv1_fastaccess').style.cursor = 'wait';
	document.getElementById(target).innerHTML = '';
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		req = new ActiveXObject("Microsoft.XMLHTTP");
	}
	if (req != undefined) {
		req.onreadystatechange = function() {extLoadDone(url, target);};
		req.open("GET", url, true);
		req.send("");
	}
} 

function extLoadDone(url, target) {
	if (req.readyState == 4) { // only if req is "loaded"
		if (req.status == 200) { // only if "OK"
			document.getElementById(target).innerHTML = req.responseText;
		} else {
			document.getElementById(target).innerHTML=" extLoad Error:\n"+ req.status + "\n" +req.statusText;
		}
		document.getElementById('topnavi_lv1_fastaccess').style.cursor = 'auto';
	}
}

function loadExternalContent(name, div) {
    extLoad(name,div);
    return false;
}



