/*
 * Javascript Functions
 *
 * Copyright (c) CLICKSPORTS
 * $Rev$
 * $Author$
 * $Date$
 *
 */

// Set some common attributes
document.observe('dom:loaded', function() {
	
	setScrollTopLinks();
	setImageFlash();
});

function setScrollTopLinks() {
	
	$$('a.scrolltop').each(function(st_link) {

		st_link.observe('click', function(e) {

			elm = Event.element(e);
			Event.stop(e);
			new Effect.ScrollTo('start');
		});

	});
	
}

function setImageFlash() {
	
	fadeTime = 4.0;
	elm = $('image_teaser');
	imgs = elm.select('img');
	counter = imgs.length;

	if (counter > 1) {
		imgs.invoke('hide');
		imgs[0].show();
		i = 0;
		setInterval("imageFlash(counter, imgs)", 4000);
	}
}

function imageFlash(end, Slides) {

	new Effect.Fade(Slides[i], { duration: 2.0 });

	if (i == end-1) i = 0;
	else i++;

	new Effect.Appear(Slides[i], { duration: 2.0 });
}
