﻿var TimeToFade = 1000.0;

function changeImage() {
    var theimages = new Array();
    theimages[0] = "images/comcast.jpg";
    theimages[1] = "images/AstraZenaka.jpg";
    theimages[2] = "images/bud.jpg";
    theimages[3] = "images/wilmington.jpg";

    var loc = document.getElementById("imageposition");
    var current = loc.value;
    var lastPosition = current;
    if (current == 3) {
        current = 1;
    }
    else {
        current = parseInt(current) + 1;
    }
    loc.value = current;

    
    document.getElementById('r1').src = theimages[parseInt(current)];


}

function $(id) {
    var $ = document.getElementById(id);

    $.fadeIn = function (delay, callbk, out) {
        var _this = this;
        for (i = 1; i <= 100; i++) {
            (function (j) {
                setTimeout(function () {
                    if (out == true) j = 100 - j;
                    _this.style.opacity = j / 100;
                    _this.style.MozOpacity = j / 100;
                    _this.style.KhtmlOpacity = j / 100;
                    _this.style.zoom = 1; // for ie, set haslayout
                    _this.style.display = "block";
                    if (j == 100 && callbk != undefined) { callbk.call(_this); }
                    else if (out == true && callbk != undefined && j == 0) { callbk.call(_this); }
                    _this.style.filter = "alpha(opacity=" + j + ");";
                }, j * delay / 100);

            })(i);
        }
    };

    $.fadeOut = function (delay, callbk) {
        $.fadeIn(delay, callbk, true);
    };

    return $;
}

function go() {
    if (isimg == true) {
        var disln = getstyle($("ln"), "display");
        if (disln == "none") {
            $("ln").fadeIn(1000);
        }
    }
    else {
        var disln = getstyle($("txt"), "display");
        if (disln == "none") {
            $("txt").fadeIn(1000);
        }
    }


}

function go2() {

    if (isimg == true) {
        var disln = getstyle($("ln"), "display");
        if (disln == "block") {
            $("ln").fadeOut(1000, function () {
                $("ln").style.display = "none";
            });
        }
    }
    else {
        var disln = getstyle($("txt"), "display");
        if (disln == "block") {
            $("txt").fadeOut(1000, function () {
                $("txt").style.display = "none";
            });
        }

    }

}


