var videoWidth = "711"; // Video width
var videoHeight = "400"; // Video height

// Will start the video and resize the window to allow for viewing
function playMovie() { 
	document.getElementById("walkonvideo").style.width = videoWidth+"px";
	document.getElementById("walkonvideo").style.height = videoHeight+"px";
	document.getElementById("flashbox").style.width = videoWidth+"px";
	document.getElementById("flashbox").style.height = videoHeight+"px";
	getFlashMovie().JStoASviaExternalInterface("startvideo");
}

// Provides the proper address for the movie depending on browser
function getFlashMovie() {
	var isIE = getBrowser();
	return (isIE) ? window['walkonvideo'] : document['walkonvideo'];
}

function getBrowser() {
	return navigator.appName.indexOf("Microsoft") != -1;
}

// Closes window
function closeFlashWindow() {
	document.getElementById("walkonvideo").style.width = "1px";
	document.getElementById("walkonvideo").style.height = "1px";
	document.getElementById("flashbox").style.width = "1px";
	document.getElementById("flashbox").style.height = "1px";
}

function createFlash(bod,videoWidth,videoHeight) {
	var flashbox = document.createElement('div');
	flashbox.id = 'flashbox';
	flashbox.style.zIndex = '100';
	flashbox.style.position = 'fixed';
	flashbox.style.width = '1px';
	flashbox.style.height = '1px';
	flashbox.style.bottom = '0px';
	flashbox.style.right = '0px';
	bod.appendChild(flashbox);
	var flashcontainer = document.createElement('div');
	flashcontainer.id = 'flashcontainer';
	flashbox.appendChild(flashcontainer);
	
	var flashvars = {};
				flashvars.flvFile = "HDWalkOn.flv"; // File name of FLV, should reside in same folder
				flashvars.buffer = 2; // Seconds of the video that should load before playing (Might wish to increase for large files)
				flashvars.dropshadow = 1; // 1/0 - Should player have a drop shadow
				flashvars.fadein = 1; // 1/0 - Should player fade in
				flashvars.fadeout = 1; // 1/0 - Should player fade out
				flashvars.videoLink = 1; // 1/0 - Should the video have a link to another page
				flashvars.videoURL = "www.virtualwebvideo.com"; // URL if video should be linked, without http://
				flashvars.controlsLocation = "center"; // "left", "center", "right" - Location of controls
				flashvars.videoWidth = videoWidth; // Don't change 
				flashvars.videoHeight = videoHeight; // Don't change 
				flashvars.buttonValue = "Virtual Web Video"; // Button value
			var params = {};
				params.wmode = "transparent"; // Don't change 
				params.scale = "noscale"; // Don't change 
			var attributes = {};
				attributes.name = "walkonvideo"; // Don't change 
				attributes.id = "walkonvideo"; // Don't change 
	swfobject.embedSWF("walkonvideo_template_nobrand.swf", "flashcontainer", videoWidth, videoHeight, "8.0.0", false, flashvars, params, attributes); // swf filename, name of div to place flash, video width, video heigth, video minimum version, leave the rest of the variables
	
	setTimeout('playMovie()',3000);
}

window.onload = function(){createFlash(document.getElementsByTagName('body')[0],videoWidth,videoHeight)};
