/****
 * equalColumns - Sets two CSS columns to have an equal CSS style height
 * @param {String} lCol - Left column
 * @param {String} rCol - Right column
 */
function equalColumns(lCol, rCol){
    l = document.getElementById(lCol);
    r = document.getElementById(rCol);

    height_left = l.style.height;
    height_right = r.style.height;

    if (height_left == '') {
      height_left = l.offsetHeight;
    } else {
      height_left = height_left.replace("px", "");
    }
    if (height_right == '') {
      height_right = r.offsetHeight;
    } else {
      height_right = height_right.replace("px", "");
    }

//    window.alert(lCol + " : " + height_left);
//    window.alert(rCol + " : " + height_right);

    if (height_right > height_left) {
      l.style.height = height_right + "px";
    } else if (height_left > height_right) {
      r.style.height = height_left + "px";
    }

//    window.alert(lCol + " : " + l.offsetHeight);
//    window.alert(rCol + " : " + r.offsetHeight);
}

function equalColumns_offset(lCol, rCol, offset){
    l = document.getElementById(lCol);
    r = document.getElementById(rCol);

    height_left = l.offsetHeight;
    height_right = r.offsetHeight + offset;

//    window.alert(height_left);
//    window.alert(height_right);

    if (height_right > height_left) {
      l.style.height = height_right + "px";
    } else if (height_left > height_right) {
      r.style.height = (height_left - offset) + "px";
    }

/*
    if (r.offsetHeight >= (l.offsetHeight + offset)) { 
      l.style.height = (r.offsetHeight + offset) + "px";
    } else if ((l.offsetHeight - offset) > r.offsetHeight) {
      r.style.height = (l.offsetHeight - offset) + "px";
    } else if (r.offsetHeight <= (l.offsetHeight + offset)) { 
    } else if ((l.offsetHeight - offset) < r.offsetHeight) {
    }
*/
//    window.alert(l.offsetHeight);
//    window.alert(r.offsetHeight);
}  

/****
 * addHeight - adds an offset to the height of a DIV.
 * @param {String} col - column ID
 * @param {int} offset - Offset.
 */
function addHeight(col, offset){
    r = document.getElementById(col);
    r.style.height = (r.offsetHeight + offset) + "px";
//    window.alert(r.offsetHeight);
}  
function subtractHeight(col, offset){
    r = document.getElementById(col);
    r.style.height = (r.offsetHeight - offset) + "px";
//    window.alert(r.offsetHeight);
}  

/****
 * relativeColumns - Sets one CSS columns to a minimum of the CSS style height of another column plus a specified offset.
 * @param {String} rCol - Reference column
 * @param {String} aCol - Adjusted column
 * @param {int} offset - Offset
 */
function relativeColumns(rCol, aCol, offset){
    r = document.getElementById(rCol);
    a = document.getElementById(aCol);
    compHeight = r.offsetHeight + offset;

    if ( compHeight >= a.offsetHeight) {
      a.style.height = compHeight + "px";
    }
}

