﻿function SetImage(img) {
    document.getElementById("imgMain").src = '/productImages/300/' + img;
}
function ShowBigger(img) {
    $get("imgBigger").innerHTML = "<img src=\"" + img + "\">";
    $get("imgBigger").style.visibility = "visible";
    placeIt("imgBigger", $get("imgMain"))
}
function HideBigger() {
    $get("imgBigger").style.visibility = "hidden";
}
function placeIt(objName, ctl) {
    obj = $get(objName);
    if (document.documentElement) {
        theLeft = document.documentElement.scrollLeft;
        theTop = document.documentElement.scrollTop;
    }
    else if (document.body) {
        theLeft = document.body.scrollLeft;
        theTop = document.body.scrollTop;
    }
    theLeft += calculateOffset(ctl.offsetParent, "offsetLeft") - 500;
    theTop = calculateOffset(ctl, "offsetTop") - 100;
    obj.style.left = theLeft + 'px';
    obj.style.top = theTop + 'px';
    obj.style.visibility = 'visible';
}
function calculateOffset(field, attr) {
    var offset = 0;
    while (field) {
        offset += field[attr];
        field = field.offsetParent;
    }
    return offset;
}
