I'm trying to make a menu that collapses using div tags can anyone help me out.

this is the code that I am using:

function switchMenu(obj) {
var el = document.getElementById(obj);
if ( el.style.display != "none" ) {
el.style.display = 'none';
}
else {
el.style.display = '';
}
}


the only problem is the page loads with the menu open. I need it load with the menu collapse. Can anyone help me please???