var trail = new function() {
	this.spacer = baseURL + '/core/images/spacer.gif';
	document.write('<div id="trail-div" style="position:absolute; left:0px; top: 0px; width:1px; height:1px; border:1px solid #ccc; background:#fff;"><img id="trail-img" alt="" src="' + this.spacer + '" /></div>');
	$('#trail-div').hide();

	this.hide = function() {
		$('#trail-div').hide();
		$('#trail-img').attr('src', this.spacer);
		document.onmousemove='';
	}

	this.show = function(width, height, file) {
		$('#trail-img').attr('src', file);
		$('#trail-div').width(width).height(height).show();
		document.onmousemove = function(e) {
			if (typeof e != 'undefined') {
				mouseX = e.pageX;
				mouseY = e.pageY;
			} else if (typeof window.event != 'undefined') {
				mouseX = event.clientX;
				mouseY = event.clientY;
			}
			var xcoord = mouseX + 20;
			var ycoord = mouseY + 20;
			if (xcoord + width > $(window).width()) xcoord = xcoord - width - 40;
			if (ycoord + height > $(window).height()) ycoord = ycoord - height - 40;
			$('#trail-div').css('left', xcoord + 'px').css('top', ycoord + 'px');
		}
	}
}
