/*
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 = '#e6eaee';
var tableTdNormalColor = '#ffffff';
/* **************************************************
* 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';
}
level = document.getElementById('topnavi_lv2_' + l1);
if (level) {
level.style.display = 'inline';
}
}
//**************************************************
// 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) {
level.className = 'topnavi_lv1';
}
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 switchSearchBox() {
if (!document.getElementById("SearchForm"))
return false;
var SearchForm = document.getElementById("SearchForm");
var DIV = SearchForm.parentNode;
if (DIV.style && DIV.style.display == "block") {
DIV.style.display = "none";
getSiteElement('loginSwitchImg').src='/images_fr_FR/ico_teaser_open.gif';
} else {
DIV.style.display = "block";
getSiteElement('loginSwitchImg').src='/images_fr_FR/ico_teaser_close.gif';
//if (getSiteElement("login").value == "" && getSiteElement("passw").value == "") {
// getSiteElement("login").focus();
//}
}
}
function switchIndiciesBox() {
if (!document.getElementById("IndiciesFrame"))
return false;
var IndiciesFrame = document.getElementById("IndiciesFrame");
var DIV = IndiciesFrame.parentNode;
if (DIV.style && DIV.style.display == "block") {
DIV.style.display = "none";
getSiteElement('IndiciesImg').src='/images_fr_FR/ico_teaser_open.gif';
} else {
DIV.style.display = "block";
getSiteElement('IndiciesImg').src='/images_fr_FR/ico_teaser_close.gif';
//if (getSiteElement("login").value == "" && getSiteElement("passw").value == "") {
// getSiteElement("login").focus();
//}
}
}
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='/images_fr_FR/ico_teaser_open.gif';
} else {
DIV.style.display = "block";
getSiteElement('loginSwitchImg').src='/images_fr_FR/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)
}
/* **************************************************
* 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 == "") & (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('
');
log_wdw = window.open('', "Logfenster", "width=1024,height=680,left=0,top=0");
log_wdw.document.open();
log_wdw.document.writeln("