Browser=new Object;
function Browser()
{
    alert('The Browser class cannot be instantiated');
    return null;
}

Browser.IsNS4 = (document.layers) ? true : false;
Browser.IsIE4 = (document.all && !document.getElementById) ? true : false;
Browser.IsIE5 = (document.all && document.getElementById) ? true : false;
Browser.IsNS6 = (!document.all && document.getElementById) ? true : false;

// Diagnose Opera:
Browser.IsOp = (navigator.userAgent.indexOf('Opera') != -1);
if( Browser.IsOp ) {
    Browser.IsOp7 = (navigator.userAgent.indexOf('Opera/7.') != -1) || (navigator.userAgent.indexOf('Opera 7.') != -1);
    Browser.IsNS6 = false;
    Browser.IsIE5 = false;
}

// Diagnose Konqueror - not really worried about this one:
Browser.IsKr  = Browser.IsIE5 && (navigator.userAgent.indexOf("Konqueror") != -1);
if( Browser.IsKr ) {
    Browser.IsIE5 = false;
}

// Diagnose pre-1.0 Mozilla - not really worried about this one:
Browser.IsNS5 = Browser.IsNS6 && (navigator.userAgent.indexOf("; 0.8)") != -1);
if( Browser.IsNS5 ) {
    Browser.IsNS6 = false;
}

// Diagnose IE 6
if( navigator.userAgent.indexOf('MSIE 6.') ) {
    Browser.IsIE6=true;
    // We let it stay IsIE5 (praying for backward compatibility!)
}

// IE5 on the Mac is more like IE4 on Windows
if( Browser.IsIE5 && navigator.userAgent.indexOf("Mac") != -1 ) { 
    Browser.IsIE5Mac = true;
}

Browser.GoodDOM = true;
// Opera prior to version 7 has an unusable DOM implementation
if( (Browser.IsOp && !Browser.IsOp7) || Browser.IsNS4 || Browser.IsIE4 ) {
    Browser.GoodDOM = false;
}


Browser.Diagnostics = function()
{
    var message="Browser diagnostics\n\t" +navigator.userAgent+"\n\n";
    for(i in Browser) {
	message += i +': '+ Browser[i]+"\n";
    }
    alert(message);
}

