﻿function isIE() {
    return (navigator.appName == "Microsoft Internet Explorer");
}

var animatedObjects = [];


function setElementOpacity(e, op) {
    if (op == 0) {
        //e.style.display = 'none';
    }
    else {
        if (e.style.display != "block")
            e.style.display = "block";

            e.style.opacity = op;
            e.style.filter = 'alpha(opacity = ' + (op * 100) + ')';
    }
}


function setElementOpacity2(e, op) {
    if (op == 0) {
        //e.style.display = 'none';
    }
    else {
        if (e.style.display == "inline - block")
            e.style.display = "inline - block";

        e.style.opacity = op;
        e.style.filter = 'alpha(opacity = ' + (op * 100) + ')';
    }
}





var animation = false;


function addObjectToAnimate(obj) {

    var i = this.length;
    while (i--) {
        if (this[i] === obj)
            return;
    }

    animatedObjects.push(obj);

    if (!animation) {
        animation = true;
        lastTick = new Date().getTime();
        animationCore();
    }
}

var lastTick = null;

function Log(msg) {
    //document.getElementById("log").innerHTML += " " + msg;
}

function animationCore() {
    var tick = new Date().getTime();
    var delta = tick - lastTick;
    lastTick = tick;

    var i = 0;

    while (i < animatedObjects.length) {
        if (!animatedObjects[i].Update(delta)) {
            animatedObjects.splice(i, 1);
        } else {
            i++;
        }
    }

    if (animatedObjects.length == 0) {
        animation = false;
    } else {
        setTimeout("animationCore()", 50);
    }
}





