$(document).ready(function(){

	$("body").addClass("js");

	// per posicionar la icona d'event dins el td creem un altre element
	$("#cal td.event").wrapInner("<span></span>");

	// Menú desplegable
	$(".menudesp").bind('click', function (e) {
		e.preventDefault(); // necesario para poder también poner el href en el enlace para la accesibilidad  
		$(this).next().slideToggle();
		$(".menudesp").not(this).next().slideUp();
	});

	// Desplegables Facebook/Twitter
	$(".shownet").bind('click', function (e) {	  
		if ($(this).parent().next().is(':visible')) {
			$(".shownet").attr("title","Amagar");
			if ($(this).children().attr("class") == "amagar") {
				$(".shownet").children().attr("class","amagar");
				$(this).children().attr("class","mostrar");
			} else if ($(this).children().attr("class") == "mostrar") { 
				$(".shownet").children().attr("class","mostrar");
				$(this).children().attr("class","amagar");
			}
			$(this).attr("title","Mostrar");
		} else {
			$(".shownet").attr("title","Mostrar");
			if ($(this).children().attr("class") == "mostrar") {
				$(".shownet").children().attr("class","mostrar");
				$(this).children().attr("class","amagar");
			} else if ($(this).children().attr("class") == "amagar") { 
				$(".shownet").children().attr("class","amagar");
				$(this).children().attr("class","mostrar");
			}
			$(this).attr("title","Amagar");
		}	  
		$(".shownet").parent().next().slideToggle();
		return(false);
    });
	
});
