var he1=320;
var he2=25;
var he3=49;
var nh=null;
var gl=null;
var kra=null;
var sh=5;
var nm = null;
var tm = null;
var nach=0;
var py;
var ny;
ie=window.navigator.appName == "Microsoft Internet Explorer";
document.onmousedown=cl;
document.onmouseup=up;
document.onmousemove=mo;

function prl(){
	nm = document.getElementById('rol');
	tm = document.getElementById('pol');
	nach=nm.offsetTop;
}

function mo(evnt){
	py=ny;
	if(ie){ny=event.clientY;}else{ny=evnt.clientY;}
	if(gl){
		if(gl.id=="ro" || gl.id=="ro1"){
			if(py>=ny && ny<he1+nach+he2){
				stv=parseFloat(nm.style.top)-py+ny;
				if (stv<0){stv=0;}
				nm.style.top=stv;
			}

			if(py<=ny && ny>nach+he2){
				stv=parseFloat(nm.style.top)-py+ny;
				if (stv>he1-he3-46){stv=he1-he3-46;} 
				nm.style.top=stv;
			}
		tecpr=parseFloat(nm.style.top)/(he1-he3-46);	
		stv=Math.ceil(tecpr*(tm.offsetHeight-he1));
		tm.style.top=-stv;
		}
		else{
			up();
		}
	}
}

function cl(evnt){
	if(!nm ||!tm){prl();}
	if(ie){gl = window.event.srcElement;}else{gl = evnt.target;}
	if(gl.id=="sc1" || gl.id=="sc2"){
		nh=setTimeout("scr()",1);
	}
	if(gl.className=="m"){
		if(kra){kra.style.color="58585A";}
		kra=gl;
		kra.style.color="ED7D01";
	}

}

function up(){
	clearTimeout(nh);gl=null;
}

function scr(){
	clearTimeout(nh);
	if(gl.id=="sc1" && parseFloat(tm.style.top)<0){
		stv=parseFloat(tm.style.top)+sh;
		tm.style.top=stv;
	}

	if(gl.id=="sc2" && parseFloat(tm.style.top)>-tm.offsetHeight+he1){
		stv=parseFloat(tm.style.top)-sh;
		tm.style.top=stv;
	}
	tecpr=-parseFloat(tm.style.top)/(tm.offsetHeight-he1);	
	stv=Math.ceil(tecpr*(he1-he3-46));
	if(stv<0){stv=0;}if(stv>he1-he3-46){stv=he1-he3-46;}
	nm.style.top=stv;
	nh=setTimeout("scr()",50);
}

function scrz(y){
	stv=document.getElementById(y);
	tm.style.top=-stv.offsetTop;
	tecpr=-parseFloat(tm.style.top)/(tm.offsetHeight-he1);	
	stv=Math.ceil(tecpr*(he1-he3-46));
	if(stv<0){stv=0;}if(stv>he1-he3-46){stv=he1-he3-46;}
	nm.style.top=stv;
}
