<div id="menu_1" style="background-color: #252525;color:lime;">Menu
<div id="category_1" style="display:none;padding: 6px; background-color: yellow;">
<div>odin</div>
<div>dva</div>
</div></div>
<script>
t = document.getElementById("menu_1");
t2 = document.getElementById("category_1");
window.onclick = function(e){
var target = (e=e||window.event).target || e.srcElement;
if( target == t ){ if( t2.style.display == 'none' ) t2.style.display = 'block';
} else {
if( t2.style.display !== 'none' && target == document.body) t2.style.display = 'none';
}
}
</script>
.