Working Demo: http://jsfiddle.net/fedmich/P69sL/
Try this, add your code on the start_count... then make sure to add a boolean to run your code only once.
$(function() {
var oTop = $('#counter').offset().top - window.innerHeight;
$(window).scroll(function(){
var pTop = $('body').scrollTop();
console.log( pTop + ' - ' + oTop ); //just for your debugging
if( pTop > oTop ){
start_count();
}
});
});
function start_count(){
alert('start_count');
//Add your code here
}