function scrollPage(_val, _id, _speed, _callback){
    if(!_speed) _speed = 600;

    if($.browser.webkit){
        $('body').animate({scrollTop: _val}, _speed, function() {
            // Animation complete.
            if(_id) setHash(_id);
            $('body').scrollTop(_val);
            if(_callback) _callback.call();
       });
    }else{
        $('html,body').animate({scrollTop: _val}, _speed, function() {
            // Animation complete.
            setHash(_id);
            $('html,body').scrollTop(_val);
            if(_callback) _callback.call();
         });
    }
}

function setHash(str){
      window.location.hash = str;
}

function initAnchorLinks(){

    //Anchor Links
    $('#billboard a').data('scrollTarget',  $('#bio'));

    $('#billboard a').each(function(idx, el){
        $(el).bind( 'click', function(e){

            e.preventDefault();

            var val = $(this).data('scrollTarget').offset().top;
            var id = $(this).data('scrollTarget').attr("id");
            scrollPage(val, id);

        });
    });

    //Scroll to top buttons
    $('.backtotop').click(function(e){
        e.preventDefault();
        scrollPage(0, "");

        return false;
    });

}

jQuery(document).ready(function($){
	
	initAnchorLinks();
	
	$('#billboard-subForm label').inFieldLabels();
	$('#footer-subForm label').inFieldLabels();
	
	$('#billboard-subForm').validate();
	$('#footer-subForm').validate();
			
});
