(function($){$.browserTest=function(a,z){var u='unknown',x='X',m=function(r,h){for(var i=0;i<h.length;i=i+1){r=r.replace(h[i][0],h[i][1]);}return r;},c=function(i,a,b,c){var r={name:m((a.exec(i)||[u,u])[1],b)};r[r.name]=true;r.version=(c.exec(i)||[x,x,x,x])[3];if(r.name.match(/safari/)&&r.version>400){r.version='2.0';}if(r.name==='presto'){r.version=($.browser.version>9.27)?'futhark':'linear_b';}r.versionNumber=parseFloat(r.version,10)||0;r.versionX=(r.version!==x)?(r.version+'').substr(0,1):x;r.className=r.name+r.versionX;return r;};a=(a.match(/Opera|Navigator|Minefield|KHTML|Chrome/)?m(a,[[/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/,''],['Chrome Safari','Chrome'],['KHTML','Konqueror'],['Minefield','Firefox'],['Navigator','Netscape']]):a).toLowerCase();$.browser=$.extend((!z)?$.browser:{},c(a,/(camino|chrome|firefox|netscape|konqueror|lynx|msie|opera|safari)/,[],/(camino|chrome|firefox|netscape|netscape6|opera|version|konqueror|lynx|msie|safari)(\/|\s)([a-z0-9\.\+]*?)(\;|dev|rel|\s|$)/));$.layout=c(a,/(gecko|konqueror|msie|opera|webkit)/,[['konqueror','khtml'],['msie','trident'],['opera','presto']],/(applewebkit|rv|konqueror|msie)(\:|\/|\s)([a-z0-9\.]*?)(\;|\)|\s)/);$.os={name:(/(win|mac|linux|sunos|solaris|iphone)/.exec(navigator.platform.toLowerCase())||[u])[0].replace('sunos','solaris')};if(!z){$('html').addClass([$.os.name,$.browser.name,$.browser.className,$.layout.name,$.layout.className].join(' '));}};$.browserTest(navigator.userAgent);})(jQuery);


function CheckBrowserInstall(){
	$("#BackgroundContainer, #PageContainer").hide();
	// ------------------------------------------------------------------------------------
	// BROWSER DISPLAY
	// ------------------------------------------------------------------------------------
	$("#browser-display").html("Platform: "+$.os.name+" | "+"Browser: "+$.browser.name+" | "+"Version: "+$.browser.versionX).hide();
	ResizeWindowVideo();
	AlertWindow();
	$(window).resize( function() {
		if($.browser.name=="chrome" || $.browser.name=="safari" || $.browser.name=="opera"){
			ResizeNonBrowser();
		} else {
			ResizeWindowVideo();
		}
	});
}
function AlertWindow(){
	if($.browser.name=="chrome" || $.browser.name=="safari" || $.browser.name=="opera"){
				$("#BackgroundContainer, #PageContainer").empty();
		$('body').append('<div id="Alert-Overlay"></div>');
		$('body').append('\
						 <div id="Alert-Window">\
						 	<div id="Logo"></div>\
							<div id="FirefoxMessage">You need to install Firefox to view this site.<br> Please download it <a href="#" target="_self">here</a></div>\
						 </div>');
		//
		winW = $(window).width()/2;
		winH = $(window).height()/2;
		elemW = $("#Alert-Window").width()/2;
		elemH = $("#Alert-Window").height()/2;
		posX = winW-elemW;
		posY = winH-elemH;
		//
		$("#Alert-Window").css({top:posY,left:posX}).fadeIn(500);
		$("#Alert-Window>#FirefoxMessage>a").attr({ href: "http://www.mozilla.com/firefox/"});
	} else {
		$("#BackgroundContainer, #PageContainer").show();
	}	
	$("#BackgroundContainer, #PageContainer").show();
}
function ResizeWindowVideo(){
	winW = $(window).width();
	winH = $(window).height();
	if(winH < 648){
		$("#BackgroundContainer").css("height","647px");
	} else {
		$("#BackgroundContainer").css("height","100%");
	}
	if(winW < 995){
		$("#BackgroundContainer").css("width","994px");
	} else {
		$("#BackgroundContainer").css("width","100%");
	}
}
function ResizeNonBrowser(){
		winW = $(window).width()/2;
		winH = $(window).height()/2;
		elemW = $("#Alert-Window").width()/2;
		elemH = $("#Alert-Window").height()/2;
		
		posX = winW-elemW;
		posY = winH-elemH;
		//
		$("#BackgroundContainer").css("height","100%");
		$("#BackgroundContainer").css("width","100%");
		$("#Alert-Window").css({top:posY,left:posX}).fadeIn(500);
		$("#Alert-Window>#FirefoxMessage>a").attr({ href: "http://www.mozilla.com/firefox/"});
}
