function setLeftNav(pos) {
	var count = 0;
	var nodes = document.getElementById('sidebar_ul').childNodes;
	for (var i = 0; i < nodes.length; i++) 
	{		
		if (nodes[i].nodeName == "LI") 
		{
			count++;

			if (count == pos) 
			{
				//nodes[i].setAttribute('class', 'sidebar_nav_current');
				nodes[i].className = 'sidebar_nav_current';
				break;
			}
		}
	}
}

function nextObject(n)
{
	do n = n.nextSibling;
	while (n && n.nodeType != 1);
	return n;
}

function ToggleDt(dt)
{
	var obj = nextObject(dt);
	var collapsed = (obj.style.height == '20px');
	obj.style.height = collapsed ? 'auto' : '20px';
	dt.firstChild.childNodes[1].innerHTML = (!collapsed) ? '[+]' : '[-]';
}

//addLoadEvent( function() {
//  var inputs = document.getElementsByTagName( 'input' );
//  var textareas = document.getElementsByTagName( 'textarea' );
//  var selects = document.getElementsByTagName( 'select' );

//  for ( var i=0; i<inputs.length; i++ ) {
//    type = inputs[i].type;

//    if (
//      ( type == 'button' || type == 'reset' ||
//      type == 'password' || type == 'text' ||
//      type == 'submit' ) &&
//      ( inputs[i].onfocus == '' ||
//      !inputs[i].onfocus )
//    ) {
//      inputs[i].onfocus = function() { this.className = 'selected'; }
//      inputs[i].onblur = function() { this.className = ''; }
//    }
//  }

//  for ( var i=0; i<textareas.length; i++ ) {
//    if ( textareas[i].onfocus == '' || !textareas[i].onfocus ) {
//      textareas[i].onfocus = function() { this.className = 'selected'; }
//      textareas[i].onblur = function() { this.className = ''; }
//    }
//  }
//  
//  for ( var i=0; i<selects.length; i++ ) {
//    if ( selects[i].onfocus == '' || !selects[i].onfocus ) {
//      selects[i].onfocus = function() { this.className = 'selected'; }
//      selects[i].onblur = function() { this.className = ''; }
//    }
//  }
//}
//);

//function addLoadEvent(func) 
//{     
//   if (typeof window.onload != 'function') 
//     window.onload = func;  
//   else
//   {
//   	 var oldonload = window.onload;  
//     window.onload = function() 
//     {  
//       if (oldonload)
//         oldonload();  
//       
//       func();  
//     }  
//   }
//  }










// admin tooltip
var tooltip=function()
{
  var id = 'tt';
  var top = 3;
  var left = 3;
  var maxw = 300;
  var speed = 10;
  var timer = 20;
  var endalpha = 95;
  var alpha = 0;
  var tt,t,c,b,h;
  var ie = document.all ? true : false;
  return { // breaks if this bracket is dropped
  show:function(v,w)
    {
      if(tt == null)
      {
        tt = document.createElement('div');
        tt.setAttribute('id',id);
        t = document.createElement('div');
        t.setAttribute('id',id + 'top');
        c = document.createElement('div');
        c.setAttribute('id',id + 'cont');
        b = document.createElement('div');
        b.setAttribute('id',id + 'bot');
        tt.appendChild(t);
        tt.appendChild(c);
        tt.appendChild(b);
        document.body.appendChild(tt);
        tt.style.opacity = 0;
        tt.style.filter = 'alpha(opacity=0)';
        document.onmousemove = this.pos;
      }
      tt.style.display = 'block';
      c.innerHTML = v;
      tt.style.width = w ? w + 'px' : 'auto';
      if(!w && ie)
      {
        t.style.display = 'none';
        b.style.display = 'none';
        tt.style.width = tt.offsetWidth;
        t.style.display = 'block';
        b.style.display = 'block';
      }
      if(tt.offsetWidth > maxw){tt.style.width = maxw + 'px'}
      h = parseInt(tt.offsetHeight) + top;
      clearInterval(tt.timer);
      tt.timer = setInterval(function() {tooltip.fade(1)},timer);
    },
    pos:function(e)
    {
      var u = ie ? event.clientY + document.documentElement.scrollTop : e.pageY;
      var l = ie ? event.clientX + document.documentElement.scrollLeft : e.pageX;
      tt.style.top = (u - h) + 'px';
      tt.style.left = (l + left) + 'px';
    },
    fade:function(d)
    {
      var a = alpha;
      if((a != endalpha && d == 1) || (a != 0 && d == -1))
      {
        var i = speed;
        if(endalpha - a < speed && d == 1) {i = endalpha - a;}
        else if(alpha < speed && d == -1) {i = a;}
        alpha = a + (i * d);
        tt.style.opacity = alpha * .01;
        tt.style.filter = 'alpha(opacity=' + alpha + ')';
      }
      else
      {
        clearInterval(tt.timer);
        if(d == -1) {tt.style.display = 'none'}
      }
    },
    hide:function()
    {
      clearInterval(tt.timer);
      tt.timer = setInterval(function(){tooltip.fade(-1)},timer);
    }
  };
}();









