/*
handige string functies
*/
String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}

var debug = 0;
var tid = null;
var last;

function show(i)
{
	var obj = document.getElementById("sub"+i);

	if (last!=null && last != obj)
		last.style.display='none';

	c();

	if (obj)
	{
		obj.style.display = 'block';

		if (!document.all)
		{
			if(!obj.style.top)
			{
				y = findPosY(obj);
				obj.style.top = (y - 200) + 'px';
			}
		}

		last = obj;
	}
}

function hide(i)
{
	var obj = document.getElementById("sub"+i);

	if (obj)
		tid = setTimeout("document.getElementById(\"sub"+i+"\").style.display='none'", 500);
}

function c()
{
	if (tid != null && tid)
	{
		clearTimeout(tid);
	}
}

function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }
