﻿//JScript File
/**
 * SWFObject v1.5.1: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept == "undefined") var deconcept = {};
if(typeof deconcept.util == "undefined") deconcept.util = {};
if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = {};
deconcept.SWFObject = function(swf, id, w, h, ver, c, quality, xiRedirectUrl, redirectUrl, detectKey) {
	if (!document.getElementById) { return; }
	this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
	this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
	this.params = {};
	this.variables = {};
	this.attributes = [];
	if(swf) { this.setAttribute('swf', swf); }
	if(id) { this.setAttribute('id', id); }
	if(w) { this.setAttribute('width', w); }
	if(h) { this.setAttribute('height', h); }
	if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
	this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
	if (!window.opera && document.all && this.installedVer.major > 7) {
		// only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE
		// fixes bug in some fp9 versions see http://blog.deconcept.com/2006/07/28/swfobject-143-released/
		if (!deconcept.unloadSet) {
			deconcept.SWFObjectUtil.prepUnload = function() {
				__flash_unloadHandler = function(){};
				__flash_savedUnloadHandler = function(){};
				window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs);
			}
			window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload);
			deconcept.unloadSet = true;
		}
	}
	if(c) { this.addParam('bgcolor', c); }
	var q = quality ? quality : 'high';
	this.addParam('quality', q);
	this.setAttribute('useExpressInstall', false);
	this.setAttribute('doExpressInstall', false);
	var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
	this.setAttribute('xiRedirectUrl', xir);
	this.setAttribute('redirectUrl', '');
	if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
}
deconcept.SWFObject.prototype = {
	useExpressInstall: function(path) {
		this.xiSWFPath = !path ? "expressinstall.swf" : path;
		this.setAttribute('useExpressInstall', true);
	},
	setAttribute: function(name, value){
		this.attributes[name] = value;
	},
	getAttribute: function(name){
		return this.attributes[name] || "";
	},
	addParam: function(name, value){
		this.params[name] = value;
	},
	getParams: function(){
		return this.params;
	},
	addVariable: function(name, value){
		this.variables[name] = value;
	},
	getVariable: function(name){
		return this.variables[name] || "";
	},
	getVariables: function(){
		return this.variables;
	},
	getVariablePairs: function(){
		var variablePairs = [];
		var key;
		var variables = this.getVariables();
		for(key in variables){
			variablePairs[variablePairs.length] = key +"="+ variables[key];
		}
		return variablePairs;
	},
	getSWFHTML: function() {
		var swfNode = "";
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
			if (this.getAttribute("doExpressInstall")) {
				this.addVariable("MMplayerType", "PlugIn");
				this.setAttribute('swf', this.xiSWFPath);
			}
			swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ (this.getAttribute('style') || "") +'"';
			swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
			var params = this.getParams();
			 for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
			var pairs = this.getVariablePairs().join("&");
			 if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
			swfNode += '/>';
		} else { // PC IE
			if (this.getAttribute("doExpressInstall")) {
				this.addVariable("MMplayerType", "ActiveX");
				this.setAttribute('swf', this.xiSWFPath);
			}
			swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ (this.getAttribute('style') || "") +'">';
			swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
			var params = this.getParams();
			for(var key in params) {
			 swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
			}
			var pairs = this.getVariablePairs().join("&");
			if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
			swfNode += "</object>";
		}
		return swfNode;
	},
	write: function(elementId){
		if(this.getAttribute('useExpressInstall')) {
			// check to see if we need to do an express install
			var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
			if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
				this.setAttribute('doExpressInstall', true);
				this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
				document.title = document.title.slice(0, 47) + " - Flash Player Installation";
				this.addVariable("MMdoctitle", document.title);
			}
		}
		if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
			var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
			n.innerHTML = this.getSWFHTML();
			return true;
		}else{
			if(this.getAttribute('redirectUrl') != "") {
				document.location.replace(this.getAttribute('redirectUrl'));
			}
		}
		return false;
	}
}

/* ---- detection functions ---- */
deconcept.SWFObjectUtil.getPlayerVersion = function(){
	var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
		}
	}else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0){ // if Windows CE
		var axo = 1;
		var counter = 3;
		while(axo) {
			try {
				counter++;
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter);
//				document.write("player v: "+ counter);
				PlayerVersion = new deconcept.PlayerVersion([counter,0,0]);
			} catch (e) {
				axo = null;
			}
		}
	} else { // Win IE (non mobile)
		// do minor version lookup in IE, but avoid fp6 crashing issues
		// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
		try{
			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		}catch(e){
			try {
				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
				PlayerVersion = new deconcept.PlayerVersion([6,0,21]);
				axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
			} catch(e) {
				if (PlayerVersion.major == 6) {
					return PlayerVersion;
				}
			}
			try {
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			} catch(e) {}
		}
		if (axo != null) {
			PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
		}
	}
	return PlayerVersion;
}
deconcept.PlayerVersion = function(arrVersion){
	this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
	this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
	this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
}
deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
	if(this.major < fv.major) return false;
	if(this.major > fv.major) return true;
	if(this.minor < fv.minor) return false;
	if(this.minor > fv.minor) return true;
	if(this.rev < fv.rev) return false;
	return true;
}
/* ---- get value of query string param ---- */
deconcept.util = {
	getRequestParameter: function(param) {
		var q = document.location.search || document.location.hash;
		if (param == null) { return q; }
		if(q) {
			var pairs = q.substring(1).split("&");
			for (var i=0; i < pairs.length; i++) {
				if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
					return pairs[i].substring((pairs[i].indexOf("=")+1));
				}
			}
		}
		return "";
	}
}
/* fix for video streaming bug */
deconcept.SWFObjectUtil.cleanupSWFs = function() {
	var objects = document.getElementsByTagName("OBJECT");
	for (var i = objects.length - 1; i >= 0; i--) {
		objects[i].style.display = 'none';
		for (var x in objects[i]) {
			if (typeof objects[i][x] == 'function') {
				objects[i][x] = function(){};
			}
		}
	}
}
/* add document.getElementById if needed (mobile IE < 5) */
if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; }}

