var myCommentWin;
var myCommentVar;
var myComment;
var myMovie;
var windowHandler = '';
var eventTime = 0;
var myArray = new Array();
var jsReady = false;
var jsCommentReady = false;
var myCommentName = "";
var currentHilite = "";
var myAssessmentContent = "";
var showCommentYN = false;

function isReady() {return jsReady;}
function isCommentReady() {return jsCommentReady;}
function pageInit() {jsReady = true;}
function commentInit() {jsCommentReady = true;}

function playMyVideo(myMovie)
 {
 	    var so = new SWFObject("../../js/CDA_FlashVideoPlayer.swf", "myAnnotatedFlashMovie", "668", "532", "9", "#FFFFFF");
		//alert("hallo");
		so.addParam("allowFullScreen", "true");
		so.addParam("allowScriptAccess","always");
		so.addVariable("VideoName", myMovie);
		so.write("myVideo");
}

function playMyVideo2(myMovie)
 {
 	    var so = new SWFObject("../js/CDA_FlashVideoPlayer.swf", "myAnnotatedFlashMovie", "668", "532", "9", "#FFFFFF");
		//alert("hallo");
		so.addParam("allowFullScreen", "true");
		so.addParam("allowScriptAccess","always");
		so.addVariable("VideoName", myMovie);
		so.write("myVideo");
}

function PopUpVideo(myVideo)
{
  myPopUpWindow=window.open(myVideo,"Comment","toolbar=no, width=720, height=580, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=yes");
}

function playMyCarousell(mySWF)
 {
 	// figuring out size of the video
		myWidth = fitVideo2Frame("rightFrame", 590, 300).width;
		myHeight = myWidth / 590 * 300
		
 	    var so = new SWFObject(mySWF, "myCarousell", myWidth, myHeight, "9", "#FFFFFF");
	
		so.addParam("allowFullScreen", "false");
		so.addParam("allowScriptAccess","always");
		//so.addVariable("VideoName", myMovie);
		so.write("myCarousel");
}

function playMyFLASH(mySWF)
 {
 	// figuring out size of the video
		myWidth = fitVideo2Frame("lowerRight", 800, 540).width;
		myHeight = fitVideo2Frame("lowerRight", 800, 540).height;
		
 	    var so = new SWFObject(mySWF, "myAnnotatedFlashMovie", myWidth, myHeight, "9", "#FFFFFF");
	
		so.addParam("allowFullScreen", "true");
		so.addParam("allowScriptAccess","always");
		//so.addVariable("VideoName", myMovie);
		so.write("myVideo");
}

function flash_comment(myCommentMovieName)
{
  myCommentName = "../movies_comments/" + myCommentMovieName;
  parent.MovieMainFrame.document.getElementById("myCommentNameMemory").innerHTML = myCommentName;
  parent.MovieMainFrame.thisMovie("myAnnotatedFlashMovie").stopAnnotatedVideoFromJavaScript("true");
  parent.MovieMainFrame.thisMovie("myAnnotatedFlashMovie").setVideoAnnotationNameFromJavaScript(myCommentMovieName);
}

function videoAnnotationName()
{
  return parent.MovieMainFrame.document.getElementById("myCommentNameMemory").innerHTML
}

function playMyAnnotatedVideo(myMovie)
{
	// step 1: load annotation timetable into myArray
		pageInit();
		initializeHREFTrackArray();
		
	// step 2: figuring out size of the video
		myWidth = fitVideo2Frame("MovieMainFrame", 707, 606).width;
		myHeight = fitVideo2Frame("MovieMainFrame", 707, 606).height;
	
	// step 3: play annotated video through the flash player
		var so = new SWFObject("../../js/CDA_FlashAnnotations.swf", "myAnnotatedFlashMovie", myWidth, myHeight, "9", "#FFFFFF");
		so.addParam("allowFullScreen", "true");
		so.addParam("allowScriptAccess","always");
		so.addVariable("VideoName", myMovie);
		//alert(showCommentYN);
		so.addVariable("AutoAnnotateState", showCommentYN);
		so.write("myAnnotatedVideo");
}

