function chCheckBox(bChecked, id)
{
  if(bChecked)
    document.getElementById(id).style.backgroundPosition="0 0";
  else
    document.getElementById(id).style.backgroundPosition="0 -14";
}


  var timer;
  var delay=10;
  var mouse_start_y;
  var MouseX, MouseY;
  var bScroll = false;
  var windowheight=0;
  var buttonsheight=20;
  var scrollheight=40;
  var Divid;
    
  var val400=430;
  var val380=val400-buttonsheight-scrollheight;
  var val360=val400-buttonsheight*2-scrollheight;

  document.onmousemove = getMouseCoordinate;
  document.onmousedown = setValues;
  document.onmouseup = scroll_destroy;

  function getMouseCoordinate(e)
  {
    if (!e) e = window.event;
    if (e)
    {
      if (e.pageX || e.pageY)
      {
        MouseX = e.pageX;
        MouseY = e.pageY;
      }
      else if (e.clientX || e.clientY)
      {
        MouseX = e.clientX + document.body.scrollLeft;
        MouseY = e.clientY + document.body.scrollTop;
      }
    }
    scroll_set();
  }
  function setValues()
  {
    mouse_start_y=MouseY;
  }

  function move_up(id)
  {
    timer=setTimeout("move_up("+id+")", delay);
    height=document.getElementById('movable-layer-'+id).offsetHeight;
    if(height>val400)// sprawdza czy obszar wychodzi poza
    {
      curent=parseInt(document.getElementById('movable-layer-'+id).style.top);
      if(!curent) curent=0;
      curent-=5;
      if(curent<(-height+val400))
      {
        curent=-height+val400;
        destroy_timer();
      }
      document.getElementById('movable-layer-'+id).style.top=curent+"px";

      move=-(curent*val360)/(height-val400);
      move=move+20;
      if(move<20) move=20;
      if(move>val380) move=val380;
      document.getElementById('scroll-'+id).style.top=move+'px';
    }
  }
  function jump_up(id)
  {
    height=document.getElementById('movable-layer-'+id).offsetHeight;
    if(height>val400)// sprawdza czy obszar wychodzi poza
    {
      curent=parseInt(document.getElementById('movable-layer-'+id).style.top);
      if(!curent) curent=0;
      curent-=15;
      if(curent<(-height+val400))
      {
        curent=-height+val400;
      }
      document.getElementById('movable-layer-'+id).style.top=curent+"px";

      move=-(curent*val360)/(height-val400);
      move=move+20;
      if(move<20) move=20;
      if(move>val380) move=val380;
      document.getElementById('scroll-'+id).style.top=move+'px';
    }
  }
  function move_down(id)
  {
    timer=setTimeout("move_down("+id+")", delay);
    height=document.getElementById('movable-layer-'+id).offsetHeight;
    if(height>val400)// sprawdza czy obszar wychodzi poza
    {
      curent=parseInt(document.getElementById('movable-layer-'+id).style.top);
      if(!curent) curent=0;
      curent+=5;
      if(curent>0)
      {
        curent=0;
        destroy_timer();
      }
      document.getElementById('movable-layer-'+id).style.top=curent+"px";

      move=-(curent*val360)/(height-val400);
      move=move+20;
      if(move<20) move=20;
      if(move>val380) move=val380;
      document.getElementById('scroll-'+id).style.top=move+'px';
    }
  }
  function jump_down(id)
  {
    height=document.getElementById('movable-layer-'+id).offsetHeight;
    if(height>val400)// sprawdza czy obszar wychodzi poza
    {
      curent=parseInt(document.getElementById('movable-layer-'+id).style.top);
      if(!curent) curent=0;
      curent+=15;
      if(curent>0)
      {
        curent=0;
      }
      document.getElementById('movable-layer-'+id).style.top=curent+"px";

      move=-(curent*val360)/(height-val400);
      move=move+20;
      if(move<20) move=20;
      if(move>val380) move=val380;
      document.getElementById('scroll-'+id).style.top=move+'px';
    }
  }
  function destroy_timer()
  {
    clearTimeout(timer);
  }
  function scroll_init(id)
  {
    bScroll=true;
    Divid=id;
	disableSelection(document.getElementById('body-body'));
  }
  function scroll_set()
  {
    if(bScroll)
    {
      movement=MouseY-mouse_start_y;
      curent=parseInt(document.getElementById('scroll-'+Divid).style.top);
      if(!curent) curent=0;
      curent=curent+movement;
      mouse_start_y=MouseY;
      if(curent<buttonsheight) curent=buttonsheight;
      if(curent>val380) curent=val380;
      document.getElementById('scroll-'+Divid).style.top=curent+'px';

      height=document.getElementById('movable-layer-'+Divid).offsetHeight;
      if(height>val400)// sprawdza czy obszar wychodzi poza
      {
        move=-((height-val400)*(curent-buttonsheight)) / val360;
        document.getElementById('movable-layer-'+Divid).style.top=move+"px";
      }
    }
  }
  function scroll_destroy()
  {
    bScroll=false;
    destroy_timer();
	enableSelection(document.getElementById('body-body'));
  }
  
  
  
    function disableSelection(target)
	{
		//For IE This code will work
		if(typeof target.onselectstart!="undefined") 
		{
			target.onselectstart=function()
			{
				return false;
			}
		}

		//For Firefox This code will work
		else if(typeof target.style.MozUserSelect!="undefined")
		{
			target.style.MozUserSelect="none";
		}

		//All other  (ie: Opera) This code will work
		else 
		{
			target.onmousedown=function()
			{
				return false;
			}
			target.style.cursor = "default";
		}
	}
	
	function enableSelection(target)
	{
		//For IE This code will work
		if(typeof target.onselectstart!="undefined")
		{
			target.onselectstart=function()
			{
				return true;
			}
		}

		//For Firefox This code will work
		else if(typeof target.style.MozUserSelect!="undefined")
		{
			target.style.MozUserSelect="text";
		}

		//All other  (ie: Opera) This code will work
		else
		{
			target.onmousedown=function()
			{
				return true;
			}
			target.style.cursor = "default";
		}
	}

