var currentAnimation=null;

function fadeMenue(aktuelleNode){
	var anims=[];

	// Bereits geöffnet?
	if(dojo.style(aktuelleNode, "display")!="none") {
		return;
	}

	// Laufende Animation anhalten
	if(currentAnimation!=null) {
		if(currentAnimation && currentAnimation.status() == "playing"){
			currentAnimation.stop();
		}
	}

	// Aufklappen
	anims.push(
		dojo.fx.wipeIn({
			node:aktuelleNode,
			duration:1000
		})
	);

	// Menü durchsuchen
	dojo.query("*[id^='submenue_']","menue").forEach(
		function(domNode) {
			// Aktuellen Eintrag nicht prüfen
			if(domNode.id!=aktuelleNode) {
				// Wenn bereits zu, dann nichts machen
				if(dojo.style(domNode.id, "display")!="none") {
					// Zuklappen
					anims.push(
						dojo.fx.wipeOut({
							node:domNode.id,
							duration:1000
						})
					);
				}
			}
		}
	);

	// Animation abspielen
	currentAnimation=dojo.fx.combine(anims);
	currentAnimation.play();
}

// Bilder im Kopf welchseln
setTimeout("headerInit()", 4000);
setInterval(function() { headerSwitch() }, 5000);

var picMax;
var picCurrent;
var picList;

function headerInit(){
	var i=0;

	// Bilder holen und Werte initaialisieren
	picList=dojo.query(".container_flash_pic","container_flash");
	picMax=picList.length;
	picCurrent=picMax;

	// Wenn das erste mal aufgerufen wird, dann restliche Bilder ausblenden
	for(i=0; i<picMax-1; i++) {
		dojo.style(picList[i].id, "display", "block");
		dojo.fadeOut({ node:picList[i].id, duration:1 }).play();
	}
}

function headerSwitch(){
	var outNr=picCurrent;
	picCurrent++;
	if(picCurrent>picMax) picCurrent=1;
	var inNr=picCurrent;

	var animOut = dojo.fadeOut({ node:picList[outNr-1].id, duration:1000 });
	var animIn = dojo.fadeIn({ node:picList[inNr-1].id, duration:1000 });
	dojo.fx.combine([animOut,animIn]).play();
}

// ***************************
// *** Sonstige Funktionen ***
// ***************************

function P7_OpResizeFix(a) { //v1.1 by PVII
if(!window.opera){return;}if(!document.p7oprX){
 document.p7oprY=window.innerWidth;document.p7oprX=window.innerHeight;
 document.onmousemove=P7_OpResizeFix;
 }else{if(document.p7oprX){
  var k=document.p7oprX-window.innerHeight;
  var j=document.p7oprY - window.innerWidth;
  if(k>1 || j>1 || k<-1 || j<-1){
  document.p7oprY=window.innerWidth;document.p7oprX=window.innerHeight;
  location.reload();}}}
}
P7_OpResizeFix();

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
