//var teaserUrl = "http://system.legermuseum.nl/get"  + "?site=" + siteAlias + "&page_alias=teaser";

var teaser = {
	url: site_root + "get?site=" + siteAlias + "&page_alias=teaser",
	div: "teaserDiv",
	timer: randomizerTimer || 30,
	start: null,
	updater: null
};

Event.observe(window, "load", function() {
	//Delay adding teaser updater
	teaser.start = setTimeout(function() {
		teaser.updater = new Ajax.PeriodicalUpdater(teaser.div, teaser.url + "&code=" + Math.random(), {
			method: "get",
			frequency: teaser.timer
		});
	}, teaser.timer * 1000);
});

Event.observe(window, "unload", function() {
	//Delete timers on window unload
	if (teaser.start !== null && teaser.updater === null) {		
		clearTimeout(teaser.start);		
	} else if (teaser.updater !== null) {		
		teaser.updater.stop();		
	}
});

/*
function actionReload() {
	keepAlive();
	refresh();
}

var keepAliveTimer = -1;
function keepAlive() {
	if (keepAliveTimer!=-1) clearTimeout(keepAliveTimer);
	keepAliveTimer = window.setTimeout("actionReload()", randomizerTimer*1000);
}

function refresh() {			
	new Ajax.Updater(holderDiv, teaserUrl + "&code=" + Math.random());
}

keepAlive();
*/
