if(typeof fi == "undefined") var fi = {};
fi.east = {};
fi.east.App = {};

fi.east.App = function(swf, newDivId, width, height, version, bgcolor) {
	this.swf = new FlashObject(swf, newDivId, width, height, version, bgcolor);
	this.buttons = new Array();
	this.icons = new Array();
	this.videos = new Array();
}
fi.east.App.prototype = {
	addParam:function(param, value) {
		this.swf.addParam(param, value);
	},
	show:function(divId) {
		
		var xmlString = "<xml><menu>";
		var numberOfButtons = this.buttons.length;
		var numberOfIcons = this.icons.length;
		var numberOfVideos = this.videos.length;
		
		for(i=0; i<numberOfButtons; i++){
			xmlString += "<button><label><![CDATA[" + this.buttons[i].label + "]]></label><video>" + this.buttons[i].videos + "</video><digit>" + this.buttons[i].digit + "</digit></button>";
		}
		xmlString += "</menu><icons>";
		for(i=0; i<numberOfIcons; i++){
			xmlString += "<icon x='" + this.icons[i].x + "' y='" + this.icons[i].y + "'><video>" + this.icons[i].videos + "</video><digit>" + this.icons[i].digit + "</digit><description><![CDATA[" + this.icons[i].description + "]]></description></icon>";
		}
		xmlString += "</icons><videos>";
		for(i=0; i<numberOfVideos; i++){
			xmlString += "<video id='" + this.videos[i].id + "'><file>" + this.videos[i].file + "</file><label><![CDATA[" + this.videos[i].label + "]]></label><digit>" + this.videos[i].digit + "</digit></video>";
		}
		xmlString += "</videos></xml>";
		
		this.swf.addVariable("xmlData", xmlString);
		this.swf.write(divId);
			
	},
	addButton:function(label, videos, digit) {
		this.buttons.push(
			{
				label:label,
				videos:videos,
				digit:digit
			}
		);
	},
	addIcon:function(x, y, videos, digit, description) {
		this.icons.push(
			{
				x:x,
				y:y,
				videos:videos,
				digit:digit,
				description:description
			}
		);
	},
	addVideo:function(id, file, label, digit) {
		this.videos.push(
			{
				id:id,
				file:file,
				label:label,
				digit:digit
			}
		);
	}
}

var App = fi.east.App;