// SeViR Simple Horizontal Accordion @2007
// http://letmehaveblog.blogspot.com
// http://letmehaveblog.blogspot.com/2007/10/haccordion-simple-horizontal-accordion.html
jQuery.fn.extend({
haccordion: function(params){
var jQ = jQuery;
var params = jQ.extend({
	speed: 500,
	headerclass: "title",
	contentclass: "content",
	contentwidth: 680,
	openone:0
	},params);
	return this.each(function(index){
		jQ("."+params.headerclass,this).each(function(index){
			if(index == params.openone){
				var p = jQ(this).parent()[0];
				p.opened = this;
				// per scambiare l'aspetto del tasto
				$(this).addClass("active");
				jQ(this).next("div."+params.contentclass).animate({
				width: params.contentwidth + "px"
				}, params.speed);
			}
			}).click(function(){
			var p = jQ(this).parent()[0];
			// per non far cliccare quello gia' aperto
			if (p.opened == this) return;
			if (p.opened != "undefined"){
				// per scambiare l'aspetto del tasto
				$(p.opened).removeClass("active");
				jQ(p.opened).next("div."+params.contentclass).animate({
				width: "0px"
				},params.speed);
			} 
			p.opened = this;
			$(this).addClass("active");
			jQ(this).next("div."+params.contentclass).animate({
				width: params.contentwidth + "px"
				}, params.speed);
			});
		});
	}
}); 