function fitVideo2Frame(frameName, myFlashPlayerWidth, myFlashPlayerHeight) {
    var result = {height:0, width:0};
	var myVideoFrame = eval("parent." + frameName);
	
	if (typeof(myFlashPlayerWidth) != 'number'){
		// if original Height and Width are not provided, setting them to optional values
		myFlashPlayerWidth = 707;
		myFlashPlayerHeight = 606;
		}
		
	// compute the correct aspect ratio
	var videoAspect = myFlashPlayerWidth/myFlashPlayerHeight;

	if(typeof(myVideoFrame.innerWidth) == 'number' ) {
		//Non-IE
		myFrameWidth = myVideoFrame.innerWidth;
		myFrameHeight = myVideoFrame.innerHeight;
		} else {
		//IE 6+ in 'standards compliant mode'
		myFrameWidth = myVideoFrame.document.body.innerWidth;
		myFrameHeight = myVideoFrame.document.body.innerHeight;
		}
  
     if (myFrameWidth == 0 || typeof(myFrameWidth) != 'number') {
		//Last Try, usually works with IE7
		myFrameWidth = myVideoFrame.document.body.clientWidth;
        myFrameHeight = myVideoFrame.document.body.clientHeight;
	  }
	  
    if (myFrameWidth == 0 || typeof(myFrameWidth) != 'number') {
		// if the script does not yield to valid values, set video-player size to 75% of original value to be able to show on smaller displays as well
		myFlashPlayerWidth = myFlashPlayerWidth/3*4;
		myFrameWidth = myFlashPlayerWidth;
		myFlashPlayerHeight = myFlashPlayerHeight/3*4;
		myFrameHeight = myFlashPlayerHeight;
		}

	// set the available Width and Height to at least 80 pixel smaller than the frame it uses
	var myFinalWidth = myFrameWidth - 40;
	var myFinalHeight = Math.round(myFinalWidth/videoAspect);

	if ((myFrameWidth - myFinalWidth) < 40) {
		// set the 
		myFinalWidth = myFrameWidth - 40;
		myFinalHeight = Math.round(myFinalWidth/videoAspect);
		}		
	if ((myFrameHeight - myFinalHeight) < 40) {
		// set the 
		myFinalHeight = myFrameHeight - 40;
		myFinalWidth = Math.round(myFinalHeight*videoAspect);
		}
	
	// use computed size only in case that frame is smaller than original video-player size
	if (myFlashPlayerWidth < myFinalWidth) {myFinalWidth = myFlashPlayerWidth; myFinalHeight = myFlashPlayerHeight}
	if (myFlashPlayerHeight < myFinalHeight) {myFinalHeight = myFlashPlayerHeight; myFinalWidth = myFlashPlayerWidth}

	result.width = eval(myFinalWidth + 0);
    result.height = eval(myFinalHeight + 0);
	return result;
}


function initializeHREFTrackArray()
// takes the HREFTrack-formattet content of the tag "HREFTable" 
// formates it myArray[milliseconds]
{
 var myTable = document.getElementById("HREFTable").innerHTML.toLowerCase();

 var FirstBracket = 0;
   for (i=0; i > -1; i++)
   {
   StartTC = myTable.indexOf("[",FirstBracket);
   if (StartTC < 0) {break}
   EndTC = myTable.indexOf("]",StartTC);
   myTC = myTable.substring(StartTC + 1,EndTC);
   myTCmillisec = hhmmss2sec(myTC);
   
   myArray[i] = new Array();
   myArray[i][0] = i+1;
   myArray[i][1] = myTCmillisec;
 
   FirstBracket = EndTC + 2;
   } 
}

