var Dimension = {

	window: Class.create(),

	document: Class.create(),

	repeatedCalling: false,

	getMainDimensions: function() {

		if(this.repeatedCalling) {

			this.repeatedCalling = false;

			return;
		}

		this.repeatedCalling = true;

		Dimension.window.getDimensions();
		Dimension.document.getDimensions();

	},

	get: function(obj) {

		var w,h,dim=[],el = $(obj);

		dim.push((w = el.offsetWidth));
		dim.push((h = el.offsetHeight));

		dim['w'] = w;
		dim['h'] = h;

		return dim;

	}

}

Dimension.window = {

	width: 0,

	height: 0,

	getDimensions: function () {

		var x,y;

		if (window.innerHeight) // all except Explorer
		{
			x = window.innerWidth;
			y = window.innerHeight;
		}
		else if (document.documentElement && document.documentElement.clientHeight)
			// Explorer 6 Strict Mode
		{
			x = document.documentElement.clientWidth;
			y = document.documentElement.clientHeight;
		}
		else if (document.body) // other Explorers
		{
			x = document.body.clientWidth;
			y = document.body.clientHeight;
		}

		this.width = x;
		this.height = y;

		var dims = [x,y];

		dims['x'] = dims['width'] = x;
		dims['y'] = dims['height'] = y;

		return dims;

	}

}


Dimension.document = {

	width: 0,

	height: 0,

	getDimensions: function () {

		var dims = Dimension.window.getDimensions();

		this.width = dims[0];
		this.height = dims[1];

	}

}

Dimension.getMainDimensions();

//Event.listen(window, 'resize', Dimension.getMainDimensions, false);

//Event.listen(window, 'load', Dimension.getMainDimensions, false);