var doScrolling=0;
function stopScroll(){if(doScrolling)clearTimeout(doScrolling);doScrolling=0;}
function startScroll(Scroller,LayerScroll,dLeft,dTop,rel1,rel2)
{
	if(dom)LeftMax = parseInt(document.getElementById(Scroller).style.width) - parseInt(document.getElementById(LayerScroll).style.width);
	else if(ie4)LeftMax = parseInt(document.all[Scroller].style.width) - parseInt(document.all[LayerScroll].style.width);
	else LeftMax = 0;//document.layers[Scroller].width - document.layers[Scroller].document.layers[LayerScroll].width;
	if(doScrolling)clearTimeout(doScrolling);
	doScrolling=true;
	Scrolling(Scroller,LayerScroll,dLeft,dTop,LeftMax,0,rel1,rel2);
}

function Scrolling(Scroller,LayerScroll,dLeft,dTop,LeftMax,TopMax,rel1,rel2)
{
	if ((relPosY(rel1) > relPosY(rel2)+13) || (dTop > 0)) {
		stdScrollTo(Scroller,LayerScroll,dLeft,dTop,LeftMax,TopMax);
	}
	if(doScrolling)
		doScrolling = setTimeout('Scrolling("'+Scroller+'","'+LayerScroll+'",'+dLeft+','+dTop+','+LeftMax+','+TopMax+',"'+rel1+'","'+rel2+'")',20);
}

function stdScrollTo(Scroller,LayerScroll,dLeft,dTop,LeftMax,TopMax)
{
	var cLeft, cTop;
if(dom){
	cLeft = parseInt(document.getElementById(LayerScroll).style.left)+parseInt(dLeft); 
	cTop = parseInt(document.getElementById(LayerScroll).style.top)+parseInt(dTop);
	if(cLeft > 0)cLeft=0;
	if(cTop > 0)cTop=0;
	if(LeftMax&&cLeft < LeftMax)cLeft=LeftMax;
	if(TopMax&&cTop < TopMax)cTop=TopMax;
	document.getElementById(LayerScroll).style.left = cLeft+'px';
	document.getElementById(LayerScroll).style.top = cTop+'px';
}else if(ie4){
	cLeft = parseInt(document.all[LayerScroll].style.left)+parseInt(dLeft); 
	cTop = parseInt(document.all[LayerScroll].style.top)+parseInt(dTop);
	if(cLeft > 0)cLeft=0;
	if(cTop > 0)cTop=0;
	if(LeftMax&&cLeft < LeftMax)cLeft=LeftMax;
	if(TopMax&&cTop < TopMax)cTop=TopMax;
	document.all[LayerScroll].style.left = cLeft+'px';
	document.all[LayerScroll].style.top = cTop+'px';
}else if(nn4){
	cLeft = document.layers[Scroller].document.layers[LayerScroll].left + parseInt(dLeft);
	cTop = document.layers[Scroller].document.layers[LayerScroll].top + parseInt(dTop);
	if(cLeft > 0)cLeft=0;
	if(cLeft > 0)cLeft=0;
	if(cTop > 0)cTop=0;
	if(LeftMax&&cLeft < LeftMax)cLeft=LeftMax;
	if(TopMax&&cTop < TopMax)cTop=TopMax;
	document.layers[Scroller].document.layers[LayerScroll].left = cLeft;
	document.layers[Scroller].document.layers[LayerScroll].top = cTop;
}
}