var vermas = "pics/vermas.png";
var ocultar = "pics/ocultar.png"

jQuery(document).ready(function() {
	
	jQuery("#lista_menu li[ul]").each(function() {
		var t = false;		
		jQuery("a",this).each(function() {
			if (jQuery(this).attr("href")==document.location.href) {
				jQuery(this).css("font-weight","bold");
				t=true;
			} 
		});
		
		if (!t) jQuery("ul:first",this).hide();
				
		jQuery(this).prepend("<img style=\"float:right;\" src=\""+((t)? ocultar:vermas)+"\" alt=\"+\" />");

		var fShow = function() {
			jQuery(this).fadeTo("slow",0.3,function() {jQuery(this).attr("src",ocultar).attr("alt","-").fadeTo("slow",1);});
			jQuery(this).siblings("ul:first").animate({
					height: 'show',  
					width: 'show',
  					opacity: 'show'
			}, 1600, "easeout");
		};
		var fHide = function() {
			jQuery(this).fadeTo("slow",0.3,function() {jQuery(this).attr("src",vermas).attr("alt","+").fadeTo("slow",1);});
			jQuery(this).siblings("ul:first").animate({
  				height: 'hide',
				width: 'hide',  				
  				opacity: 'hide'  				
				}, 1000, "easeout");
		};
		jQuery("img:first",this).toggle(((t)? fHide:fShow),((t)? fShow:fHide)).css("cursor","pointer");
		
	});

});
