jQuery.fn.haccordion = function(settings) {
	settings = jQuery.extend({	
		speed: 400,
		start: 1,
		minWidth: 0,
		maxWidth: 0
	}, settings);
	
	$.fx.step.syncWidth = function(fx){   
	    if(!fx.state) {
		var o = fx.options;
		fx.start = fx.now = $(fx.elem).width();
		fx.oElem = o.syncElement;
	    } 
	    var syncedWidth = Math.round(fx.pos*(fx.end-fx.start));
	    
	    fx.elem.style.width = (syncedWidth+fx.start)+fx.unit;
	    fx.oElem.style.width = (540-syncedWidth)+fx.unit;
	};  
	
	var elem = $(this);
	var items = elem.find('li');
	var count = items.size();
	var current = items[0];
	
	if(settings.start < count) {
	    current = items[settings.start];
	}
	
	$(current).addClass('active');
	$(current).css('width', settings.maxWidth+"px");
	
	$(items).each(function() {
	    var item = this;
	    $(item).find('img:first').bind('mouseover', function() {
		if($(item).hasClass('active')) {
		    return false;
		}
		$(this).css('cursor', 'pointer');
	    });
	    $(item).find('img:first').bind('click', function() {
		if($(item).hasClass('active')) {
		    return false;
		}
		var tmp = current;
		current = item;	  
		$(tmp).removeClass('active');
		$(item).addClass('active');
		$(item).animate({syncWidth: settings.maxWidth+"px"}, {queue: false, duration:settings.speed, syncElement: tmp, minWidth: settings.minWidth+"px"});
		$(this).css('cursor', 'auto');
		return false;
	    });
	});
	
} 

