﻿function clickButton(e, buttonid) {
    var bt = document.getElementById(buttonid);
    if (typeof bt == 'object') {
        if (navigator.appName.indexOf("Netscape") > (-1)) {
            if (e.keyCode == 13) {
                if (buttonid != 'NoBut') {
                    bt.click();

                }
                return false;
            }
        }
        if (navigator.appName.indexOf("Microsoft Internet Explorer") > (-1)) {
            if (event.keyCode == 13) {
                if (buttonid != 'NoBut') {
                    bt.click();

                }
                return false;

            }
        }
    }
}
function OpenWindow(path, name) {
    win = window.open(path, name);
}

function EvImageOverChange(direction,name) {
    switch (direction) {
        case 'out':
            name.width = "44"
            name.height = "44";
            break;
        case 'in':
            name.width = "54"
            name.height = "54";
            break;
    }
}
function SetOpacity(elem, opacityAsInt) {
    var opacityAsDecimal = opacityAsInt;

    if (opacityAsInt > 100)
        opacityAsInt = opacityAsDecimal = 100;
    else if (opacityAsInt < 0)
        opacityAsInt = opacityAsDecimal = 0;

    opacityAsDecimal /= 100;
    if (opacityAsInt < 1)
        opacityAsInt = 1; // IE7 bug, text smoothing cuts out if 0

    elem.style.opacity = (opacityAsDecimal);
    elem.style.filter = "alpha(opacity=" + opacityAsInt + ")";
}
function FadeOpacity(elemId, fromOpacity, toOpacity, time, fps) {

    var steps = Math.ceil(fps * (time / 1000));
    var delta = (toOpacity - fromOpacity) / steps;

    FadeOpacityStep(elemId, 0, steps, fromOpacity, delta, (time / steps));
}

function FadeOpacityStep(elemId, stepNum, steps, fromOpacity, delta, timePerStep) {
    SetOpacity(document.getElementById(elemId), Math.round(parseInt(fromOpacity) + (delta * stepNum)));

    if (stepNum < steps)
        setTimeout("FadeOpacityStep('" + elemId + "', " + (stepNum + 1) + ", " + steps + ", " + fromOpacity + ", " + delta + ", " + timePerStep + ");", timePerStep);
}
function ShowHideControl(value, control) {
    document.getElementById(control).style.visibility = value;
}

