top_pos = 170;  // location of the whole DIV from top of page    
left_pos = 230;  // location of the whole DIV from left edge    
box_height = 285;  // height of clip rect box    
box_width = 275;  // width of clip rect box    
scroll_height = 430; // total moving distance of the DIV
scrolling = 1; // 1=constant, 2=scrolling 
temp = 0; // store the current top position of the DIV  
    
function scroll(direction)  
{  
if (scrolling==2){  
	clearTimeout(timer);  
}  
if (direction=='up'){
	if (temp>0){
		scroll_in_action();
	}
	scrollup(temp);  
}  
else if (direction=='down'){
	if (temp<scroll_height){
		scroll_in_action();
	}
	scrolldown(temp);  
}  
}   
  
  
function scrolldown(box_top)     
{    
if (document.layers) {    
	bodyDiv = document.scrollbody;    
	bodyDiv.clip.top = box_top;    
	bodyDiv.clip.bottom = box_top + box_height;   
	bodyDiv.top = top_pos - box_top;	  
}    
else {    
	bodyDiv = scrollbody.style;    
	bodyDiv.clip = "rect(" + box_top + "px " + box_width + "px " + (box_top + box_height) + "px 0px)";     
	bodyDiv.pixelTop = top_pos - box_top;  
}    
    
if (box_top < scroll_height) {    
	box_top = (box_top + 2); 
	temp = box_top;  
	scrolling = 2;  
	timer = setTimeout("scrolldown(" + box_top + ")", 50);    
}    
else {		      
	scrolling = 1;
	reach_buttom();
}    
}    
    
function scrollup(box_top)     
{    
if (document.layers) {    
	bodyDiv = document.scrollbody;    
	bodyDiv.clip.top = box_top;    
	bodyDiv.clip.bottom = box_top + box_height;    
	bodyDiv.top = top_pos - box_top;    
}    
else {    
	bodyDiv = scrollbody.style;    
	bodyDiv.clip = "rect(" + box_top + "px " + box_width + "px " + (box_top + box_height) + "px 0px)";    
	bodyDiv.pixelTop = top_pos - box_top;    
}    
if (box_top > 0) {    
	box_top = (box_top - 2);  
	temp = box_top    
	scrolling = 2;  
	timer = setTimeout("scrollup(" + box_top + ")", 50);    
}    
else {		    
	scrolling = 1;
	reach_top();
}
}  
  
function pause()  
{  
if (scrolling==2) {  
	scrolling = 1;
	document.pause.src="images/nav_buttons/pause_disabled.gif";
	clearTimeout(timer);  
}  
} 
 
function to(anchor) 
{ 
if (scrolling==2){ 
	clearTimeout(timer); 
	scrolling = 1 
} 
if (anchor=='top'){
	reach_top();
	scrollup(0); 
	temp = 0; 
} 
else if (anchor=='buttom'){
	reach_buttom(); 
	scrolldown(scroll_height); 
	temp = scroll_height; 
} 
scrolling = 1 
}

function reach_top()
{
	document.up.src="images/nav_buttons/up_disabled.gif";  
	document.top.src="images/nav_buttons/top_disabled.gif";
	document.down.src="images/nav_buttons/down.gif";  
	document.buttom.src="images/nav_buttons/buttom.gif";
	document.pause.src="images/nav_buttons/pause_disabled.gif";
}

function reach_buttom()
{
	document.down.src="images/nav_buttons/down_disabled.gif";  
	document.buttom.src="images/nav_buttons/buttom_disabled.gif";
	document.up.src="images/nav_buttons/up.gif";  
	document.top.src="images/nav_buttons/top.gif";
	document.pause.src="images/nav_buttons/pause_disabled.gif";
}

function scroll_in_action()
{
	document.down.src="images/nav_buttons/down.gif";
	document.buttom.src="images/nav_buttons/buttom.gif";
	document.up.src="images/nav_buttons/up.gif";  
	document.top.src="images/nav_buttons/top.gif";
	document.pause.src="images/nav_buttons/pause.gif";
}
