// $Id: sharenetatm.js 151 2010-12-21 02:07:29Z tboronczyk $

function findPosition(obj) {
    var sumTop = 0;
    var sumLeft = 0;

    if (obj.offsetParent) {
        do {
            sumTop += obj.offsetTop;
            sumLeft += obj.offsetLeft;

            obj = obj.offsetParent;
        }
        while (obj);
    }

    return {top:sumTop, left:sumLeft};
}

function displayDropDown(obj, value) {
    obj.style.display = (value) ? "block" : "none";
}

function init() {
    // Each drop down needs to be positioned beneigth its parent
    var pos = findPosition(SCT.$("products_item"));
    SCT.$("products_menu").style.position = "absolute";
    SCT.$("products_menu").style.left = pos.left + "px";

    // Both drop down and parent need to have show/hide attached
    SCT.$("products_item").onmouseover = function () { displayDropDown(SCT.$("products_menu"), true); };
    SCT.$("products_item").onmouseout =  function () { displayDropDown(SCT.$("products_menu"), false); };
    SCT.$("products_menu").onmouseover = function () { displayDropDown(SCT.$("products_menu"), true); };
    SCT.$("products_menu").onmouseout =  function () { displayDropDown(SCT.$("products_menu"), false); };

    // the video appearing on the about.php page needs to open in a new window
    if (SCT.$("video_a")) {
        SCT.$("video_a").onclick = function () {
            window.open("/video/video.html","video_window","height=400,width=560");
            return false;
        };
    }
}

