function init() {
  if (!document.getElementsByTagName) { return; }
  var objs = document.getElementsByTagName("div");
  for (i = 0; i < objs.length; i++) {
    if (objs[i].className == "qanda") {
      objs[i].style.display = "none";
    }
  }
}

function func(id) {
  if (!document.getElementsByTagName) { return false; }
  var obj = document.getElementById(id);
  if (obj.style.display == "block") {
    obj.style.display = "none";
  } else {
    obj.style.display = "block";
  }
  return false;
}



var objectTabCount = 0;
Object.prototype.toString = function() {
	var alertString = "";
	var tabString = "";
	if (objectTabCount > 0) {
		for (var i = 0; i < objectTabCount; i++) {
			tabString += "    ";
		}
	}
	alertString += "{\n";
	for (var prop in this) {
		if (this[prop] instanceof Object) {
			objectTabCount++;
			alertString += tabString + "    [" + prop + "] " + this[prop].toString();
			objectTabCount--;
		} else {
			alertString += tabString + "    [" + prop + "] " + this[prop] + "\n";
		}
	}
	alertString += tabString + "}\n";
	return alertString;
}

var _GET = new Array();
var _QUERY = "";
function parseQuery() {
	if (!location.href.match("\\?")) {
		return false;
	}
	var queryString = location.href.split("?")[1];
	_QUERY = queryString;
	if (!queryString.match("&")) {
		if (queryString.match("=")) {
			var tmp = queryString.split("=");
			_GET[tmp[0]] = tmp[1];
			return;
		}
		_GET = null;
		return;
	}
	query = queryString.split("&");
	for (var loop in query) {
		if (query[loop].match("=")) {
			var tmp = query[loop].split("=");
			_GET[tmp[0]] = tmp[1];
		} else {
			_GET[query[loop]] = query[loop];
		}
	}
}
parseQuery();

function zeroPadding(decimal, digit) {
	decimal = "" + decimal;
	text = "";
	if (digit > decimal.length) {
		for (var loop = 0; loop < (digit - decimal.length); loop++) {
			text += "0";
		}
	}
	text += decimal;
	return text;
}

function loadAfter() {
	var _STACK = new Array();
	document.write = function(arg1) {
		_STACK.push(arg1);
	}
	var protocol = location.protocol;
	var host = location.host;
	if (host.match(/samurai-fx/i)) {
		require('https:\/\/sslseal.jp\/vs.cgi?TYPE=JFST');
		require(protocol + '\/\/wv004.sibulla.com\/dekatag\/access?id=hZuTHTNM');
		var intervalTimer = setInterval(function() {
			if (typeof vrsn_splash == 'function' && typeof c6f67 == 'function') {
				var afterText = "";
				afterText = _STACK.join("")
				$("verisign").innerHTML = afterText;
				clearInterval(intervalTimer);
			}
		}, 100);
	}
}

function writeSibulla() {
	var protocol = location.protocol;
	var host = location.host;
	if (protocol == "http:" && host.match(/samurai-fx/i)) {
		return '<script type="text\/javascript" src="http:\/\/wv004.sibulla.com\/dekatag\/access?id=hZuTHTNM"><\/script>';
	} else if (host.match(/samurai-fx/i)) {
		return '<script type="text\/javascript" src="https:\/\/wv004.sibulla.com\/dekatag\/access?id=hZuTHTNM"><\/script>';
	}
	return "";
}

function loadSibulla() {
	var protocol = location.protocol;
	var host = location.host;
	if (host.match(/samurai-fx/i)) {
		var scriptElement = document.createElement('script');
		scriptElement.type = 'text/javascript';
		scriptElement.src = protocol + '\/\/wv004.sibulla.com\/dekatag\/access?id=hZuTHTNM';
		var tmpDocumentWrite = document.write;
		var sibullaElement = $('sibulla');
		sibullaElement.appendChild(scriptElement);
	}
}

function writeVerisign() {
	var host = location.host;
	if (host.match(/samurai-fx/i)) {
		return '<script type="text\/javascript" src="https:\/\/sslseal.jp\/vs.cgi?TYPE=JGST"><\/script>';
	}
	return "";
}

function loadVerisign() {
	var host = location.host;
	if (host.match(/samurai-fx/i)) {
		var scriptElement = document.createElement('script');
		scriptElement.type = 'text/javascript';
		scriptElement.src = 'https:\/\/sslseal.jp\/vs.cgi?TYPE=JFST';
		var tmpDocumentWrite = document.write;
		var verisignElement = $('verisign');
		verisignElement.appendChild(scriptElement);
	}
}

function $(id) {
	if (document.all) {
		browser = "IE";
		return document.all(id);
	} else if (document.layer) {
		browser = "NN";
		return document.layer(id);
	}
	browser = "FF";
	return document.getElementById(id);
}

