﻿var timer;
var nTicks = 0;


function pval(n) {
    return Number(n.replace(/px/, ""));
}

function roundout(x) {
    var sgn = 0;
    if (x < 0) sgn = -1; else if (x > 0) sgn = 1;
    return Math.ceil(Math.abs(x)) * sgn;
}


function GetScreenY(item) {
    var p = pval(item.style.top);
    if (p.parentNode)
        p += GetScreenY(p.ParentNode);
    return p;
}

function GetScreenX(item) {
    var p = pval(item.style.left);
    if (p.parentNode)
        p += GetScreenX(p.ParentNode);
    return p;
}


function DoFlyIn() {
    FlyIn.style.left = -document.documentElement.clientWidth;
    FlyIn.style.display = "block";
    timer = setInterval("animate()", 5);
}

function animate() {

    if (pval(FlyIn.style.left) >= 310) {
        clearInterval(timer);
    }
    else {
        FlyIn.style.left = (pval(FlyIn.style.left) + 3) + "px";
    }
}
