Without further looking into it I notice a syntax error:
Code:
$('div#nav ul li ul').hide();;
There is one semicolon too much.
For everything else we need to see more of your site – a link to a live example would be good. Alternatively there are sites like
http://jsbin.com/, for example, where you can test your code and show it to others.