
var jq=jQuery.noConflict();

jq(document).ready(function($){

	
	var tree=$("#tmp_Shopping_botoneraLateral[instance='126']");

	tree.hide();
	
	tree.find('li.tree_item>ul.tree').hide();
	
	var parentsLi=tree.find('li.tree_item:has(ul.tree)').addClass('closed');
	var childrenLi=tree.find('li.tree_item:not(:has(ul.tree))');
	
	//si se quiere decir desde codigo la indentacion
	//$('li>ul').css('padding-left','20px');
	
	
	//ie hack para last-child
	$('ul>li:last-child').css('margin-bottom','0');
	
	//efecto de opacidad en el hover
	/*$('.tree_item').hover(
			function(){
				$(this).stop(true,true).animate({'opacity':'1.0'},500);
			},function(){
				$(this).stop(true,true).animate({'opacity':'0.8'},400);
			}
	);*/
	

	
	
		parentsLi.each(function(){
		    
		    var li=$(this);
		    
		    li.find('div.tree_item_content:first,  span.tree_item_icon:first').click(function(){
		    	
		        li.toggleClass('opened').toggleClass('closed');
		        li.find('ul.tree:first').slideToggle('fast');
		    });
	
		    
		});

	
	//abre el menu con etiqueta <a href> que coincide con el enlace de la web	
	tree.find('a[href="'+window.location.pathname+'"]').parents('li.tree_item').addClass('selected').children('div.tree_item_content').addClass('selected').click().prev('span.tree_item_icon').addClass('selected');
	tree.find('a[href="'+window.location.href+'"]').parents('li.tree_item').addClass('selected').children('div.tree_item_content').addClass('selected').click().prev('span.tree_item_icon').addClass('selected');

	//tree.show();
	
			
	
	
	tree.fadeIn(1950);

});

