﻿var animateInterval = 0;

//function startAnimate(ctl, startColor, endColor, step, time) {
//    ctl.endColor = endColor;
//    ctl.rStep = (getColorElement(1, endColor) - getColorElement(1, startColor)) / step;
//    ctl.gStep = (getColorElement(2, endColor) - getColorElement(2, startColor)) / step;
//    ctl.bStep = (getColorElement(3, endColor) - getColorElement(3, startColor)) / step;
//    animateInterval = setInterval('animateStep(\'' + ctl.id + '\',' + step + ');', time / step);
//}

//function getColorElement(rgb, color){
//    return parseInt(color.substr(((rgb - 1) * 2 + 1), 2), 16);
//}

//function getColorString(r, g, b) {
//    return '#' + r.toString(16) + g.toString(16) + b.toString(16);
//}

//function animateStep(sCtl, step) {
//    ctl = document.getElementById(sCtl);
//    if (ctl.step == step) {
//        clearInterval(animateInterval);
//        ctl.style.backgroundColor = ctl.endColor;
//    } else {
//        ctl.step++;
//        var curColor = ctl.style.backgroundColor;
//        var r = getColorElement(
//    }
//}

function highlightContainer(sCtl) {
    var ctl = $get(sCtl);
    ctl.parentElement.className = 'TopNavLink5';
    ctl.parentElement.attributes["onmouseover"].value = "";
    ctl.parentElement.attributes["onmouseout"].value = "";
}

function showHideContainer(sCtl, bShow) {
    var ctl = $get(sCtl);
    ctl.parentElement.style.display = bShow ? '' : 'none';    
}

function startAnimate(ctl, cssName, step, time) {
    ctl.step = 0;
    ctl.origClass = ctl.className;
    if (animateInterval != 0) clearInterval(animateInterval);
    animateInterval = setInterval('animateStep(\'' + ctl.id + '\',\'' + cssName + '\',' + step + ');', time / step);
}

function animateStep(sCtl, cssName, step) {
    ctl = document.getElementById(sCtl);
    ctl.step++;
    if (ctl.step == step) {
        clearInterval(animateInterval);
    }
    ctl.className = ctl.origClass + ' ' + cssName + ctl.step;
}

function resetAnimate(ctl, cssName) {
    ctl.className = cssName;
    if (animateInterval != 0) clearInterval(animateInterval);
}
