var oldImage = 0;
var curImage = 0;
var globalScope = new Array();

function showRandom()
{
    this.uniqueId =  "randomImagePicker";
    
    if( document.all )
    {
       /* IE */
       globalScope[ this.uniqueId ] = this;
	   setInterval( 'ieIntervalHandler("' + this.uniqueId + '","pickRandom")', randomTimeOut );
    }
    else
    {
      /* Mozilla */
      this.timer = setInterval ( function( that ) { that.pickRandom(); }, randomTimeOut, this );
    }
}

function pickRandom()
{
	if ( document.getElementById( "random" ) )
	{
    	while (curImage == oldImage)
    	{
    		curImage = Math.floor( Math.random() * randomImages.length );
    	}
    	oldImage = curImage;

        document.getElementById( "random" ).style.background = "url(" + randomImages[curImage] + ") no-repeat left top;";
        
        if ( document.all )
        {
            alphaBackgrounds();
        }
	}
}

function ieIntervalHandler( id, strFunc )
{
	var scope = globalScope[id];
	eval( "scope." + strFunc + "()" );
}
