var aktiv2 = false;
window.onload = function(){
	if($('picFader')){
		startShow('fade');
		lastPic = $$('.pfPic').length-1;
		aktiv2 = window.setTimeout("startShow()", 500);
	}
	
	/* Logo */
	new Element('a',{
		'id'	:	'logo',
		'href'	:	$$('#navigation li a')[0].getAttribute('href')
	}).inject('base','top');
	
	if($('acc')){
		var accordion = new Accordion('a.atStart', 'div.atStart', {
			opacity: false,
			onActive: function(toggler, element){
				//toggler.setStyle('color', '#3179A8');
			},
			onBackground: function(toggler, element){
				//toggler.setStyle('color', '#003251');
			},
			start : 'all-closed',
			alwaysHide: true
		},$('acc'));
	}
	
	if(! $chk($$('.detailOpen')[0])){
		$$('.news object').setStyle('visibility','hidden');
	}
	
	if($$('#lang_en')){
		if($$('#mp3 span')[0]){
		$$('#mp3 span')[0].innerHTML='Sound on/off';
		}

	}
}

var lastPic = 'none';
function startShow(mode){
	for(a=0; a<10; a++){
		if($('pfPic_'+a)){
			if(mode == 'fade'){
				$('pfPic_'+a).fade(0);
			}
			else{
				$('pfPic_'+a).style.display='block';
			}
		}
	}
	if(aktiv2 != false){
		window.clearTimeout(aktiv2);
		$('picFader').style.background = 'none';
		showPics();
		aktiv = window.setInterval('showPics()', 4000);	
	}
}

function showPics(){
//	if($('pfPic_'+lastPic)){
		if(lastPic != 'none'){
			//$('pfPic_'+lastPic).fade(0);
			$('pfPic_'+lastPic).set('morph',{duration:2000}).morph({opacity:0});

		}
		else{
			lastPic = 0;
		}
		var newID = lastPic+1;
		if($('pfPic_'+newID)){
			lastPic = newID;
			$('pfPic_'+newID).set('morph',{duration:2000}).morph({opacity:1});
		}
		else{
			lastPic = 0;	
			$('pfPic_'+lastPic).set('morph',{duration:2000}).morph({opacity:1});
		}
//	}
}

openNews = {};
var lastID;
function showNews(id){
	if(openNews[id] != true){
		

		$$('#news_'+id+' object')[0].setStyle('visibility','visible');
		$('newsLink_'+id).innerHTML = 'schlie&szlig;en';
		if(typeof($$('.L1')[0]) != 'undefined'){
			$('newsLink_'+id).innerHTML = 'close';
		}
		openNews[id] = true;
		if(lastID != null){
			$('newsLink_'+lastID).innerHTML = 'mehr &raquo;';
			if(typeof($$('.L1')[0]) != 'undefined'){
				$('newsLink_'+lastID).innerHTML = 'more &raquo;';
			}
		}
	}
	else{
		$$('#news_'+id+' object')[0].setStyle('visibility','hidden');
		$('newsLink_'+id).innerHTML = 'mehr &raquo;';
		if(typeof($$('.L1')[0]) != 'undefined'){
			$('newsLink_'+id).innerHTML = 'more &raquo;';
		}
		openNews[id] = false;
	}
	lastID = id;
}