(function($) {
	$.fn.boxShadow = function(xOffset, yOffset, blurRadius, shadowColor) {
	    if (!$.browser.msie) return;
	    return this.each(function(){
	    	$(this).css({
	    		position:	"relative",
	    		zoom: 		1,
	    		zIndex:		"3"
	    	});
	    	$(this).parent().css({
	    			position:	"relative"
	    	});
	    	
	    	var div=document.createElement("div");
	    	$(this).parent().append(div);
	    
	    	var _top, _left, _width, _height;
	    	if (blurRadius != 0) {
	    		$(div).css("filter", "progid:DXImageTransform.Microsoft.Blur(pixelRadius="+(blurRadius)+", enabled='true')");
	    		_top = 		yOffset-blurRadius-1;
	    		_left =		xOffset-blurRadius-1;
	    		_width =		$(this).outerWidth()+1;
	    		_height =	$(this).outerHeight()+1;
	    	} else {
	    		_top = 		yOffset;
	    		_left =		xOffset;
	    		_width = 	$(this).outerWidth();
	    		_height = 	$(this).outerHeight();
	    	}
	    	$(div).css({
	    		top: 			_top,
	    		left:			_left,
	    		width:		_width,
	    		height:		_height,
	    		background:	shadowColor,
	    		position:	"absolute",
	    		zIndex:		2
	    	});
	    	
	    });
	};		
})(jQuery);
	
$(document).ready(function(){
    
    $('a').focus(function(){ this.blur();} );
    $(".fotoGalleryFooter").attr("height",$(".fotoGalleryWrap").attr("height"));
    if ($.browser.msie) {
    	$('#boxShadow').boxShadow(  0,   0, 5, "#550219");
    }
    // Photo Gallery
    $('a.gallery').click(function(e){
    	e.preventDefault();
		$('a.gallery').each(function(index){
			//alert(index + ':' + $(this).attr('class'));
			if($(this).hasClass('cur')) $(this).removeClass('cur');
		});
		$(this).addClass('cur');
		newSrc = $(this).attr('href');
    	$('#headerBilder').attr("style","background: url('fileadmin/images/spinner.gif') no-repeat center center");
    	// calulate format factor
    	//var factor = $('#headerBild').attr("width") / $("img", this).attr("width"); 
    	var factor = $('#headerBild').attr("height") / $("img", this).attr("height"); 
    	// getting the new height value
    	//var newHeight = $("img", this).attr("height") * factor;
    	var newWidth = $("img", this).attr("width") * factor;
    	
    	$('#headerBild').fadeOut('slow', function() {
    		$(this).load(function (){
    			$(this).fadeIn();
    			// setting the new height value to the headerBild
    			//$('#headerBild').attr("height",newHeight);
    			// setting the new width value to the headerBild
    			$('#headerBild').attr("width",newWidth);
    		});
    		$(this).attr("src", newSrc);
    	});
    	
    	//$('html, body').scrollTop(0);
    	$('html, body').animate({scrollTop: $('#navigation').offset().top}, 2000);
    	// moving the address to the bottom only if we force the width
    	//$("div.address").attr("style","height:"+newHeight+"px");
    }); 
});
