jQuery.noConflict();

(function($) {

$(function() {
	
	var ie6 = $.browser.msie && $.browser.version.substr(0,1) < 7;
	var subfolder = window.subfolder || 0;
	
	var speed = 300;
	var bgRegex = /[a-zA-Z]*\.png/;
	
	$("#navi a").not(".active").each(function() {
		var that = $(this);
		
		if(!ie6) {
			var bgImage = that.css("background-image").match(bgRegex);
			var src = "images/navi/"+bgImage;
			if(subfolder) {
				for(var i=0; i<subfolder; i++)
					src = "../" + src;
			}
			
			that
				.css({ overflow: "hidden" })
				.append("<img>")
				.find("img")
				.attr({
					  "src": src,
					  "alt": that.text()
				})
				.css({ position: "absolute", top: that.height()+"px", left: "0" })
				.end()
				.hover(
					function() {
						$(this)
							.css({"z-index": 40})
							.find("img")
							.stop()
							.animate( {top: "0px"}, {duration: speed});
					},
					function() {
						var $this = $(this);
						
						$this
							.find("img")
							.stop()
							.animate( {top: that.height()+"px"}, {duration: speed, complete: function() {
								$this.css({"z-index": 10})
							}} );
					}
				);
		}
		else { // == IE6
			that.hover(
				function() {
					$(this).addClass("over");
				},
				function() {
					$(this).removeClass("over");
				}
			);
		}
		
	});
});
})(jQuery);