// Code By Mark Leetch - Wakeuphate.com
$(document).ready(function(){
  $('.tooltip').delay(3500).fadeOut('slow');
  $('.notify').delay(3500).slideUp('slow');

  var mailcheck = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
  $('.contact-form input[type="submit"]').click(function(){
    var errors = false;
    $('.error').removeClass('error');
    $('.contact-form input, .contact-form textarea').not('.contact-form .cap').each(function(){
      if($(this).val() == ''){
        $(this).addClass('error');
        errors = true;
      } else if ($(this).hasClass('email')){
        if(!mailcheck.test($('.email').val())){ 
          $('.email').addClass('error');
          errors = true;
          return false;
        }
      }
    });
    if(!errors) {
      $('.contact-form').submit();
    }
    return false;
  });
  
  // iOS only
  var deviceAgent = navigator.userAgent.toLowerCase();
  var agentID = deviceAgent.match(/(iphone|ipod)/);
  if (agentID) {
    // Fix position fixed
    function changeFooterPosition() {   
      $('.navigation').css('top', window.innerHeight + window.scrollY - 75 + "px");
    }
    $(document).bind('scroll', function() {
      changeFooterPosition();
    }); 
  }
});
$(window).load(function(){
  $('.wuh-slider ul').hoverscroll();
});
