function Crossbrowser( )
{
}

Crossbrowser.prototype.Init = function( )
{
    this.isIE = document.all ? true : false;
    this.isDOM = document.getElementById ? true : false;
    this.isNs4 = document.layers ? true : false;
    this.isMac = ( navigator.userAgent.toLowerCase( ).indexOf( "mac") >= 0) ? true : false;
}

Crossbrowser.prototype.GetVisibility = function( visibility)
{
    this.Init( );
    if ( this.isDOM || this.isIE)
        return ( visibility ? "visible" : "none");
    else
        return ( visibility ? "show" : "hidden");
}

Crossbrowser.prototype.GetStyleWidth = function( width)
{
    this.Init( );
    if ( document.layers)
        return width;

    return ( width + "px");
}

Crossbrowser.prototype.BodyObj = function( )
{
    this.Init( );
    var d = ( ( document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body);
    if ( !d && document.documentElement)
        return document.documentElement;

    return d;
}

Crossbrowser.prototype.FindObj = function( n, d)
{
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=this.FindObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

Crossbrowser.prototype.GetScrollTop = function( )
{
    this.Init( );
    if ( this.isIE)
        return this.BodyObj( ).scrollTop;

    return window.pageYOffset;
}

Crossbrowser.prototype.GetScrollLeft = function( )
{
    this.Init( );
    if ( this.isIE)
        return this.BodyObj( ).scrollLeft;

    return window.pageXOffset;
}

Crossbrowser.prototype.GetBodyWidth = function( )
{
    this.Init( );
    if ( this.isIE) return this.BodyObj( ).clientWidth;
    return window.innerWidth;
}

Crossbrowser.prototype.GetBodyHeight = function( )
{
    this.Init( );
    if ( this.isIE) return document.body.clientHeight;
    return window.innerHeight;
}

Crossbrowser.prototype.OpacityFull = function( obj, value, nohide)
{
    this.Init( );

    if ( !obj || value < 0 || value > 10)
        return false;

    obj.style.opacity = value / 10;
    obj.style.filter = 'alpha(opacity=' + value * 10 + ')';
    if ( value <= 0 && !nohide)
    {
        if ( !this.isIE)
            obj.style.visibility = this.GetVisibility( false);
    }

    return true;
}

Crossbrowser.prototype.Opacity = function( obj, value)
{
    this.Init( );
    return this.OpacityFull( obj, value, false);
}

Crossbrowser.prototype.Visible = function( obj, visible)
{
    this.Init( );
    if ( !obj) return false;
    obj.style.visibility = this.GetVisibility( visible);
}

Crossbrowser.prototype.Display = function( obj, status)
{
    this.Init( );
    if ( !obj) return false;
    obj.style.display = status ? "block" : "none";
}

Crossbrowser.prototype.Enable = function( obj, status)
{
    this.Init( );
    if ( !obj) return false;
    obj.disabled = status ? "" : "disabled";
}

