// Create a column of buttons using absolute locations.
// This is to centralize the code to generate buttons.
// Absolute locations are used to imitate the style of 
// that has been priviously used on the site.
//


var kButtonWidth = 142;
var kButtonHeight = 50;
var kButtonsTop = 141;
var kButtonLeft = 48;
var kVerticalGap = 4;
var gPageName = "events";
var gLastCreated = 0;
function loadOneImage ( imageName )
{
	var imageObject = new Image ( kButtonWidth, kButtonHeight );
	imageObject.src = "left_buttons/" + imageName;
}

function loadOneButton ( buttonName )
{
	loadOneImage ( buttonName + '_over.png' );
}

function preloadImages ( pageName )
// Load all the images that may be used by the page.
{
	// These may be extra for some pages.
	loadOneImage ( "index_14_over.jpg" );
	loadOneImage ( "index_13_over.jpg" );

	// These are needed by all pages which use this code.
	
	loadOneButton ( "home" );
	loadOneButton ( "menu" );
	loadOneButton ( "privatedining" );
	loadOneButton ( "events" );
	loadOneButton ( "photos" );
	loadOneButton ( "aboutus" );
	loadOneButton ( "contact" );
	loadOneButton ( "recipes" );
}

function makeAttribute ( attributeName, attributeValue )
// Put into the document name="attrubute" with a space after.
{
	document.write ( attributeName + "=\"" + attributeValue + "\" " );
}

function setImage ( imageObject, imageName )
{
	imageObject.src = imageName;
}
function createOneButton ( buttonName )
// Generate html for a button and place the result in the current file.
// Note that this creates a <tr> tag. This function should be called while
// constructing a table.
//
// This creates a button using the buttonName as a prefix for the button file name.
// 
{
	document.write (	'	<tr><td> ');
	document.write ( 	'<a ' );
	makeAttribute		( 	'href', buttonName + '.htm' );
	makeAttribute		(		'page_link', 'true' );
	document.write ( 	'>' );
	document.write (	'<img ' );
	makeAttribute ( "height", "52" );
	makeAttribute ( "width", "130" );
	if ( buttonName == gPageName )
	{
		makeAttribute		( 'src', 'left_buttons/' + buttonName + '_over.png' );
		makeAttribute	( 'onMouseOver', "this.src='" + 'left_buttons/' + buttonName + ".png'"); 
		makeAttribute		( 'onMouseOut', "this.src='" + 'left_buttons/' + buttonName + "_over.png'"); 
	}
	else
	{
		makeAttribute		( 'src', 'left_buttons/' + buttonName + '.png' );
		makeAttribute	( 'onMouseOver', "this.src='" + 'left_buttons/' + buttonName + "_over.png'"); 
		makeAttribute		( 'onMouseOut', "this.src='" + 'left_buttons/' + buttonName + ".png'"); 
	}
	document.write ( '>' );
	document.write ("</a> ");
	document.write ("	</td></tr> ");
}

function createWaitonme()
// enclose the tag provided by 
// Wait-On-Me,  Edwin Meijer (650)867-9684mailto:edwin.meijer@waitonme.com
// 
// with tag to make it a table shell
//
{
	// Enclosure start
	document.write ( '<tr>' );
		document.write ( '<td>' );

			// Copy the tag that was provided

			document.write ( '<div align="center">' );
			 document.write ( '<div style="margin-top:10px;">' );
				 document.write ( '<a href="http://waitonme.com/menu/yaya">' );	
					document.write ( '<img alt="waitonme" src="left_buttons/takeout.gif" border="0">' );
					 document.write ( '</a>' );
				document.write ( '</div>' );
		 document.write ( '</div>' );

	// Enclosure end
		document.write ( '</td>' );
	document.write ( '</tr>' );	
}
	
function createButtons ( pageName )
// Inside a <table>, create rows for left side buttons.
{
	gPageName = pageName;
	createOneButton ( "home" );
	createOneButton ( "menu" );
	createOneButton ( "privatedining" );
	createOneButton ( "events" );
	createOneButton ( "photos" );
	createOneButton ( "aboutus" );
	createOneButton ( "contact" );
	createWaitonme ();
}	
	