function hiliteCurrentAnnotation(myVideoTime)
{
    //parent.MovieRightFrame.document.getElementById("myTC").innerHTML = myVideoTime + " seconds";
	//this.document.getElementById("tc").innerHTML = myArray;
	
	for (i=0; i<(myArray.length); i++)
	{
		if (eval(myArray[i][1]) > eval(myVideoTime))
		break;
	}
	//this.document.getElementById("tc").innerHTML = myArray[i];
	if ((myArray[i] != null) && (currentHilite != myArray[i][0]))
	{
		if ((eventTime != myArray[i][0]) && (myArray[i][0] > 1))
		{
			//alert("HILITE ELEMENT " + (myArray[i][0] - 1));
			currentHilite = myArray[i][0];
			HiliteElement(myArray[i][0] - 1);
			eventTime = myArray[i][0];
		}
	}
	
}

function sequentialVideosInit() {
	// this function sets the content of the frame "video_player" to the ID of the first list element of frame "movie_sequence"
	var myVideoPlayerURL = parent.frames['video_player'].location.href;
	var myVideoName = parent.frames['movie_sequence'].document.getElementsByTagName("td")[0].id;
	sequentialVideosPlay(myVideoName);
}

function sequentialVideosPlay(myVideoName) {
	// Reset coloring
	var myLength = parent.frames['movie_sequence'].document.getElementsByTagName("td").length;
	for (i=0; i<myLength; i++) {
		// reset bg color of cells except for the clicked one
		parent.frames['movie_sequence'].document.getElementsByTagName("td")[i].className='background_white';
		if (myVideoName == parent.frames['movie_sequence'].document.getElementsByTagName("td")[i].id) {
		parent.frames['movie_sequence'].document.getElementsByTagName("td")[i].className='background_blue';
		}
	}
	// Set the content of frame "video_player" to "myVideoHREF"
	myVideoHREF = "../" + myVideoName + "/frameset.htm";
	parent.frames['video_player'].location.href = myVideoHREF;
}
	
function sequentialVideoDone() {
	// first, a check is done if the function was called within the proper setting to show annotated videos in a sequence
	// in which case there must be a frame-object named "movie_sequence" present:
	if (typeof(parent.frames['movie_sequence']) == 'object'){
	var myLength = parent.frames['movie_sequence'].document.getElementsByTagName("td").length;
	for (i=0; i<myLength-1; i++) {
		//figure out which video is playing - the one playing must have the class "background_blue"..
		if (parent.frames['movie_sequence'].document.getElementsByTagName("td")[i].className == 'background_blue'){	
			myVideoName = parent.frames['movie_sequence'].document.getElementsByTagName("td")[i+1].id;
			sequentialVideosPlay(myVideoName);
			}
		}

	}
}

function AnnotationCheckboxTrue() {	
	showCommentYN = true;
}

function AnnotationCheckboxFalse() {
	showCommentYN = false;
}

function sequentialVideosPlayNext() {
	// execute only if there is a movie_sequence frame
	if (typeof(parent.frames['movie_sequence']) == 'object'){
	
	// this function is called from the "sequential folder" movie_sequence.htm file. 
	var myVideoPlayerURL = parent.frames['video_player'].document.URL;
	
	if (myVideoPlayerURL.indexOf("CDA_AnnotatedVideoPlaceholder") != -1) {
		// this statement is true  in case that there is not yet a video loaded, so let's load the first video.
		var myVideoName = parent.frames['movie_sequence'].document.getElementsByTagName("td")[0].id;
		myVideoPlayerURL = "../" + myVideoName + "/frameset.htm";
		parent.frames['video_player'].location.href = myVideoPlayerURL;
	    };
	}
}


