
var require = (window.require) = null;

/*@cc_on
if (typeof document.documentMode == "undefined" || document.documentMode < 9)
	document.execCommand("BackgroundImageCache", false, true);

if (document.documentMode == 8)
	document.write('<style type="text/css">html{visibility:hidden}</style>');
@*/

if (/\bMac/.test(navigator.platform))
	document.write('<link rel="stylesheet" type="text/css" href="/common/css/macos.css" />');

else if (/\biP(?:hone|ad|od)\b/.test(navigator.platform))
	document.write('<link rel="stylesheet" type="text/css" href="/common/css/ios.css" />');

(function()
{
	var path,
	    exported = {};
	
	require = (window.require) = function(pathname)
	{
		pathname = path + pathname.toString()
			.replace(/\s/g, "")
			.replace(/\/\.{1,}\//g, "/")
			.replace(/\/{2,}/g, "/")
			.replace(/^\//, "")
			.replace(/\/$/, "");
		
		if (!(pathname in exported))
		{
			document.write("\x3C\x73\x63\x72\x69\x70\x74\x20\x74\x79\x70\x65\x3D\x22\x74\x65\x78\x74\x2F"
				+ "\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74\x22\x20\x73\x72\x63\x3D\x22"
				+ pathname
				+ "\x22\x3E\x3C\x2F\x73\x63\x72\x69\x70\x74\x3E"
			);
			
			exported[pathname] = null;
		}
	};
	
	(function()
	{
		var REQUIRED_MODULES =
		[
			"lib/BoxModel.js",
			"lib/Cookie.js",
			"lib/DOMOperator.js",
			"lib/EventManager.js",
			"lib/httpGet.js",
			"lib/StyleManager.js",
			"lib/Property.js",
			/*@cc_on "lib/InternetExplorer.js", @*/
			/*@cc_on "lib/VML.js", @*/
			"rollover.js",
			"side-navigation.js",
			"open-new-window.js",
			"font-size.js",
			"content-width.js"
		];
		
		var i, j, m, n,
		    scripts,
		    script,
				queryString,
				query = {},
				keyValuePair = [],
				moreModules,
				authRegex = /^\w+:\/\/[^\/]+/,
				fnameRegex = /\/init\.js(?:\?(.+))?$/,
				queryRegex = /([^&]+)(?:&|$)/g;
			
		scripts = document.getElementsByTagName("\x53\x43\x52\x49\x50\x54");
		
		for (i = 0, m = scripts.length; i < m; i++)
		{
			script = scripts.item(i);
			
			if (fnameRegex.test(script.src))
			{
				if (script.defer)
					throw new Error("Do not specify \"defer\" to the script \"init.js\".");
				
				queryString = RegExp.$1;
				
				path = script.src.replace(fnameRegex, "").replace(authRegex, "") + "/";
				
				while (queryRegex.test(queryString))
				{
					keyValuePair = RegExp.$1.split("=", 2);
					query[keyValuePair[0]] = keyValuePair[1];
				}
				
				if ("import" in query)
				{
					moreModules = query["import"].toString().split(",");
					
					for (j = 0, n = moreModules.length; j < n; j++)
						REQUIRED_MODULES.push(moreModules[j].toString());
				}
				
				for (j = 0, n = REQUIRED_MODULES.length; j < n; j++)
					require(REQUIRED_MODULES[j]);
				
				path += "lib/";
				
				return;
			}
		}
		
		window.setTimeout(arguments.callee, 1);
		
	}).call();
	
}).call();

