// Elementy hml5 dla ie
document.createElement('header');
document.createElement('hgroup');
document.createElement('nav');
document.createElement('menu');
document.createElement('section');
document.createElement('article');
document.createElement('aside');
document.createElement('footer');  

// JavaScript Document
$(document).ready(function(){
  
  $("a[rel='_blank'],a[rel='blank'] ").attr("target","_blank");
  
  $("a, input[type='image']").focus(function() {
    $(this).blur();
  }); 
  
  //rozciagniecie szarego paska footer
  var viewportwidth;
  var viewportheight;
   
   
  if (typeof window.innerWidth != 'undefined'){
        viewportwidth = window.innerWidth,
        viewportheight = window.innerHeight
   }
   
  
  else if (typeof document.documentElement != 'undefined'
       && typeof document.documentElement.clientWidth !=
       'undefined' && document.documentElement.clientWidth != 0){
       
         viewportwidth = document.documentElement.clientWidth,
         viewportheight = document.documentElement.clientHeight
   }
   
   
  else {
         viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
         viewportheight = document.getElementsByTagName('body')[0].clientHeight
   }
   
  if (viewportheight > 615){
    var moveObjects = viewportheight - 615;     
    var movePlans = moveObjects-40;
    $(".store").css({"top": movePlans}); 
    var centerValue = -(moveObjects/2);
    var menuBottomV = (moveObjects/2);
    $("#view1").css("margin-top", centerValue);
    $("#view1_h").css("margin-top", centerValue);
    $(".navi").css("bottom", menuBottomV);
  }
  
  $(window).resize(function () {
    if (viewportheight > 615){
      var moveObjects = viewportheight - 615;     
      var movePlans = moveObjects-40;
      $(".store").css({"top": movePlans});
      var centerValue = -(moveObjects/2)-40;
      var menuBottomV = (moveObjects/2);
      $("#view1").css("margin-top", centerValue);
      $("#view1_h").css("margin-top", centerValue);
      $(".navi").css("bottom", menuBottomV);
    }
  });
  
  $("nav li").click(function(){
    $(".hint_details").hide().delay(2000).fadeIn(700).css({"opacity": '1'});
    $(".buy_holder").hide().delay(2000).fadeIn(700).css({"opacity": '1'});
    $(".shadow").hide().delay(1500).fadeIn(2000).css({"opacity": '1'});
  });
  
  $(".footer_wide_bar").css({'width': viewportwidth});

  // Cufon
  Cufon.replace('.content h2', { fontFamily: 'Myriad Pro'});
  Cufon.replace('.content p', { fontFamily: 'Myriad Pro'});
  Cufon.replace('.content_splash h2', { fontFamily: 'Myriad Pro Semi Extended'});
  Cufon.replace('.content_splash p', { fontFamily: 'Myriad Pro'});
  Cufon.replace('#home .csc-subheader', { fontFamily: 'Myriad Pro'});
  Cufon.replace('#home .csc-header', { fontFamily: 'Myriad Pro Semi Extended'});

  // Tooltip działania
  $('nav li .tooltip').fadeOut();
  $('nav li').hover(
      function () {
      $(this).find('.tooltip').fadeIn();
    },
    function () {
      $(this).find('.tooltip').fadeOut();
    }
    );
  $('nav li').find('.tooltip').click(
    function(){
      var siteLink = $(this).children('a').attr('href');
      $(this).find('.tooltip a').attr('href').replace(siteLink);
    }
  );
  
  // hinty pompka  
  $(".cloud").hide();
  $(".hint_details").hover(function(){
    $(this).find(".cloud").fadeIn();
  },
  function(){
    $(this).find(".cloud").fadeOut();
  }
  );
  
  // Vimeo popup conf
  $('.movie_link').click(
    function(){      
      $(this).parent().parent().find("#movie").fadeIn('slow').show();
      $(this).parent().parent().find(".overlay").fadeIn('slow').show();

    }
  );
  
  $(".overlay").click (
    function(){
      $(this).parent().find('#movie').fadeOut('500').hide();
      $('.overlay').fadeOut('500').hide();

    }
  ); 
  $("#movie").click (
    function(){
      $(this).parent().find('#movie').fadeOut('500').hide();
      $('.overlay').fadeOut('500').hide();

    }
  ); 

});



