  var offset = 4;
  var top_item = 0;
  var count = 0;
  var scroller=0;
  function set_first(id)
  {
  	if(count != 0)
  		{
  			if(id+offset < count)
  			{
				for(var a= 0; a<count;a++)
  				{
  					if(a < id-1)
  					{
  						document.getElementById('main'+a).style.display='none';
  					}
  					else if(a < id-1+offset)
  					{
  						document.getElementById('main'+a).style.display='block';
  					}
  					else
  					{
  						document.getElementById('main'+a).style.display='none';
  					}
  				}
  				top_item = id;
  			}
  			else
  			{
  				top_item = count-offset;
  				
				for(var a= 0; a<count;a++)
  				{
  					if(a < top_item)
  					{
  						document.getElementById('main'+a).style.display='none';
  					}
  					else if(a < top_item+offset)
  					{
  						document.getElementById('main'+a).style.display='block';
  					}
  					else
  					{
  						document.getElementById('main'+a).style.display='none';
  					}
  				}
  			}
  		}
  }
  function scroll_main(up)
  {
  	if(up== false)
  	{
  		if(count != 0)
  		{
  			if(top_item+offset < count)
  			{
				top_item = top_item +1;  				
  				for(var a= 0; a<count;a++)
  				{
  					if(a < top_item)
  					{
  						document.getElementById('main'+a).style.display='none';
  					}
  					else if(a < top_item+offset)
  					{
  						document.getElementById('main'+a).style.display='block';
  					}
  					else
  					{
  						document.getElementById('main'+a).style.display='none';
  					}
  				}
  			}
  		}
  		//go down
  	}
  	else
  	{
  		if(count != 0)
  		{
  			if(top_item > 0)
  			{
				top_item = top_item -1;  				
  				for(var a= 0; a<count;a++)
  				{
  					if(a < top_item)
  					{
  						document.getElementById('main'+a).style.display='none';
  					}
  					else if(a < top_item+offset)
  					{
  						document.getElementById('main'+a).style.display='block';
  					}
  					else
  					{
  						document.getElementById('main'+a).style.display='none';
  					}
  				}
  			}
  		}
  		//go up
  	}
  }
  
