/*****************************************************************************************
	
	Script	:	play intro
	Desc	:	auto play media and repeat on finish
	Author	: 	Reinhold Becze
	
*****************************************************************************************/

function playIntro() {
	var allPlayButtons = $$('.playButton');
	var imgSrc = allPlayButtons[0].getProperty('src');
	var imghtmlTag = '<img class="playButton" src="'+imgSrc+'"/>';
	allPlayButtons[0].dispose();
	
	flowplayer(
		"a.mainIntroPlayer",  
		{
			src: "./swf/flowplayer-3.2.7.swf",
			expressInstall: "./swf/expressinstall.swf",
   		// older versions will see a custom message
			onFail: function(){
				document.getElementById("infoBox").style.display = "block";
				// flashplayer onFail event always inserts a default message into the player container
				// for custom message being visible only, the player container needs to be overwritten again
				$('mainIntro').set('html', imghtmlTag);
			},
			wmode: 'transparent'
		}, 
		{
	  	clip:{
		   		autoPlay: true, 
		      autoBuffering: true,
		      scaling: 'orig'
		  },
			plugins:{
				controls: null
			},
			onBeforeFinish: function(){		// set an event handler in the configuration
        return false;
    	}
		}
	);
	
	flowplayer(
		"a.internationalIntroPlayer",  
		{
			src: "./swf/flowplayer-3.2.7.swf",
			expressInstall: "./swf/expressinstall.swf",
   		// older versions will see a custom message
			onFail: function(){
				document.getElementById("infoBox").style.display = "block";
				// flashplayer onFail event always inserts a default message into the player container
				// for custom message being visible only, the player container needs to be overwritten again
				$('internationalIntro').set('html', imghtmlTag);
			},
			wmode: 'transparent'
		},  
		{
	  	clip:{
		   		autoPlay: true, 
		      autoBuffering: true,
		      scaling: 'orig'
		  },
			plugins:{
				controls: null
			},
			onFinish: function(){
				$('internationalIntro').dispose();
        $('intro').morph({'height': 0, 'border-width': 0});
    	}
		}
	);
}


