var requiredMajorVersion = 9;
var requiredMinorVersion = 0;
var requiredRevision = 124;
var isSubmit = false;

function showLunaSlot( app, v ) {
	if (isSubmit) return false;
	var html = '';
	var hasProductInstall = DetectFlashVer(6, 0, 65);
	var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	if ( hasProductInstall && !hasRequestedVersion ) {
		var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
		var MMredirectURL = window.location;
	    document.title = document.title.slice(0, 47) + " - Flash Player Installation";
	    var MMdoctitle = document.title;
		html = AC_FL_GetContent(
			"src", "playerProductInstall",
			"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
			"width", "870",
			"height", "678",
			"align", "middle",
			"id", app,
			"quality", "high",
			"bgcolor", "#869ca7",
			"name", app,
			"allowScriptAccess","always",
			"type", "application/x-shockwave-flash",
			"pluginspage", "http://www.adobe.com/go/getflashplayer"
		);
	} else if (hasRequestedVersion) {
		html = AC_FL_GetContent(
			"src", app,
			"width", "870",
			"height", "678",
			"align", "middle",
			"id", app,
			"quality", "high",
			"wmode", "transparent",
			"name", app,
			"allowScriptAccess","always",
			"type", "application/x-shockwave-flash",
			"pluginspage", "http://www.adobe.com/go/getflashplayer",
			"flashvars", v
		);
	} else {
	    var alternateContent = 'Alternate HTML content should be placed here. '
	  	+ 'This content requires the Adobe Flash Player. '
	   	+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
	   	html = alternateContent;
	}
	isSubmit = true;
	document.write(html);
	return false;
}

function LunaSlotCloseApplication() {
	setTimeout('isSubmit = false;', 500);
}

function LunaSlotClose() {
	top.location.href = './main.html';
}

function LunaSlotGoBuyMint() {
	if (window.opener && !window.opener.closed) {
		window.opener.location.href = 'http://www.mgame.jp/myinfo/mint/';
		window.opener.focus();
	}else{
		window.open('http://www.mgame.jp/myinfo/mint/');
	}
	return false;
}

function onSelectServer(obj) {
	if (!isLogin()) {
		alert('ログインしてください。');
		return false;
	}else{
		var selectChar = document.forms['frm_selectChar'].ch;
		selectChar.selectedIndex = 0;
		for (var i=(selectChar.options.length-1); i>0; i--)
			selectChar.options[i] = null;
		if (f_getFormValue(obj) == '0') {
			for (var i=0; i<sv0Chars.length; i++) {
				selectChar.options[selectChar.options.length] = new Option(sv0Chars[i],sv0Chars[i]);
			}
		}else if (f_getFormValue(obj) == '1') {
			for (var i=0; i<sv1Chars.length; i++) {
				selectChar.options[selectChar.options.length] = new Option(sv1Chars[i],sv1Chars[i]);
			}
		}else if (f_getFormValue(obj) == '7') {
			for (var i=0; i<sv7Chars.length; i++) {
				selectChar.options[selectChar.options.length] = new Option(sv7Chars[i],sv7Chars[i]);
			}
		}
		return true;
	}
}

function goSelectSlot() {
	var form = document.forms['frm_selectChar'];
	if (!isLogin()) {
		alert('ログインしてください。');
		return;
	}else if (f_getFormValue(form.sv) =='') {
		alert('サーバーを選択してください。');
		return;
	}else if (f_getFormValue(form.ch) =='') {
		alert('キャラクターを選択してください。');
		return;
	}
	form.submit();
}

function movePage(page){
	document.forms["winForm"].wincds.disabled = true;
	document.forms["winForm"].Page.value = page;
	document.forms["winForm"].submit();
}

function focusPage() {
	self.focus();
}

f_addEvent (window, 'onload', focusPage, false);

