/**
 *	Code wich show the viewport dimensions of
 *	window client
 *
 *	@author Luis Pirir <luispirir@gmail.com, lpirir@solucionweb.com>
 *	
 */

if ( typeof ( Client ) == 'undefined' )

	Client = Class.create();

Object.extend ( Client.prototype, {

	initialize : function () {
	
		return [ this.getViewPortWidth (), this.getViewPortHeight () ];

	},

	getViewPortWidth : function () {
		
		return self.innerWidth || ( document.documentElement.clientWidth || document.body.clientWidth );

	},

	getViewPortHeight : function () {
	
		return self.innerHeight || ( document.documentElement.clientHeight || document.body.clientHeight );

	}

} );

Event.observe ( window, 'load', function() {
	$$('a[rel=external]').each(function(link){
		$(link).setAttribute('target', '_blank');
	})

	var _client = new Client();

	if (_client.getViewPortHeight() > $('wrapper').getHeight())
	{
		$('wrapper').setStyle({'height': (_client.getViewPortHeight() - 20) + 'px'});

		$$('html')[0].addClassName('html');
	} else $$('html')[0].addClassName('html');
})