﻿function $(s) { return document.getElementById(s); }

function callbackSetShadow(e, context) {
    if (context) {
        setShadow(context.fgID, context.bgID);
    }
}

function setShadow(fgID, bgID) {
    if (fgID && bgID) {
        var fg = $get(fgID);
        var loc = getPosition(fg); //$common.getLocation($get("rcHeader"));
        var dim = getBounds(fg);
        //$common.setLocation($get('rcBackground'), loc);
        var bg = $get(bgID);
        bg.style.position = 'absolute';
        bg.style.zIndex = fg.style.zIndex - 1;
        //bg.style.filter = 'alpha(opacity=70)';
        bg.style.top = loc.y + 5;
        bg.style.left = loc.x + 5;
        bg.style.width = dim.width;
        bg.style.height = dim.height;
    }
}
function getPosition(el) {
    var left = 0;
    var top = 0;

    while (el.offsetParent) {
        left += el.offsetLeft;
        top += el.offsetTop;
        el = el.offsetParent;
    }

    left += el.offsetLeft;
    top += el.offsetTop;

    return { x: left, y: top };
}
function getBounds(el) {
    var width = 0;
    var height = 0;

    if (el.innerHeight) {
        width = el.innerWidth;
        height = el.innerHeight;
    } else {
        width = el.clientWidth;
        height = el.clientHeight;
    }

    return { width: width, height: height };
}
