I would suggest to create a separate class for selected item(you could copy the existing ui-state-active and rename it to something like selected) and then:.
$("#menu").find("a").click(function(){
$("#menu").find("a").removeClass("selected");//remove if something was selected
$(this).addClass("selected");//add a selected class
});
hope that helps