var calcHeight;
var calcWidth;

function zoom(obj,bildgross,breite,hoehe,Titel){	
	
	var c = (Titel != "") ? "<br/>" + Titel : "";
	$("body").append("<p onmouseout='zoom_out()' id='preview'><img id='BildGross' src='"+ bildgross +"' alt='" + Titel + "' width='"+breite+"' height='"+hoehe+"' />"+ c +"</p>");								 
	
	if (this.scrollY) {
		var y = this.scrollY;
		var x = this.scrollX;
	} else {
		var y = document.body.scrollTop;
		var x = document.body.scrollLeft;
	}
	
	if (this.innerHeight) {
		var h = this.innerHeight;
		var b = this.innerWidth;
	} else {
		var h = document.body.offsetHeight;
		var b = document.body.offsetWidth;
	}
	
	calcHeight = (y + h / 2 - hoehe / 2) - 20;
	calcWidth = (x + b / 2 - breite / 2);
	
	$("#preview")
		.css("top", calcHeight + "px")
		.css("left", calcWidth + "px")
		.fadeIn(1000);	 
	
	$("div.preview").hover(
		function(e){},
		function(e){
			if (e.pageX>calcWidth & e.pageX<calcWidth+parseInt(breite) & e.pageY>calcHeight & e.pageY<calcHeight+parseInt(hoehe)){
				a=1;
			} else {
				$("#preview").remove();
			}
		}
	);
	
	$("div.preview").mousemove(function(e){
		$("#preview")
			.css("top", calcHeight + "px")
			.css("left", calcWidth + "px");
	});		
	
};

function zoom_out(){
	$("#preview").remove();
}
