var spt = {
	//zet alles in apart object om conflicten te vermijden; naar de naam van dit object wordt ook verwezen in het bestand jsComm.as voor de spotlight.fla
	//nb: naar jQuery wordt verwezen dmv "jQuery" ipv dmv "$" om conflicten met andere libraries te vermijden.
	//de oplossing om alles in een anonymous function te wrappen die je jQuery als parameter meegeeft werkt hier niet, omdat de functie spt.getUpdateFromSpotlight vanuit flash moet worden aangeroepen.  Als alles dan in een anonymous function staat, bestaat het object spt alleen in de scope van die anonymous function, en dan kan flash hem dus niet aanroepen.

	swfId: "spotlightmovie",//id van spotlight swf,
	delay: 500,//vertraging voor aanpassen spotlight bij hover op ankeilers
	
	sendUpdateToSpotlight: function(id) {
		//stuurt array-index van te tonen clip naar spotlight (clip nr 1 heeft id=0)
		var playIndex = id.split("-")[1];
		var swf = document.getElementById(this.swfId);
		if (swf) {
			swf.updateSpotlight(playIndex);
		}
	},
	
	getUpdateFromSpotlight: function(id) {
		//ontvangt array-index van huidge clip van spotlight (clip nr 1 heeft id=0)
		var id = "spotAnkeiler-"+id;
		jQuery("#spotankeilers li").each(function() {
			var currId = jQuery(this).attr("id");
			if (currId == id) {
				jQuery(this).addClass("active");
			} else {
				jQuery(this).removeClass("active");
			}
		});
	},

	initAnkeilers: function() {
		//add mouseenter en click events op li
		jQuery("#spotankeilers li").each(function() {
			jQuery(this).mouseenter(function(e) {
				spt.newId = jQuery(this).attr("id");
				clearTimeout(spt.updateTimer);//evt eerder gesette timer clearen
				spt.updateTimer = setTimeout(spt.update, spt.delay);
			});
			
			jQuery(this).mouseleave(function(e) {
				clearTimeout(spt.updateTimer);//evt eerder gesette timer clearen
			});
			
			var url = jQuery(this).children("a:first").attr("href");
			jQuery(this).click(function(e) {
				window.location = url;
			});
		});
	},
	
	update: function() {
		spt.sendUpdateToSpotlight(spt.newId);
	},
	
	clog: function(msg) {
		//stuurt msg vanuit swf naar firebug console (voor debuggen)
		if (console) {console.log(msg);}
	},
	
	init: function() {
		this.initAnkeilers();
	}
};
spt.init();
