/**
    * Costruisce l'oggetto detect browser
    */
function DetectBrowser()
{
    this.__browser = undefined;
    if (document.all)
    {
        this.__browser = "IE";
    }
    else if (document.layers)
    {
        this.__browser = "NS5";
    }
    else if (document.getElementById)
    {
        this.__browser = "NS6";
    }

    this.isIE = _isIE;
    this.isNS = _isNS5;
    this.isNS6 = _isNS6;
    
    // metodi
    this.setTagText = _setTagText;

    // Azioni specifiche per browser
    _forNS( this )
    
}

/**
    * Indica se è Internet Explorer
    */
function _isIE()
{
    return this.__browser == "IE";
}

/**
    * Indica se è Netscape/Mozilla fino al 6 escluso
    */
function _isNS5()
{
    return this.__browser == "NS5";
}

/**
* Indica se è Netscape/Mozilla versione 6
*/
function _isNS6()
{
    return this.__browser == "NS6";
}

function _forNS( oThis )

{
    if ( !oThis.isNS6() && !oThis.isNS() )
        return

    // Crea il metodo click sugli elementi DIV per NS (Mozilla, Firefox)
    try
    {
        // crea un elemento span, così si è sicuri che esista un HTMLElement
        document.createElement('span');
        HTMLElement.prototype.click = function ()
        {
            if (typeof this.onclick == 'function')
                this.onclick({type: 'click', target: this});
        };
    }
    catch (e)
    {
    }
}

function _setTagText( oDiv, sTesto )
{
    if ( this.isIE() )
        oDiv.innerText = sTesto
    else
        oDiv.innerHTML = sTesto;
}