var time;
var scrollDiv = {};
function scrollBox(obj, height){
	if(obj.offsetHeight>height){
		width = 150;
		obj.style.height = height;
		var rectDiv = document.createElement('div');
		var mainDiv = document.createElement('div');
		mainDiv.id = '_'+obj.id;
		mainDiv.style.width = '143px';
		mainDiv.style.position = 'relative'
		mainDiv.style.overflow = 'hidden';
		mainDiv.innerHTML = obj.innerHTML;
		//rectDiv.style.position = 'absolute';
		//rectDiv.style.clip = 'rect(0px, '+width+'px, '+(height-20)+'px, 0)';
		//rectDiv.appendChild(mainDiv);
		var div = document.createElement('div');
		div.style.overflow = 'hidden';
		div.style.height = height-20;
		div.appendChild(mainDiv);
		var bKey = document.createElement('img');
		var aKey = document.createElement('img'); aKey.src = './img/d.gif'; //aKey.style.display = 'none';
		bKey.aKey = aKey;
//		aKey.bKey = bKey;
		
		bKey.src = './img/u.gif';
		bKey.mainDiv = mainDiv;
		bKey.onmouseover = function (){
			scrollDiv = this.mainDiv;
			if(time) clearTimeout(time);
			scrolUp();
//			this.aKey.style.display = 'block';
		}
		bKey.onmouseout = function (){
			if(time) clearTimeout(time);
		}
		bKey.onclick = function (){
			scrollDiv.style.top = (-scrollDiv.offsetHeight)+scrollDiv.parentNode.parentNode.offsetHeight-40;
		}

		aKey.mainDiv = mainDiv;
		aKey.onmouseover = function (){
			scrollDiv = this.mainDiv;
			if(time) clearTimeout(time);
			scrolDown();
		}
		aKey.onmouseout = function (){
			if(time) clearTimeout(time);
		}
		aKey.onclick = function (){
			scrollDiv.style.top = 0;
		}

		obj.innerHTML = '';
		obj.appendChild(aKey);
		obj.appendChild(div);
		obj.appendChild(bKey);
	}
}
function scrolUp(){
	if(document.all)
		_top = scrollDiv.offsetTop;
	else
		_top = scrollDiv.offsetTop-scrollDiv.parentNode.offsetTop;

	if(_top<=(-scrollDiv.offsetHeight)+scrollDiv.parentNode.parentNode.offsetHeight-40){
		if(time) clearTimeout(time);
//		scrollDiv.parentNode.parentNode.parentNode.getElementsByTagName('img')[1].display = 'none';
		return false;
	}
//	alert(scrollDiv.parentNode.offsetTop);
	scrollDiv.style.top = _top-2;
	time = setTimeout('scrolUp()', 1);
}
function scrolDown(){
	if(document.all)
		_top = scrollDiv.offsetTop;
	else
		_top = scrollDiv.offsetTop-scrollDiv.parentNode.offsetTop;

	if(_top>=0){
		if(time) clearTimeout(time);
		return false;
	}
	scrollDiv.style.top = _top+2;
	time = setTimeout('scrolDown()', 1);
}


