var LANGUAGE_KOREAN		= "korean";
var LANGUAGE_ENGLISH		= "english";

var MODE_RELEASE			= "release";
var MODE_DEBUG			= "debug";
var runMode = MODE_RELEASE;

function isDebugMode() {
	// console.log("debug mode ? " + runMode);
	return runMode == MODE_DEBUG ? true : false;
}

function isReleaseMode() {
	// console.log("release mode ? " + runMode);
	return runMode == MODE_RELEASE ? true : false;
}


var GAME_SCREEN_SIZE = { x: 1024, y: 768 }



var sessionStorageManager = new SessionStorageManager();
{
	// if(isDebugMode()) {
	// 	sessionStorageManager.playerName = "부현율";
	// 	sessionStorageManager.playerID = 8;
	// 	sessionStorageManager.playingAppID = 101;
	// 	sessionStorageManager.playingAppName = "space_invaders";
	// 	sessionStorageManager.score = 1000;
	// 	sessionStorageManager.highScore = 2000;
	// }

	console.log("maestroID : " + sessionStorageManager.maestroID);
	console.log("maestroAccountType : " + sessionStorageManager.maestroAccountType);
	console.log("playerName : " + sessionStorageManager.playerName);
	console.log("playerID : " + sessionStorageManager.playerID);
	console.log("playerAccountType : " + sessionStorageManager.playerAccountType);
	console.log("playingAppID : " + sessionStorageManager.playingAppID);
	console.log("playingAppName : " + sessionStorageManager.playingAppName);
	console.log("playingAppKoreanName : " + sessionStorageManager.playingAppKoreanName);
	console.log("record : " + sessionStorageManager.record);
	console.log("bestRecord : " + sessionStorageManager.bestRecord);

	if(sessionStorageManager.maestroID === null && !isLogin()) {
		goLogin();
	}
}

function isLogin() {
	var filename = location.pathname.substring(location.pathname.lastIndexOf("/") + 1);
	// console.log(filename);

	return filename === "login.html" ? true : false;
}

function goLogin() {
	location.href = "login.html";
}

function isTypingGame() {
	if(sessionStorageManager.playingAppName === null)
		return false;

	if(sessionStorageManager.playingAppName.indexOf("typing") < 0)
		return false;

	return true;
}

function isTypingPracticeStage() {
	var appName = sessionStorageManager.playingAppName;

	if(appName.indexOf("practice_") > -1)
		return true;

	return false;
}

function isTypingTestStage() {
	var appName = sessionStorageManager.playingAppName;

	if(appName.indexOf("test_") > -1)
		return true;

	return false;
}

function isTypingWordStage() {
	var appName = sessionStorageManager.playingAppName;

	if((isTypingPracticeStage() || isTypingTestStage()) && appName.indexOf("_word") > -1)
		return true;

	return false;
}

function isTypingSentenceStage() {
	var appName = sessionStorageManager.playingAppName;

	if((isTypingPracticeStage() || isTypingTestStage()) && appName.indexOf("_sentence") > -1)
		return true;

	return false;
}


var textStyleBasic = { font: "bold 32px Arial", fill: "#fff", align: "center", boundsAlignH: "center", boundsAlignV: "middle" };