function flash_comment16by9(myCommentMovieName)
	{
  myCommentName = myCommentMovieName;
  parent.MovieMainFrame.document.getElementById("myCommentNameMemory").innerHTML = myCommentMovieName;
  parent.MovieMainFrame.thisMovie("myAnnotatedFlashMovie").stopAnnotatedVideoFromJavaScript("true");
  myCommentWindow=window.open("../../js/CDA_FlashComment16by9Player.htm","Comment","toolbar=no, width=760, height=530, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=yes");
	}
	
function getMyCommentName() {
	//    window.opener.parent.MovieMainFrame.thisMovie("myAnnotatedFlashMovie").playAnnotatedVideoFromJavaScript("true");
	var myCommentName =  window.opener.parent.MovieMainFrame.document.getElementById("myCommentNameMemory").innerHTML;
	return(myCommentName);
	}
  
function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
		} else {
		return document[movieName];
		}
     }
	 
function sendToActionScript(value) {
     thisMovie("myAnnotatedFlashMovie").sendToActionScript(value);
     }
	 
function stopAnnotatedVideo(value){
	parent.thisMovie("myAnnotatedFlashMovie").stopAnnotatedVideoFromJavaScript(value);
	}
	 
function playAnnotatedVideo(value){
	thisMovie("myAnnotatedFlashMovie").playAnnotatedVideoFromJavaScript(value);
	}
	 
function flashVideoTimeCode(value) {
	hiliteCurrentAnnotation(value);
	}
	
function sendToJavaScript(value) {
    document.forms["form1"].output.value = "ActionScript says: " + value;
    }
	 
function setFlashVideoName() {
	// alert("SetVideoName");
	var mySource = this.document.getElementById("myAnnotatedMovie").innerHTML;
	thisMovie("myAnnotatedFlashMovie").setVideoNameFromJavaScript(mySource);
	}
	 
function setCommentName(myCommentName) {
	//var mySource = this.document.getElementById("myCommentMovieName").innerHTML;
	thisMovie("myCommentMovie").setCommentNameFromJavaScript(myCommentName);
	}
	 
function getVideoNameFromJavaScript() {
	// alert("SetVideoName");
	var mySource = this.document.getElementById("myAnnotatedMovie").innerHTML;
	return mySource;
	}
	 
function getCommentVideoNameFromJavaScript() {
	//alert("Comment Movie tries to get Source");
	var myCommentName =  window.opener.parent.MovieMainFrame.document.getElementById("myCommentNameMemory").innerHTML;
	var myCommentName = "../movies_comments/" + myCommentName;
	//alert(myCommentName);
    return myCommentName;
	}

function writeAnnotatedMovieFlash(){
	pageInit();
    initializeHREFTrackArray();
	setFlashVideoName();
	}

function hhmmss2sec(hhmmss)
// converts (dd:hh:)mm:ss:ff TimeCodes into Seconds
{
	// strip the numbers behind the "." if any
	var checkpoint = hhmmss.lastIndexOf("."); 
	if (checkpoint !=-1) {hhmmss = hhmmss.substring(0,checkpoint)}

   // get the seconds into milliseconds
	var checkpoint = hhmmss.lastIndexOf(":");
	var mySeconds = eval(hhmmss.substring(checkpoint + 1,hhmmss.length));
    var hhmm = hhmmss.substring(0,checkpoint);
	
	// get the minutes converted and added to the milliseconds
	var checkpoint = hhmm.lastIndexOf(":");
	var myMinutes = eval(hhmm.substring(checkpoint + 1,hhmm.length));
	var mySeconds = mySeconds + (myMinutes*60);

	return mySeconds
}

function sec2hhmmss(sec) {
	var myTimeScale = document.main_movie.GetTimeScale();
	
	var min = Math.floor(sec/60);
	sec = sec % 60;
	t = two(sec);
	
	var hr = Math.floor(min/60);
	min = min % 60;
	t = two(min) + ":" + t;
	
	return t
}

function two(x) {return ((x>9)?"":"0")+x}
function three(x) {return ((x>99)?"":"0")+((x>9)?"":"0")+x}

