function __resize(item){
    if (isNull(item)) return;
    
    this.__tpOf = toInt(item.getAttribute("topOffset"));
    this.__btOf = toInt(item.getAttribute("bottomOffset"));
    this.__inEl = item.getAttribute("ElementID") ? document.getElementById(item.getAttribute("ElementID")) : item.parentNode;
    
    this.flagToWidth = item.getAttribute("rWidth") ? true : false;
    
    this.checkObj = function(){
        return (isNull(this.__inEl));
    }
    
    this.Resize = function()
    {
        if (!this.checkObj())
        {
            var height = null;
            
            if (this.flagToWidth){
                var width = null;
                var offset = isSafari() ? 20 : 25;
                if (isSafari() || isMozilla()) 
                {
                    width = toInt(innerWidth);
                }
                if (isMSIE()) width = toInt(document.getElementsByTagName('html')[0].offsetWidth);
                
                if(!isNull(width)){
                    if (this.__inEl.style) this.__inEl.style.width = (width - offset).toString() + "px";
                }
            }
            
            if (isSafari() || isMozilla()) 
            {
                height = toInt(innerHeight);
            }
            if (isMSIE()) height = toInt(document.getElementsByTagName('html')[0].offsetHeight);
            
            
            if (!isNull(height))
            {
                if (this.__inEl.style) 
                {
                    var newHeight = height - this.__tpOf - this.__btOf;
                    if(newHeight > 0)
                    {
                        this.__inEl.style.height = (newHeight).toString()+"px";
                    }
                }
            }
        }
    }
}

function obj_resize(){
    /*this.Resize = function(evt){
        debugger;
        if (this.LastTimeOutId){
            clearTimeout(this.LastTimeOutId);
        }
        this.LastTimeOutId = setTimeout("oResize.setHeight()",100);
    }
    
    this.LastTimeOutId = null;*/
    
    this.Resize = function(){
        if (!isNull(oResize)){
            for (var j in oResize.resEl) oResize.resEl[j].Resize();
        }
    }
    
    this.__El = document.getElementsByTagName('bodyResizeElem');
    this.resEl = new Array();
    
    for (var i = 0; i < this.__El.length; i++){
        this.resEl.push(new __resize(this.__El[i]));
    }
    
    for (var j in this.resEl){
        this.resEl[j].Resize();
    }
}

var oResize = new obj_resize();
Sys.UI.DomEvent.addHandler(window, "resize", oResize.Resize);
