 jQuery(document).ready(function() {	
	
	//Put in the DIV id you want to display
	launchWindow('#popup');
	
	//if close button is clicked
	 jQuery('.window #close').click(function () {
		 jQuery('#mask').hide();
		 jQuery('.window').hide();
	});		
	
	//if mask is clicked
	 jQuery('#mask').click(function () {
		 jQuery(this).hide();
		 jQuery('.window').hide();
	});			
	
});

function launchWindow(id) {
	
		//Get the screen height and width
		var maskHeight =  jQuery(document).height();
		var maskWidth =  jQuery(window).width();
	
		//Set heigth and width to mask to fill up the whole screen
		 jQuery('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		 jQuery('#mask').fadeTo("slow",0.0);	
	
		//Get the window height and width
		var winH =  jQuery(window).height();
		var winW =  jQuery(window).width();
              
		//Set the popup window to center
		 jQuery(id).css('top',  winH/2- jQuery(id).height());
		 jQuery(id).css('left', winW/2- jQuery(id).width()/2);
	
		//transition effect
		 jQuery(id).fadeIn(3000); 
	

}

