
var mainLoaded = false;
var layerLoaded = false;
var layerComplete = false;
var skipIntro = false;

function onSWFLoaded(id)
{
	if (id == "main") mainLoaded = true;
	if(id == "layer") layerLoaded = true;
	startMain();

}

function onLayerComplete()
{	
	layerComplete = true;
	startMain();
}

function startMain()
{   
    var objMain;
	
	if(mainLoaded) 
	{   
		if(layerLoaded && layerComplete || skipIntro != false) 
		{			
            if (layerLoaded && layerComplete){              
                //if ie6
            	if ($.browser.msie == true && $.browser.version == 6)
            		setTimeout(function() {
            	document.getElementById("main").start()
            		}, 500);
            	else
            		document.getElementById("main").start();               
            }
            else
            {               
                startStandaloneMain();                
            }
             
             document.getElementById("layerSWF").style.display = "none";
		}
	}
}

function startStandaloneMain()
{
 if (navigator.userAgent.indexOf("Firefox")!=-1)
 {
    //ffx
 	setTimeout(function() {
 	document.getElementById("main").start()
 	}, 5000);
 }
 else
 {
  //ie
 	setTimeout(function() {
 	document.getElementById("main").start()
 	}, 7000);
    
 }
 //startMain();
}


function launchVideoDebug(){
    console.log('debug add')
    document.forms[0].main.start();
    console.log('debug end')
}

function getMovie(movieName)
{
	var retour;	
	if (navigator.appName.indexOf("Microsoft") != -1) {	    
	    retour = document.forms[0].main;	    
	}
	   else{
	   
	    retour = document[movieName];
	    }
	    
	   return retour;
	    
}
