GIN.namespace("desktop");
GIN.desktop.ArrangeBody = new Class({
    Implements: [Options, Events, Chain],
    options: {
    	"topBody": "topBody",
    	"bodyWidth": 800
	},
	initialize: function(options){
        this.setOptions(options);
	},
	testSize: function(){
        var win = window;
        var scroll = win.getScroll();
        var size = win.getSize();
        var msg = "scroll.x:"+scroll.x+"  size.x:"+size.x;
        alert(msg);
	},
	arrangeCenter: function(){
        var win = window;
        var scroll = win.getScroll();
        var size = win.getSize();
		var px = (size.x-this.options.bodyWidth)/2 + scroll.x;
		px = Math.max(0, px);
		var topBody = document.id(this.options.topBody);
        if(!topBody){
        	topBody = $(document.body);
        }
		topBody.setStyle('left', px);
	},
    arrangeResize: function(){
        var boundDestroy = this.arrangeCenter.bind(this);
        //window.addEvent("scroll", boundDestroy);
        window.addEvent("resize", boundDestroy);
    }
	
});

