IsFileIncluded = true;
var scFlag = false;
var scrollcount = 0;
var Strict_Compat = false;

if (document.compatMode == "CSS1Compat")
	Strict_Compat = true;

var newLineChar = String.fromCharCode(10);
var char34 = String.fromCharCode(34);
var LastMenu = "";
var HTMLStr;
var x = 0;
var y = 0;
var x2 = 0;
var y2 = 0;
var x3 = 0;
var ToolbarMenu;
var ToolbarLoaded = false;
// var ToolbarColorBackground = "#EEEEEE"; // toolbar background color;
var ToolbarColorBackground = "#000000"; // toolbar background color;
// var ToolbarColorLines      = "#888888"; // lines
var ToolbarColorLines      = "#000000"; // lines
// var ToolbarColorMouseOver  = "#AAAA00"; // mouseover font color
var ToolbarColorMouseOver  = "#FF99FF"; // mouseover font color

var fontSmall;
var fontXSmall;

var menuItemCount = 0;
var menuItemCountMax = 30;
var arrMenuInfo = new Array(menuItemCountMax);

var colorActive         = "#FFFFFF";
var colorNonActive       = "#A9A9A9";

// Output style sheet and toolbar ID
document.write("<SPAN ID='StartMenu' STYLE='display:none;'></SPAN>");

// Build toolbar template
HTMLStr  = "<DIV ID='idToolbar'  STYLE='background-color:white;width:758;'>";
HTMLStr += "<DIV ID='idRow'      STYLE='position:relative;height:20px;'>";
HTMLStr += "<DIV ID='idMenuPane' STYLE='position:absolute;top:0px;left:0px;height:21px;width:10px;";
HTMLStr += 						 "background-color:" + ToolbarColorBackground;
HTMLStr += 						 ";float:right;padding-right:10px;padding-left:5px;"
HTMLStr += 						 "border-color:" + ToolbarColorLines + ";border-style:solid;border-width:1px;' NOWRAP><!--Menu--></DIV>";
HTMLStr += "</DIV>";
HTMLStr += "</DIV>";
HTMLStr += 	"<SCRIPT TYPE='text/javascript'>" + 
			"   var ToolbarMenu = StartMenu;" + 
			"</SCRIPT>" + 
			"<DIV WIDTH=100%>";		

// Define event handlers
window.onscroll  = scrollbaroptions;

//if (Strict_Compat)
//	fontSmall  = "bold x-small Verdana";
//else
	fontSmall   = "x-small Verdana";
	fontxSmall  = "xx-small Verdana";




// -------------------------------------------------------------------------
function drawToolbar()
{
	HTMLStr += "</DIV>";
	document.write(HTMLStr);
	ToolbarLoaded = true;

	idToolbar.style.backgroundColor   = ToolbarColorBackground;
	idMenuPane.style.backgroundColor  = ToolbarColorBackground;

	for (i = 0; i < menuItemCount; i++) 
	{
		thisMenu = document.all(arrMenuInfo[i].IDStr);
		if (thisMenu != null)
		{
			if (arrMenuInfo[i].IDStr == LastMenu && arrMenuInfo[i].type == "R")
			{
				// Last MSMenu has to be absolute width
				arrMenuInfo[i].type = "A";
				arrMenuInfo[i].unit = 100;
			}
			if (arrMenuInfo[i].type == "A")
				thisMenu.style.width = arrMenuInfo[i].unit + 'px';
			else 
				thisMenu.style.width = Math.round(arrMenuInfo[i].width * arrMenuInfo[i].unit) + 'em';
		}
	}
}

// -------------------------------------------------------------------------
function setSubMenuWidth(MenuIDStr, WidthType, WidthUnit)
{
	var fFound = false;
	if ( menuItemCount == menuItemCountMax )
	{
		alert("Unable to process menu. Maximum of " + menuItemCountMax + " reached.");
		return;
	}
	
	for (i = 0; i < menuItemCount; i++)
		if (arrMenuInfo[i].IDStr == MenuIDStr)
		{
			fFound = true;
			break;
		}

	if (!fFound)
	{
		arrMenuInfo[i] = new menuInfo(MenuIDStr);
		menuItemCount += 1;
	}

	if (!fFound && WidthType.toUpperCase().indexOf("DEFAULT") != -1)
	{
		arrMenuInfo[i].type = "A";
		arrMenuInfo[i].unit = 220;
	}
	else
	{
		arrMenuInfo[i].type = (WidthType.toUpperCase().indexOf("ABSOLUTE") != -1)? "A" : "R";
		arrMenuInfo[i].unit = WidthUnit;
	}
}

