/// Flash External Interface API

function show(args) {
	showTopLayer(args, 'flash');
}

function loadControl(id) {
// 	console.log(id);
	var so = new SWFObject("control"+ id +".swf", "control", "250", "398", "8", "#faf3ed");
	so.addParam('wmode', 'transparent');
	so.write("fl_control");
}

function levelSwitch(args) {
	try {
		thisMovie('index').levelSwitch(args);
	} catch (e) {}
}

function loadArgs(args) {
	arr = args.split(',');
	if (arr[1].length == 0) {
		arr[1] = 'null';
	}
	return arr;
}

function loadText(args) {
	arr = loadArgs(args);
	thisMovie('control').displayInfo(arr[0], arr[1]);
}

function setGlobal(args) {
	arr = loadArgs(args);
	thisMovie('control').setGlobal(arr[0], arr[1]);
}

function hoverOut(args) {
	try {
		thisMovie('index').hoverOut(args);
	} catch (e) {
	}
}

function hideTopLayer(args) {
	document.getElementById('kompan_hideButton').onclick();
}

function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName]
	} else {
		return document[movieName]
	}
}
