﻿function fixWidth(){
	if(window.innerWidth != ""){
		$browserWidth = window.innerWidth;
	}
	if(document.body.offsetWidth != ""){
		$browserWidth = document.body.offsetWidth;
	}
	if(document.documentElement.offsetWidth != ""){
		$browserWidth = document.documentElement.offsetWidth;
	}

	$bodyAlign = (($browserWidth - 780) / 2)
	$("body").css("margin-left", $bodyAlign);
}

function getInternetExplorerVersion(){

	// Official Microsoft detect method http://msdn.microsoft.com/en-us/library/hh273397%28v=vs.85%29.aspx
	// Returns the version of Internet Explorer or a -1
	// (indicating the use of another browser).
	
	var rv = -1; // Default value assumes failure. 
	var ua = navigator.userAgent;

	// If user agent string contains "MSIE x.y", assume
	// Internet Explorer and use "x.y" to determine the
	// version.
 
	var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
	if (re.exec(ua) != null) 
	rv = parseFloat( RegExp.$1 );
	return rv;

}


$(document).ready(function() {
	fixWidth();
	
	$(window).resize(function(){
		fixWidth();
	});
	
	internetExplorerVersion = getInternetExplorerVersion();

});
