
var varIdVideo = null;
var TimeoutTrailer = null;

function fecharVideo(divId , idVideo){
	
	varIdVideo = idVideo
	
	// Fechando a div com o Video
	window.document.getElementById(divId).style.display = 'none';
	
	// Parando o Video
	sendEvent('stop');
	
}
	
// Retornando o video que está rodando
function thisMovie(swf) {
	if(navigator.appName.indexOf("Microsoft") != -1) {
		return window[swf];
	} else {
		return document[swf];
	}
};
	
// Enviando o evento para fchar o video
function sendEvent(typ,prm) { 
	if (varIdVideo != null)
		thisMovie(varIdVideo).sendEvent(typ,prm);
};

function executar(divId , idVideo){
	
	varIdVideo = idVideo

	//Exibindo a DIV
	window.document.getElementById('dvTrailer').style.display = 'block';
	
	//Inicializando o vídeo
	TimeoutTrailer = setTimeout("playTrailer()", 800);
	
}

function playTrailer()
{
	try
	{
		clearTimeout(TimeoutTrailer);
		sendEvent('item', '0');
		sendEvent('play', 'true');
	}
	catch(err)
	{
		TimeoutTrailer = setTimeout("playTrailer()", 500);
	}
}
