//----------------------------------------------------------------------------// Global variables used in drawing the menu.//----------------------------------------------------------------------------	// Main menu	var gLang = "j";	var gMenuNormalSrc = new Array(11);	var gMenuHiliteSrc = new Array(11);	var gMenuSelectSrc = new Array(11);	var gMenuSelRedSrc = new Array(11);	var gMenuWidth = new Array(11);	var gMenuHREF = new Array(11);	// Sub menu	var gSubMenuWidth = [ [0], [0, 59, 55, 44, 76, 109, 307], [0, 103, 67, 54, 34, 75, 90, 76, 43, 108], [0, 59, 33, 77, 64, 50, 367], [0, 169, 153, 87, 241], [0, 103, 88, 38, 421], [0, 125, 66, 33, 73, 353], [0, 36, 44, 570], [0, 37, 33, 33, 62, 485] ];	var gSubMenuHeight = 15;	var gSubMenuHREF = [ ["x"], ["x", "general/basics_01.htm", "diary/diary_index.htm", "general/links_01.htm", "guestbook/guestbook.htm", "general/about.htm", "X"], ["x", "sf/sf.htm", "areas/monterey_01.htm", "areas/carmel_01.htm", "areas/napa_01.htm", "areas/sausalito_01.htm", "areas/svalley_01.htm", "areas/sacramento.htm", "areas/areas.htm"], ["x", "sf/spots.htm", "sf/transportation.htm", "sf/sfshopping.htm", "eat/sf.htm", "event/calendar_sf.htm"], ["x", "event/calendar_sf.htm", "event/calendar_sv.htm", "event/gallery.htm"], ["x", "eat/sf.htm", "eat/sv.htm", "eat/discover/discover_index.htm"], ["x", "shop/mall.htm", "shop/brands.htm", "shop/market.htm", "shop/souvenir_01.htm"], ["x", "play/parks.htm", "play/museums.htm"], ["x", "faq/general.htm", "faq/transportation.htm", "faq/weather.htm", "faq/send_question.htm"], ["x", "", "", "", "", "", "", "", ""] ]//----------------------------------------New---------------------------------	var gPageIndex = 0;	var gPathPrefix = "";// Two variables below are defined in "PageData" file; 0 = _00.htm based multi-page set; 1 = "No intro" multi-page set starting with _01.htm	//	var gPageType = 0;					//  var gPageData://----------------------------------------------------------------------------// Init Page//----------------------------------------------------------------------------	window.name = "California Asobikata";//----------------------------------------------------------------------------// asbInitialize//----------------------------------------------------------------------------// This function creates path prefix based on depth of web page//// Parameters:	//		- inDepth: Depth from the root of the web site hierarchy at which the //		  calling web page resides.//----------------------------------------------------------------------------function asbInitialize( inDepth, inLang ) {	gLang = inLang;	gPathPrefix = asbGetPathDepth( inDepth );	if ( typeof gPageData != "undefined" ) {		if ( gPageData.length ) {								// If it's a multi-page document			var docName = asbFindDocName( document.URL );				gPageIndex = asbNameToPageIndex( docName );						}	}}//----------------------------------------------------------------------------// asbLoadMenuImages//----------------------------------------------------------------------------// This function loads in all menu images into the an array of cache.//----------------------------------------------------------------------------function asbLoadMenuImages() {	// First define image source files	for (i=1; i<=10; i=i+1)	{		gMenuNormalSrc[i] = gPathPrefix + "images/nav/m_n_" + i + ".gif";		gMenuHiliteSrc[i] = gPathPrefix + "images/nav/m_h_" + i + ".gif";		gMenuSelectSrc[i] = gPathPrefix + "images/nav/m_s_" + i + ".gif";		gMenuSelRedSrc[i] = gPathPrefix + "images/nav/m_r_" + i + ".gif";	}	// Now define image width	gMenuWidth[1] = 58;	gMenuWidth[2] = 86;	gMenuWidth[3] = 37;	gMenuWidth[4] = 71;	gMenuWidth[5] = 59;	gMenuWidth[6] = 45;	gMenuWidth[7] = 46;	gMenuWidth[8] = 44;	gMenuWidth[9] = 184;	gMenuWidth[10] = 20;		// Now define HREF	gMenuHREF[1] = gPathPrefix + "index.html";	gMenuHREF[2] = gPathPrefix + "areas/areas.htm";	gMenuHREF[3] = gPathPrefix + "sf/sf.htm";	gMenuHREF[4] = gPathPrefix + "event/event.htm";	gMenuHREF[5] = gPathPrefix + "eat/eat.htm";	gMenuHREF[6] = gPathPrefix + "shop/shop.htm";	gMenuHREF[7] = gPathPrefix + "play/play.htm";	gMenuHREF[8] = gPathPrefix + "faq/faq.htm";	gMenuHREF[9] = "";	gMenuHREF[10] = "";}//----------------------------------------------------------------------------// asbGenerateMenu//----------------------------------------------------------------------------// This function generates the navigation menu/submenu at the top of the page.// It is called by individual web pages at the beginning of page loading.//// Parameters:	//		- menuIndex: Must be between 1 and 9, corresponding to the top menu //		  item.//		- submenuIndex: Index for the current submenu to be in bold.  If it's//		  0, then it's the "intro" page and nothing will be in bold.//----------------------------------------------------------------------------function asbGenerateMenu( inMenuIndex, inSubIndex ) {	asbLoadMenuImages();	// First open the stream to the document and write out top level table	document.open("text/html");	document.writeln('<P><CENTER><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>');	document.writeln('<TR>');	document.writeln('<TD VALIGN=top ROWSPAN=2 WIDTH=1>');		// logo at the top left	document.writeln('<P></P>');	document.writeln('</TD>');	document.writeln('<TD VALIGN=top>');	document.writeln('<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>');	document.writeln('<TR>');	// Now loop through each menu item and write selected (sl) or unselected (nm) images with right rollover (hi)	for (i=1; i<=10; i=i+1)	{		document.writeln('<TD VALIGN=bottom WIDTH=' + gMenuWidth[i] + '>');		if ( i == inMenuIndex ) {					// Need to write up "selected" image without rollover			if ( inSubIndex == 0 ) {	// No submenu selected, so display "selected" red menu and no HREF				document.writeln('<P><IMG SRC=' + gMenuSelRedSrc[i] + ' WIDTH=' + gMenuWidth[i] + ' HEIGHT=33 BORDER=0 NAME="menuImage' + i + '"' + ' ALIGN=bottom></P>');			}			else {		// Submenu is selected, so display the normal black menu				document.writeln('<P><A HREF=' + gMenuHREF[i] + ' TARGET="_top"><IMG SRC=' + gMenuSelectSrc[i] + ' WIDTH=' + gMenuWidth[i] + ' HEIGHT=33 BORDER=0 NAME="menuImage' + i + '"' + ' ALIGN=bottom></A></P>');			}		} 		else {								// Write out "unselected" image with "hilite" rollover			if ( i == 9 ) {			// special case the 2nd from last item (the blank space), which doesn't have HREF				document.writeln('<P><IMG SRC=' + gMenuNormalSrc[i] + ' WIDTH=' + gMenuWidth[i] + ' HEIGHT=33 BORDER=0 NAME="menuImage' + i + '"' + ' ALIGN=bottom></P>');			}			else if ( i == 10 ) {	// special case email icon				document.writeln('<P><A HREF="mailto:admin@asobikata.com" onMouseOver="document.menuImage' + i + '.src=' + "'" + gMenuHiliteSrc[i] + "'" + '"' + ' onMouseOut="document.menuImage' + i + '.src=' + "'" + gMenuNormalSrc[i] + "'" + '"' + ' TARGET="_top"><IMG SRC=' + gMenuNormalSrc[i] + ' WIDTH=' + gMenuWidth[i] + ' HEIGHT=33 BORDER=0 NAME="menuImage' + i + '"' + ' ALIGN=bottom></A></P>');			}			else {				document.writeln('<P><A HREF=' + gMenuHREF[i] + ' onMouseOver="document.menuImage' + i + '.src=' + "'" + gMenuHiliteSrc[i] + "'" + '"' + ' onMouseOut="document.menuImage' + i + '.src=' + "'" + gMenuNormalSrc[i] + "'" + '"' + ' TARGET="_top"><IMG SRC=' + gMenuNormalSrc[i] + ' WIDTH=' + gMenuWidth[i] + ' HEIGHT=33 BORDER=0 NAME="menuImage' + i + '"' + ' ALIGN=bottom></A></P>');			}		}		document.writeln('</TD>');	}			document.writeln('</TR>');	document.writeln('</TABLE></TD></TR>');	document.writeln('<TR><TD VALIGN=top>');	document.writeln('<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>');	document.writeln('<TR>');		// Now write up sub-menu table	for (i=1; i<gSubMenuWidth[inMenuIndex].length; i=i+1) {		if ( inMenuIndex < 9 ) {		// only if it's not blank or email icon			if ( i != ( gSubMenuWidth[inMenuIndex].length - 1 ) ) {						// it's not the last item, which is a blank line and shouldn't have a link				if ( i == inSubIndex ) {					document.writeln('<TD VALIGN=top WIDTH=' + gSubMenuWidth[inMenuIndex][i] + '><P><IMG SRC="' + gPathPrefix + 'images/nav/s_r_0' + inMenuIndex + '_0' + i + '.gif" WIDTH=' + gSubMenuWidth[inMenuIndex][i] + ' HEIGHT=15 BORDER=0 ALIGN=bottom></P></TD>');				}				else {					document.writeln('<TD VALIGN=top WIDTH=' + gSubMenuWidth[inMenuIndex][i] + '><P><A HREF=' + gPathPrefix + gSubMenuHREF[inMenuIndex][i] + ' TARGET="_top"><IMG SRC="' + gPathPrefix + 'images/nav/s_n_0' + inMenuIndex + '_0' + i + '.gif" WIDTH=' + gSubMenuWidth[inMenuIndex][i] + ' HEIGHT=15 BORDER=0 ALIGN=bottom></A></P></TD>');				}			}			else { 						// it's the last item, so don't have HREF				document.writeln('<TD VALIGN=top WIDTH=' + gSubMenuWidth[inMenuIndex][i] + '><P><IMG SRC="' + gPathPrefix + 'images/nav/s_n_0' + inMenuIndex + '_0' + i + '.gif" WIDTH=' + gSubMenuWidth[inMenuIndex][i] + ' HEIGHT=15 BORDER=0 ALIGN=bottom></P></TD>');			}		}	}		// Finally write up the rest of the page	document.writeln('</TR></TABLE></TD></TR>');	document.writeln('<TR><TD HEIGHT=5><P></P></TD><TD HEIGHT=5><P></P></TD></TR>');		// Blank 5 pixel high space	document.writeln('</TABLE></CENTER></P>');	document.close();}//----------------------------------------------------------------------------// asbAdjustPathDepth//----------------------------------------------------------------------------//// Parameters:	//		- inMenuIndex: Must be between 1 and 9, corresponding to the top menu //		  item.//		- inSubmenuIndex: Index for the current submenu to be in bold.  If it's//		  0, then it's the "intro" page and nothing will be in bold.function asbAdjustPathDepth( inDepth ) {	var path = "";		for (i=2; i<=inDepth; i=i+1) {		path = "../" + path;	}	return path;}//----------------------------------------------------------------------------//----------------------------------------------------------------------------//----------------------------------------------------------------------------//----------------------------------------------------------------------------// asbGetPathDepth//----------------------------------------------------------------------------//// Parameters:	//		- inDepth: Number of times "../" should be appended.//----------------------------------------------------------------------------function asbGetPathDepth( inDepth ) {	var path = "";		for (i=1; i<=inDepth; i=i+1) {		path = path + "../";	}	return path;}//----------------------------------------------------------------------------// asbGeneratePagePopup//----------------------------------------------------------------------------// This function generates popup menu for navigating between pages.//// Parameters:	//		- inSelected: Currently selected menu item. //----------------------------------------------------------------------------function asbGeneratePagePopup() {	var pageIndex = gPageIndex;	if ( gPageType == 1 ) pageIndex = pageIndex - 1;				// multi-page set without _00.htm "Intro" page - shift one for 	// First open the stream to the document and write out controls for the popup menu form	document.open("text/html");	document.writeln('<P CLASS=main>');	document.writeln('<FORM ACTION="" METHOD=POST name=PagePopupFormName>');	document.writeln('<SELECT NAME=PagePopupName onChange="asbSelectPagePopupMenu(this.options[this.selectedIndex].value, ' + gPageIndex + ')">');	// Now loop through each menu item	for (i=0; i<gPageData.length; i=i+1)	{		if ( i == pageIndex ) {					// Need to put "SELECTED" 			document.writeln('<OPTION VALUE="' + gPageData[i][1] + '" SELECTED>' + gPageData[i][0]);		} 		else {								document.writeln('<OPTION VALUE="' + gPageData[i][1] + '">' + gPageData[i][0]);		}	}	// Finish up	document.writeln('</SELECT></FORM></P>');	document.close();}//----------------------------------------------------------------------------// asbSelectPagePopupMenu//----------------------------------------------------------------------------//// Parameters:	//		- inURL: URL to jump to when the menu is selected.//		- inMenuIndex: Menu for this page.  Bring it back to the original//        state after user selection.function asbSelectPagePopupMenu( inURL, inMenuIndex ) {	if ( gPageType == 1 ) inMenuIndex = inMenuIndex - 1;				// multi-page set without _00.htm "Intro" page - shift one for 	document.PagePopupFormName.PagePopupName.selectedIndex = inMenuIndex;	window.open( inURL, '_top' );}//----------------------------------------------------------------------------// asbGenerateNextPrevControls//----------------------------------------------------------------------------// This function generates next/previous button controls and [x/y] indicator.//----------------------------------------------------------------------------function asbGenerateNextPrevControls() {	var pageIndex = gPageIndex;	var pageCount = ( gPageType == 0 ) ? ( gPageData.length - 1 ) : ( gPageData.length );		// "-1" for "Intro" items; "-1" for "Back to XXX"	var prevIndex = ( gPageType == 0 ) ? ( pageIndex - 1 ) : ( pageIndex - 2 );	var nextIndex = ( gPageType == 0 ) ? ( pageIndex + 1 ) : ( pageIndex );	var nextWidth = 90;	var prevWidth = 90;	document.open("text/html");	document.writeln('<TABLE BORDER="0" CELLSPACING="2" CELLPADDING="2"><TR>');		if ( pageIndex != gPageType ) {						// Not the first item - put "Previous" button and page indicator		// "Previous" button		document.writeln('<TD ALIGN="right" VALIGN="top">');		document.writeln('<A HREF="' + gPageData[prevIndex][1] + '" onmouseover="document.PrevPage.src=' + "'" + gPathPrefix + "images/page_prev_red.gif'" + '" onmouseout="document.PrevPage.src=' + "'" + gPathPrefix + "images/page_prev_blk.gif'" + '" onclick="document.PrevPage.src=' + "'" + gPathPrefix + "images/page_prev_blk.gif'; window.open('" + gPageData[prevIndex][1] + "','_top')" + '"><img src="' + gPathPrefix + 'images/page_prev_blk.gif" width=' + prevWidth + ' height=22 border=0 align=bottom name=PrevPage></A></TD>');		// Page indicator	}	document.writeln('<TD CLASS="page_indicator" ALIGN="center" VALIGN="middle">' + '[' + pageIndex + ' of ' + pageCount + ']</TD>');	if ( pageIndex != pageCount ) {				// Not thel ast item - put "Next" button		document.writeln('<TD ALIGN="left" VALIGN="top">');		document.writeln('<A HREF="' + gPageData[nextIndex][1] + '" onmouseover="document.NextPage.src=' + "'" + gPathPrefix + "images/page_next_red.gif'" + '" onmouseout="document.NextPage.src=' + "'" + gPathPrefix + "images/page_next_blk.gif'" + '" onclick="document.NextPage.src=' + "'" + gPathPrefix + "images/page_next_blk.gif'; window.open('" + gPageData[nextIndex][1] + "','_top')" + '"><img src="' + gPathPrefix + 'images/page_next_blk.gif" width=' + nextWidth + ' height=22 border=0 align=bottom name=NextPage></A></TD>');	}	document.writeln('</TR></TABLE>');	document.close();}///----------------------------------------------------------------------------// asbGenerateFooter//----------------------------------------------------------------------------// This function generates the separater bar, text based navigation menu, and// the copyright notice.//----------------------------------------------------------------------------function asb_GenerateFooter() {	// First write open the stream to the document and write out top level table	document.open("text/html");	document.writeln('<CENTER><TABLE border="0" cellspacing="0" cellpadding="0">');	document.writeln('<TR><TD HEIGHT=20></TD></TR>');	document.writeln('<TR><TD><img src="' + gPathPrefix + 'i/bar_gr650x4.gif" width="650" height="4" border="0"></TD></TR>');	document.writeln('<TR><TD HEIGHT=10></TD></TR>');	document.writeln('<TR><TD CLASS="copyright" ALIGN="CENTER">Copyright 2001-2006 tabitabitabi.com, All Rights Reserved.</TD></TR>');	document.writeln('</TABLE></CENTER>');	document.close();}//----------------------------------------------------------------------------// asbRandomImage//----------------------------------------------------------------------------//// Parameters:	//		- inImageCount: Number of images to pick from.//		- inImageIndex: Index to the image in document where the random image//		  should be displayed.//		- inSourceLocation: Path and file name prefix of the image files,//		  for example: "images/mainsplash/image_".  The random number and //		  ".jpg" suffix will be appended.//----------------------------------------------------------------------------function asbRandomImage( inImageCount, inImageIndex, inSourceLocation ) {   randomIndex = Math.round( Math.random() * inImageCount ) + 1;	// +1 fot 0->1-based   document.images[inImageIndex].src = inSourceLocation + randomIndex + ".jpg"}//----------------------------------------------------------------------------// asbFindDocName//----------------------------------------------------------------------------//// Parameters:	//		- inURL: URL from which to extract the document name// Returns://		- Document name//----------------------------------------------------------------------------function asbFindDocName( inURL ) {   var lastSlash = inURL.lastIndexOf( "/" );   lastSlash++;									// Skip "/", or set to 0 if -1   return inURL.slice( lastSlash, inURL.length );}//----------------------------------------------------------------------------// asbNameToPageIndex//----------------------------------------------------------------------------//// Parameters:	//		- inDocName: Name of the HTML document// Returns://		- Page index of the document//----------------------------------------------------------------------------function asbNameToPageIndex( inDocName ) {	var pageIndex = 0;	for ( x = 0; x < gPageData.length; x++ ) {		if ( gPageData[x][1] == inDocName ) {			pageIndex = x;			break;		}	}	pageIndex = pageIndex + gPageType;			// Add 1 if 1-based document set	return pageIndex;}//----------------------------------------------------------------------------