// JavaScript Document
$(document).ready(function() {
	$("a[@rel=imagebox]").hover(function(e) {
		$('#image').remove();
		img = $(this).find("img").get(0).src.replace(/A_/,"S1_");
     	$(this).parents('#artikelliste').append('<div id="image"><img src="images/lightbox-ico-loading.gif" alt="" id="preload" /><img src="images/blank.gif" alt="" id="aktimg" /></div>');
		pos = $(this).parents('.artikel').position().top-50;
		$('#image').css("top",pos);
		//if($.browser.msie && /MSIE\s(5\.5|6\.)/.test(navigator.userAgent) && pos==56) {
			$("#artikelsuche, .suchform, .ta").css("visibility","hidden");
			$("#contentbox_unten").css("visibility","hidden");
		//}
		$('#aktimg').hide();
		var objImagePreloader = new Image();
		objImagePreloader.onload = function() {
			$('#aktimg').attr('src',img);
			// Perfomance an effect in the image container resizing it
			w = objImagePreloader.width;
			h = objImagePreloader.height;
			if(920-(w+20)<=e.pageX) {
				$('#image').css("right",20+(920-w-e.pageX));
			}
			$('#preload').hide();
			$('#image').animate({ width: w, height: h },"slow", function() { $('#aktimg').show(); });
			//	clear onLoad, IE behaves irratically with animated gifs otherwise
			objImagePreloader.onload=function(){};
		};
		objImagePreloader.src = img;
	}, function() {
		$("#artikelsuche, .suchform, .ta").css("visibility","visible");
		$("#contentbox_unten").css("visibility","visible");
     	$('#image').remove();
	});
});