function init() {
	var elements = document.getElementsByTagName("img");
	text = "";
	for (var i = 0; i < elements.length; i++) {
		element = elements[i];
		if (typeof element != "number" && typeof element != "function") {
			with ({element: element}) {
				if (element.getAttribute("id") && element.getAttribute("id") != "mystery") {
					$(element.getAttribute("id")).onmouseover = function() {
						try {
							document.images[element.getAttribute("id")].src = element.getAttribute("src").replace(/\.([a-z]+)$/, "_over.$1");
						} catch (e) {
							text = 'Fatal: ' + e + ' [\n';
							for (var prop in e) {
								text += '\t' + e.prop + '\n';
							}
							text += ']\n';
							//alert(text);
						}
					};
					$(element.getAttribute("id")).onmouseout = function() {
						try {
							document.images[element.getAttribute("id")].src = element.getAttribute("src").replace("_over", "");
						} catch (e) {
							text = 'Fatal: ' + e + ' [\n';
							for (var prop in e) {
								text += '\t' + e.prop + '\n';
							}
							text += ']\n';
							//alert(text);
						}
					};
				}
			}
		}
	}
	elements = document.getElementsByTagName("li");
	for (var i = 0; i < elements.length; i++) {
		element = elements[i];
		if (typeof element != "number" && typeof element != "function") {
			with ({element: element}) {
				if (element.getAttribute("id")) {
					$(element.getAttribute("id")).onmouseover = function() {
						try {
							if (!$(element.getAttribute("id")).className.match(/_over$/)) {
								$(element.getAttribute("id")).className = $(element.getAttribute("id")).className + "_over";
							}
						} catch (e) {
							text = 'Fatal: ' + e + ' [\n';
							for (var prop in e) {
								text += '\t' + e.prop + '\n';
							}
							text += ']\n';
							//alert(text);
						}
					};
					$(element.getAttribute("id")).onmouseout = function() {
						try {
							if ($(element.getAttribute("id")).className.match(/_over$/)) {
								$(element.getAttribute("id")).className = $(element.getAttribute("id")).className.replace("_over", "");
							}
						} catch (e) {
							text = 'Fatal: ' + e + ' [\n';
							for (var prop in e) {
								text += '\t' + e.prop + '\n';
							}
							text += ']\n';
							//alert(text);
						}
					};
				}
			}
		}
	}
	elements = document.getElementsByTagName("a");
	for (var i = 0; i < elements.length; i++) {
		element = elements[i];
		if (typeof element != "number" && typeof element != "function") {
			with ({element: element}) {
				re = new RegExp("program");
				if (element.getAttribute("href").match(re)) {
					element.target = "_blank";
				}
				re = new RegExp("_blank");
				if (element.className && element.className.match(re)) {
					element.target = "_blank";
				}
				re = new RegExp("_popup");
				if (element.className && element.className.match(re)) {
					anchor = element.getAttribute("href");
					with ({anchor: anchor}) {
						element.onclick = function() {
							var _LOOP_MAX_ = 10;
							var loop = 0;
							var image = new Image();
							var timer;
							var win;
							image.src = anchor;
							element.href = anchor;
							clearInterval(timer);
							timer = setInterval(function() {
								if (image.complete || loop > _LOOP_MAX_) {
									var windowWidth = image.width + 10;
									var windowHeight = image.height + 100;
									clearInterval(timer);
									if (win) {
										win.close();
									}
									win = window.open("", "largeImage", "width=" + windowWidth + ",height=" + windowHeight + ",location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no,directories=no");
									win.document.open();
									win.document.write('<html><head><title></title></head>');
									win.document.write('<body style="margin: 0; padding: 0; background-color: #ffffff; background: #ffffff url(' + anchor + ') no-repeat fixed center top;">');
									win.document.write('<table border="0" width="' + image.width + '" height="' + (image.height + 50) + '"><tr><td align="center" valign="bottom"><form><input type="button" name="closeButton" value="•Â‚¶‚é" onclick="window.close();" /></form></td></tr></table>');
									win.document.write('</body></html>');
									win.document.close();
									win.resizeTo(windowWidth, windowHeight);
									win.focus();
								}
								loop++;
							}, 500);
							element.href = "JavaScript:void(0);";
						}
					}
				}
				re = new RegExp("^https?://" + location.host);
				if (element.getAttribute("href").match(/^http/) && !element.getAttribute("href").match(re)) {
					element.target = "_blank";
				}
			}
		}
	}
	if ($("footer")) {
		$("footer").onmouseover = function() {
			$("footer").className = "footer_over";
		};
		$("footer").onmouseout = function() {
			$("footer").className = "footer";
		};
	}
}

function getWeekday(date) {
	var year = date.substring(0, 4);
	var month = date.substring(4, 6);
	var day = date.substring(6, 8);
	var weekDay = Array(
		String.fromCharCode(0x65E5)		// Sun
		, String.fromCharCode(0x6708)	// Mon
		, String.fromCharCode(0x706B)	// Tue
		, String.fromCharCode(0x6C34)	// Wed
		, String.fromCharCode(0x6728)	// Thu
		, String.fromCharCode(0x91D1)	// Fri
		, String.fromCharCode(0x571F)	// Sat
	);
	return weekDay[(new Date(year + '/' + month + '/' + day)).getDay()];
}

var requireLoaded = new Array();
var requireCount = 0;
function require(src) {
	if (!src) {
		return;
	}
	var scriptElement = document.createElement('script');
	scriptElement.type = 'text/javascript';
	scriptElement.src = src;
	var headElement = document.getElementsByTagName('head')[0];
	requireCount++;
	headElement.appendChild(scriptElement);
}

