
function click_topmenu(code) {
	if (code == "000") {
		document.location.href = "http://nostale.gameyarou.jp";
	} else if (code == "021") {
		document.location.href = "http://nostale.gameyarou.jp/story/";
	} else if (code == "610") {
		document.location.href = "http://nostale.gameyarou.jp/library/gameclient/";
	} else if (code == "_01") {
		document.location.href = "http://nostale.gameyarou.jp/secure/regist.asp";
	}
};

function onClickSuppress(obj) {
	var ckExpire = new Date();
	ckExpire.setDate(ckExpire.getDate() + 30);
	if (obj.checked)
		f_setCookie("NOSTALE_LANDING_SUPPRESS", "1", ckExpire, "/", "nostale.jp", false);
	else
		f_setCookie("NOSTALE_LANDING_SUPPRESS", "0", ckExpire, "/", "nostale.jp", false);
};

function f_getCookie(name) {
	var a_all_cookies = document.cookie.split(';');
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	for (i = 0; i < a_all_cookies.length; i++) {
		a_temp_cookie = a_all_cookies[i].split('=');
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
		if (cookie_name == name) {
			if (a_temp_cookie.length > 1) {
				cookie_value = unescape(a_temp_cookie[1].replace(/^\s+|\s+$/g, ''));
			}
			return cookie_value;
		}
	}
	return '';
};

function f_setCookie(name, value, expires, path, domain, secure) {
	document.cookie = name + '=' + escape(value) +
	((expires && (expires.constructor == Date)) ? ';expires=' + expires.toGMTString() : '') +
	((path) ? ';path=' + path : '') +
	((domain) ? ';domain=' + domain : '') +
	((secure) ? ';secure' : '');
};

function f_writeFlashTags(id, src, width, height, wmode, bgcolor, flashvars, scriptAccess) {
	var requiredMajorVersion = 9;
	var requiredMinorVersion = 0;
	var requiredRevision = 124;
	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;
		AC_FL_RunContent(
			"src", "/js/playerProductInstall",
			"FlashVars", "MMredirect" + MMredirectURL + '&MMplayerType=' + MMPlayerType + '&MMdoctitle=' + MMdoctitle + "",
			"width", width,
			"height", height,
			"align", "middle",
			"id", id,
			"quality", "high",
			"bgcolor", (bgcolor ? bgcolor : ""),
			"wmode", (wmode ? wmode : "window"),
			"name", id,
			"allowScriptAccess", (scriptAccess ? scriptAccess : "sameDomain"),
			"type", "application/x-shockwave-flash",
			"pluginspage", "http://www.adobe.com/go/getflashplayer"
		);
	} else if (hasRequestedVersion) {
		AC_FL_RunContent(
		"src", src,
		"flashvars", (flashvars ? flashvars : ""),
		"width", width,
		"height", height,
		"align", "middle",
		"id", id,
		"quality", "high",
		"bgcolor", (bgcolor ? bgcolor : ""),
		"wmode", (wmode ? wmode : "window"),
		"name", id,
		"allowScriptAccess", (scriptAccess ? scriptAccess : "sameDomain"),
		"type", "application/x-shockwave-flash",
		"pluginspage", "http://www.adobe.com/go/getflashplayer"
		);
	} else {
		var alternateContent = 'このサイトをご覧になるには<a href="http://www.adobe.com/go/getflash/" target="_blank">FlashPlayer</a>が必要です。';
		document.write(alternateContent);
	}
};
