/* Safe Console */

	(function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info, log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();)b[a]=b[a]||c})(window.console=window.console||{});

/* Classs */

	if (typeof JS == 'undefined') {
		var JS = {};
	}
	JS.Fullscreen = new Class({
		
		initialize: function(els)
		{
			this.els = els.each(function(el) {
				el.setStyles({
					display:	'block',
					position:	'absolute',
					top:		'50%',
					left:		'50%'
				});
			}.bind(this));
			window.addEvent('resize', function(ev) {
				this._refresh();
			}.bind(this));
			this._refresh();
		},
		
		_refresh: function()
		{
			var vp = window.getSize();
			this.els.each(function(el) {
				var size	= el.getSize();
				var ratio	= Math.max(vp.x / size.x, vp.y / size.y);
				var width	= Math.ceil(size.x * ratio);
				var height	= Math.ceil(size.y * ratio);
				el.setStyles({
					width:		width + 'px',
					height: 	height + 'px',
					marginLeft: (Math.ceil(width / 2) * -1) + 'px',
					marginTop:	(Math.ceil(height / 2) * -1) + 'px'
				});
			}.bind(this));
		}
			
	});

/* Features */

//	new JS.Blank($$('*[href^=http:], *[href^=https:]'));
	new JS.Fullscreen($$('#bg img'));