// -------------------------------------------------------------------------
// This function creates a menuInfo object instance.
function menuInfo(MenuIDStr)
{
	this.IDStr = MenuIDStr;
	this.type  = "";
	this.unit  = 0;
	this.width = 0;
	this.count = 0;
}

// -------------------------------------------------------------------------
function updateSubMenuWidth(MenuIDStr)
{
	for ( i=0; i<menuItemCount; i++ )
	{
		if ( arrMenuInfo[i].IDStr == MenuIDStr )
		{
			if (arrMenuInfo[i].width < MenuIDStr.length) 
				arrMenuInfo[i].width = MenuIDStr.length;

			arrMenuInfo[i].count = arrMenuInfo[i].count + 1;
			break;
		}
	}
}

// -------------------------------------------------------------------------
function addMenu(MenuIDStr, MenuDisplayStr, MenuURLStr, cText, strImage)
{
	tagStr  = "<!--Menu-->";
	
	MenuStr = newLineChar;
	if ( LastMenu != "" )
		MenuStr += "<SPAN STYLE='font:" + fontSmall + ";color:" + ToolbarColorLines + "'>|&nbsp;</SPAN>"; 
	MenuStr += "<A TARGET='_top'" +
			"   ID='AM_" + MenuIDStr + "'" +
			"   STYLE='text-decoration:none;cursor:hand;font:" + fontSmall + ";background-color:" + ToolbarColorBackground + ";color:" + cText + ";'";
	if (MenuURLStr != "")
		MenuStr += " HREF='" + MenuURLStr + "'";
	else
		MenuStr += " HREF='' onclick='window.event.returnValue=false;'";
		
	MenuStr += 	" onmouseout="  + char34 + "mouseMenu('" + cText + "'); hideMenu();" + char34;
	MenuStr += 	" onmouseover=" + char34 + "mouseMenu('" + ToolbarColorMouseOver + "'); doMenu('"+ MenuIDStr + "');" + char34 + ">";
	
	if ( strImage != "" )
		MenuStr +=  "<img src=" + strImage + " border=0 align=absmiddle>";
	
	MenuStr +=  "&nbsp;<b>" + MenuDisplayStr + "</b>&nbsp;</a>";
	MenuStr += tagStr;
	
	HTMLStr = HTMLStr.replace(tagStr, MenuStr);	
	setSubMenuWidth(MenuIDStr,"default",0);
	
	LastMenu = MenuIDStr;
}

// -------------------------------------------------------------------------
//   nType - 0: Normal
//           1: Bold
//           2: Indented
// -------------------------------------------------------------------------
function addSubMenu(SubMenuStr, SubMenuURLStr, cText, bSubSubMenu)
{
	var MenuPos = LastMenu.toUpperCase().indexOf("MENU");
	if (MenuPos == -1)
		MenuPos = LastMenu.length;

	var LookUpTag  = "<!--" + LastMenu + "-->";
	var sPos = HTMLStr.indexOf(LookUpTag);
	if (sPos <= 0)
	{
		HTMLStr += newLineChar + newLineChar + "<SPAN ID='" + LastMenu + "' ";
		HTMLStr += "STYLE='display:none;position:absolute;background-color:" + ToolbarColorBackground;
		HTMLStr += ";border-style:solid;border-width:1px;border-top-width:0px;border-color:" + ToolbarColorLines + ";";
		HTMLStr += "padding-top:0px;padding-left:0px;padding-bottom:15px;z-index:9px;'";
		HTMLStr += "onmouseout='hideMenu();'>";		
		HTMLStr += "<DIV STYLE='position:relative;left:0px;top:8px;'>";
	}

	strStyle  = "text-decoration:none;cursor:hand";
	strStyle += ";color:" + cText;
	if ( bSubSubMenu == true )
	{
		SubMenuStr = "&nbsp;&nbsp;&nbsp;&nbsp;" + SubMenuStr;
		strStyle += ";font:" + fontSmall; // used to be fontxSmall
	}
	else
	{
		strStyle += ";font:" + fontSmall;
		strStyle += ";font-weight:bold";
	}		

	TempStr = newLineChar +
				"<A ID='AS_" + LastMenu + "'" +
				"   STYLE='" + strStyle + "'" +
				"   HREF='"  + SubMenuURLStr + "' TARGET='_top'" +
				" onmouseout="  + char34 + "mouseMenu('" + cText + "');" + char34 + 
				" onmouseover=" + char34 + "mouseMenu('" + ToolbarColorMouseOver + "');" + char34 + ">" +
				"&nbsp;" + SubMenuStr + "</A><BR>" + LookUpTag;
	if (sPos <= 0)
		HTMLStr += TempStr + "</DIV></SPAN>";
	else
		HTMLStr = HTMLStr.replace(LookUpTag, TempStr);	

	updateSubMenuWidth(LastMenu);	
}

