// JavaScript Document

// replaces image heading with flash heading
function fir () {
  // var so1 = new SWFObject("flash/text_header.swf?"+nazwa, nazwa, "465", "49", "8", "#ffffff");
  // so1.write("flashHeader");
  swfobject.embedSWF("flash/text_dynamic_header.swf", "flashHeader", "465", "49", "9.0.0", "img/expressInstall.swf", {headertext: nazwa}, {wmode:"transparent"});
}
// replaces standard menu with menu with hidden text and fancy backgrounds as text
// author: Devoth
function ir (menuID) {
  var menu = document.getElementById(menuID);
  var listLinks = menu.getElementsByTagName('a');
  for (var i=0; i<listLinks.length; i++) {
    var listLink = listLinks[i];
    var tmplistLink = document.createDocumentFragment();
    var additionalSpan = document.createElement('span');
    tmplistLink.appendChild(additionalSpan);
    while (listLink.firstChild) {
      tmplistLink.appendChild(listLink.firstChild);
    }
    listLink.appendChild(tmplistLink);
  }
  menu.className = 'IR';
}
function swap_letter() {
  $('p[class!=noFirstLetter][class!=linkto][class!=produktyNav]').each(function(i){
    var node = this;
    while (node.childNodes.length)
    {
      node = node.firstChild;
    }
    var text = $.trim(node.nodeValue)+' ';
    var first_letter = text.substr(0,1);
    var match = /[a-zA-Z]/.test(first_letter);
    if ( match ) {
      node.nodeValue = text.slice(1);
      $('<span>'+first_letter.toUpperCase()+'</span>').addClass('firstLetter').prependTo( this );
    }
  });
}
window.onload = function () {
  fir();
  ir('mainMenu');
  makeMails();
  $('a[rel=lightbox]').lightBox();
  swap_letter();
}