1. I have received an error from debugger like: Object doesn't support this property or method
Which object defines working scroll as removed nav will not work scroll but even I put nav it will report
Object doesn't support this property or method

2. Where to put jQuery ad not $ in the correct way?
Lines:
PHP Code:

           
$('nav ul li a').click(function(){
              var 
el = $(this).attr('href');
              var 
elWrapped = $(el);

              
scrollToDiv(elWrapped,40);

              return 
false;
            }); 
Javascript is the following:
PHP Code:

<script language "javascript" type "text/javascript" charset="utf-8">
            
jQuery(document).ready(function() {
            function 
scrollToDiv(element,navheight){
              var 
offset element.offset();
              var 
offsetTop offset.top;
              var 
totalScroll offsetTop-navheight;

              $(
'body,html').animate({
                      
scrollToptotalScroll
              
}, 500);
            }
            
jQuery('nav ul li a').click(function(){
              var 
el = $(this).attr('href');
              var 
elWrapped = $(el);

              
scrollToDiv(elWrapped,40);

              return 
false;
            });
            } );
</script>