function checkNotification()
{
	jQuery.getJSON(globalHttpPath+"/account/getMessages/",
	function(data) {
		if (data.length > 0) {
			div = jQuery("#asd");
			
			var h = $(window).height() + $(window).scrollTop();
			var w = $(window).width();

			div.css('position', 'absolute');
			div.css('left', (w - 300) + 'px');
			div.css('top', (h - 200) + 'px');
			div.css('z-index', '3100');
			
			jQuery.each(data, function(message) {
				elem = jQuery("#modalContainer_"+this.ID);
				if (elem.length == 0) {

					var html = "<div id='modalContainer_"+this.ID+"' class='modalContainer'><div class='spacer'></div><div>You have a new message:<br>'"+this.MESSAGE+"'</div>";
					html += "<div><a href=\"javascript:;\" onclick='setAsRead("+this.ID+", \""+this.URL+"\"); return false;' style='color: #000;'>(click to view)</a>";
					html += "<div><a href=\"javascript:;\" onclick='setAsRead("+this.ID+", \"\"); return false;' style='color: #000;'>(click to close)</a></div>";
					html += "<div><br /><a href=\"" + globalHttpPath+"/account/interactivity/" + "\" style='color: #000;'>(change settings)</a></div>";
					html += "</div>"
					div.append(html);
					jQuery("#modalContainer_"+this.ID).slideDown("slow");
				}
			});
		}
	});
}

function setAsRead(id, url)
{
	jQuery("#modalContainer_" + id).remove();
	jQuery.getJSON(globalHttpPath + "/account/setMessageRead/?id="+id,
	function(data) {	
		if (url && url != null) {
			document.location.replace(url);
		}
	});
}