(function($) {

$.fn.mthover = function(options) {

var defaults = {
	startPos: '-40px',
	startBgColor: '#696969',
	endBgColor: '#f47321',
    time: 250,
    delay: 300,
    pop: '.teaser' //selector or element to show when this is hovered over
	};
var itemCount = this.length;
var s = $.extend(defaults, options);    

return this.each(function(i) {
    var hideDelayTimer = false,
        beingShown = false,
        shown = false;
	var $obj = $(this);
    $(this).mouseover(function() {
        if (hideDelayTimer)
            clearTimeout(hideDelayTimer);
            
        if (beingShown || shown) {
            return;
        } else {
            beingShown = true;
            
            var doneMouseOver = function() {
                beingShown = false;
                shown = true
            };
            
            $(s.pop, $obj)
                .show()
                .css({position: "absolute",
                      left: 0,
					  width: itemCount * $(this).width()})
                .animate({bottom: '0',backgroundColor: s.endBgColor}, s.time, 'swing', doneMouseOver)
				.addClass('on');
        }
        
    }).mouseout(function() {
        if (hideDelayTimer)
            clearTimeout(hideDelayTimer);

        var doneMouseOut = function() {
            shown = false;
            $(s.pop, $obj).removeClass('on');
        };                    
        
        hideDelayTimer = setTimeout(function() {
            hideDelayTimer = false;
            $(s.pop, $obj).animate({bottom:s.startPos, backgroundColor:s.startBgColor}, s.time, 'swing', doneMouseOut)
        }, s.delay);

    });
});

};

})(jQuery);