function changeImage(target,imgsrc){
	if(document.images){
	document.images[target].src = imgsrc;
	}
}

var nowpos=0;
var tempflag=1;
var timer;
var IE = navigator.appName.charAt(0)=="M";
var NN = navigator.appName.charAt(0)=="N";

function getScrollTop() {
	if (IE) {
		return document.body.scrollTop;
	} else if (NN) {
		return window.pageYOffset;
	}
}

function getLayerTop(layerid){
	if(document.getElementById){
		return parseInt(document.getElementById(layerid).offsetTop);
	}else if(document.all){
		return document.all(layerid).style.pixelTop;
	}else if(document.layers){
		return document.layers[layerid].top;
	}
	return 0;
}

function scrollblock(thnum){
	if(document.getElementById){
		var threadtop=getLayerTop(thnum);
		scrollit(threadtop);
	}else{
		location.href="#"+thnum;
	}
}

function scrolltop(){
	scrollit(0);
}

function scrollit(pos){
clearTimeout(timer);
	if(tempflag==1){
		nowpos=getScrollTop();
		newpos=pos;
		timer=setTimeout('moveit('+newpos+')',1);
	}else{
		dis=0;
		nowdis=0;
		newpos=pos;
		clearTimeout(timer);
		timer=setTimeout('moveit('+newpos+')',1);
	}
}

function moveit(newpos){
	tempflag=0;
	dis=(newpos-nowpos)/7;
	nowpos=nowpos+dis;
	nowdis=newpos-nowpos;
	if(nowdis<1 && nowdis>-1){
		nowpos=newpos;
		window.scroll(0,nowpos);
		clearTimeout(timer);
		tempflag=1;
	}else{
		window.scroll(0,nowpos);
		timer=setTimeout('moveit('+newpos+')',50);
	}
}
