$.extend($.easing, {
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
    easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	}
});

$.fn.MenuSlider = function(position) {
	//var _positions = ["0px","78px","163px","243px"];
	return $(this).each(function(i) {
		$this = $(this);
		_this = this;
		var _position = position;
		var _href = $this.attr("href");
		$this.click(function() {
			$("div#MainSlider").animate({left: _position}, 150, "easeInCirc", function() {
				document.location.href = _href;
			});
			return false;
		});
	});
};

$.fn.logofy = function() {
    $(this).each(function() {
        var $this = $(this);
        
        var img = $this.children("img").attr("src");
        if(img) {
            var desaturated = $(document.createElement("div")).css({
                position: "absolute",
                left: "0px",
                top: "0px",
                background: "url("+img+") 0px 0px",
                width: "100%",
                height: "100%"
            });
            var normal = $(document.createElement("div")).css({
                position: "absolute",
                left: "0px",
                top: "0px",
                background: "url("+img+") 0px -100px",
                width: "100%",
                height: "100%",
                display: "none"
            });
            
            $this.html("");
            $this.append(desaturated);
            $this.append(normal);
            
            $this.hover(
            function() {
    			if($.browser.msie || true) {
    				normal.css({display: "block"});
    				desaturated.css({display: "none"});
    			}
    			else {
    				if(normal.is(':animated')) {
    					normal.stop().fadeTo(200, 1);
    				} else {
    					normal.fadeTo(200, 1);
    				}	
    			}
            },             
            function() {
    			if($.browser.msie || true) {
    				desaturated.css({display: "block"});	
    				normal.css({display: "none"});
    			}
    			else  {
    				if (normal.is(':animated')) {
    					normal.stop().fadeTo(200, 0);
    				} else {
    					normal.fadeOut(200);
    				}	
    			}
            })
        }
    });             
};
