
			// start as -1, it will be set for the first time in the function below.  If we tried to
			// set it now, it wouldn't be right in IE.
			var startY = -1;
			
			// Need to keep track of the last several scroll positions, so we can detect when they are
			// done scrolling. Yea this is kind of a hacky way to do it, we should really come up with a proper timer.
			var last_pY = -1;
			var second_last_pY = -1;
			var third_last_pY = -1;
			
			window.adjustMovingDiv=function()
			{

				var autoMovingDiv = document.getElementById('autoMovingDiv');
				if (startY == -1) {
					startY = findPosY(autoMovingDiv);
					//alert('Just set startY to ' + startY);
				}
				
				var ns = (navigator.appName.indexOf("Netscape") != -1);	
				var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body;
				var pY = ns ? window.scrollY : iebody.scrollTop;
				
				if (ns) moveDivisor = 1.2;  // need to move faster for FF, it doesn't look good otherwise.
				else    moveDivisor = 2;
				
				// if the current scroll position has been the same for the last 3 checks, then assume they are done scrolling
				if (last_pY == pY  && second_last_pY == pY && third_last_pY == pY) {
					var currentY = findPosY(autoMovingDiv);
					
					// the distance we need to move is calculated by looking at the current scroll position
					// and subtracting the current position of the element
					distanceToMove = pY - currentY;
					origDistanceToMove = distanceToMove;
					
					// we only move a portion of the total distance required each time, this makes it look smooth			
					distanceToMove = parseInt(distanceToMove / moveDivisor);
								
					// now we can set the point we need to move to.  Need to offset for the elements starting position.
					needToMoveTo = currentY + distanceToMove - startY;

					// but we don't want to move it up past its original starting point.
					if (needToMoveTo < 0) needToMoveTo = 0; 
					else needToMoveTo += 1; // else add a little margin
	
					// then finally move it
					autoMovingDiv.style.top = needToMoveTo + "px";
				}
				third_last_pY = second_last_pY;
				second_last_pY = last_pY;
				last_pY = pY;
				
				// call this function again in a few milliseconds
				setTimeout(adjustMovingDiv, 30);
			}
	
			// function to return the Y position of an element.
			  function findPosY(obj)
			  {
			    var curtop = 0;
			    if(obj.offsetParent)
			        while(1)
			        {
			          curtop += obj.offsetTop;
			          if(!obj.offsetParent)
			            break;
			          obj = obj.offsetParent;
			        }
			    else if(obj.y)
			        curtop += obj.y;
			    return curtop;
			  }
			 
function addOnload(myfunc) {
	if(window.addEventListener)
		window.addEventListener('load', myfunc, false);
	else if(window.attachEvent)
		window.attachEvent('onload', myfunc);
	}

// added check for small screens
if (screen.height > 768) {
	addOnload(adjustMovingDiv);
}