




function moveThumbs() {
	//Keep on moving the thumbnails till the target is achieved
	if(y!=dest_y) y = y + interval;

	//Move the image to the new location
	document.getElementById("thumbholder").style.top  = y+'px';
	whereyis = y+interval;
	if (y+interval != dest_y) {
		//Keep on calling this function every 2 microsecond 
		//	till the target location is reached
		window.setTimeout("moveThumbs()",2);
		}
	else {
		if (window.whichway == "prev") 
			{
			window.newrow = window.currentrow - 1;}
		if (window.whichway == "next") {window.newrow = window.currentrow + 1;}
		if (window.newrow==2) 
			{
			var upspan = document.createTextNode('\u2191up');
			prbutt = document.getElementById('prevbutton');
			while (prbutt.childNodes[0]) {
    			prbutt.removeChild(prbutt.childNodes[0]);
				}
			prbutt.appendChild(upspan);
			previousbutton = false;
			}
		else 
			{
			var uplink = document.createElement("a");
			uplink.setAttribute('href','#');
			uplink.setAttribute('onclick','morethumbs(\'prev\', ' + newrow + ', ' + numrows + ');');
			uplink.innerHTML = '&uarr;up';
			prbutt = document.getElementById('prevbutton');
			while (prbutt.childNodes[0]) {
    			prbutt.removeChild(prbutt.childNodes[0]);
				}
			prbutt.appendChild(uplink);
			previousbutton=true;
			}
		if (window.newrow==window.numrows) 
			{
			thenextbutton=false; 
			document.getElementById('nextbutton').innerHTML="&darr;down";
			}
		else 
			{
			var downlink = document.createElement("a");
			downlink.setAttribute('href','#');
			downlink.setAttribute('onclick','morethumbs(\'next\', ' + newrow + ', ' + numrows + ');');
			downlink.innerHTML = '&darr;down';
			nxbutt = document.getElementById('nextbutton');
			while (nxbutt.childNodes[0]) {
    			nxbutt.removeChild(nxbutt.childNodes[0]);
				}
			nxbutt.appendChild(downlink);
			thenextbutton=true;
			}
		}
}

function morethumbs(whichway, currentrow, numrows)
	{
	window.whichway=whichway;
	window.currentrow=currentrow;
	window.numrows=numrows;
	interval = 1;
	if (whichway=="prev") 
		{
		var thumbmod = 0;
		}
		
	if (whichway=="next") 
		{
		var thumbmod = -0;
		interval = -interval;
		}
	
	y = document.getElementById("thumbholder").offsetTop;
	window.dest_y = y + thumbmod;
	moveThumbs();
	document.getElementById("prevbutton").innerHTML="&uarr;up";
	document.getElementById("nextbutton").innerHTML="&darr;down";
	}
	


