function show_modal(modal_id,msg){
	//set display to block and opacity to 0 so we can use fadeTo
	$('#mask').css({ 'display' : 'block', opacity : 0});
	//fade in the mask to opacity 0.8
	$('#mask').fadeTo(500,0.1);
	 //show the modal window
	//$('#mydiv').html(msg);
	$('#mydiv').html(msg);
	$(modal_id).fadeIn(500);

}
function close_modal(modal_id){
	//hide the mask
	$('#mask').fadeOut(500);
	//hide modal window(s)
	$(modal_id).fadeOut(500);

}

function ShowModalWindow(modal_id,msg){
	var window_width = $(window).width();
	var window_height = $(window).height();
	$('.main_body_container').each(function(){
		
		//get the height and width of the modal
		var modal_height = $(this).outerHeight();
		var modal_width = $(this).outerWidth();
		
		//calculate top and left offset needed for centering
		var top = (window_height-modal_height)/2;
		var left = (window_width-modal_width)/2;
		
		//apply new top and left css values
		$(this).css({'top' : top , 'left' : left});
	
	});
	
	show_modal(modal_id,msg);
	$('.close').click(function(){
		close_modal(modal_id);
	});
	
}
