var initialised = true; 
 
function verifyCompatibleBrowser()
{ 
    this.ver = navigator.appVersion; 
    this.dom = document.getElementById?1:0;
	this.ie7 = (this.ver.indexOf("MSIE 7")>-1 && this.dom)?1:0;
    this.ie5 = (this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; 
    this.ie4 = (document.all && !this.dom)?1:0; 
    this.ns5 = (this.dom && parseInt(this.ver) >= 5) ?1:0; 
 
    this.ns4 = (document.layers && !this.dom)?1:0; 
    this.bw = (this.ie7 || this.ie5 || this.ie4 || this.ns4 || this.ns5);
    return this;
} 
 
function ConstructObject(obj,nest)
{ 
	bw = new verifyCompatibleBrowser();
    nest = (!nest) ? '':'document.'+nest+'.' 
    this.el = bw.dom?document.getElementById(obj):bw.ie7?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0; 
    this.css = bw.dom?document.getElementById(obj).style:bw.ie7?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0; 
    this.scrollWidth = bw.ns4?this.css.document.Width:this.el.offsetWidth; 
    this.clipWidth = bw.ns4?this.css.clip.width:this.el.offsetWidth; 
    this.left = MoveAreaLeft;
    this.right = MoveAreaRight; 
    this.MoveArea = MoveArea; 
    this.inLoop = false;
    this.loop;
    this.timer;
    this.x; 
    this.y;
	this.page;
	this.pages;
    this.obj = obj + "Object" 
    eval(this.obj + "=this"); 
    return this; 
} 

function MoveArea(x,y)
{ 
    this.x = x;
    this.y = y;
	this.css.left = this.x + 'px'; 
    this.css.top = this.y + 'px';		
} 
 
function MoveAreaRight(move)
{ 
    if (move <= 0)
	{
		this.loop = false;
		this.inLoop = false;
		if(this.timer) clearTimeout(this.timer); 
    }
    else 
    {
		this.MoveArea(this.x-move,0);
		move = move-1;
		if(this.loop) setTimeout(this.obj+".right("+move+")",20); 
    }
} 
function MoveAreaLeft(move)
{ 
	if (move <= 0) 
	{
		this.loop = false;
		this.inLoop = false;
		if(this.timer) clearTimeout(this.timer); 
	}
	else 
	{	
	    this.MoveArea(this.x+move,0); 
	    move = move-1;
	    if(this.loop) setTimeout(this.obj+".left("+move+")",20); 
	}
} 
 
function PerformScroll(speed, uniqueScroller)
{ 
	if(initialised == true && uniqueScroller.inLoop == false)
	{
		uniqueScroller.inLoop = true;			
	    uniqueScroller.loop = true;
		var number = 0;
		var lastNumber = 1;
		uniqueScroller.pagewidth = speed;
	    if(speed > 0)
	    {
			if(uniqueScroller.page > uniqueScroller.pages)
			{
				uniqueScroller.x = 0;
				uniqueScroller.page = 1;
			}
			uniqueScroller.page += 1;
			while(number < speed)
			{
				number += lastNumber;
				lastNumber++;
			}
			move = lastNumber - 1;
			rest = number - speed;
			uniqueScroller.x += rest;
			uniqueScroller.right(move);
		}
	    else
	    {
			uniqueScroller.page -= 1;
			if(uniqueScroller.page < 1)
			{
				uniqueScroller.x = uniqueScroller.pagewidth * (uniqueScroller.pages);
				uniqueScroller.page = uniqueScroller.pages;
			}
			while(number > speed)
			{
				number -= lastNumber;
				lastNumber++;
			}
			move = lastNumber - 1;
			rest = speed - number;
			uniqueScroller.x -= rest;
			uniqueScroller.left(move);	
		}
	} 
} 

function countScrollablePages(tableId)
{
	var tabelle = document.getElementById(tableId);
	var zeilen = tabelle.rows;
	var spalten = zeilen[0].cells;		
	return spalten.length;
}

var ver = navigator.appVersion;
var platform = navigator.platform;

function showdiv(id) {
	if (ver.indexOf("MSIE") != -1 && platform.indexOf("Mac") == -1 && !window.opera) {
		window.document.getElementById("tab"+id).style.setAttribute('display','block','false');
	} else {
		document.getElementById("tab"+id).style.display = "block";
	}
}

function hidediv(id) {
	if (ver.indexOf("MSIE") != -1 && platform.indexOf("Mac") == -1 && !window.opera) {
		window.document.getElementById("tab"+id).style.setAttribute('display','none','true');
	} else {
		document.getElementById("tab"+id).style.display = "none";
	}
}