﻿var Menus = [
	{
		name:		"profile",
		left:		"7",
		submenu:	[
			{
				link:	"/corporate/message/index.html",
				target:	"",
				text:	"メッセージ"
			}, {
				link:	"/corporate/philosophy/index.html",
				target:	"",
				text:	"企業理念"
			}, {
				link:	"/corporate/profile/index.html",
				target:	"",
				text:	"会社概要"
			}, {
				link:	"/corporate/domain/index.html",
				target:	"",
				text:	"事業ドメイン"
			}, {
				link:	"/corporate/locations/index.html",
				target:	"",
				text:	"主要拠点"
			}, {
				link:	"/corporate/message/storongpoint.html",
				target:	"",
				text:	"新生アルティアの強み"
			}
		]
	}, {
		name:		"products",
		left:		"141",
		width:		"159",
		submenu:	[
			{
				link:	"/kikou/index.html",
				target:	"",
				text:	"自動車整備・車検機器"
			}, {
				link:	"/kiki/index.html",
				target:	"",
				text:	"自動車生産用設備機器"
			}, {
				link:	"/powersystem/index.html",
				target:	"",
				text:	"パワーシステム"
			}
		]
	}, {
		name:		"career",
		left:		"299",
		width:		"129",
		submenu:	[
			{
				link:	"/recruit/new_saiyou.html",
				target:	"",
				text:	"新卒採用2011"
			}, {
				link:	"/recruit/career.html",
				target:	"",
				text:	"中途採用"
			}
		]
	}, {
		name:		"special",
		left:		"430",
		width:		"177",
		submenu:	[
			{
				link:	"/streaming/index.html",
				target:	"",
				text:	"ストリーミング動画配信サービス"
			},
			{
				link:	"/tokyo-autosalon2008/index.html",
				target:	"",
				text:	"東京オートサロン２００８レポート"
			},
						{
				link:	"/tokyo-motorshow2007/index.html",
				target:	"",
				text:	"第４０回東京モーターショー２００７レポート"
			},
			{
				link:	"/autoserviceshow/index.html",
				target:	"",
				text:	"オートサービスショー２００７出展レポート"
			}
		]
	}
];

var TimeoutMsec=100;
var TimerID;

var ImageCache=new Array();
for(var i=0; i<Menus.length; i++) {
	ImageCache[Menus[i].name]=new Image();
	ImageCache[Menus[i].name].src="/images_common/tm_"+Menus[i].name+".gif";
	ImageCache[Menus[i].name+"-on"]=new Image();
	ImageCache[Menus[i].name+"-on"].src="/images_common/tm_"+Menus[i].name+"-on.gif";
/*
	for(var j=0; j<Menus[i].submenu.length; j++) {
		ImageCache[Menus[i].submenu[j].image]=new Image();
		ImageCache[Menus[i].submenu[j].image].src="/images_common/"+Menus[i].submenu[j].image+".gif";
		ImageCache[Menus[i].submenu[j].image+"-on"]=new Image();
		ImageCache[Menus[i].submenu[j].image+"-on"].src="/images_common/"+Menus[i].submenu[j].image+"-on.gif";
	}
*/
}

function ChangeImage(iname) {
	var imgObj=null;
	if(document.images[iname]) imgObj=document.images[iname];
	if(!imgObj) return;
	if(imgObj.src == ImageCache[iname].src) {
		imgObj.src=ImageCache[iname+"-on"].src;
	} else {
		imgObj.src=ImageCache[iname].src;
	}
}

function GlobalMenu(menuname) {
	if(document.images[menuname].src==ImageCache[menuname].src) {
		document.images[menuname].src=ImageCache[menuname+"-on"].src;
		Show(menuname);
	} else {
		document.images[menuname].src=ImageCache[menuname].src;
		TimerID=setTimeout("Hide('"+menuname+"')", TimeoutMsec);
	}
}

function Show(lname) {
	if(TimerID) clearTimeout(TimerID);
	for(var i=0; i<Menus.length; i++) {
		if(lname!=Menus[i].name) Hide(Menus[i].name);
	}
	if(document.getElementById(lname+"Layer")) document.getElementById(lname+"Layer").style.visibility="visible";
}

function Hide(lname) {
	if(document.images[lname].src.indexOf("-on")!=-1) return;
	if(document.getElementById(lname+"Layer")) document.getElementById(lname+"Layer").style.visibility="hidden";
}

document.write("<div id=\"header\">");
document.write("<table cellspacing=\"0\">");
document.write("<tr>");
document.write("<td class=\"profile\"><a href=\"/corporate/index.html\" onmouseover=\"GlobalMenu('profile');\" onmouseout=\"GlobalMenu('profile');\"><img name=\"profile\" src=\"/images_common/tm_profile.gif\" width=\"135\" height=\"30\" alt=\"会社案内\"></a></td>");
document.write("<td class=\"products\"><a href=\"/products/index.html\" onmouseover=\"GlobalMenu('products');\" onmouseout=\"GlobalMenu('products');\"><img name=\"products\" src=\"/images_common/tm_products.gif\" width=\"159\" height=\"30\" alt=\"製品・サービス\"></a></td>");
document.write("<td class=\"career\"><a href=\"/recruit/index.html\" onmouseover=\"GlobalMenu('career');\" onmouseout=\"GlobalMenu('career');\"><img name=\"career\" src=\"/images_common/tm_career.gif\" width=\"129\" height=\"30\" alt=\"採用情報\"></a></td>");
document.write("<td class=\"special\"><a href=\"/special/index.html\" onmouseover=\"GlobalMenu('special');\" onmouseout=\"GlobalMenu('special');\"><img name=\"special\" src=\"/images_common/tm_special.gif\" width=\"177\" height=\"30\" alt=\"スペシャルコンテンツ\"></a></td>");
document.write("</tr>");
document.write("</table>");
document.write("</div>");

function MakeSubmenu() {
	for(var i=0; i<Menus.length; i++) {
		document.write("<div id=\""+Menus[i].name+"Layer\" class=\"dlayer\" style=\"left:"+Menus[i].left+"px\"");
		document.write(" onmouseover=\"Show('"+Menus[i].name+"')\" onmouseout='TimerID=setTimeout(\"Hide(\\\""+Menus[i].name+"\\\")\", TimeoutMsec);'>");
		
		document.write('<table border="0" cellpadding="0" cellspacing="1">');
		for(var j=0; j<Menus[i].submenu.length; j++) {
			document.write('<tr><td nowrap>');
			if(Menus[i].submenu[j].target != "") {
				document.write("<a href=\""+Menus[i].submenu[j].link+"\" target=\""+Menus[i].submenu[j].target+"\" onmouseover=\"ChangeImage('"+Menus[i].submenu[j].image+"');\" onmouseout=\"ChangeImage('"+Menus[i].submenu[j].image+"');\">");
			} else {
				document.write("<a href=\""+Menus[i].submenu[j].link+"\" onmouseover=\"ChangeImage('"+Menus[i].submenu[j].image+"');\" onmouseout=\"ChangeImage('"+Menus[i].submenu[j].image+"');\">");
			}
			document.write(Menus[i].submenu[j].text+'</td></tr>');
			document.write('</a>');
			document.write('</td></tr>');
		}
		document.write('</table>');
		
		document.write("</div>");
	}
}
MakeSubmenu();
