﻿// SeViR Simple Horizontal Accordion @2007
// http://letmehaveblog.blogspot.com
jQuery.fn.extend({
	haccordion: function(params){
		var params = $.extend({
			speed: 500,
			slowSpeed: 2500,
			headerclass: "contentLeft",
			contentclass: "contentRight",
			contentwidth: 240,
			opend: null
		},params);

		$($(this).children().get(1)).animate({
			width: params.contentwidth + "px"
		}, params.speed);
		params.opened = $(this).children().get(0);

		return this.each(function(e){
			$("."+params.headerclass,this).mouseover(function(e){
				var shift = e.shiftKey;
			
				if (params.opened == "undefined" || params.opened != "undefined" && params.opened != this) {
					var p = $(this).parent()[0];
					if (params.opened != "undefined"){
						$(params.opened).next("div."+params.contentclass).find(".more").hide();
						$(params.opened).next("div."+params.contentclass).animate({
							width: "0px"
						},shift?params.slowSpeed:params.speed);
					}
					params.opened = this;
					$(this).next("div."+params.contentclass).find(".more").hide();
					$(this).next("div."+params.contentclass).animate({
						width: params.contentwidth + "px"
					},shift?params.slowSpeed:params.speed,null, function(){$(params.opened).next("div."+params.contentclass).find(".more").fadeIn(shift ? 500 : 100);});
				}
			});
		});
	}
});