
function getE(name) {
    if (document.getElementById)
        var elem = document.getElementById(name);
    else if (document.all)
        var elem = document.all[name];
    else if (document.layers)
        var elem = document.layers[name];
    return elem;
}

function OpenWindow(query, w, h, scroll) {
    var l = (screen.width - w) / 2;
    var t = (screen.height - h) / 2;

    winprops = 'resizable=0, height=' + h + ',width=' + w + ',top=' + t + ',left=' + l + 'w';
    if (scroll) winprops += ',scrollbars=1';
    var f = window.open(query, "_blank", winprops);
}

$(document).ready(function () {
    // Change the image of hoverable images
    $(".imgHoverable").hover(function () {
        var hoverImg = HoverImgOf($(this).attr("src"));
        $(this).attr("src", hoverImg);
    }, function () {
        var normalImg = NormalImgOf($(this).attr("src"));
        $(this).attr("src", normalImg);
    }
   );
});

function HoverImgOf(filename) {
    var re = new RegExp("(.+)\\.(gif|png|jpg)", "g");
    return filename.replace(re, "$1_hover.$2");
}
function NormalImgOf(filename) {
    var re = new RegExp("(.+)_hover\\.(gif|png|jpg)", "g");
    return filename.replace(re, "$1.$2");
}

