(function($) {
	$(document).ready(function() {
		//has no flash
		if (!swfobject.hasFlashPlayerVersion("9.0.14")) {
			var maskHeight = $(document).height();
			var maskWidth = $(window).width();
	
			//Set heigth and width to mask to fill up the whole screen
			$('.noflash .mask').css({'width':maskWidth,'height':maskHeight});
			
			//transition effect		
			$('.noflash .mask').fadeIn(500);
			$('.noflash .mask').fadeTo(500, 0.8);
	
			//Get the window height and width
			var winH = $(window).height();
			var winW = $(window).width();
	
			var id = ".noflash .dialog";
			//Set the popup window to center
			$(id).css('top',  winH/2-$(id).height()/2);
			$(id).css('left', winW/2-$(id).width()/2);
	
			//transition effect
			$(id).fadeIn(2000); 
			
			//if close button is clicked
			$('.noflash .dialog .close').click(function (e) {
				//Cancel the link behavior
				e.preventDefault();
				
				$('.noflash .mask').hide();
				$('.noflash .dialog').hide();
				
				//set session so method won't be called again
				$.post('/?eID=flashcheck');
			});
			
			//if mask is clicked
			$('.noflash .mask').click(function () {
				$(this).hide();
				$('.noflash .dialog').hide();
				
				//set session so method won't be called again
				$.post('/?eID=flashcheck');
			});
		}
	});
})(jQuery);