

var video = null;

function Video ()
{
	var v = document.getElementById("video"),
		m = document.getElementById("video-main"),
		b = document.getElementById("video-box");
		
	this.hideVideo = function()
	{
		swfobject.removeSWF("swf-box");		
		var d = document.createElement('div');
		d.id = "swf-box";
		b.appendChild(d);
		v.style.display = "none";
		resumeSound();
	}
		
	this.showVideo = function(_url, _width, _height)
	{
		v.style.display = "block";
		centerVideo(_width, _height);
		playVideo(_url, _width, _height);
		setTimeout(function(){haltSound();},250);
	}
	
	function centerVideo(_width, _height)
	{
		m.style.width = _width + 'px';
		m.style.height = _height + 'px';
		m.style.marginLeft = - (_width/2) + 'px';
		m.style.marginTop = - (25 + _height/2) + 'px';
	}
	
	function playVideo(_url, _width, _height)
	{
		swfobject.embedSWF(_url, "swf-box", _width, _height, "9.0.0");
	}
	
	function getFlashMovie(movieName)
	{
		var isIE = navigator.appName.indexOf("Microsoft") != -1;
		return (isIE) ? window[movieName] : document[movieName];
	}
	
	function haltSound()
	{ 
		getFlashMovie("main").haltSound("halt");
	}

	function resumeSound()
	{ 
		getFlashMovie("main").resumeSound("start");
	}
}

function renderMain()
{
	var flashvars = {};
	var params = {
		menu: "false",
		scale: "noScale",
		allowFullscreen: "true",
		allowScriptAccess: "always",
		bgcolor: "#000000",
		wmode: "transparent"
	};
	var attributes = {
		id: "main",
		name: "main"
	};
	swfobject.embedSWF("site.swf", "altContent", "100%", "100%", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
}

function init()
{
	video = new Video();
	renderMain();
}



