// some variables to save
var currentPosition;
var currentRemaining;
var currentVolume;
var currentItem;
var currentState;
var currentLoad;
var currentXsize;
var currentYsize;

// this function is caught by the JavascriptView object of the player.
function sendEvent(typ,prm,swf) { thisMovie(swf).sendEvent(typ,prm); };

// this function is called by the JavascriptView object of the player.
function getUpdate(typ,pr1,pr2,swf) {
	if(typ == "time") { currentPosition = pr1; pr2 == undefined ? null: currentRemaining = Math.round(pr2); }
	else if(typ == "volume") { currentVolume = pr1; }
	else if(typ == "item") { currentItem = pr1; }
	else if(typ == "state") { currentState = pr1; }
	else if(typ == "load") { currentLoad = pr1; }
	else if(typ == "size") { currentXsize = "X=" + pr1; pr2 == undefined ? null: currentYsize = "Y=" + Math.round(pr2); }
};

// These functions are caught by the feeder object of the player.
function loadFile(obj,swf) { thisMovie(swf).loadFile(obj); };

function addItem(obj,idx,swf) { thisMovie(swf).addItem(obj,idx); };

function removeItem(idx,swf) { thisMovie(swf).removeItem(idx); };

function getLength(swf) { return(thisMovie(swf).getLength()); };

// This is a javascript handler for the player and is always needed.
function thisMovie(movieName) {
	if(navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	} else {
		return document[movieName];
	}
};

// This creates the TV
function createTV() {
//? ? %3F
//= ? %3D
//& ? %26
	var s1 = new SWFObject("/templates/AJs_Initial/media/imagerotator.swf","TV","320","190","9", "#000000");
	s1.addParam("allowfullscreen","false");
	s1.addParam("allowscriptaccess","always");
	s1.addVariable("shownavigation","false");
	s1.addVariable("file","http://www.ajsbargrill.com/templates/AJs_Initial/html/tv.php%3Fch%3Dch1");
	s1.addVariable("shuffle","false");
	s1.addVariable("rotatetime","3");
///	s1.addVariable("enablejs","true");
//	s1.addVariable("javascriptid","TV");
	s1.addVariable("width","320");
	s1.addVariable("height","190");
	s1.addVariable("displayheight","205");
	s1.addVariable("autostart","true");
	s1.write("holderTV");
};

function destroyTV(){
	document.getElementById("holderTV").innerHTML='';
}

// This creates the Audio
function createAudio() {
	var s1 = new SWFObject("/templates/AJs_Initial/media/mediaplayer.swf","Autio","320","20","9", "#000000");
	s1.addParam("allowfullscreen","false");
	s1.addParam("allowscriptaccess","always");
	s1.addVariable("file","http://www.ajsbargrill.com/templates/AJs_Initial/html/audio.php");
	s1.addVariable("shuffle","false");
	s1.addVariable("volume","50");
	s1.addVariable("enablejs","true");
	s1.addVariable("showicons","true");
	s1.addVariable("shownavigation","true");
	s1.addVariable("javascriptid","Audio");
	s1.addVariable("width","320");
	s1.addVariable("height","20");
	s1.addVariable("autostart","true");
	s1.addVariable("repeat","true");
	s1.write("holderAudio");
};

function destroyAudio(){
	document.getElementById("holderAudio").innerHTML='';
}