/*  Copyright (c) 2001-2007 FOX Software Sp. z o.o. author: marcin.lisok@fox.com.pl */
var op = /opera/i.test(navigator.userAgent);
var ie = !op && /msie/i.test(navigator.userAgent);	     
var mz = !op && /mozilla\/5/i.test(navigator.userAgent); 

// funkcja przełącza TabSheet
function changeTabSheet() {
  if ((!this) || (this.className == 'front')) return false;
  var ul = this.parentNode;
  var li = ul.getElementsByTagName('LI');
  for (var i=0; i<li.length; i++ ) {
    li[i].className = (li[i]==this) ? li[i].className.replace('back','front') : li[i].className.replace('front','back');
    var a = li[i].getElementsByTagName('A');
    if (a.length > 0) {
      var k = a[0].href.indexOf('#');
      var id = a[0].href.substr(k+1);
      var pg = document.getElementById(id);
      if (pg) {
        pg.className = (li[i]==this)? pg.className.replace('back','front') : pg.className.replace('front','back');
      }
    }
  }
  return false;
}
function activateTabSheet() {
  var ul = document.getElementsByTagName('UL');
  for( i=0; i<ul.length; i++ ) {
    if (ul[i].className != 'tabs') continue;
    var li = ul[i].getElementsByTagName('LI');
    for( j=0; j<li.length; j++ )
      li[j].onclick = changeTabSheet;
  }
}

function findParentElement( node, tag ) {
  var res = null;
  tag = tag.toUpperCase();
  while (node && node.tagName != tag) {
    node = node.parentNode;
  } 
  if (node && node.tagName == tag) res = node;
  return res;
}

window.onload = function() {
  activateTabSheet();
}
