
// (c) 2008, Przemysław W±dołowski

if ( window.self != window.top )
{
  window.top.location = window.location.href;
}

$(document).ready(init);

function init()
{
  $('.abc').hide();
//  $('#home_baner').flash('flash/baner.swf', 150, 100);
  $('#flash-zaufalinam').flash('flash/zaufali-nam.swf', 130, 76, {wmode:'opaque'} );
  $('#flash-zaufalinam').append('<div><a href="media/image/zaufali-nam.jpg" rel="lightbox" target="_blank"><img src="images/blank.gif" width="130" height="76"></a></div>')
  $('.readmore').each(function()
  {
    $(this).hide();
    $('#' + this.id + ' > *:first-child').css('margin-top', 0);
    $('#' + this.id + ' > *:last-child').css('margin-bottom', 0);
    $(this).after('<p class="readmore-btn"><a href="javascript:readmore(\''+ this.id +'\')">rozwiń</a></p>');
  });
  $('a[rel=lightbox]').lightbox();
}


function readmore(id)
{
  $('#'+id).slideDown('slow');
  $('#'+id).next().replaceWith('<p class="readmore-btn"><a href="javascript:ureadmore(\''+ id +'\')">zwiń</a></p>');
}
function ureadmore(id)
{
  $('#'+id).slideUp('slow');
  $('#'+id).next().replaceWith('<p class="readmore-btn"><a href="javascript:readmore(\''+ id +'\')">rozwiń</a></p>');
}


function swf(swf, width, height) {
  var date = new Date();
  var id = hex_md5(swf + date.getUTCSeconds() + Math.random());
  document.write('<div id="' + id + '"></div>');
  
  var swfo = new SWFObject(swf, id + 'movie', width, height, "9", "#FFFFFF");
  swfo.write(id);  
}

function startup()
{
  fixanchors();
}

function fixanchors()
{
  base = document.location.href;
  pos = base.indexOf('#');
  if (pos > -1) {
    base = base.substring(0, pos);
  }
  
  anchors = document.getElementsByTagName('a');
  log = '';
  for (x in anchors) {
    log += anchors[x] + "\r\n";
    href = new String(anchors[x].href);
    pos = href.indexOf('#');
    if (pos > -1) {
      log += 'anchor: ' + href.substring(pos) + "\r\n";
      anchors[x].href = base + href.substring(pos);
    }
  }
  //alert(log);
}


function popup(url, width, height)
{
  if (width == undefined) width = 500;
  if (height == undefined) height = 500;
  var base = document.getElementsByTagName('base')[0].href;
  var left =  (screen.availWidth - width) / 2;
  var top =  (screen.availHeight - height) / 2;
  window.open(base + url, '', 'width='+width+',height='+height+',left='+left+',top='+top
                              +',resizable,scrollbars=auto');
}

function setCurrentLogo(no)
{
  alert(no);
}
