function repairBanner(){
  height = document.getElementById('header').offsetHeight;
  if (height>200){
    document.getElementById('header').style.paddingBottom = 23;
  }
}

function myFacebookInitLikeBox(link){
    window.fbAsyncInit = function() {
      FB.init({appId: 162567887088541,
               status: true,
               cookie: true,
               xfbml: true});
    };
    (function() {
      var e = document.createElement('script');e.async = true;
      e.src = document.location.protocol +
        '//connect.facebook.net/cs_CZ/all.js';
      document.getElementById('fb-root').appendChild(e);
    }());

    document.write('<fb:fan profile_id="192812115813" stream="0" connections="12" height="350" width="190" css="'+link+'/css/facebook4.css"></fb:fan>');
}

function myFacebookInitLikeCreation(){                 
  document.write('<fb:like send="true" layout="button_count"  show_faces="false" action="recommend" font="verdana" ></fb:like>');
}

function myFacebookInitLikePage(link){                 
  document.write('<fb:fan profile_id="192812115813" stream="0" connections="0" height="32" width="388" css="'+link+'/css/facebook17.css"></fb:fan>');
}

/**
 * Add previews to thumbs
 */
function drawPreviewTooltips(){
  $(".previewImage").tooltip({
    top: 10,
    left: 10,
    delay: 300,
    showURL: false,
    bodyHandler: function() {
      return $("<img/>").attr("src", this.src.substr(0,this.src.length-4)+'.large.'+this.src.substr(this.src.length-3));
    }
  });
 }

$(function(){

/**
 * hide "no-java-script" elements
 */
  document.getElementById('noJs1').style.display = 'none';
  document.getElementById('noJs2').style.display = 'none';
  //if (document.getElementById('btnList')){
  //  document.getElementById('btnList').style.display = 'none';
 // }

  //element details
  if (document.getElementById('phonesList')){
    document.getElementById('phonesList').style.display = 'none';
  }

  /**
   * Add tooltips to icons
   */
  $(".icons img").tooltip({
    top: -95,
    left: -75,
    delay: 300,
    showURL: false,
    bodyHandler: function() {
      return $("<img/>").attr("src", this.src.substr(0, this.src.length - 4) + "-big." + this.src.substr(this.src.length - 3, this.src.length ));
    }
  });

  drawPreviewTooltips();

  repairBanner();

  /**
   * Init player
   */

  myPlayer = new MyPlayer();
  myPlayer.init();

  /**
   * Get selected phone values
   */

  myPhones = new MyPhones();
  myPhones.init();


});
