var px = 15;  //mehr=schneller
var mytimer;
var mytimer2;


function adjustVertPos()
  {
	var hoehe = document.getElementById('main_container_wrap').offsetHeight;
	newMargin = Math.round(hoehe*-0.5)+"px";		
	document.getElementById('distance').style.marginBottom = newMargin;
  }


function hideCenterToggles()
  {
	if (document.getElementById('contSlider'))
		{
		if ( document.getElementById('contSlider').offsetHeight < 420 )
			{
				document.getElementById('centerup').style.display='none';
				document.getElementById('centerdown').style.display='none';
			}	
		}	
  }

 
function hideRightToggles()
  {
	if (document.getElementById('slider'))
		{
		var hoehe = document.getElementById('slider').offsetHeight;
		if ( hoehe < 300 && hoehe != 0 )
			{				
				document.getElementById('rightup').style.display='none';
				document.getElementById('rightdown').style.display='none';
			}
		}
  }
  
  
function scrollDenDiv(val)
  {
    clearTimeout(mytimer);	
    d=document.getElementById('contentbox');
    y=d.scrollTop;
    if(val==1)y-=px;
    if(val==2)y+=px;
	
    if(y<=d.scrollHeight-d.offsetHeight+px&&y>=0-px)
      {
        d.scrollTop=y;
        mytimer=setTimeout('scrollDenDiv('+val+')',50);
	  }

    if(y<0||y>d.scrollHeight-d.offsetHeight)
      {
        clearTimeout(mytimer);			
      }
}

function scrollThumb(val)
  {
    clearTimeout(mytimer2);	
    d=document.getElementById('selection_box');
    y=d.scrollTop;
    if(val==1)y-=px;
    if(val==2)y+=px;
	
    if(y<=d.scrollHeight-d.offsetHeight+px&&y>=0-px)
      {
        d.scrollTop=y;
        mytimer2=setTimeout('scrollThumb('+val+')',50);
	  }

    if(y<0||y>d.scrollHeight-d.offsetHeight)
      {
        clearTimeout(mytimer2);			
      }
}




