(function($) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery)
jQuery.preLoadImages("./images/menu-spot.png", "./images/srafabila.png");
$(document).ready(function() {
  $('#text').jScrollPane({
    showArrows: true
  });
  center();
  $('input[name="contactForm[name]"]').focus(function(){
    if ($(this).val() == 'jméno a příjmení'){
      $(this).val('');
    }
  });
  $('input[name="contactForm[email]"]').focus(function(){
    if ($(this).val() == 'e-mail'){
      $(this).val('');
    }
  });
  $('textarea[name="contactForm[message]"]').focus(function(){
    if ($(this).val() == 'váš vzkaz nebo dotaz'){
      $(this).val('');
    }
  });

  if($('.contact_form .ok').length == 0){
    $('.contact_form form').show();
  }
  
  $('.again').click(function(){
    $('.contact_form .notice').hide();
    $('.contact_form form').show();
  })
});
function center(){
  var width = $(window).width();
  $('#footer').css('left',((width - $('#footer').width())/2)+'px');
  $('.jScrollPaneContainer').css('left',(width - 720) / 2+'px');
  $('#contact').css('left',((width-720)/2)+520+'px');
  $('#menu').css('left',((width - 720)/2)-247+'px');

}
$(window).resize(function() {
  center();
});

$(window).change(function(){
  alert('Okno');
});