/**
 * by David Milner, September 2005
 * Copyright (c) 2005 by Spectrum Chromatography
 *
 * Spectrum grants you a royalty free license to use or modify this
 * software provided that this copyright notice appears on all copies.
 * This software is provided "AS IS," without a warranty of any kind.
 */

// starthere


var j_TopImage;
var j_TopLastOver;
var j_TopMenuUp = -1;
var j_TopMenuSpans = Array ();
var j_TopCloseTimer;
var j_TopCloseTime = 1500;

function $ (name) {
	return document.getElementById (name);
}

function DebugMsg (msg) {
	var dv = document.getElementById ('DebugDiv');
	dv.innerHTML += msg + '<br>\n';
}

function j_TopMenuOff () {
	try {
		if (j_TopImage) { j_TopImage.src = j_TopImage.src.replace (/_hil/, ''); }
		j_TopImage = undefined;
		j_TopMenuUp = -1;
		$('topmenu').style.visibility = 'hidden';
	} catch (e) {}
}

function j_TopMenuStart (Timg, Twhich) {
	j_TopStopClose ();

        if (typeof(j_LCloseAll) == 'function') { j_LCloseAll(); }
	if (typeof(MClose) == 'function') { MClose(); }

	if (Twhich == j_TopMenuUp) {
		j_TopUnhilite ();
		j_TopLastOver = 0;
		return;
	}

        j_TopMenuOff();
	if (Twhich == 1 ||
	    Twhich == 5 ||
	    Twhich == 6) { return; }
	
	j_TopMenuUp = Twhich;
	var dv = $('topmenu');
	j_TopImage = Timg;

	try {
		var mSession = '';
		var aret = '';
		try {
			if (typeof(FromName == 'string')) { aret = FromName; }
			if (!aret.length) { aret = document.title; }
			var afrom = window.location;
			aret = '?FrName='+escape(aret)+';LiFrom='+escape(afrom)+';';
		} catch (e) { aret=''; }
		if (typeof(session)!='undefined' && session.length) { mSession = '?Ses='+session+';'; }
//		var entries = ["Ordering",            "e-mail links",         "facilities",            "distributors",            "lit request",          "How are we doing?"];
		var entries = ["ご注文方法",          "e-mailリンク",        "施設",                "代理店",                "資料請求",            "調査"];
		var links   = ["/generic/phone.html", "/generic/emails.html", "/generic/contact.html", "/i18n/distributors.html", "/generic/litreq.html", "/generic/Survey.html"+aret];
		if (typeof(TopMenuOffset) == 'undefined') { dv.style.top = '55px'; }
		else { dv.style.top = ''+(55+TopMenuOffset)+'px'; }
		dv.style.left = '497px';
		var width = 110;
		if (Twhich == 3) {
//			entries = ["company profile",       "press center",        "executive bios",     "job opportunities",  "art collection", 'privacy policy', "FAQ', 'copyright info'];
			entries = ["企業概要",             "広報",              "役員略歴",          "絵画コレクション", "プライバシーポリシー", "よくある質問", "著作権情報"] ;
			links   = ["/generic/profile.html", "/generic/press.html", "/generic/bios.html", "/generic/art.html", '/generic/privacy.html', '/generic/Welcome.html', '/generic/copyrite.html'];
			width = 100;
			dv.style.left = '583px';
		}
		if (Twhich == 4) {
//			entries = ["Catalogs &amp; Publications", "Product Brochures",   "Instructions for Use",   "Applications Notes", "Technical Information", "MSDS",           "Quality Documents", "Chemical Compatibility", "Videos"];
			entries = ["カタログ＆印刷物",    "製品紹介資料",        "取り扱い説明書",        "応用事例",          "技術情報",       "安全性関連情報",  "品質管理情報",      "薬品適合性", "Videos"];
			links   = ["/lit/catalogs.html", "/lit/brochures.html", "/lit/instructions.html", "/lit/appnotes.html", "/lit/tech.html", "/lit/msds.html", "/lit/quality.html", "/cell/Compatibility.html", "/lit/videos.html"];
			width = 133;
			dv.style.left = '670px';
		}
		var ins = '';
		var ix;
		for (ix=0; ix<entries.length; ix++) {
			if (ix == entries.length-1)	{ ins += '<div id="J_TOPMENU'+ix+'" class="topmenuitem1" '; }
			else					{ ins += '<div id="J_TOPMENU'+ix+'" class="topmenuitem" '; }
			ins +=	' onMouseOver="j_TopSMenuOver(this, '+ix+');" onMouseOut="j_TopSMenuOut(this, '+ix+');" onClick="j_TopMenuClick(\''+window.top.location.protocol+'//'+window.location.hostname+j_Foffset+links[ix]+mSession+'\');">'+
				'<a href="'+window.top.location.protocol+'//'+window.location.hostname+j_Foffset+links[ix]+mSession+'" class="topmenu" target="_top"><nobr>'+entries[ix]+'</nobr></a></div>';
		}
		dv.innerHTML = ins;
		dv.style.visibility = 'inherit';
		dv.style.zIndex = 39;
	} catch(e) {}
}

function j_TopMenuOut (TArea, Twhich) {
	j_TopStartClose();
}

function j_TopSMenuOver (dv, cnt) {
	j_TopStopClose();
	if (typeof(j_TopLastOver) != 'undefined' && j_TopLastOver.id && j_TopLastOver.id != dv.id) { j_TopUnhilite(); }
	j_TopLastOver = dv;
	dv.style.backgroundColor = '#FF9800';
	s = j_TopImage.src;
	if (!s.match(/_hil/)) {
		j_TopImage.src = s.replace (/(\.[^\/]+)$/, '_hil$1');
	}
}

function j_TopSMenuOut (dv, cnt) {
	j_TopStartClose();
	j_TopUnhilite();
}

function j_TopUnhilite () {
	if (typeof(j_TopLastOver) != 'undefined' && j_TopLastOver.style) {
		j_TopLastOver.style.backgroundColor = 'white';
	}
}

function j_TopMenuClick (where) {
	window.top.location = where;
}

function j_TopStartClose() {
	j_TopStopClose();
	j_TopCloseTimer = setTimeout ("j_TopCloseUp();", j_TopCloseTime);
}

function j_TopStopClose() {
	if (j_TopCloseTimer != 0) { clearTimeout(j_TopCloseTimer); }
	j_TopCloseTimer = 0;
}

function j_TopCloseUp () {
	try {
		j_TopImage.src = j_TopImage.src.replace (/_hil/, '');
		j_TopStopClose();
		var dv = $('topmenu');
		j_TopMenuUp = -1;
		dv.style.visibility = 'hidden';
		dv.innerHTML = ' ';
		dv.style.zIndex = 1;
	} catch (e) {}
}

