/**
 * File: DynamicHTML.js
 * JavaScript 
 * Modificato da: Piero Giampani
 * Data della modifica: 14 agosto 2008 
 */

function clientSniffer() {
    var agent = navigator.appName;

    this.isIE = function() {
        return (agent == "Microsoft Internet Explorer" && document.all);
    }

    this.isNS = function() {
        return (agent == "Netscape");
    }

    this.getVersion = function() {
        if (this.isNS()) {
            return parseInt(navigator.appVersion);
        }
        if (this.isIE()) {
            var vIdx = navigator.appVersion.indexOf("MSIE ") + "MSIE ".length;
            return parseInt(navigator.appVersion.substring(vIdx, vIdx + 3));
        }
        return 0;
    }

    this.isDOM = function() {
        return document.getElementById ? true : false;
    }
}

function writeToLayer(lyrID, html) {
    var cs = new clientSniffer();
    if (cs.isDOM()) {
        document.getElementById(lyrID).innerHTML = html;
    } else if (cs.isIE()) {
        document.all[lyrID].innerHTML = html;
    } else {
        with (document.layers[lyrID].document) {
            open();
            write(html);
            close();
        }
    }
}
