﻿function SlideShowConnectDebug (message) { 
	var obj=document.getElementById("appout"); 
	if(!obj) return; 
	var p = document.createElement("DIV");
	p.innerHTML = message;
	obj.appendChild(p);
	p.scrollIntoView();
}
var __p;
var SlideShowConnect = __p = {};
//Call to start the comm between flash and JS
__p.start = function(flashObject) {
	if(flashObject==null) return;
	this.state=1;
	this.flashObject=flashObject;
	this.initInterval=setInterval("SlideShowConnect.init()",100);
	this.init();
};
__p.init = function () {
	if(this.flashObject.ReadyState<3)return;
	clearInterval(this.initInterval);
	this.state=2;
};
__p.flashObject;
__p.initInterval;
__p.state = 0;
__p.handleIncoming = function (command, args) {
	SlideShowConnectDebug("command" + command + " " + args);
	//alert("HANDLE FLASH COMMAND");
};
__p.send = function (command,args) {
	//make sure the flash object is ready.
	var flashObject = this.flashObject;
	if(flashObject == null || this.state < 2) return;
	
	if(flashObject.handleCommand != null) {
		flashObject.handleCommand.apply(flashObject, arguments);
	}
};
delete __p;