(function ($) {
	$.event.special.load = {
		add: function (hollaback) {
			if ( this.nodeType === 1 && this.tagName.toLowerCase() === 'img' && this.src !== '' ) {
				// Image is already complete, fire the hollaback (fixes browser issues were cached
				// images isn't triggering the load event)
				if ( this.complete || this.readyState === 4 ) {
					hollaback.handler.apply(this);
				}

				// Check if data URI images is supported, fire 'error' event if not
				else if ( this.readyState === 'uninitialized' && this.src.indexOf('data:') === 0 ) {
					$(this).trigger('error');
				}
				
				else {
					$(this).bind('load', hollaback.handler);
				}
			}
		}
	};
}(jQuery));


jQuery(document).ready(function($) {

		$(":radio, :checkbox").uniform(); 	
		
		var $sucheImgs = $(".article_wrapper img.image");
		
		var $freiluftloader = $('<div class="freiluft_loading"/>').appendTo(".article_wrapper");
		
		$(".suche_miniimage_wrap img").hover(function(){
			
			
			
			var $that = $(this);
			var $articlewrapper = $that.parents(".article_wrapper");
			var $bigimage = $articlewrapper.find(".article_image img.image");
			
			var $thisloader = $articlewrapper.find(".freiluft_loading").show();
			
			
			var miniImgSrc = $(this).attr("src");
			var bigImgSrc = miniImgSrc.replace(/mini/,"klein");
			
			var newImage = new Image();
			
			$(newImage).load(function(){
				
				$bigimage.replaceWith($(this));
				$thisloader.hide();
					
			}).attr('src',bigImgSrc).addClass('image');
		
		});
		
		$('#fw_HeaderShopPopup').appendTo('#menu-item-333');
	
});

