
// Copyright (C) 2008 Przemysław Wądołowski

$(document).ready(initOnReady);

onload = initOnLoad;

function initOnLoad()
{
  $('.home-right-image img').each(function()
  {
    if ( this.height )
    {
      $(this).parent().parent().height(this.height + 14);   
    }
  });
}

function initOnReady() 
{
  $('.home-right-image img').each(function()
  {
    this.onload = function()
    {
      if ( this.height )
      {
        $(this).parent().parent().height(this.height + 14);   
      }
    }
  });

  $('#flash-marki').flash('flash/loga.swf', 170, 100, { wmode:'transparent' });
  $('#page-banner').flash('flash/top.swf', 932, 204, { wmode:'transparent' });
  $('#promocja').flash('flash/promocja.swf', 530, 70, { wmode:'transparent' });
  
  $('a[rel=lightbox]').lightbox();
  
  setInterval(function()
  {
    $('.blink').each(function() 
    {  
      if ( $(this).css('opacity') == 1 )
      {
        //$(this).css('visibility', 'visible');
        $(this).animate({ opacity:0 });
      }
      else
      {
        //$(this).css('visibility', 'hidden');
        $(this).animate({ opacity:1 });
      }
    });
    $('.border-blink').each(function() 
    {  
      if ( parseInt($(this).css('border-top-width')) == 0 )
      {
        $(this).css('border-width', '7px');
        $(this).css('margin', '0px');
      }
      else
      {
        $(this).css('border-width', '0px');
        $(this).css('margin', '7px');
      }
    });    
  }, 800);
  
  $('marquee').mouseover(function(){this.stop()}).mouseout(function(){this.start()});
  
}

function addToCart(id)
{
  var form = $('#cmdAddToCart').get(0);
  form.id.value = id;
  form.submit();
  return false;
}