// -------------------------------------------------------------------------
function addSubMenuLine()
{
	var LookUpTag = "<!--" + LastMenu + "-->";
	var sPos = HTMLStr.indexOf(LookUpTag);
	if (sPos > 0)
	{
		cColor  = ToolbarColorLines;
		TempStr = newLineChar + "<HR STYLE='color:" + cColor + "' SIZE=1>" + LookUpTag;
		HTMLStr = HTMLStr.replace(LookUpTag, TempStr);
	}
}

// -------------------------------------------------------------------------
function mouseMenu(color) 
{
	window.event.srcElement.style.color = color;
}

// -------------------------------------------------------------------------
function doMenu(MenuIDStr) 
{
	var thisMenu = document.all(MenuIDStr);

	if (ToolbarMenu == null || thisMenu == null || thisMenu == ToolbarMenu || thisMenu.style==null) 
	{
		window.event.cancelBubble = true;
		return false;
	}
	
	// Reset dropdown menu
	window.event.cancelBubble = true;
	ToolbarMenu.style.display = "none";
	ToolbarMenu = thisMenu;

	// Set dropdown menu display position
	x  = window.event.srcElement.offsetLeft +
	 	 window.event.srcElement.offsetParent.offsetLeft + 60;

	if (MenuIDStr == LastMenu)
		x += (window.event.srcElement.offsetWidth - thisMenu.style.posWidth);
	x2 = x + window.event.srcElement.offsetWidth;
	y  = idRow.offsetHeight;
		 
	thisMenu.style.top  = y;
	thisMenu.style.left = x;
	thisMenu.style.clip = "rect(0 0 0 0)";
	thisMenu.style.display = "block";
	thisMenu.style.zIndex = 102;

	// delay 2 millsecond to allow the value of ToolbarMenu.offsetHeight be set
	window.setTimeout("showMenu()", true);
	return true;
}

// -------------------------------------------------------------------------
function showMenu() 
{
	if (ToolbarMenu != null && ToolbarMenu.style!=null) 
	{ 
		//alert("Showing menu " + ToolbarMenu.id);
		y2 = y + ToolbarMenu.offsetHeight;

		ToolbarMenu.style.clip = "rect(auto auto auto auto)";
		x2 = x + ToolbarMenu.offsetWidth;
	}
}

// -------------------------------------------------------------------------
function hideMenu()
{
	if (ToolbarMenu != null && ToolbarMenu != StartMenu &&  ToolbarMenu.style!=null) 
	{
		// Don't hide the menu if the mouse move between the menu and submenus
		cY = event.clientY + document.body.scrollTop;
		cX = event.clientX; 
		if (document.body.offsetWidth > x && scFlag)
		{
			cX = x + 9;
		}
		if ( (cX >= (x+5) && cX <= x2) &&
		     (cY > (y-10) && cY <= y2) )
		{
			window.event.cancelBubble = true;
			return; 
		}
		ToolbarMenu.style.display = "none";
		ToolbarMenu = StartMenu;
		window.event.cancelBubble = true;
	}
}

// -------------------------------------------------------------------------
function scrollbaroptions()
{
	scrollcount++;
	if ( scrollcount < 3 )
	{
		scFlag = true;
	}
	else
	{
		scrollcount = 0;
		scFlag = false;
	}	
}


// Add the menus here...
//
//	Syntax:
//		addMenu("MenuID", "MenuCaption", "Link", Color, "OptionalIconLink");
//		addSubMenu("SubMenuCaption", "Link", Color, indented(Y/N));

// SOLUTIONS/CASE
addMenu("SOLUTIONS/CASE", "SOLUTIONS/CASE", "http://www.javatel.co.jp/SOLUTION_CASE/index.html",  colorActive, "");


