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.setBackingList = function(array)
	{
		this._backingList = array;
	}
	
	this.setUiViewComponent = function(documentElement)
	{
		this._uiViewComponent = documentElement;
	}
	
	this.setI = function(i)
	{
		this._i = i;
	}
	
	this.scrollList = function()
	{
		this._i++;
		// We mod over the list so that it appears to be a never-ending list.
	    var id = this._i % this._backingList.length;
	    var obj = this._backingList[id];
	    
	    var newRow = "<div class=\"blog\" 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);
			}
		}
	}
}