/*

	jQuery Accordions v1.1	
	Copyright 2010 por Pedro Magalhães	
	
	web: http://www.webgrafismo.com
	email: webgrafismo@gmail.com	
	Gratuito para uso não comercial

*/


(function($){
		  
	$.fn.jQueryAccordions = function(options) {

		var defaults = {
			topclass: 		".mod_links_top", 
			contentclass:   ".mod_links_content", 
			footerclass:    ".mod_links_footer", 
			parentclass:    ".parent", 
			childrenclass:  ".children", 
			showclass:      ".show_link",			
			hideclass:      ".hide_link", 
			speedfx:		400			
		};
		
		var options = $.extend(defaults, options);								
		
		obj = $(this);		
		
		var showclass = $(options.showclass, obj);
		var hideclass = $(options.hideclass, obj);			
		var topclass = $(options.topclass, obj);						
		var contentclass = $(options.contentclass, obj);									
		var footerclass = $(options.footerclass, obj);												
		var parentclass = $(options.parentclass, obj);															
		var childrenclass = $(options.childrenclass, obj);																		
		var speedfx = $(options.speedfx, obj);																					
		
		contentclass.find("ul li.parent:gt(2), ul li.parent li").hide();
		
		$(options.parentclass +	"> a").attr("href", "javascript:void(0)");				   					
		
		topclass.click(function () {
								 
			$(this).toggleClass("open").parent().find(options.contentclass,options.footerclass).slideToggle(options.speedfx);									
			$(this).parent().find(options.footerclass).slideToggle(options.speedfx);	
			
		});		
		
		childrenclass.click(function () {
									  
			$(this).toggleClass("open").parent().children().find("li:gt(1)").slideToggle(options.speedfx);		
			
		});	
		
		showclass.click(function () {
								  
			$(this).parent().prev().find("ul li.parent:gt(2)").slideToggle(options.speedfx);				
			$(this).parent().children(options.showclass).hide();
			$(this).parent().children(options.hideclass).show();
			
		});	
		
		hideclass.click(function () {
								  
			$(this).parent().prev().find("ul li.parent:gt(2)").slideToggle(options.speedfx);
			$(this).parent().children(options.hideclass).hide();
			$(this).parent().children(options.showclass).show();
			
		});
		
	};

})(jQuery);
