

function doEffect(nr){
	switch(nr){
		case 0:	Effect.Pulsate('plane', { pulses: 12, duration: 4 });break;
		case 1:	Effect.Pulsate('karneval', { pulses: 12, duration: 4 });break;
		case 2:	
		vcontrol.hideVideo()
		$('hangar').appear();
		
		break;
		
		doEffect(2)
	}
}


function VIDEO(file) {
	this.name=file;
	this.isLoop=false;
	this.x=148;
	this.y=320;
	this.width=620;
	this.height=338;
	this.action=false;
	this.stopAction="";
	this.showtime=false;
	this.triggerActions=new Array();
	
	
	
}
VIDEO.prototype.move= function(a,b) {
	this.x=a;
	this.y=b;
	
}
VIDEO.prototype.scale= function(w,h) {
	this.width=w;
	this.height=h;
	
}

function VIDCONTROL(c) {
	this.container=c;
	this.vids=new Array();
	this.vids.push(new VIDEO("StillAir_Button_Final_small.flv"));//intro
	this.vids[0].isLoop=true;
	//this.vids[0].showtime=true;	
	this.vids[0].loopFrom=1; // Sekunde    isloop muss true!
	this.vids[0].loopTo=6; // Sekunde
	this.vids[0].move(300,100);
	this.vids[0].scale(920,500);
	this.vids[0].stopAction=this.vids[0].action="top.location='index.php?page=1&v=1'";
	
	this.vids.push(new VIDEO("Rubriken_Final_Ton_small.flv"));//erklärung
	
	//this.vids[1].showtime=true;	
	this.vids[1].action="top.location='index.php?page=1&v=3'";
	this.vids[1].trigger='12,20';  // bei diesen sekunden wird swfTrigger(sec) aufgerufen
	this.vids[1].triggerActions[12]="doEffect(0)"
	this.vids[1].triggerActions[20]="doEffect(1)"
	this.vids[1].stopAction="top.location='index.php?page=4'"
	

	this.vids.push(new VIDEO("2010-02-10_Hangar.flv"));//hangar
	this.vids[2].action="doEffect(2)"
	this.vids[2].trigger='9';  // bei diesen sekunden wird swfTrigger(sec) aufgerufen
	//this.vids[2].showtime=true;	
	this.vids[2].triggerActions[9]="doEffect(2)"
	this.vids[2].startAction="setTimeout(\"$('videoback').show();\",1000)"

	this.vids.push(new VIDEO("StillAir_04_small.flv"));//männchen
	this.vids[3].isLoop=true;
	this.vids[3].width=400;
	this.vids[3].x=360;
	this.vids[3].action="top.location='index.php?page=1&v=1'";
	
}

VIDCONTROL.prototype.setActiveVideo= function(nr) {
	this.activeVideo=this.vids[nr];
}



VIDCONTROL.prototype.showVideo = function() {
	this.container.setStyle( {	
		display : 'block',
		left:this.activeVideo.x,
		top:this.activeVideo.y,
		width:this.activeVideo.width,
		height:this.activeVideo.height
	});
}

VIDCONTROL.prototype.hideVideo = function() {
	this.container.setStyle( {	
		display : 'none'
	});
}

VIDCONTROL.prototype.trigger = function(sek) {
	if (this.activeVideo.triggerActions[sek]){
		eval(this.activeVideo.triggerActions[sek])
	}
	//else alert("video "+this.activeVideo.name+" trigger at "+sek)
	
}


VIDCONTROL.prototype.click= function() {
	if (this.activeVideo.action){
		eval(this.activeVideo.action)
	}
	//else alert("video "+this.activeVideo.name+" clicked")
}


VIDCONTROL.prototype.stop= function() {
	this.hideVideo();
	if (this.activeVideo.stopAction){
			eval(this.activeVideo.stopAction)
	}
	//else alert("video "+this.activeVideo.name+" stopped")
	
}


VIDCONTROL.prototype.startVideo = function(nr) {
	this.setActiveVideo(nr);
	this.showVideo();

	
	if (AC_FL_RunContent == 0) {
		alert("Diese Seite erfordert die Datei \"AC_RunActiveContent.js\".");
	} else {
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
			'width', '100%',
			'height', '100%',
			'src', 'video/stillair',
			'quality', 'best',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'id', 'StillAir',
			'bgcolor', '#ffffff',
			'name', 'StillAir',
			'menu', 'true',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
			'movie', 'video/stillair?'+(this.activeVideo.showtime?'showtime=1&':'')+'loop='+(this.activeVideo.isLoop?1:0)+'&loop_from='+this.activeVideo.loopFrom+'&loop_to='+this.activeVideo.loopTo+'&action='+this.activeVideo.trigger+'&flv='+this.activeVideo.name,
			'salign', ''
			); //end AC code
	}

	
}

VIDCONTROL.prototype.doStartAction = function() {
	if (this.activeVideo.startAction){
		eval(this.activeVideo.startAction)
	}

}




function videoStopped() {
		if(vcontrol)vcontrol.stop()
}


function swfClick(){if(vcontrol)vcontrol.click()}

function swfTrigger(sec){
		if(vcontrol)vcontrol.trigger(sec)
	//alert(sec);
}
