function css_ns4(id){
    this.zindex = function(alt){
        this.container.zIndex = alt;
    }
    this.hide = function(){
        //alert(this.container.visibility);
        this.container.visibility="hidden";
    }
    this.show = function(){
        this.container.visibility="visible";
    }
    this.move = function(x, y){
        this.container.top=y;
        this.container.left=x;
    }
    this.resize = function(x, y){
        this.container.height=y;
        this.container.width=x;
        this.container.resizeTo(x,y);
    }
    this.getbyid = function(id){
        return eval("document."+id);
    }
    this.container = this.getbyid(id);
}

function css_ie(id){
    this.zindex = function(alt){
        this.container.zIndex = alt;
    }
    this.hide = function(){
        this.container.visibility="hidden";
    }
    this.show = function(){
        this.container.visibility="visible";
    }
    this.move = function(x, y){
        this.container.top=y+"px";
        this.container.left=x+"px";
    }
    this.getbyid = function(id){
        return eval("document.all."+id+".style");
    }

    this.resize = function(x, y){
        this.container.height=y+"px";
        this.container.width=x+"px";
    }

    this.container = this.getbyid(id);
}

function css_ns6(id){
    this.zindex = function(alt){
        this.container.zIndex = alt;
    }
    this.hide = function(){
        this.container.visibility="hidden";
    }
    this.show = function(){
        this.container.visibility="visible";
    }
    this.move = function(x, y){
        this.container.top=y+"px";
        this.container.left=x+"px";
    }
    this.resize = function(x, y){
        this.container.height=y+"px";
        this.container.width=x+"px";
    }
    this.getbyid = function(id){
        return document.getElementById(id).style;
    }
    
    this.container = this.getbyid(id);
}

function css(id){
    if (id)
        switch(getbrowser()){
          case 0: // IE4
            this.cssobj = new css_ie(id);
            break;
          case 1: //Netscape4
            this.cssobj = new css_ns4(id);
            break;
          case 2: //Netscape6
            this.cssobj = new css_ns6(id);
            break;
          default:
          this.cssobj = null;
        }

    this.hide = function(){
        if (this.cssobj) this.cssobj.hide();
    }
    this.show = function(){
        if (this.cssobj) this.cssobj.show();
    }
    this.alive = function(){
    }
    this.zindex = function(alt){
        if (this.cssobj) this.cssobj.zindex(alt);
    }
    
    this.move = function(x, y){
        if (this.cssobj) this.cssobj.move(x, y);
        this.x = x;
        this.y = y;
    }
    this.switch_pos = function(css){
        x=this.x;
        y=this.y;
        if (this.cssobj) this.move(css.x, css.y);
        if (this.cssobj) css.move(x,y);
    }
    
    this.resize = function(x, y){
        if (this.cssobj) this.cssobj.resize(x, y);
    }
    this.x = 0;
    this.y = 0;
}
