 
var showProductTrailer = function(swf_file, width, height, container){

	var min_flash_version = '9.0';

	var swf_width = width;
	var swf_height = height;
	var moduleContentMovie;

	var container = "atrisk-trailer-container";
	var mid = "atrisk-trailer-movie";
	if ( swfobject.hasFlashPlayerVersion( min_flash_version ) ) {


		var c = document.getElementById("mid");
		if (!c) {
			var d = document.createElement("div");
			d.setAttribute("id", mid);
			document.getElementById(container).appendChild(d);
		}

		var att = { data:swf_file, width:swf_width, height:swf_height, backgroundColor: '#ffffff' };
		var par = { WMode: 'transparent', flashvars:"allowScriptAccess=sameDomain", allowFullScreen: 'true', scale: "noScale" };
		
		var d = swfobject.createSWF(att, par, mid);
		
		document.getElementById(container).appendChild(d);
		document.getElementById(mid).style.display = 'block';
	}	
};

var removeProductTrailer = function(){
	var sos = jQuery('.swfmovie');
	sos.show();
	
	$('#box').animate({top: '-800px', height: '20px', alpha: 0}, function(evt){
		try{
			document.getElementById(mid).style.display = 'none';
			swfobject.removeSWF(mid);
		} catch(err){}		
	});	
}

var showProductPlayer = function(swf_file, width, height, container, html_alt){	

	if($.browser.msie && $.browser.version=="6.0") {
		window.open(html_alt,'','toolbars=no,width='+width+',height='+height+',resizable=yes');
	} else {
		var l = ($(window).width() /2) -(width/2);
		var sos = jQuery('.swfmovie');
		sos.hide();
		
		document.getElementById('box').style.left = l + 'px';
	  	document.getElementById('box').style.display = 'block';

		$('#overlay').fadeIn('fast',function(){
		   
			$('#box').animate({'top':'160px', left: l+'px', width: width+'px', height: height+'px'},500, function(evt){
				showProductTrailer(swf_file, width, height, container);
			});
		});
	}
}


$(function() {
	
	$('#boxclose').click(function(){
		$('#box').animate({'top':'-500px' },500,function(){
			$('#overlay').fadeOut('fast');
		});
	});

});

