
function openVideo(movieID){

	if(bracketsExpanded){
		closeBrackets();
		$('top_swfContent').closeBrackets();
	}

	var gameID = '1673';

	var video = document.createElement("div");
	var videoContent = document.createElement("div");

	video.style.height = "1400px";
	
	video.id = "video";
	videoContent.id = "videoContent";

	video.innerHTML = "<div id='videoCloseBtn' onClick='closeVideo();'></div>";
	video.appendChild(videoContent);

	openModal("", video, attachVideo);
	$('modalOverlay').addClass("video");

	function attachVideo(){
		var flashvars = {};
		var params = {scale: "noborder", salign: "TC", allowScriptAccess: "always", wmode: "transparent", bgcolor: "#000000", quality: "HIGH", allowFullScreen: "true"};
		var attributes = {id: "videoContent"};
		swfobject.embedSWF("http://www.gametrailers.com/flash/gt6player237c.swf?mid=" + movieID + "&agegatebool=0", attributes.id, "720", "440", "8.0.0", "_swf/expressInstall.swf", flashvars, params, attributes);
	}
	
	// Add the GT tracking iFrame
	var tracking_iframe = document.createElement("iframe");
	tracking_iframe.style.visibility = "hidden";
	tracking_iframe.style.width = "1px";
	tracking_iframe.style.height = "1px";						
	tracking_iframe.src = "http://www.gametrailers.com/neo/stats/dlcount_iframe.php?movie_id=" + movieID + "&game_id=" + gameID + "&type=mov&page=tekken";
	document.body.appendChild(tracking_iframe);
}

function openBracketsVideo(character){
	var movie_ids = Array();
	
	movie_ids['phoenix'] = '51709';
	movie_ids['ganryu'] = '51914';
	movie_ids['king'] = '51912';
	movie_ids['anna'] = '51922';
	movie_ids['christie'] = '51920';
	movie_ids['kuma'] = '51926';
	movie_ids['steve'] = '51932';
	movie_ids['asuka'] = '51934';	
	movie_ids['nina'] = '51938';
	movie_ids['jack6'] = '51940';
	movie_ids['bob'] = '51944';

	openVideo(movie_ids[character]);
}

function closeVideo(){
	closeModal();
}

var isFullscreen = false;

function fullScreenMe() {
	var videoDiv = $('videoContent');
	scroll(0, 0);

	var isSafari = false;
	if(navigator.vendor){
		isSafari = (navigator.vendor.indexOf("Opera") != -1);
	}
	
	var isOpera = false;
	if(navigator.appName){
		isOpera = (navigator.appName.indexOf("Opera") != -1);
	}
	if(!isOpera && document.documentElement && document.documentElement.clientHeight) {
		w = document.documentElement.clientWidth;
		h = document.documentElement.clientHeight;
	} else 	if(document.body) {
		w = document.body.clientWidth;
		h = document.body.clientHeight;
	}

	$('video').addClass('fullScreen');

	if(!isSafari) {
		videoDiv.style.width = w + 'px';
		videoDiv.style.height = h + 'px';
	} else {
		//Safari
		videoDiv.style.width = '100%';
		videoDiv.style.height = '100%';

	}
}

function unFullScreenMe() {
	var videoDiv = $('videoContent');

	$('video').removeClass('fullScreen');

	videoDiv.style.width = '720px';
	videoDiv.style.height = '440px';
}

parent.document.onkeydown = function(e){
	if (!e) e = window.event; // just in case
	if(e.keyCode == 27) { //esc
		fullscreenCallback(1, 1);
	}
}

function fullscreenCallback(flash8, onlyIfFull){
	if (onlyIfFull && !isFullscreen) return;
	if (flash8) {
		if(isFullscreen) {
			unFullScreenMe();
		} else {
			fullScreenMe();
		}
	}
	isFullscreen = !isFullscreen;
}

function fullScreenToggle() {
	fullscreenCallback(1);
	//flashProxy.call('fullscreenToggle');
}