/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

$(document).ready(function(){

	jQuery.fn.fadeToggle = function(speed, easing, callback) {
		return this.animate({
			opacity: 'toggle'
		}, speed, easing, callback);
	};
 
	$('.menuItem').click(function(e)
	{

		e.stopPropagation();
		$('.menuItem').next().slideUp();
		$(e.target).next().slideDown();
	});

	$('.subMenuItem, .aba').click(function(e)
	{
		e.stopPropagation();
		e.preventDefault(); 
		if($('.produtoItens', $(e.target).closest('.item')).attr('ref') != 'aberta')
		{
			$('.produtoItens',$(e.target).closest('.container')).slideUp();  
			$('.produtoItens',$(e.target).closest('.container')).attr('ref', 'fechado');
			$('.produtoItens', $(e.target).closest('.item')).slideDown();
			$('.produtoItens', $(e.target).closest('.item')).attr('ref', 'aberta');
		}

	});
	$('.subMenuItem:first').click();
	$('.menuItem:gt(0)').each(function(){
		$(this).next().hide();
	});
	$('.produtoItens').each(function(){
		$(this).hide();
	});

});

