var stationID = 2005435268;
//var FileLocation = "http://da5nvap6twti1.cloudfront.net/mps/q4_2008_10slides/Q42008.mps.idx";
//var FileLocation = "http://bgomps01.vizky.com:8031/banner/header.mps.idx";
//var FileLocation = VizkyGetPathOfHtmlPage() + "Q4/Q42008.mps.idx"
var FileLocation = "http://BGOMPS02.vizky.com/Demo/Q4/Q42008.mps.idx"
var extID = 0;
var instID = 0;
var VizkyVersion = 0;

var Width = 950
var Height = 533

//Full Window button scene
var extIDFull = 0;
var instIDFull = 0;
var fullflag = false
//Full Window button scene
function Fullscreen(ControlObject)
{
	ControlObject.ToggleFullscreen();
	if (fullflag)
	{
		ControlObject.ShowDirectorTag(instIDFull,"full","max");
		fullflag = false
	}else
		{
		   ControlObject.ShowDirectorTag(instIDFull,"full","min");
		   fullflag = true
		}
}
function OnVizkyLMouseDown(ControlObject)
{
	var aUObject = ControlObject.GetInteractivityObject();
	switch(aUObject)
	{
		//Full Screen Window//
		case ("Full"):
			Fullscreen(ControlObject); 
		break;
		//Full Screen Window//
	}
}

/*
var isFullscreen = getURLVar("framework");
if (isFullscreen == "fullscreen") {
	Width = window.screen.width - 100;
	Height = Width * 9/16;
	
} else {
	Width = 955
	Height = 533
}
*/
function OnVizkyInit(ControlObject)
{
	
	ControlObject.CreateViewport(2);
	ControlObject.SetDisplayDownloading(1);
	stationID = ControlObject.GenerateStationID(window.location);
	ControlObject.SetViewportPositionAndSize(0, 0, 0, Width, Height);
	ControlObject.SetViewportStationAndChannelID(0, stationID, 0);
	ControlObject.SetViewportPositionAndSize(1, 0, 0, Width, Height);
	ControlObject.SetViewportStationAndChannelID(1, stationID, 1);
	ControlObject.CommitAllViewportStationAndChannelChanges();
	// Check file version and current client version;
	VizkyVersion = ControlObject.GetVersion();
	var VersionArray = VizkyVersion.split(".");
	var currentVersion = ((parseInt(VersionArray[0]) << 28) | (parseInt(VersionArray[1]) << 24) | (parseInt(VersionArray[2]) << 16) | parseInt(VersionArray[3]));
	var requiredVersion = ((1 << 28) | (5 << 24) | (8 << 16) | 0);
	if(currentVersion >= requiredVersion)
	{	
		extID = Control.Import(stationID, FileLocation);
		instID = Control.Load(stationID, extID);
		extIdFull = Control.Import(stationID, "http://BGOMPS02.vizky.com/Demo/full/full.mps.idx");
		instIDFull = Control.Load(stationID, extIdFull);
		Control.TakeIn(stationID, 0, 0, instID);
		Control.TakeIn(stationID, 1, 0, instIDFull);
	}
	else
		{
			//---------------Vizky Checkversion Text-------------//			
			var pleaseInstall2 = '<div class="tv2_millionaer_content millionaer_download" style="font-family: arial; font-size: 12px; padding-right: 200px;"><h2>Please upgrade your Vizky plug-in</h2><p style="font-size: 12px;">Your Vizky version is&nbsp;'+ VizkyVersion +'&nbsp;This page require at least Vizky version 1.5.8.0<br>We now add up more functions in the new version.<br /> Please update your Vizky to experience new enhancement of 3D Graphics.<br /><br /> <a target="_blank" style="color: #ff9000;" href="http://www.vizky.com/download/"><strong>Click to update your Vizky </strong></a><br />The program is developed from Vizrt, the world\'s leader in real-time 3D graphic render for broadcasting which has several major TV channels on the customer lists, including CNN and BBC.<br /></p><p style="font-size: 12px;"><a target="_blank" style="color: #ff9000;" href="http://mps2.vizky.com/node/68">Basic Troubleshooting</a><br /></p><p style="font-size: 12px;">When the program is installed, <strong>Restart the Browser</strong>.</p></div>';
			document.write(pleaseInstall2);
		}	
	// Check file version and current client version;		
}
/*
function getURLVar(urlVarName) {
	//divide the URL in half at the '?'
	var urlHalves = String(document.location).split('?');
	var urlVarValue = '';
	if(urlHalves[1]){
	//load all the name/value pairs into an array
		var urlVars = urlHalves[1].split('&');
		//loop over the list, and find the specified url variable
		for(i=0; i<=(urlVars.length); i++){
			if(urlVars[i]){
			//load the name/value pair into an array
			var urlVarPair = urlVars[i].split('=');
				if (urlVarPair[0] && urlVarPair[0] == urlVarName) {
				//I found a variable that matches, load it's value into the return variable
					urlVarValue = urlVarPair[1];
				}
			}
		}
	}
	return urlVarValue;   
}
*/