// PRODUCTS
addMenu("PRODUCTS", "PRODUCTS", "http://www.javatel.co.jp/PRODUCTS/index.html", colorActive, "");
addSubMenu("統一セキュリティー・プラットホーム<br>","http://www.javatel.co.jp/PRODUCTS/UnifiedSecurityPlatform/index.html", colorActive, false);
	addSubMenu("IPビデオ監視 (OMNICAST)<br>","http://www.javatel.co.jp/PRODUCTS/IP_video_surveillance/index.html", colorActive, false);
	addSubMenu("IP入退出管理 (SYSNERGIS)<BR>","http://www.javatel.co.jp/PRODUCTS/IP_access-control/index.html", colorActive, false);
	addSubMenu("IPナンバー読取カメラ (AUTOVU)<BR>","http://www.javatel.co.jp/LIBRARY/Genetec/Catalog/JA.AutoVu%20Brochure.pdf", colorActive, false);
	addSubMenu("エイロク NVR<BR>","http://www.javatel.co.jp/PRODUCTS/NVR EIROKU/index.html", colorActive, false);
	addSubMenu("Javatel アーカイブ・サーバ<BR>","http://www.javatel.co.jp/index.html", colorNonActive, false);
	addSubMenu("プラグイン<BR>","http://www.javatel.co.jp/index.html", colorNonActive, false);
	addSubMenu("ｶﾒﾗ Enc/Dec ﾓﾊﾞｲﾙ ﾍﾟﾘﾌｪﾗﾙ ﾈｯﾄﾜｰｸ <BR>","http://www.ipcam.tv/index.html", colorActive, false);

// NEWS
addMenu("NEWS", "NEWS", "http://www.javatel.co.jp/NEWS/index.html", colorActive, "");
	addSubMenu("プレスリリース<BR>", "http://www.javatel.co.jp/NEWS/PRESS_RELEASES/index.html",  colorActive, false);
	addSubMenu("コーポレートニュースレター<BR>", "http://www.javatel.co.jp/index.html",  colorNonActive, false);
	addSubMenu("イベント<BR>", "http://www.javatel.co.jp/index.html",  colorNonActive, false);
	addSubMenu("インザニュース<BR>", "http://www.javatel.co.jp/NEWS/IN_THE_NEWS/",  colorActive, false);
// SUPPORT
addMenu("SUPPORT", "SUPPORT", "http://www.javatel.co.jp/index.html", colorActive, "");
	addSubMenu("ビデオ容量計算<BR>", "http://www.javatel.co.jp/SUPPORT/calculator/index.html",  colorActive, false);
	addSubMenu("ソリューション・トレーニング<BR>","http://www.javatel.co.jp/SUPPORT/Solutions_Training/index.html", colorActive, false);
	addSubMenu("メンテナンスと保障<BR>","http://www.javatel.co.jp/index.html", colorNonActive, false);
	addSubMenu("ライセンス発行<BR>","http://www.javatel.co.jp/index.html", colorNonActive, false);
	addSubMenu("ログイン 顧客向けサポート<BR>","http://www.javatel.co.jp/index.html", colorNonActive, false);
	addSubMenu("ログイン インタラクティブサポート<BR>","http://www.javatel.co.jp/index.html", colorNonActive, false);
// COPORATE
addMenu("COPORATE", "CORPORATE", "http://www.javatel.co.jp/index.html", colorActive, "");
	addSubMenu("会社概要<BR>", "http://www.javatel.co.jp/CORPORATE/discoverjavatel.html",  colorActive, false);
	addSubMenu("ご挨拶<BR>", "http://www.javatel.co.jp/CORPORATE/Greeting.html",  colorActive, false);
	addSubMenu("組織図<BR>", "http://www.javatel.co.jp/index.html",  colorNonActive, false);
	addSubMenu("テクノロジーパートナー<BR>", "http://www.javatel.co.jp/CORPORATE/Technology_Partners.html",  colorActive, false);
	addSubMenu("経営報告<BR>", "http://www.javatel.co.jp/CORPORATE/Sales.html",  colorActive, false);
// LIBRARY
addMenu("LIBRARY", "LIBRARY", "http://www.javatel.co.jp/index.html", colorNonActive, "");
	addSubMenu("データシート/カタログ<BR>", "http://www.javatel.co.jp/index.html",  colorNonActive, false);
	addSubMenu("マニュアル<BR>","http://www.javatel.co.jp/index.html", colorNonActive, false);
// CONTACT
addMenu("CONTACT", "CONTACT", "http://www.javatel.co.jp/index.html", colorActive, "");
	addSubMenu("交通アクセス<BR>", "http://www.javatel.co.jp/CONTACT/map.html",  colorActive, false);
	addSubMenu("OMNICASTのご用命は<BR>", "http://www.javatel.co.jp/CONTACT/agent.html",  colorActive, false);
// CAREERS
addMenu("CAREERS", "CAREERS", "http://www.javatel.co.jp/index.html", colorNonActive, "");