/*******************************************************************************
*	jQuery accordion plugin
*	Author: Phillip j Parr - http://wizpip.com
*******************************************************************************/

(function($){
		  
	$.fn.extend({
				
		accordion: function(options) {
			
			var defaults = {
				speed: 1000,
				contentHook: '.content',
				anchorHook: '.anchor'
			}
			
			var options = $.extend(defaults, options);			
		
			return this.each(function() {
				
				var o = options;
				
				var obj = $(this);
				
				$(this).find(o.contentHook).slideUp(0);
				
				$(this).find(o.anchorHook).click(function() {
					if($(this).hasClass('open')) {
						$(this).removeClass('open');
						$(this).parent().find(o.contentHook).slideUp(o.speed);						
						return;
					}
					obj.find(o.anchorHook).removeClass('open');
					obj.find(o.contentHook).slideUp(o.speed);
					$(this).parent().find(o.contentHook).slideDown(o.speed);
					$(this).addClass('open');
				});
				
				
			});
		}
	});
})(jQuery);
