// Musee Psyche Standard JavaScript

// src attribute for script tag is obviously supported by this browser.
src = true;

// standard variables for such browsers.
// must be referenced locally within this script file.
var	jpn = false;
var	level = "";
var	SWF_pluginspage = "";
var	ie = navigator.appName.indexOf("Microsoft") != -1;
var	separator = (ie && location.hostname == "" ? '\\' : '/');
									// required for development purpose.
var	win95 = navigator.appVersion == "3.01 (Win95; I)";

function	MP_SetUp()
{
	var	pathname = location.pathname;
	var	root = (location.hostname == "member.nifty.ne.jp"
		 || location.hostname == "" ? "psyche" : "~psyche");

	if (pathname.charAt(pathname.length - 1) == separator)
		pathname += (shtml ? "index.shtml" : "index.html");

	for (i = pathname.length - 1; pathname.charAt(i) != '.'; i--)
		;

	jpn = pathname.charAt(--i) == 'j';
		// which means that non-japanese path name must not end with 'j'.

	for (; pathname.charAt(i) != separator; i--)
		;

	for (; ;)
	{
		for (j = i--; pathname.charAt(i) != separator; i--)
			;

		if (pathname.substring(i + 1,j) == root)
			break;

		level += "../";
	}

	SWF_pluginspage = jpn
	 ? "http://www-asia.macromedia.com/jp/shockwave/download/"
	 : "http://www.macromedia.com/shockwave/download/";
}

function	SWF_Embed(name,src0,width,height)
{
	var	src = level + src0;

	document.write("<object id=\"" + name + "\"");
	document.write(" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"");
	document.write(" width=\"" + width + "\" height=\"" + height + "\"");
	document.write(" codebase=\"http://active.macromedia.com/flash2/"
	 + "cabs/swflash.cab#version=2,0,0,0\">");
	document.write("<param name=\"movie\" value=\"" + src + "\">");
	document.write("<param name=\"quality\" value=\"high\">");
	document.write("<embed name=\"" + name + "\" src=\"" + src
	 + "\" quality=\"high\" swliveconnect=\"true\"");
	document.write(" width=\"" + width + "\" height=\"" + height + "\"");
	document.write(" pluginspage=\"" + SWF_pluginspage + "\">");
	document.write("</embed></object>");
}

function	SWF_HeaderInit(idHeader)
{
	var	root = ie ? window : document;

	root.header.GotoFrame(idHeader * 10 + 1);
	root.header.Play();
}

function	SWF_FooterInit(idFooter)
{
	var	root = ie ? window : document;

	root.footer.GotoFrame(idFooter * 10 + 1);
	root.footer.Play();
}

function	SWF_TitleInit(no)
{
	var	root = ie ? window : document;

	root.title0.GotoFrame(no);
	root.title0.Play();
}

function	SWF_LocalJump(name)
{
	location.hash = name;
}

function	SWF_LangJump(language)
{
	var	dest = location.protocol + "//" + location.hostname
		 + location.pathname;

	if (dest.charAt(dest.length - 1) == separator)
		dest += (shtml ? "index.shtml" : "index.html");

	for (i = dest.length - 1; dest.charAt(i) != '.'; i--)
		;

	j = (dest.charAt(i - 1) == 'j' ? (i - 1) : i);

	dest = dest.substring(0,j) + (language == "Japanese" ? 'j' : "")
	 + dest.substring(i,dest.length);

	location.href = dest;
}

function	SWF_SiteJump(section)
{
	var	dest = level.substring(3,level.length) + section;

	if (jpn)
		dest += 'j';

	dest += ((section == "index" && shtml)
	 ? ".shtml" : ".html");

	location.href = dest;
}

function	SWF_ComplexJump(hostname,pathname)
{
	var dest = location.protocol;
	var	shtml2 = hostname == "www.yk.rim.or.jp" || location.hostname == "";

	if (dest == "http:")
		dest += "//" + hostname + pathname;

	else if (win95)	// for local testing on Windows 95
	{
		if (pathname.charAt(1) == '~')
			dest += "///C|/" + pathname.substring(2,pathname.length);
		else
			dest += "///C|" + pathname;
	}

	else 			// for local testing on Macintosh
	{
		if (pathname.charAt(1) == '~')
			dest += "///Macintosh%20HD/"
			 + pathname.substring(2,pathname.length);
		else
			dest += "///Macintosh%20HD/" + pathname;
	}

	dest += (jpn ? "indexj" : "index") + (shtml2 ? ".shtml" : ".html");

	location.href = dest;
}

MP_SetUp();

// end of mpscript.js

