function imageMenu()
{
	var self = this;
	
	this.build = function(selectMenu,selectElem,extendWidth,selectAppearOnMouseup)
	{
		self.menu = $(selectMenu)
		self.elems = $(selectElem,$(selectMenu));
		self.selectAppearOnMouseup = selectAppearOnMouseup;
		self.menuWidth = self.menu.width();
		self.extendWidth = extendWidth;
		self.elems.mousedown(self.rollHover,self.rollOut);
		
		$(self.selectAppearOnMouseup,self.elems).animate({'opacity':1},'fast');

		self.menu.css('position','relative');
		self.menu.append('<div style="position:absolute;height:'+$(selectMenu).height()+'px;width:'+($(selectMenu).width()*2)+'px;clip: rect(0px '+$(selectMenu).width()+'px '+$(selectMenu).height()+'px 0px);" class="imageMenuContainer"></div>');
		self.elems.appendTo($('.imageMenuContainer',self.menu));
		
		self.elems.eq(self.elems.length-1).width(self.menuWidth);
		self.elems = self.elems.lt(self.elems.length-1)
	}
	
	this.rollHover = function()
	{
		var menuWidth = 28;//self.menuWidth;
		var singleWidth = 100;//Math.floor(menuWidth/(self.elems.length+1));

		var outWidth = 28;//Math.floor((menuWidth-(singleWidth+self.extendWidth))/(self.elems.length));
		var hoverWidth = 165;//menuWidth - outWidth * (self.elems.length);

		$(this).removeClass('out');

		$(self.selectAppearOnMouseup,self.elems).stopAll();
		$(self.selectAppearOnMouseup,self.elems).animate({'opacity':1},'fast');

		$(self.selectAppearOnMouseup,this).stopAll();
		$(self.selectAppearOnMouseup,this).animate({'opacity':1},'fast');

		self.elems.stopAll();
		$(self.elems).animate({'height':outWidth},'fast');
		$(this).stopAll();
		$(this).animate({'height':hoverWidth},'fast');
	}
	
	this.rollOut = function()
	{
		var menuWidth = self.menu.width();
		var singleWidth = 28;//Math.floor(menuWidth-(self.elems.length+1));
		
		$(this).addClass('out');

		$(self.selectAppearOnMouseup,this).stopAll();
		$(self.selectAppearOnMouseup,this).animate({'opacity':1},'fast');
		
		self.elems.stopAll();
		self.elems.animate({'height':singleWidth},'fast');
	}
}

// Small part of code from Interface (http://interface.eyecon.ro/)
jQuery.fn.extend({
	stopAll : function(step) {
		return this.each(function(){
			if (this.animationHandler)
				jQuery.stopAnim(this, step);
			if ( this.queue && this.queue['fx'] )
				this.queue.fx = [];
		});
	}
});

jQuery.extend({
	stopAnim: function(elem, step)
	{
		if (step)
			elem.animationHandler.startTime -= 100000000;
		else {
			window.clearInterval(elem.animationHandler.timer);
			elem.animationHandler = null;
			jQuery.dequeue(elem, "fx");
		}
	}
});