(function($){
	$.fn.hAccordion = function(settings) {
		var settings = $.extend({
			defaultOpen: 1,
			totalWidth: 770,
			titleWidth: 37,
			speed: "normal",
			nowCassName: "nowHAccordion"
		},settings);
		var hAccordionBlock=$(this);
		var defaultOpen=settings.defaultOpen;
		var totalWidth=settings.totalWidth;
		var titleWidth=settings.titleWidth;
		var speed=settings.speed;
		var nowCassName=settings.nowCassName;
		var amount=hAccordionBlock.find(".hAccordionTitle").size();
		var ctWidth=totalWidth-(amount*titleWidth);
		hAccordionBlock.width(totalWidth);
		hAccordionBlock.find(".hAccordionCTMask:last-child").width(ctWidth);
		hAccordionBlock.find(".hAccordionTitle").each(function(i){
			$(this).width(titleWidth);
			$(this).data("n", (i+1));
			$(this).click(function(){
				switchHAccordion($(this).data("n"));
			});
		});
		function switchHAccordion(w){
			hAccordionBlock.find(".hAccordionTitle").each(function(i){
				if((i+1)==w){
					$(this).addClass(nowCassName);
				}else{
					$(this).removeClass(nowCassName);
				}
			});
			hAccordionBlock.find(".hAccordionCTMask").each(function(i){
				$(this).animate({width:((i+1)==w? ctWidth : 0)+"px"}, {duration:speed, queue:false});
			});	
		}
		switchHAccordion(defaultOpen);
	};
})(jQuery);