var i=1 var movingleft = 'n' var movingright = 'n' var contwidth = 120 var visboxes = 3 var visresults = 3 var imagesperbox = 1 var movespeed = 6 var maxboxes = 13 var totalimages = 13 var totalwidth = contwidth*visboxes var rightshift = totalwidth + (contwidth * (maxboxes-visboxes-1)) var j= maxboxes var kk = 1 var start = (i*visresults) function moveLeft() { kk=1 if (j== (maxboxes- visboxes)) { movingright = 'y'; } if ((i == 1) && ((j-i) < visboxes)) { movingright = 'y'; } //moves all divs to the left if (movingright != 'y') { movingleft = 'y'; var boxArray = new Array() while (kk <= maxboxes) { boxArray[kk] = document.getElementById("mb"+kk) kk++ } if (parseInt(boxArray[i].style.left) > -contwidth) { kkk = 1 while (kkk <= maxboxes) { boxArray[kkk].style.left=parseInt(boxArray[kkk].style.left)-movespeed+"px" kkk++ } setTimeout("moveLeft()",30) } else { //move the left most box to the right boxArray[i].style.left=rightshift+"px" i++; if (i > maxboxes) i=1; if (i == 1) { j= maxboxes } else { j= (i-1) } refreshTotal(); movingleft = 'n'; return } } } function refreshTotal() { start = (((i-1)*imagesperbox)+1); end = start+visresults-1; if (end > totalimages) { end = totalimages; } var realtotal = totalimages if (realtotal >0) { //document.getElementById("status").innerHTML = "Results "+start+"-"+end+" of "+totalimages+""; } else { //document.getElementById("status").innerHTML = "Sorry, no results found."; } } function moveRight() { //moves all divs to the left if (((i == 1) && ((j-i) <= visboxes)) || (i == 1)) { movingleft = 'y'; } if (movingleft!= 'y') { kk=1 movingright = 'y'; var boxArray = new Array() while (kk <= maxboxes) { boxArray[kk] = document.getElementById("mb"+kk) kk++ } if ( parseInt(boxArray[j].style.left)>= contwidth ) { boxArray[j].style.left= -contwidth+"px" } if (parseInt(boxArray[j].style.left)< 0 ) { kkk=1 while (kkk <= maxboxes) { boxArray[kkk].style.left=parseInt(boxArray[kkk].style.left)+movespeed+"px" kkk++ } setTimeout("moveRight()",30) } else { //move the right most box to the left //boxArray[maxboxes-i+1].style.left=-contwidth+"px" if (i == 1) i=maxboxes else i-- if (i == 1) { j= maxboxes } else { j= (i-1) } //document.getElementById("status").innerHTML = " i = "+i+" j = "+j; movingright = 'n'; refreshTotal(); return } } }