$('document').ready( function() {
		
	var messageElem = $('#floatingMessage');
	var win = $(window);
	var Wheight = win.height();
	var Wwidth = win.width();
	var width = messageElem.width();
	var height = messageElem.height();
	
	var html = $('html');
	
	var cookieOptions = {path: '/'};
	
	var recId = $.cookie('record');
	
	if (!recId) return;
	
	$.cookie('record', null, cookieOptions);
	
	var recElem = $('#rec'+recId);
	if (recElem.size() != 1) {
		recId = recId.split('-');
		recId = recId[0];
		
		recElem = $('#rec'+recId);
	}
	
	if (recElem.size() != 1) {
		return;
	}
	
	var offset = $.cookie('rec'+recId);
	if (offset) {
		offset = offset.split('x');
		window.scrollTo(offset[0],offset[1]);
		
		$.cookie('rec'+recId, null, cookieOptions);
	}
	
	var left = recElem.offset().left - (width / 2);
	var top = recElem.offset().top + recElem.height();

	if ((left + (width)) > (Wwidth + html
			.attr('scrollLeft')))
		left = html.attr('scrollLeft') + Wwidth
				- (width);
	if ((top + height) > (Wheight + html
			.attr('scrollTop')))
		top = html.attr('scrollTop') + Wheight
				- height;
	if (left < html.attr('scrollLeft'))
		left = html.attr('scrollLeft');
	if (top < html.attr('scrollTop'))
		top = html.attr('scrollTop');

	messageElem.css('left', left).css('top',
			top).removeClass('noDisplay');
	
});