вдруг кому то понадобится ...
<script type="text/javascript">
window.onscroll = function() {
var scrolled = window.pageYOffset || document.documentElement.scrollTop;
var elem = document.getElementById('idtopmenu');
if (scrolled>65){ elem.className = "topmenu2";}
else{elem.className = " topmenu"; }
}
</script>