function replace(string,text,by) {
// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}


function HiliteElement(ID)
{
 var total = (parent.MovieRightFrame.document.getElementsByTagName("tr").length);
 var ID = eval(ID);
 var total = eval(total);
 total=(total+1);
 var i;
 i=1;
 // step 1: reset bg color to white, font color to black, and icons to pale
  for (i==1; i<total; i++)
  	{
	  p = parent.MovieRightFrame.document;
	  p.getElementById(i).style.backgroundColor='FFFFFF';
	  p.getElementById(i).style.color='CCCCCC';
	  if (p.getElementById(i+1000) != null){
		  var myString = p.getElementById(i+1000).innerHTML;
		  var myNewString = replace(myString,"movie_camera_icon.png","movie_camera_bright.png");
		  p.getElementById(i+1000).innerHTML = myNewString;
		  }
 	 }
	 
 // step 2: show which annotation is actually in use. From top to there, set font color to black and icons to solid	 
 i=1;
 for (i==1; i<ID; i++)
  	{
	  p = parent.MovieRightFrame.document;
	  p.getElementById(i).style.color='000000';
	  if (p.getElementById(i+1000) != null){
		  var myString = p.getElementById(i+1000).innerHTML;
		  var myNewString = replace(myString,"movie_camera_bright.png","movie_camera_icon.png");
		  p.getElementById(i+1000).innerHTML = myNewString;
		  }
 	 } 
	 
 // step 3: make font color black and bg color yellow
 p = parent.MovieRightFrame.document.getElementById(ID);
 p.style.backgroundColor='FFFF00';
 p.style.color='black';
 
 // step 4: insert full color camera icon
 p = parent.MovieRightFrame.document.getElementById(ID+1000);
 if (p != null)
  {
 //replace pale icon with solid-color icon
 var myString = p.innerHTML;
 var myNewString = replace(myString,"movie_camera_bright.png","movie_camera_icon.png");
 p.innerHTML = myNewString;
 
 
 parent.MovieMainFrame.thisMovie("myAnnotatedFlashMovie").checkAutoAnnotateCheckboxStatus("value");
	if (showCommentYN == true) {
	myElement = parent.MovieRightFrame.document.getElementById(ID);
	myElement.onclick();
	}


  }
}

function closeComment(){
    window.close();
    window.opener.parent.MovieMainFrame.thisMovie("myAnnotatedFlashMovie").playAnnotatedVideoFromJavaScript("true");
}

function show_textcomment(myURL)
{
window.open(myURL,"Comment","toolbar=no, width=600, height=400, location=no, directories=no, status=no, menubar=yes, scrollbars=no, resizable=no, copyhistory=yes");
frame1=eval("parent.MovieMainFrame");
frame1.document.main_movie.Stop();
}


function close_movie()
{
window.close();
}


/**
 * SWFObject v2.0: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept == "undefined") var deconcept = new Object();
if(typeof deconcept.util == "undefined") deconcept.util = new Object();
if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object();
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 = new Object();
	this.variables = new Object();
	this.attributes = new Array();
	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
		deconcept.SWFObject.doPrepUnload = 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 = new Array();
		var key;
		var variables = this.getVariables();
		for(key in variables){
			variablePairs.push(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') +'"';
			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') +'">';
			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{
		// 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"; // throws 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(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=0; i < objects.length; i++) {
		objects[i].style.display = 'none';
		for (var x in objects[i]) {
			if (typeof objects[i][x] == 'function') {
				objects[i][x] = function(){};
			}
		}
	}
}
// fixes bug in fp9 see http://blog.deconcept.com/2006/07/28/swfobject-143-released/
if (deconcept.SWFObject.doPrepUnload) {
	deconcept.SWFObjectUtil.prepUnload = function() {
		__flash_unloadHandler = function(){};
		__flash_savedUnloadHandler = function(){};
		window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs);
	}
	window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload);
}
/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}

/* 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;