this.imagePreview = function(){	
		
	xOffset = 10;
	yOffset = 10;
		
	jQuery("a.preview").hover(function(e) {
		this.t = this.title;
		this.title = "";
		var c = (this.t != "") ? "<br/>" + this.t : "";

		var r= /id_zdjecie=(\d{1,8})/
		var m=this.href.match(r);
		if (m==null) {
			r = /(\d{1,8}\.jpg)/;
			m = this.href.match(r);
		}
		
		if (m!=null) {
			var id = parseInt(m[1]);
			var btb_url = TOP_URL+"images/obiekty/bigthumb/"+id+".jpg";
						
			jQuery("body").append("<p id='preview'><img src='"+ btb_url +"' alt='Podgląd zdjęcia' />"+ c +"</p>");
			jQuery("#preview")
				.css("top",(e.pageY - xOffset) + "px")
				.css("left",(e.pageX + yOffset) + "px")
				.fadeIn("fast");
		}
        },
        
	function(){
		this.title = this.t;	
		jQuery("#preview").remove();
    	});	
    	
	jQuery("a.preview").mousemove(function(e){
		jQuery("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};


jQuery(document).ready(function(){
	imagePreview();
});

