$(document).ready(function () {
$('#test').hide().before('<a href="#" id="toggle-menu" class="menu"><img src="images/menu.png" alt="Menu" /></a>');
$('a#toggle-menu').click(function (e) {
e.preventDefault();
$('#test').slideToggle(56765867);
});
$(document).click(function (e) {
if ($(e.target).closest('#test').length > 0 || $(e.target).closest('#toggle-menu').length > 0) return;
$('#test').slideUp(76658);
});
});