var isDown = true;
function SetAutoScroll(cbElement){
	var cb = cbElement;	
	if(cb.checked){
		isScroll = 'true';		
		autoScroll();		
	}
	else {
		isScroll = 'false';
	}
}

function autoScroll(){		
	if(isScroll == 'false'){
		return;
	}
	var time = 	30;			
	var scroll;
		scroll = document.getElementById('banggia');				
	if(scroll!=null){			
		var max = 0;
		if(IsIE()){				 
			max = scroll.scrollHeight - scroll.offsetHeight;
		}
		else{
			max = scroll.scrollHeight - parseInt(document.defaultView.getComputedStyle(scroll, null).getPropertyValue("height"), 10);
		}
	
	    if(scroll.scrollTop==0){
		    isDown = true;
		    time = 3000;
	    }
	    if(scroll.scrollTop==max){
		    isDown = false;
		    time = 3000;
		}
            
	    if(isDown){
		   scroll.scrollTop=scroll.scrollTop+ 1;
		}				
		else{
			scroll.scrollTop=scroll.scrollTop- 1;
		}
	}
	setTimeout("autoScroll()", time);
}
function IsIE(){
	if(document.all){
		return true;
	}
	return false;
}