function Maximizeable(obj){

    var dims = System.display.getScreenDimensions();
    var screenWidth = dims[0];
    var screenHeight = dims[1];
    var width;
    var height;
    var left;
    var top;

    var setLeft = function(value){
        left = value;
    };

    var setTop = function(value){
        top = value;
    };

    var setWidth = function(value){
        width = value;
    };

    var setHeight = function(value){
        height = value;
    };

    obj.addOnMaximize = function(action){ obj.addSubscriber("maximize",action); };

    obj.maximize = function(){
        if(obj.isMaximizeable()){
            if(obj.isMaximized()){
                obj.setWidth(width);
                obj.setHeight(height);
                obj.setLeft(left);
                obj.setTop(top);
                obj.validate();
                obj.maximized = false;
            }else{
                setLeft(obj.left);
                setTop(obj.top);
                setWidth(obj.width);
                setHeight(obj.height);
                obj.setHeight(screenHeight);
                obj.setWidth(screenWidth);
                obj.setLeft(0);
                obj.setTop(0);
                obj.validate();
                obj.maximized = true;
            }
        }
    };

    obj.isMaximizeable = function(){
        return this.maximizeable;
    };

    obj.isMaximized = function(){
        return this.maximized;
    };

    return obj;

}

