function imgMouseOverEvents(outString, overString, selector) {
	$$(selector).each(function(image) {
		image = $(image);
		if (image.hasClass('active'))
			{
			// set active
			if ($type(image.src)) image.src = image.src.replace(outString, overString);
			}
			
		if ($type(image.src)) {
			if (image.src.indexOf(outString) > 0) {
				image.addEvent('mouseenter',function(){
					image.src = image.src.replace(outString, overString);
				}).addEvent('mouseleave', function(){
					image.src = image.src.replace(overString, outString);
				});
			}
		}
	});
};
var activecat = 'start';

function catswap(newactive) {
	$(newactive).addClass('active');
	$(newactive).removeEvents('mouseleave');
	if(!(activecat == 'start')) {
		$(activecat).removeClass('active');
		$(activecat).setProperty('src', 'images/tnav/'+activecat+'_en_off.png');
		$(activecat).cloneEvents($(newactive));
	}
	$('th_'+activecat).setStyle('display', 'none');
	$('th_'+newactive).setStyle('display', 'block');
	activecat = newactive;
}

function switchtodefault() {
	$('intro_video').setStyle('display', 'none');
	$('intro_content').setStyle('display', 'block');
}

function gwsteps(mode) {
	if(mode == 2) {
		$('gw_introtext').setStyle('display','none');
		$('gw_regeln').setStyle('display','block');
	}
	if(mode == 3) {
		$('gw_regeln').setStyle('display','none');
		$('gw_frame').setStyle('display','none');
		$('gw_reg').setStyle('display','block');
		$('gw_teilnahmebed').setStyle('display','block');
	}
}

window.addEvent('domready', function(){
	imgMouseOverEvents('_off', '_on', 'div.catnav img, div#nav img');
	
	if($('spp_acc')) {
		var accordion = new Accordion('div.spp_hl', 'div.spp_text', {
			opacity: true,
			alwaysHide: true,
			show: 0,
			duration: 700,
			onActive: function(toggler) { toggler.setStyle('background-image', 'url(images/spp_hl_on.gif)'); },
			onBackground: function(toggler) { toggler.setStyle('background-image', 'url(images/spp_hl_off.gif)'); }
		}, $('spp_acc'));
	}
	

});