isIE = navigator.appVersion.indexOf("MSIE") >= 0 ? true : false;

/**
 * A ViewPort is just an animated list-like thingy.  Depends upon the
 * Scriptaculous and Prototype javascript effects libraries.
 */
function ViewPort(size)
{
	this._i = 0;
	this._viewPortSize = size;
	this._backingList = new Array();
	this._uiViewComponent = document;
	this._lastItem = "0"//add
	
	this.setLastItem = function(item)
	{
		this._lastItem = item;
	}
	
	this.setBackingList = function(array)
	{
		this._backingList = array;
	}
	
	this.setUiViewComponent = function(documentElement)
	{
		this._uiViewComponent = documentElement;
	}
	
	this.setI = function(i)
	{
		this._i = i;
	}
	
	this.scrollList = function()
	{
	    var obj = this._backingList.pop();
	    
	    if(null != obj)
	    {
			this._i++;
			var id = this._i % this._backingList.length;
			
			var newRow = "<div class=\"singleBeat\" style=\"display: none;\" id=\"" + 
	    		this._i + "\">" + obj + "</div>";
	        
			new Insertion.Top(this._uiViewComponent, newRow);
		    
			var appearMe = document.getElementById(this._i);
			
			if (null != appearMe)
			{
				if (isIE)
				{
					new Effect.Appear(appearMe.id);
				}
				else
				{
					new Effect.SlideDown(appearMe.id);
				}
			}
		    
			var fadeMeId = this._i - this._viewPortSize;
		    
			var fadeMe = document.getElementById(fadeMeId);
		    
			if (null != fadeMe)
			{
				if (isIE)
				{
					new Effect.Fade(fadeMe.id);
				}
				else
				{
					new Effect.SlideUp(fadeMe.id);
				}
			}
		}
	}
}