$(document).ready(function(){
	/*
		adjust's top position of message box when browser is being scrolled 
		better if default_position is equal to the msgbox style default top position
		anyway you can modify it accordding what your site needs
	*/
	var default_position = 250;
	$(window).scroll(function(){
		$('#msgbox').animate({top:$(window).scrollTop()+default_position+"px" },{queue: false, duration: 350});  
	});							
									
	$("#DimBackground").css("height", $(document).height());
	
	//When the link that triggers the message is clicked, display DimBackground and fadeIn msgbox...
	$(".show").click(function(){
		$("#DimBackground").css({'display':'block'});
		$("#msgbox").fadeIn();
		return false;
	});
	
	//When the message box is closed, hide DimBackground and fadeOut msgbox...
	$(".close").click(function(){
		$("#DimBackground").css({'display':'none'});
		$("#msgbox").fadeOut();
		return false;
	});

});

//adjust's height of overlay to fill screen when browser gets resized  
$(window).bind("resize", function(){
	$("#DimBackground").css("height", $(window).height());
});
