
jQuery(function () {
var scroll_timer;
var displayed = false;
var top = jQuery(document.body).children(0).position().top;
jQuery(window).scroll(function () {
window.clearTimeout(scroll_timer);
scroll_timer = window.setTimeout(function () {
if(jQuery(window).scrollTop() <= top)
{
displayed = false;
jQuery('#top').fadeOut(500);
}
else if(displayed == false)
{
displayed = true;
jQuery('#top').stop(true, true).show().click(function () { jQuery('#top').fadeOut(500); });
}
}, 400);
});
});

 $(document).ready(function(){
  // defaults
  var st, win = $(window)[0],
   body = $('#fundoDin')[0],
   doc = (jQuery.support.boxModel) ? document.documentElement : document.body,
   wrap = $('body')[0], 
  
   // Set top background image height here
   imgH = 3000; // top image height

  // vertical parallax scroll
  $(win).scroll(function(){
   st = (win.pageYOffset || doc.scrollTop );
   if (st < imgH) { wrap.style.backgroundPosition = 'left ' + (st/4) + 'px'; } // limit moving top image only when in view
   body.style.backgroundPosition = 'right ' + ( imgH + st/4) + 'px';
  });

 });



$(document).ready(function() {

$('#top').click(function() {
      $('html,body').animate({scrollTop: $('#chamada').offset().top}, 3000);
});

$('#mobile').click(function() {
      $('html,body').animate({scrollTop: $('#toMobile').offset().top}, 3000);
});

$('#web').click(function() {
      $('html,body').animate({scrollTop: $('#toWeb').offset().top}, 3000);
});

$('#motion').click(function() {
      $('html,body').animate({scrollTop: $('#toMotion').offset().top}, 3000);
});

$('#contato').click(function() {
      $('html,body').animate({scrollTop: $('#footer').offset().top}, 4000);
});

})


