var clipTop = 0;
var clipWidth = 0;
var clipBottom = 0;
var topper = 0;
var lyrheight = 0;
var clipLeft = 0;
var clipHeight = 0;
var clipRight = 0;
var lefter = 0;
var lyrwidth = 0;
var time,amount,theTime,theHeight,theWidth,DHTML;
var reset = true;
var lastLeftMenu = "default";

function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}

function scrollayer(layername,amt,tim,cTop,cWidth,cBottom)
{
	DHTML = (document.getElementById || document.all || document.layers)
	if (!DHTML) return;
	thelayer = new getObj(layername);
	if (!thelayer) return;
	if (reset) { 
		reset = false;
		clipTop    = cTop;
		clipBottom = cBottom;
		clipWidth  = cWidth;
		topper     = 0; 
		if (document.layers) {
			lyrheight  = thelayer.style.clip.bottom;
			lyrheight += 20;
		} else if (document.getElementById || document.all) {
			lyrheight = thelayer.obj.offsetHeight;
		}	
	}		
	amount = amt;
	theTime = tim;
	realscroll(cTop,cWidth,cBottom);
}

function realscroll(cTop,cWidth,cBottom)
{
	if (!DHTML) return;
	clipTop += amount;
	clipBottom += amount;
	topper -= amount;
	if (clipTop < 0 || clipBottom > lyrheight)
	{
		clipTop -= amount;
		clipBottom -= amount;
		topper += amount;

		clipTop    = cTop;
		clipBottom = cBottom;
		clipWidth  = cWidth;
		topper     = 0; 
//		return;
	} 
	if (document.getElementById || document.all)
	{
		clipstring = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)';
		thelayer.style.clip = clipstring;
		thelayer.style.top = topper + 'px';
	}
	else if (document.layers)
	{
		thelayer.style.clip.top = clipTop;
		thelayer.style.clip.bottom = clipBottom;
		thelayer.style.top = topper;
	}
	time = setTimeout('realscroll('+cTop+','+cWidth+','+cBottom+')',theTime);
}

function scrollayerv(layername,amt,tim,cLeft,cHeight,cRight)
{
	DHTML = (document.getElementById || document.all || document.layers)
	if (!DHTML) return;
	thelayer = new getObj(layername);
	if (!thelayer) return;
	if (reset) { 
		reset = false;
		clipLeft    = cLeft;
		clipRight   = cRight;
		clipHeight  = cHeight;
		lefter     = 0; 
		if (document.layers) {
			lyrwidth  = thelayer.style.clip.right;
			lyrwidth += 20;
		} else if (document.getElementById || document.all) {
			lyrwidth = thelayer.obj.offsetWidth;
		}	
	}		
	amount = amt;
	theTime = tim;
	realscrollv();
}

function realscrollv()
{
	if (!DHTML) return;
	clipLeft += amount;
	clipRight += amount;
	lefter -= amount;
	if (clipLeft < 0 || clipRight > lyrwidth)
	{
		clipLeft -= amount;
		clipRight -= amount;
		lefter += amount;
		return;
	}
	if (document.getElementById || document.all)
	{
		clipstring = 'rect(0,'+clipRight+'px,'+clipHeight+'px,'+clipLeft+'px)';
		thelayer.style.clip = clipstring;
		thelayer.style.left = lefter + 'px';
	}
	else if (document.layers)
	{
		thelayer.style.clip.left = clipLeft;
		thelayer.style.clip.right = clipRight;
		thelayer.style.left = lefter;
	}
	time = setTimeout('realscrollv()',theTime);
}


function stopscroll()
{
	if (time) clearTimeout(time);
}

function zobrazSkryj(idecko,visible) {
     el=document.getElementById(idecko); if(el) { 
	     if(visible!=0) el.style.display=(visible == -1)?'none':'block'; 
    	 else el.style.display=(el.style.display == 'block')?'none':'block'; }
 }

function showLeftMenu(id) {
  if ( lastLeftMenu ) zobrazSkryj(lastLeftMenu,-1);  
  if ( !document.getElementById(id) ) id = 'default'; 
  zobrazSkryj(id,1); 
  lastLeftMenu = id;
  reset = true;
}



