
var oLayout = null;

var Layout = function()
{
	this.init();
}

Layout.prototype =
{
	init : function()
	{
		// Set the Layout on load
		var oParams = this.calculateDimensions();
		this.resize(oParams);
		
		var self = this;
		// Apply the handler to the event
		$(window).resize(function(){
			self.onResize();
		});
	},
	
	onResize : function()
	{
		var oParams = this.calculateDimensions();
		this.resize(oParams);
	},
	
	calculateDimensions : function()
	{
		 var iViewPortWidth;
		 var iViewPortHeight;
		 
		 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
		 
		 if (typeof window.innerWidth != 'undefined')
		 {
			 iViewPortWidth = window.innerWidth,
			 iViewPortHeight = window.innerHeight
		 }
		 
		// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

		 else if (typeof document.documentElement != 'undefined'
		     && typeof document.documentElement.clientWidth !=
		     'undefined' && document.documentElement.clientWidth != 0)
		 {
			 iViewPortWidth = document.documentElement.clientWidth,
			 iViewPortHeight = document.documentElement.clientHeight
		 }
		 
		 // older versions of IE
		 
		 else
		 {
			 iViewPortWidth = document.getElementsByTagName('body')[0].clientWidth,
			 iViewPortHeight = document.getElementsByTagName('body')[0].clientHeight
		 }
		
		 return {
			 width : iViewPortWidth,
			 height : iViewPortHeight
		 };
	},
	
	resize : function(oParams)
	{
		var iNewWidth = (parseInt(oParams.width) - 960) / 2;
		var iPictureMargin =  parseInt(iNewWidth) - 480;
		
		$('#latestnews').css('marginLeft', parseInt(iNewWidth) + 510);
	}
}

$(document).ready(function()
{
	oLayout = new Layout();
});
