$(document).ready(function() {
	
	jQuery.fn.center = function() {
	    //this.css("position","absolute");
	    
		var w = $(window);
		this.css("position","absolute");
		this.css("top",(w.height()-this.height())/2+w.scrollTop() + "px");
		this.css("left",(w.width()-this.width())/2+w.scrollLeft() + "px");
	
    	return this;
	}

	
	$('body').append('<div id="mImagePopupHolder"><div id="mImagePopup"></div></div>');
	
	$('.OfferImg a').bind('mouseover', function(e) {
		
		var $i = $("#mImagePopupHolder");
		
		var params = {};
		
		params.opacity = "show";
		$i.center();
		
		$("#mImagePopup").html('<img src="'+$(this).attr("rel")+'" />');
		$i.animate(params);
		
		$("#mImagePopup img").load(function() {
			$i.center();
		});
		
		
	}).bind('mouseout', function(e) {
			$("#mImagePopupHolder").hide();$("#mImagePopup").empty();
	});
});
