(function (jQuery) {
	var children;
	var current;
	jQuery.fn.bulletAccordion = function () {
		children = $(this).children(".item");
		for ( var i = 0, len = children.length; i < len; i++ ) {
			$(children[i]).attr("id", "bullet-"+i);
			//hide all;
			var child = $(children[i]);
			child.click (itemClickHandler);
			child.data ({previousHeight:$("div#" + child.attr("id") + " div.expandedContent").height()});
			
			
			$("div#" + child.attr("id") + " div.expandedContent")
				.css ({
					height:0
				});
		}
	}
	function collapseAllBullets () { 
		for ( var i = 0, len = children.length; i < len; i++ ) {
			var child = $(children[i]);
			var b = $("div#"+child.attr("id") + " div.bullet");
			b.removeClass("expanded").addClass("collapsed");
		}
	}
	function itemClickHandler () { 
		collapseAllBullets();
		var child = $(this);
		if (current) { 
			current
				.animate({
						height:0
					}, {
						duration:600,
						easing:"easeInOutQuint"
					})
		}
		current = $("div#" + child.attr("id") + " div.expandedContent")
			.animate({
				height:74
			},{
				duration:600,
				easing:"easeInOutQuint"
			});
			
		var b = $("div#"+child.attr("id") + " div.bullet");
		b.removeClass("collapsed").addClass("expanded");
	}
})(jQuery);
