
var offsetfromcursorX=12;
var offsetfromcursorY=20;

var pos_x;
var pos_y;

document.write('<div id="noticeBox"><span id="noticeTitle"></span><span id="noticeX"><a class="invisible" href="#">x</a></span><p id="noticeText"></p></div>');

$(document).bind('mousemove',function(event)
{ 
	pos_x = event.pageX; 
	pos_y = event.pageY;
});

$("#noticeX").click(function() { 
	$("#noticeBox").hide();
});


function snotice(text, title, width)
{
	if (title == null) title = 'info';
	var win_width =  $(window).width();
	var win_height = $(window).height();
	var x = pos_x + offsetfromcursorX;
	var y = pos_y + offsetfromcursorY;

	
	$("#noticeTitle").html(title);
	$("#noticeText").html(text);
	
	var width =  $("#noticeBox").css('width');
	var height =  $("#noticeBox").css('height');

	if (pos_x + width >= win_width) x = pos_x - width - 2*offsetfromcursorX;
	if (x < 0)	 x = 10;

	if (pos_y + height >= win_height) y = pos_y - height - 2*offsetfromcursorY;
	if (y < 0)	 y = 10;
	
	$("#noticeBox").css('left', x).css('top', y).show();
}

function hnotice()
{
	$("#noticeBox").hide();
}



