$(function() {	
	var xOffset = 10,
		yOffset = 100;

	$('img.preview').hover(function(e){
		this.a = this.alt;
		this.alt = '';
		this.t = this.title;
		this.title = '';
		if ($('#image-preview img').attr('src') !== this.a) {
			$('#image-preview').remove();
		}
		$('body').append('<p id="image-preview"><img src="'+ this.a +'" alt="Image preview" />' + (this.t ? ('<br />' + this.t) : '') + '</p>');								 
		$('#image-preview').css({
			top: (e.pageY - yOffset) + 'px',
			left:(e.pageX + xOffset) + 'px'
		})
		.fadeIn('fast');						
    },
	function(){
		this.alt = this.a;	
		$('#image-preview').hide();
    });	
	$('img.preview').mousemove(function(e){
		$('#image-preview').css({
			top: (e.pageY - yOffset) + 'px',
			left: (e.pageX + xOffset) + 'px'
		});
	});			
});
