$(document).ready(function() {
	oIndexpage = new indexpage();
	oIndexpage.fetchLatestScenes($("input[name=results]").val(), $("input[name=outOf]").val());
});

function indexpage()
{
	var timerID = null;
	var timerRunning = false;
	var delay = 15000;

	this.fetchLatestScenes = function(amt, of)
	{
		amt == undefined ? amt = 4 : amt = amt;
		of == undefined ? of = 20 : of = of;
		
		var that = this;
		oAjax.get(
				'/ajax/scenes/indexnewest/',
				{amount: amt, outOf: of},				
				function(oData) { that.reloadLatestScenes(oData); }
			);
		//this.startTimer();
	};
	
	this.reloadLatestScenes = function(sSnippet)
	{
		oIndexActivity.geoAnimate(sSnippet, undefined, 'indexnewest');		
	};	
	
	this.startTimer = function()
	{
		that = this;
		timerID = self.setTimeout('that.fetchLatestScenes($("input[name=results]").val(), $("input[name=outOf]").val())', delay);
	};
}