function showOverLay(SiteMessageId) {	
	myWindow = window.open("/site_messages/" + SiteMessageId,'SiteMessage');
}

function showModeBackground(){
	var background = document.createElement("div");
	background.id = "background-modal";
	$(background).css('position','absolute').css('top',0).css('left',0).css('z-index',100).css('background','#000000').css('display','none').css('text-align','center')
	.appendTo(document.body).css('opacity',0).show();	
	$(background).css('height',$(document).height()+'px')
	.css('width',$(window).width()+'px').fadeTo(500, 0.25);
	$(background).bind('click',hideMessage).bind('click',hideModeBackground);
}

function hideModeBackground(){
	$('#background-modal').remove();
	$(window).resize(null);
}

function showMessage(postdata) {	
	var msg = document.createElement("div");	
	msg.id = 'site_message';
	//$(msg).html(postdata).appendTo(document.body);
	var widthBox = 700
	var heightBox = 200
	var left = 0;
	var center = $(document).width() / 2;
	left = center - (widthBox / 2);
	left = left + $(window).scrollLeft();
	var top = ($(window).height() / 2) - (heightBox / 2);
	var offset = $(window).scrollTop();
	top = top + offset
	$(msg).css('position','absolute').css('top',top).css('z-index',200).css('left',left);
	$(msg).css('background','#F5F5F5 none repeat scroll 0 0').css('width',widthBox).css('height', heightBox).css('overflow-y','auto');
	$(msg).css('background','#F5F5F5 none repeat scroll 0 0');
	$(msg).css('border','solid #333 2px');
	$(msg).css('padding','0px 5px');
	$(msg).html(postdata).appendTo(document.body);
}

function hideMessage() {
	$('#site_message').remove();
	hideModeBackground();
}
