function openbol(x,wid,hei) {

  myWin=open("", x, "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width="+wid+",height="+hei);
  myWin.document.open();
  myWin.document.write("<html><head><title>Photo</title></head>");
  myWin.document.write("<body bgcolor='#FFFFFF' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>");
  myWin.document.write("<script language='JavaScript'>self.focus();<\/script>");
  myWin.document.write("<img src='/img/"+x+".jpg' width='"+wid+"' height='"+hei+"' border='0'>");
  myWin.document.write("</body></html>");
  myWin.document.close();  
}









var dragapproved=false

var z,x,y,sd,speed,n;

var limit = 294;   //sama dlina memezka



function moveTo(sd){



	if (sd>=0&&sd<=limit){

		z.style.top=sd;

		speed = -actualHeight/limit;

		document.all.scrolldiv.style.top=sd*speed;

		to=sd*speed;

		return false;

	}



}



function move(){



if (event.button==1&&dragapproved&&dragapproved2) {



	if (event.clientY<10){

		n=0;

		moveTo(n);

	} else if (event.clientY>600){

		n=limit;

		moveTo(n);

	} else {

		n=temp1+event.clientY-x;

		moveTo(n);

	}



	return false

}



}



function drags(){



if (event.srcElement.className=="drag"){



	dragapproved=true

	z=event.srcElement

	temp1=z.style.pixelTop

	x=event.clientY

}



}



document.onmousemove=move

document.onmousedown=drags

document.onmouseup=new Function("dragapproved=false")





var to = 0;

var scrollTimer;

var actualHeight;

var dragapproved2=false;



function Load() {

if (document.all) {

actualHeight=scrolldiv.offsetHeight-220;    //visota scrolla v OPERE

}



if (actualHeight<=0){

dragapproved2=false;

} else {

dragapproved2=true;

}



}





function vverx() {



	if (document.all&&scrolldiv.style.pixelTop>-actualHeight) {

		to=scrolldiv.style.pixelTop;

		to-=2;

		document.all.scrolldiv.style.top=to;

		scrollTimer=setTimeout("vverx()", 20);



		document.all.dgar.style.pixelTop=-to*limit/actualHeight;



	}

}





function vniz() {

	if (document.all&&scrolldiv.style.pixelTop<0) {

		to=scrolldiv.style.pixelTop;

		to+=2;

		document.all.scrolldiv.style.top=to;

		scrollTimer=setTimeout("vniz()", 20);



		document.all.dgar.style.pixelTop=-to*limit/actualHeight;

	}

}



function stopScroll() {

clearTimeout(scrollTimer);

}
