function logoitem(img, uri, delay, margin) {
	this.img = img;
	this.uri = uri;
	this.delay = delay;
	this.margin = margin;
}

function logolist(id, interval) {
	this.el = document.getElementById(id);
	this.list = new Array();
	this.total = 0;
	this.interval = interval;
}

logolist.prototype.add = function(img, uri, delay, margin) {
	this.list.push(new logoitem(img, uri, this.total, margin));
	this.total = this.total + delay;
}

logolist.prototype.start = function() {
	var me = this;
	this.current = -1;
	this.update();
	this.timer = setInterval(function() { me.update() }, this.interval);
}

logolist.prototype.update = function() {
	var l = this.list.length;
	var slot = Math.floor(new Date().getTime() / this.interval) % this.total;
	for(var i=l-1; i >= 0; i--) {
		var logo = this.list[i];
		if(slot >= logo.delay) {
			if(this.current == i)
				return;

			var extra = "";
			if(logo.margin > 0)
				extra = " style=\"margin-top: " + logo.margin + "px;\"";

			this.el.innerHTML="<a href=\"" + logo.uri + "\" target=\"_blank\"><img src=\"" +
				logo.img + "\"" + extra + " alt=\"\" border=\"0\"/></a> ";

			this.current = i;
			return;
		}
	} 
}

var logos = new logolist("sponsorlogo", 3000);
logos.add("/static/archery-dynamics.gif", "http://www.archery-dynamics.com", 1, 0);
logos.add("/static/chessconsult.gif", "http://www.chessconsult.be", 1, 0);
logos.add("/static/cv-warehouse.gif", "http://www.cvwarehouse.com", 1, 13);
logos.add("/static/fun.gif", "http://www.fun.be", 1, 0);
logos.add("/static/novotea.gif", "http://www.novotea.com", 1, 0);
logos.add("/static/oce.gif", "http://www.oce.be", 1, 0);
logos.add("/static/ofd.gif", "http://olfossedouth.com", 1, 0);
logos.add("/static/real.gif","mailto:dominique.real@swing.be", 1, 20);
logos.add("/static/thyssenkrupp.gif", "http://www.thyssenkrupp.be", 1, 0);

logos.start();

