/*
 * script.js
 * Common script functions
 *
 * $Id: $
 *
 * Copyright (c) 2006-2008 AMC World Technologies GmbH
 * Fischerinsel 1, D-10179 Berlin, Deutschland
 * All Rights Reserved.
 *
 * This software is the confidential and proprietary information of AMC World
 * Technologies GmbH ("Confidential Information"). You shall not disclose such
 * Confidential Information and shall use it only in accordance with the terms
 * of the license agreement you entered into with AMC World Technologies GmbH.
 */


//-- Functions ----------------------------------

/**
 * Gets the element with the given ID from the current document. The element is
 * retrieved for different types of browsers.
 *
 * @param[in] id  [string] the ID of the desired element
 * @return        [object] the element; @c null if an error occurred
 */
function getElem(id) {
    if (document.getElementById) {
        return document.getElementById(id);
    } else if (document.all) {
        return document.all[id];
    } else {
        return null;
    }
}

/**
 * Highlights a row in the Euroregion Neisse-Nisa-Nisa organizational diagram.
 *
 * @param[in] ctrl  [object] the cell where the mouse is over
 * @param[in] act   [bool] whether or not the row is to highlight
 */
function highlightOrgStructRow(ctrl, act) {
    if (ctrl.id.match(/^instSect(\d+)_(\d+)$/)) {
        var r = RegExp.$2;
        for (var c = 0; c < 3; c++) {
            getElem("instSect" + c + "_" + r).style.backgroundColor =
                act ? "#E3E3E3" : "white";
        }
    }
}