/* add some aliases for ease of use/backwards compatibility */
var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject; // for legacy support
var SWFObject = deconcept.SWFObject;

//end of swfobject

function Browser() {

  var ua, s, i;

  this.isIE    = false;
  this.isNS    = false;
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

var browser = new Browser();

// Global object to hold drag information.

var dragObj = new Object();
dragObj.zIndex = 0;

function dragStart(event, id) {

  var el;
  var x, y;

  // If an element id was given, find it. Otherwise use the element being
  // clicked on.

  if (id) {
    dragObj.elNode = document.getElementById(id);
  }
  else {
    if (browser.isIE)
      dragObj.elNode = window.event.srcElement;
    if (browser.isNS)
      dragObj.elNode = event.target;

    // If this is a text node, use its parent element.

    if (dragObj.elNode.nodeType == 3)
      dragObj.elNode = dragObj.elNode.parentNode;
  }

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Save starting positions of cursor and element.

  dragObj.cursorStartX = x;
  dragObj.cursorStartY = y;
  dragObj.elStartLeft  = parseInt(dragObj.elNode.style.left, 10);
  dragObj.elStartTop   = parseInt(dragObj.elNode.style.top,  10);

  if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0;
  if (isNaN(dragObj.elStartTop))  dragObj.elStartTop  = 0;

  // Update element's z-index.

  dragObj.elNode.style.zIndex = ++dragObj.zIndex;

  // Capture mousemove and mouseup events on the page.

  if (browser.isIE) {
    document.attachEvent("onmousemove", dragGo);
    document.attachEvent("onmouseup",   dragStop);
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS) {
    document.addEventListener("mousemove", dragGo,   true);
    document.addEventListener("mouseup",   dragStop, true);
    event.preventDefault();
  }
}

function dragGo(event) {

  var x, y;

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Move drag element by the same amount the cursor has moved.
  dragObj.elNode.style.left = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px";
  dragObj.elNode.style.top  = (dragObj.elStartTop  + y - dragObj.cursorStartY) + "px";

  if (browser.isIE) {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS)
    event.preventDefault();
}

function dragStop(event) {

  // Stop capturing mousemove and mouseup events.

  if (browser.isIE) {
    document.detachEvent("onmousemove", dragGo);
    document.detachEvent("onmouseup",   dragStop);
  }
  if (browser.isNS) {
    document.removeEventListener("mousemove", dragGo,   true);
    document.removeEventListener("mouseup",   dragStop, true);
  }
}

function PlayVideo(string)

{
    if (document.getElementById('boxB').style.display == 'block')
    {
        document.getElementById('boxB').style.display = 'none';
        document.getElementById('content').innerHTML = '';
    }
    else
    {
        document.getElementById('boxB').style.display = 'block';
        SetVideoName(string);
    }
}

function SetVideoName(name)
{
    var videoname=name;

    var so = new SWFObject("http://static.octopusmt.com/clients/t/thomascook/tcsite/ThomasCook.swf","video", "496", "358", "8", "#ededed");
    so.addParam("quality", "high");
    so.addParam("wmode","transparent");
    so.addParam("allowScriptAccess", "always");
    so.addParam("swLiveConnect", "true");
    so.addParam("allowFullScreen", "true");
    so.addVariable("setAssetGUID", videoname);    
//so.addVariable("setStream", videoname);
    so.write("content");
    setBackgroundColour("small");    
}

function CloseMe(obj)
{
    document.getElementById(obj).style.display = 'none';
    document.getElementById('content').innerHTML = '';
}


function setBackgroundColour(mode)
{
    var width;
    var height;

    switch(mode)
    {
        case "small" :
            width = "496px";
            height = "358px";
            
            document.getElementById("boxB").style.width=width;
            document.getElementById("boxB").style.height=height;
            document.getElementById("video").style.width=width;
            document.getElementById("video").style.height=height;
        break;
        case "medium" :
            
            width = "727px";
            height = "485px";
            
            document.getElementById("boxB").style.width=width;
            document.getElementById("boxB").style.height=height;
            document.getElementById("video").style.width=width;
            document.getElementById("video").style.height=height;
        break;
    }
}

var OctopusMT = function(){

   function Browser() {

  var ua, s, i;

  this.isIE    = false;
  this.isNS    = false;
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

var browser = new Browser();

var dragObj = new Object();
dragObj.zIndex = 0;

function dragStart(event, id) {

  var el;
  var x, y;

  if (id)
    dragObj.elNode = document.getElementById(id);
  else {
    if (browser.isIE)
      dragObj.elNode = window.event.srcElement;
    if (browser.isNS)
      dragObj.elNode = event.target;

    // If this is a text node, use its parent element.

    if (dragObj.elNode.nodeType == 3)
      dragObj.elNode = dragObj.elNode.parentNode;
  }

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Save starting positions of cursor and element.

  dragObj.cursorStartX = x;
  dragObj.cursorStartY = y;
  dragObj.elStartLeft  = parseInt(dragObj.elNode.style.left, 10);
  dragObj.elStartTop   = parseInt(dragObj.elNode.style.top,  10);

  if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0;
  if (isNaN(dragObj.elStartTop))  dragObj.elStartTop  = 0;

  // Update element's z-index.

  dragObj.elNode.style.zIndex = ++dragObj.zIndex;

  // Capture mousemove and mouseup events on the page.

  if (browser.isIE) {
    document.attachEvent("onmousemove", dragGo);
    document.attachEvent("onmouseup",   dragStop);
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS) {
    document.addEventListener("mousemove", dragGo,   true);
    document.addEventListener("mouseup",   dragStop, true);
    event.preventDefault();
  }
}

function dragGo(event) {

  var x, y;

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  dragObj.elNode.style.left = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px";
  dragObj.elNode.style.top  = (dragObj.elStartTop  + y - dragObj.cursorStartY) + "px";

  if (browser.isIE) {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS)
    event.preventDefault();
}

function dragStop(event) {


  if (browser.isIE) {
    document.detachEvent("onmousemove", dragGo);
    document.detachEvent("onmouseup",   dragStop);
  }
  if (browser.isNS) {
    document.removeEventListener("mousemove", dragGo,   true);
    document.removeEventListener("mouseup",   dragStop, true);
  }
}

	
    var DefaultSettings = {
			VideoID: '',		
			Width: 500,
			Height: 400, 
			Volume: 50, 
			VolumeControl: 'show', 
			Mute: 'off', 
			MuteControl: 'show', 
			AutoPlay: true,
			SeekControl: 'show', 
			FullScreenControl: 'show',
			Carousel: 'hide',
			ChaptersControl: 'hide',
			FullscreenVersionTest: 'on',
			FlashUpdateURL: '',
			wmode: 'transparent',
			VideoLocationName: 'OctopusMTPlayer',
			AllowPlayerResize: 'false',
			StartPositionX:200,
			StartPositionY:100,
			EmbedPlayer:false,
			VID: '',
			LID: '',
			VideoFile: '',
			VideoFileBitrates: '100,300,500,800,1000'
			
			
    };
    
	
	var SysFunc = new Object();
         SysFunc.extendObject = function(destination, source) {
              
                  for (var property in source) {
                        destination[property] = source[property];
                  };
                  return destination;
            }
    if(typeof ConfigSettings !== 'undefined'){
	    DefaultSettings = SysFunc.extendObject(DefaultSettings, ConfigSettings);
	    console.log(DefaultSettings);
	}

    var VideoGUID,
    	Width,
		Height,
    	VideoWidth,
    	VideoHeight,
    	Volume,
    	VolumeControl,
    	Mute,
		MuteControl,
    	AutoPlay,
    	SeekControl,
    	FullScreenControl,
  		PlayerHeight,
		ChannelGUID,
		FullscreenVersionTest,
		FlashUpdateURL,
		AllowPlayerResize,
		wmode,
		VideoLocationName,
		ThumbNailWidth,
		ThumbNailHeight,
		ThumbNailLinkName,
		AssetGUID,
		PreviousHeight,
		StartPositionX,
		StartPositionY,
		EmbedPlayer = false,
		VID,
		LID,
		VideoFileBitrates,
		VideoFile;

    var get_element = document.all ?
        function (s_id) { return document.all[s_id] } :
        function (s_id) { return document.getElementById(s_id) };

	var carouselTarget;

    var Flash = {
        write : function (target){
			var playerHeight ,
				playerWidth,
				playerLocation = "http://static.octopusmt.com/clients/t/thomascook/OctopusMTPopOverPlayer.swf",
				playerFullScreenControl;     
				playerWidth = Width
				playerHeight = Height
			
          	var so = new SWFObject(playerLocation,"mediaPlayer", playerWidth, playerHeight, "9.0.124","");
			so.addParam("allowScriptAccess", "always");
			so.addParam("swLiveConnect", "true");
			so.addParam("allowFullScreen", "true");
			so.addParam("wmode", wmode);
			so.addVariable("setWidth", Width);
			so.addVariable("setHeight", Height);
			so.addVariable("setVideoWidth", VideoWidth);
			so.addVariable("setVideoHeight", VideoHeight);
			so.addVariable("setPreviousHeight", PreviousHeight);
			so.addVariable("setAssetGUID", AssetGUID); // Fixed!! 
			so.addVariable("setChannelGUID", ChannelGUID);
			so.addVariable("setVolume", Volume);
			so.addVariable("setVolumeControl", VolumeControl);
			so.addVariable("setMute", Mute);
			so.addVariable("setMuteControl", MuteControl);
			so.addVariable("setAutoPlay", AutoPlay);
			so.addVariable("setSeekControl", SeekControl);
			so.addVariable("setFullScreenControl", FullScreenControl);
			so.addVariable("setFullscreenVersionTest", FullscreenVersionTest);
			so.addVariable("setFlashUpdateURL", FlashUpdateURL);
			so.addVariable("setAllowPlayerResize", AllowPlayerResize);
			so.addVariable("setThumbNailWidth", ThumbNailWidth);
			so.addVariable("setThumbNailHeight", ThumbNailHeight);
			so.addVariable("setThumbNailLinkName", ThumbNailLinkName);
			so.addVariable("setVID", VID);
			so.addVariable("setLID", LID);
			so.addVariable("setVideoFile", VideoFile);
			so.addVariable("setVideoBitRate", VideoFileBitrates);
			so.write(VideoLocationName); 

        }
    };
	

	function hex2RGB ( hex ) {
		return '0x'+hex;
	}
	
    function RenderPlayer(guid,autoPlay) {
         
		if(guid != null && guid !=='undefined') {
		    AssetGUID=guid;
		} else {
		    AssetGUID = DefaultSettings.VideoGUID;
		}
		
		var isFlash = false;
		  
		if(guid != null && guid !=='undefined'){
		    AssetGUID=guid;
		} else {
		    AssetGUID = DefaultSettings.AssetGUID;
		}
		
		Width = DefaultSettings.Width;
		Height = DefaultSettings.Height;
		Volume = DefaultSettings.Volume;
		VolumeControl = DefaultSettings.VolumeControl;
		Mute = DefaultSettings.Mute;
		MuteControl = DefaultSettings.MuteControl;
		
		if(typeof autoPlay === 'undefined'){
			AutoPlay = DefaultSettings.AutoPlay;
		} else {
			AutoPlay = autoPlay;
		}
		
		SeekControl = DefaultSettings.SeekControl;
		FullScreenControl = DefaultSettings.FullScreenControl;
		ChannelGUID = DefaultSettings.ChannelGUID;
		FullscreenVersionTest = DefaultSettings.FullscreenVersionTest;
		FlashUpdateURL = DefaultSettings.FlashUpdateURL;
		AllowPlayerResize = DefaultSettings.AllowPlayerResize;
		wmode = DefaultSettings.wmode;
		VideoLocationName = DefaultSettings.VideoLocationName;
		VID = DefaultSettings.VID;
		LID = DefaultSettings.LID;
		VideoFile = DefaultSettings.VideoFile,
		VideoFileBitrates = DefaultSettings.VideoFileBitrates

		Flash.write(VideoLocationName);
		   	        
    }
    
	function InsertDragPlayerCode(){

	document.write(unescape("%3C%64%69%76%20%69%64%3D%22%44%72%61%67%42%6F%78%22%20%63%6C%61%73%73%3D%22%62%6F%78%32%22%20%73%74%79%6C%65%3D%22%70%6F%73%69%74%69%6F%6E%3A%61%62%73%6F%6C%75%74%65%3B%20%20%7A%2D%69%6E%64%65%78%3A%31%30%30%30%3B%22%3E%0A%09%09%3C%64%69%76%20%69%64%3D%22%44%72%61%67%42%6F%78%54%6F%70%42%61%72%22%20%63%6C%61%73%73%3D%22%62%61%72%32%22%20%6F%6E%6D%6F%75%73%65%64%6F%77%6E%3D%22%4F%63%74%6F%70%75%73%4D%54%2E%64%72%61%67%53%74%61%72%74%28%65%76%65%6E%74%2C%20%27%44%72%61%67%42%6F%78%27%29%22%20%73%74%79%6C%65%3D%22%64%69%73%70%6C%61%79%3A%6E%6F%6E%65%22%3E%3C%74%61%62%6C%65%20%77%69%64%74%68%3D%22%31%30%30%25%22%20%62%6F%72%64%65%72%3D%22%30%22%20%63%65%6C%6C%70%61%64%64%69%6E%67%3D%22%33%22%20%63%65%6C%6C%73%70%61%63%69%6E%67%3D%22%30%22%20%73%74%79%6C%65%3D%22%63%75%72%73%6F%72%3A%68%61%6E%64%22%3E%0A%20%20%3C%74%72%3E%0A%20%20%20%20%3C%74%64%20%68%65%69%67%68%74%3D%22%33%22%20%63%6F%6C%73%70%61%6E%3D%22%34%22%20%62%67%63%6F%6C%6F%72%3D%22%23%37%39%42%36%45%41%22%20%20%73%74%79%6C%65%3D%22%66%6F%6E%74%2D%66%61%6D%69%6C%79%3A%56%65%72%64%61%6E%61%2C%20%41%72%69%61%6C%2C%20%48%65%6C%76%65%74%69%63%61%2C%20%73%61%6E%73%2D%73%65%72%69%66%3B%20%63%6F%6C%6F%72%3A%23%46%46%46%46%46%46%3B%20%66%6F%6E%74%2D%73%69%7A%65%3A%31%32%70%78%22%3E%3C%2F%74%64%3E%0A%20%20%20%20%3C%2F%74%72%3E%0A%20%20%3C%74%72%3E%0A%20%20%20%20%3C%74%64%20%77%69%64%74%68%3D%22%32%22%20%62%67%63%6F%6C%6F%72%3D%22%23%37%39%42%36%45%41%22%20%20%73%74%79%6C%65%3D%22%66%6F%6E%74%2D%66%61%6D%69%6C%79%3A%56%65%72%64%61%6E%61%2C%20%41%72%69%61%6C%2C%20%48%65%6C%76%65%74%69%63%61%2C%20%73%61%6E%73%2D%73%65%72%69%66%3B%20%63%6F%6C%6F%72%3A%23%46%46%46%46%46%46%3B%20%66%6F%6E%74%2D%73%69%7A%65%3A%31%32%70%78%22%3E%26%6E%62%73%70%3B%3C%2F%74%64%3E%0A%20%20%20%20%3C%74%64%20%62%67%63%6F%6C%6F%72%3D%22%23%37%39%42%36%45%41%22%20%20%73%74%79%6C%65%3D%22%66%6F%6E%74%2D%66%61%6D%69%6C%79%3A%56%65%72%64%61%6E%61%2C%20%41%72%69%61%6C%2C%20%48%65%6C%76%65%74%69%63%61%2C%20%73%61%6E%73%2D%73%65%72%69%66%3B%20%63%6F%6C%6F%72%3A%23%46%46%46%46%46%46%3B%20%66%6F%6E%74%2D%73%69%7A%65%3A%31%32%70%78%22%3E%43%6C%69%63%6B%20%74%6F%20%64%72%61%67%20%76%69%64%65%6F%3C%2F%74%64%3E%0A%20%20%20%20%3C%74%64%20%77%69%64%74%68%3D%22%35%30%22%20%62%67%63%6F%6C%6F%72%3D%22%23%37%39%42%36%45%41%22%20%20%73%74%79%6C%65%3D%22%66%6F%6E%74%2D%66%61%6D%69%6C%79%3A%56%65%72%64%61%6E%61%2C%20%41%72%69%61%6C%2C%20%48%65%6C%76%65%74%69%63%61%2C%20%73%61%6E%73%2D%73%65%72%69%66%3B%20%63%6F%6C%6F%72%3A%23%46%46%46%46%46%46%3B%20%66%6F%6E%74%2D%73%69%7A%65%3A%31%32%70%78%22%3E%3C%64%69%76%20%61%6C%69%67%6E%3D%22%72%69%67%68%74%22%3E%3C%61%20%68%72%65%66%3D%22%6A%61%76%61%73%63%72%69%70%74%3A%4F%63%74%6F%70%75%73%4D%54%2E%43%6C%6F%73%65%46%6C%61%73%68%57%69%6E%64%6F%77%28%29%22%20%73%74%79%6C%65%3D%22%66%6F%6E%74%2D%66%61%6D%69%6C%79%3A%56%65%72%64%61%6E%61%2C%20%41%72%69%61%6C%2C%20%48%65%6C%76%65%74%69%63%61%2C%20%73%61%6E%73%2D%73%65%72%69%66%3B%20%63%6F%6C%6F%72%3A%23%31%35%41%31%35%36%3B%22%3E%43%6C%6F%73%65%20%58%3C%2F%61%3E%3C%2F%64%69%76%3E%3C%2F%74%64%3E%0A%20%20%20%20%3C%74%64%20%77%69%64%74%68%3D%22%33%22%20%62%67%63%6F%6C%6F%72%3D%22%23%37%39%42%36%45%41%22%20%20%73%74%79%6C%65%3D%22%66%6F%6E%74%2D%66%61%6D%69%6C%79%3A%56%65%72%64%61%6E%61%2C%20%41%72%69%61%6C%2C%20%48%65%6C%76%65%74%69%63%61%2C%20%73%61%6E%73%2D%73%65%72%69%66%3B%20%63%6F%6C%6F%72%3A%23%46%46%46%46%46%46%3B%20%66%6F%6E%74%2D%73%69%7A%65%3A%31%32%70%78%22%3E%26%6E%62%73%70%3B%3C%2F%74%64%3E%0A%20%20%3C%2F%74%72%3E%0A%3C%2F%74%61%62%6C%65%3E%0A%3C%2F%64%69%76%3E%0A%09%09%3C%64%69%76%20%69%64%3D%22%4F%63%74%6F%70%75%73%4D%54%50%6F%70%4F%76%65%72%50%6C%61%79%65%72%22%3E%3C%2F%64%69%76%3E%0A%09%3C%2F%64%69%76%3E%0A"))
	
	}
   	
	function init() {
		if(typeof this.ConfigSettings !=='undefined'){
			DefaultSettings = SysFunc.extendObject(DefaultSettings, this.ConfigSettings);  
		}	
		
		InsertDragPlayerCode();
		
		if(DefaultSettings.DragPlayer==true){
			OpenFlashWindow(AssetGUID);
		}else if(DefaultSettings.EmbedPlayer==true){
			RenderPlayer(AssetGUID,AutoPlay);
		}
		
	}
    
	function ResizeVideo(newHeight, videoWidth, videoHeight){	
			VideoWidth = videoWidth;
        	VideoHeight = videoHeight;
			PreviousHeight = newHeight;
			if(browser.isIE){

			}
			document.getElementById('OctopusMTPlayer').style.width = OctopusMT.ConfigSettings.Width + 'px';
			document.getElementById('OctopusMTPlayer').style.height = newHeight + 'px';
			
			
			document.getElementById('DragBox').style.width = videoWidth + 'px';
			document.getElementById('DragBox').style.height = videoHeight + 'px';
			document.getElementById('mediaPlayer').setAttribute('height',newHeight);
    }
	
	function OpenFlashWindow(AssetGUID){
		
		DefaultSettings.VideoLocationName = 'OctopusMTPopOverPlayer';
		document.getElementById('DragBox').style.top = DefaultSettings.StartPositionY + 'px';
		document.getElementById('DragBox').style.left = DefaultSettings.StartPositionX + 'px';
		document.getElementById('DragBox').style.width = DefaultSettings.Width + 'px';
		document.getElementById('DragBox').style.height = DefaultSettings.Height + 'px';
		document.getElementById('DragBoxTopBar').style.width = DefaultSettings.Width + 'px';
		document.getElementById('DragBoxTopBar').style.display = 'block';
		document.getElementById('OctopusMTPopOverPlayer').style.display = 'block';
		DefaultSettings.AssetGUID = AssetGUID;
		
		RenderPlayer();
	}
	

	function CloseFlashWindow(){
		document.getElementById('OctopusMTPopOverPlayer').innerHTML="";
		document.getElementById('DragBoxTopBar').style.display = 'none';
		document.getElementById('OctopusMTPopOverPlayer').style.display = 'none';
	}
	
	function RenderTopBar(){
		var soTop = new SWFObject("swf/TopBar.swf", "Drag Bar", OctopusMT.ConfigSettings.Width, "28", "8");
		soTop.addParam("wmode", "transparent");
		soTop.addVariable("sWidth", OctopusMT.ConfigSettings.Width);
		soTop.write('topbar');
	}
	
    return {
	    init : init,
	    RenderPlayer : RenderPlayer,
		ResizeVideo : ResizeVideo,
		OpenFlashWindow : OpenFlashWindow,
		CloseFlashWindow : CloseFlashWindow,
		dragStart: dragStart
	}   
	
	
}();

OctopusMT.init();


