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 = "00:00:00"
	
	this.setLastItem = function(item)
	{
		this._lastItem = item;
	}
	
	this.pushItem = function(singleItem)
	{
		this._backingList.push(singleItem);
	}
	
	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 id = this._i;
		//We mod over the list so that it appears to be a never-ending list.
	    //var id = this._i % this._backingList.length;
	    //alert(id);
	    //alert(this._i);
	    
	    if(this._backingList!=null){
			if(this._backingList.length>0){
				this._i++;
				var id = this._i;
				var obj = this._backingList.pop();
				var newRow = "<div class=\"blogupdate\" 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);
					}
				}
			}
		}
	}
}