

/**
 * ------------------------------------------
 * popup banner + popupy s nabidkou partneru
 * ------------------------------------------ 
 */ 

function showPopupBanner()
{  
   var oH = Element.getHeight(document.body);
   var vpH = document.viewport.getHeight();
   var cH = document.documentElement.clientHeight;
   
   var sH = 0;
   if (oH > vpH) {
      sH = oH;
   } else {
      sH = vpH;
   }
   
   $('shader').setStyle({height: sH+'px'});
   new Effect.Appear('shader', {duration: 0.5, to: 0.5});
   
   var popup = $('popupBanner');
   //var baseHeight = popup.getHeight();
   var baseWidth = popup.getWidth();
   pos_x = (document.documentElement.clientWidth-baseWidth)/2;
   
   popup.setStyle({
      position: 'absolute',
      left: pos_x+'px',
      top: 0
   });
   
   new Effect.Appear(popup, {duration: 0.5});
   setTimeout("hidePopup('popupBanner')", 10000);
}

function hidePopup(el)
{
   $(el).hide();
   $('shader').hide();
}

function showPartnerOfferPopup(elId)
{
   var pScroll = document.viewport.getScrollOffsets().top;
   
   var oH = Element.getHeight(document.body);
   var vpH = document.viewport.getHeight();
   var cH = document.documentElement.clientHeight;
   
   var sH = 0;
   if (oH > vpH) {
      sH = oH;
   } else {
      sH = vpH;
   }
   
   $('shader').setStyle({height: sH+'px'});
   new Effect.Appear('shader', {duration: 0.5, to: 0.5});
   
   var popup = $(elId);
   
   //var pIf = $$('div#popupPartnerOffer iframe')[0];
   var pIf = popup.down('iframe');
   iH = pIf.height;
   iW = pIf.width;
   
   if (iH < vpH) {
      //opera vraci velikost viewportu chybne jako velikost body, proto pouziju clientHeight
      if (vpH != cH) {
         iH = cH - 55;
      } else {
         iH = vpH - 55;
      }
      pIf.setStyle({height: iH+'px'});
      //pIf.style.height = iH+'px';
   }
   
   var pW = iW;
   var pH = iH*1 + 15;
   pW = pW+'px';
   pH = pH+'px';
   
   popup.setStyle({
      position: 'absolute',
      width: pW,
      height: pH
   });
   
   var baseHeight = popup.getHeight();
   var baseWidth = popup.getWidth();
   var pos_x = (document.documentElement.clientWidth-baseWidth)/2;
   var pos_y = pScroll + 20;
   
   popup.setStyle({
      left: pos_x+'px',
      top: pos_y+'px'
   });
   
   new Effect.Appear(popup, {duration: 0.5});
}

function showPartnerOffer(iframeEl)
{
   $(iframeEl).previous('.popup-loading').hide();
   $(iframeEl).show();
}

function updatePartnerOfferStats(offerId)
{
   var url = startUrl+'public-ajax/partneroffer/?offerId='+offerId;
   new Ajax.Request(url, {
      method: 'get',
      onSuccess: function(transport) {
      }
   });
}