// tabs on homepage
function homepageTabs()
{
  this.defaults = 
  {
    id: null,
    active: 1,
    interval: null,
    wait: null,
    persist: null,
    tabclass: 'tab',
    activeclass: 'active',
    callback: null,
    leavecallback: null
  }
  this.activebackup = null;
  for (var n in arguments[0]) { this.defaults[n]=arguments[0][n]; };  
  this.getTabs = function()
  {
    var retnode = [];
    var elem = document.getElementById(this.defaults.id).getElementsByTagName('*');
    var regexp = new RegExp("(^|\\s)" + this.defaults.tabclass.replace(/\-/g, "\\-") + "(\\s|$)");
    for (var i = 0; i < elem.length; i++) {if (regexp.test(elem[i].className)) retnode.push(elem[i]);}
    return retnode;
  }
  this.links = document.getElementById(this.defaults.id + '_nav').getElementsByTagName('a');
  this.listitems = document.getElementById(this.defaults.id + '_nav').getElementsByTagName('li');
  
  this.show = function(number)
  {
    for (var i = 0; i < this.tabs.length; i++)
    {
      this.tabs[i].style.display = ((i+1)==number) ? 'block' : 'none';
      if ((i+1)==number) {this.addClass(this.links[i], this.defaults.activeclass); this.addClass(this.listitems[i], this.defaults.activeclass + 'li');}
      else {this.removeClass(this.links[i], this.defaults.activeclass); this.removeClass(this.listitems[i], this.defaults.activeclass + 'li');}
    }
    if (this.defaults.leavecallback && (number != this.activebackup)) this.defaults.leavecallback(this.defaults.active);
    this.activebackup = number;
    this.defaults.active = number;
    if (this.defaults.callback) this.defaults.callback(number);
  }
  this.rotate = function(interval)
  {
    this.show(this.defaults.active);
    this.defaults.active++;
    if (this.defaults.active > this.tabs.length) this.defaults.active = 1;
    var self = this;
    if (this.defaults.wait) clearTimeout(this.timer2);
    this.timer1 = setTimeout(function(){self.rotate(interval);}, interval*1000);
  }
  this.next = function()
  {
    this.defaults.active++;
    if(this.defaults.active > this.tabs.length) this.defaults.active = 1;
    this.show(this.defaults.active);
  }
  this.previous = function()
  {
    this.defaults.active--;
    if(!this.defaults.active) this.defaults.active = this.tabs.length;
    this.show(this.defaults.active);
  }
  this.gup = function(name)
  {
    name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
    var regexS = "[\\?&]"+name+"=([^&#]*)";
    var regex = new RegExp( regexS );
    var results = regex.exec( window.location.href );
    if (results == null) return null;
    else return results[1];
  }
  this.parseurl = function(tabinterfaceid)
  {
    var result = this.gup(tabinterfaceid);
    if (result==null) return null;
    if (parseInt(result)) return parseInt(result); 
    if (document.getElementById(result)) {for (var i=0;i<this.tabs.length;i++) {if (this.tabs[i].id == result) return (i+1);}}
    return null;
  }
  this.createCookie = function(name,value,days)
  {
    if (days)
    {
      var date = new Date();
      date.setTime(date.getTime()+(days*24*60*60*1000));
      var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
  };
  this.readCookie = function(name)
  {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++)
    {
      var c = ca[i];
      while (c.charAt(0)==' ') c = c.substring(1,c.length);
      if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
  }
  this.contains = function(el, item, from) {return el.indexOf(item, from) != -1;}
  this.hasClass = function(el, className){return this.contains(el.className, className, ' ');}
  this.addClass = function(el, className){if (!this.hasClass(el, className)) el.className = (el.className + ' ' + className).replace(/\s{2,}/g, ' ').replace(/^\s+|\s+$/g, '');};
  this.removeClass = function(el, className){el.className = el.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)'), '$1');el.className.replace(/\s{2,}/g, ' ').replace(/^\s+|\s+$/g, '');}
  this.tabs = this.getTabs();
  this.defaults.active = (this.parseurl(this.defaults.id)) ? this.parseurl(this.defaults.id) : this.defaults.active;
  if (this.defaults.persist && this.readCookie(this.defaults.id)) this.defaults.active = this.readCookie(this.defaults.id);  
  this.activebackup = this.defaults.active;
  this.show(this.defaults.active);
  var self = this;
  for (var i = 0; i < this.links.length; i++)
  {
    this.links[i].customindex = i+1;
    this.links[i].onclick = function()
    { 
      if (self.timer1) clearTimeout(self.timer1);
      if (self.timer2) clearTimeout(self.timer2); 
      self.show(this.customindex);
      if (self.defaults.persist) self.createCookie(self.defaults.id, this.customindex, 0);
      if (self.defaults.wait) self.timer2 = setTimeout(function(){self.rotate(self.defaults.interval);}, self.defaults.wait*1000);
      return false;
    }
  }
  if (this.defaults.interval) this.rotate(this.defaults.interval);
}// grzegorz wojcik - kminek.pl/lab/yetii/