Replaced line 82 of the file class-gallery.php with this code
$r.="jQuery(document).ready(function() { if(jQuery('#slider').length > 0) { jQuery('#slider').s3Slider({ timeOut: 3000 }); } });";
Fixed the problem.
I checked there is no element #slider in the page. I think this is the problem. But how can i know why this script is generating in the page.
I got the error, the generated script on line 63 is trying to access an element #slider, which does not exists on the page, so why its id is not accessible. But i can not found which plugin is generating this script in header.