﻿function layerSetup(id, visibility) {

    if (document.getElementById) {
        this.obj = document.getElementById(id).style;
        this.obj.visibility = visibility;
        return this.obj;
    }
    else if (document.all) {
        this.obj = document.all[id].style;
        this.obj.visibility = visibility;
        return this.obj;
    }
    else if (document.layers) {
        this.obj = document.layers[id];
        this.obj.visibility = visibility;
        return this.obj;
    }
}

function hideOthers() {
    //sleep(100);
    for (i = 2; i <= 8; i++) {
        new layerSetup("id" + i, 'hidden');
    }
}

function visVisible(param) {
    sleep(150);
    new hideOthers();
    new layerSetup(param, 'visible');
}

function visHidden(param) {
    //sleep(100);
    new hideOthers();
    new layerSetup(param, 'hidden');
}

function sleep(milliseconds) {
    var start = new Date().getTime();
    for (var i = 0; i < 1e7; i++) {
        if ((new Date().getTime() - start) > milliseconds) {
            break;
        }
    }
}


