/**
 *		Startanimation 
 */
function KKAnimation() {

	
	this.calcScreenData = function() {
		
		try {
			
			var viewport = document.viewport.getDimensions(); 

			return {
					windowWidth		: viewport.width - 40 - 40,		
					windowHeight	: viewport.height- 40 - 40	 
			};
		
		
		} catch(e) { alert("Fehler: calcScreenData() !"); }
	
	}
	
	
	
	// Einstellungen für ImageControl-Komponente setzen
	this.initComponent = function() {
		
		
		
		
		
		// BODY-Objekt
		var elem = document.getElementsByTagName("body")[0];
		if(elem) this.body = elem;
		else {
			alert("ERROR: Es wurde kein BODY-Tag im Dokument gefunden !");
			return;
		}
		
		//Mainframe-DIV
		elem = this.body.select("#mainframe")[0];
		if(elem) this.mainframe = elem;
		else {
			alert("ERROR: Es wurde kein Mainframe-DIV gefunden !");
			return;
		}
		

		//kleines Logo
		elem = this.body.select("#logo")[0];
		if(elem) this.logo = elem;
		else {
			alert("ERROR: Es wurde kein Logo-DIV gefunden!");
			return;
		}
		this.logo.setStyle({visibility:"hidden"});
		new Effect.Opacity("logo", { from: 1.0, to: 0.0, duration: 0.0 });
		
		
		//IMG-Tag für großes Anilogo erstellen
		this.anilogoimg = new Image();
		this.anilogoimg.src = _fw.documentroot + "img/logo_gross.png";
		
		
		
		this.anilogo = document.createElement("img");
		this.anilogo.id = "anilogo"
		
		//großes Logo vorladen 
		var intv = window.setInterval( function() {
			if(ani.anilogoimg.complete == true) {
				window.clearInterval(intv);
				startAnimation();
			}
		},150);
		
		
		
		
		
		//Header des Mainmenus, welche animiert werden
		elem = this.body.select(".mainmenu");
		if(elem)
			for(var a=0; a<elem.length; a++) {
				elem[a].setStyle({visibility:"hidden"});
				new Effect.Opacity(elem[a].id, { from: 1.0, to: 0.0, duration: 0.0 });
				this.menu.push(elem[a]);
			}
		else {
			alert("ERROR: Keine Menü-Elemente gefunden!");
			return;
		}
		
		
		
		
		
		
		
		function startAnimation() {
			
			var scr = ani.calcScreenData();
			
			ani.anilogo = ani.anilogoimg;
			ani.anilogo.id = "anilogo";
			ani.anilogo.setStyle({ height: scr.windowHeight+"px", width: Math.round(scr.windowHeight * (1251/1516))+"px", position:"absolute", top:"-5000px" });
			
			ani.mainframe.appendChild(ani.anilogo);
			new Effect.Opacity(ani.anilogo.id, { from: 1.0, to: 0.0, duration: 0.0 });
			
			window.setTimeout(function() {
				ani.anilogo.setStyle({top:"0px"});
				new Effect.Opacity(ani.anilogo.id, { from: 0.0, to: 1.0, duration: 0.4 });
			},250);
			
			//großes Logo wieder ausblenden
			window.setTimeout(function() {
				new Effect.Opacity(ani.anilogo.id, { from: 1.0, to: 0.0, duration: 0.8 });
			},1500);
			
			
			//ausgeblendetes kleines Logo und Menüitems wieder sichtbar machen
			ani.logo.setStyle({visibility:"visible"});
			for(var a=0; a<ani.menu.length; a++) {
				ani.menu[a].setStyle({visibility:"visible"});
			}
			
			
			//kleines Logo wieder einblenden
			window.setTimeout(function() {
				new Effect.Opacity(ani.logo.id, { from: 0.0, to: 1.0, duration: 0.8 });
			},2800);

			//Fotografie-Menuitem
			window.setTimeout(function() {
				//new Effect.Move(ani.menu[0].id, { x: 195, y: 0, mode: 'relative' });
				new Effect.Opacity(ani.menu[0].id, { from: 0.0, to: 1.0, duration: 0.5 });
			},3300);

			//Information-Menuitem
			window.setTimeout(function() {
				//new Effect.Move(ani.menu[1].id, { x: 195, y: 0, mode: 'relative' });
				new Effect.Opacity(ani.menu[1].id, { from: 0.0, to: 1.0, duration: 0.5 });
			},3900);

			//Lightbox-Menuitem
			window.setTimeout(function() {
				//new Effect.Move(ani.menu[2].id, { x: 195, y: 0, mode: 'relative' });
				new Effect.Opacity(ani.menu[2].id, { from: 0.0, to: 1.0, duration: 0.5 });
			},4500);
			
			
			window.setTimeout(function() {
				top.location.href = "startseite";
			},5350);	
			
		}
		
		
		

		
		
	}
	
	
	
	this.body = {};
	this.mainframe = {};
	this.logo = {};
	this.anilogo = {};
	this.menu = new Array();
	
}
// Nachdem alles im Dokument geladen, Initialisierung und Konfiguration des
// Objektes anstoßen
Event.observe(window,"load",function() {

	this.ani = new KKAnimation();
	
	this.ani.initComponent();

});
