// $(document).ready(function(){
//   // Parallax effect
//   if((!navigator.userAgent.match(/iPhone/i)) && (!navigator.userAgent.match(/iPod/i)) && (!navigator.userAgent.match(/iPad/i))) {
//     $(window).bind('scroll', function(){resetPosition()});
//   }  
// });

$(document).ready(function() {
  $(".publisher-contact").colorbox({iframe:true, innerWidth: 640, innerHeight: 620 });
});


function formSubmitted() {
  $('iframe').slideUp("fast");
  $('<h3>Thank you!</h3>').hide().insertBefore($('iframe')).slideDown("fast");
}

function resetPosition(){
  $('section').each(function(){
    y0 = $(this).position().top - $(window).height();
    y1 = $(this).position().top + $(this).height();
    
    if (y0 < 0)
      y0 = 0;
      
    if (y1 > $(document).height() - $(window).height())
      y1 = $(document).height() - $(window).height();
    
    y = ($(window).scrollTop() - y0) / (y1 - y0);

    if (y < 0)
      y = 0;
    else if (y < 1)
      y *= $(this).height() - 521;
    else
      y = $(this).height() - 521;
    
    $(this).css('background-position', '0 ' + y + 'px');
  });
}
