var promotionLabel = {
  init: function()
  {
    var self = this;
    self.promotionLabel = $('#promotion-label');

    if(self.promotionLabel.length)
    {
      self.promotionOverlay = $('#promotion-overlay');

      // Set cookie to prevent that the slider opens each visit
      if (!readCookie('mobile_app_promotion'))
      {
        self.promotionLabel.toggleClass('active');
        self.promotionOverlay.toggleClass('active');
        createCookie('mobile_app_promotion',1,31);
      }

      $('.label', self.promotionLabel)
        .click(function(e){
          e.preventDefault();
          self.togglePromotionLabel();
        });
      self.promotionOverlay.click(function(){
        self.togglePromotionLabel();
      });
    }
  },
  
  togglePromotionLabel: function()
  {
    var self = this;
    
    self.promotionLabel.toggleClass('active');
    self.promotionOverlay.toggleClass('active');
    
    if(self.promotionLabel.hasClass('active'))
    {
      $('iframe').css({
        'visibility': 'hidden',
        'opacity': '0',
        'filter': 'alpha(opacity = 0)'
      });
    }
    else
    {
      $('iframe').css({
        'visibility': 'visible',
        'display': 'block',
        'opacity': '100',
        'filter': 'alpha(opacity = 100)'
      });
    }
  }
}

$(document).ready(function(){

  _ga.trackSocial(window.location);

  if(subscriptionOptionChoice){
    subscriptionOptionChoice.init();
  }
  if (postalcode)
  {
    postalcode.init();
  }

  $('#subscriptions').find('li').fhHover();
  promotionLabel.init();
});


