document.write('<div id="trace" style="position: absolute; top: 0px; left: 0px; ; border: 1px solid red; background-color: white; z-Index: 99999; display: none;">&nbsp;</div>');
function traceIt(T) {
	document.getElementById('trace').innerHTML += T + "<br>";
	document.getElementById('trace').style.display = "inline";
}

function rollOver(which,state) {
        if (document.images) {
                ext = which.src.substring(which.src.lastIndexOf("."));
                which.src = which.src.substring(0,which.src.lastIndexOf('-')) + "-" + state + ext;
        }
}

function pad(type,px) {
	switch (type) {
		case "tr":
			document.write('<tr><td height="'+px+'"></td></tr>');
		break;
		case "td":
			document.write('<td width="'+px+'"></td>');
		break;
		case "br":
			document.write('<img src="images/spacer.gif" alt="" width="1" height='+px+'" border="0"><br>');
		break;
	}
}

function topNav(which) {
	document.write('<table cellpadding="0" cellspacing="0" class="X">');
	document.write('<tr><td valign="top" style="padding: 15 0 0 15px;" width="240">');
	document.write('<a href="home.html"><img src="images/spacer.gif" alt="Foster\'s Grill - Home of the Charburger" width="240" height="155" style="z-Index: 9;"></a>');
	document.write('</td><td valign="top" style="padding: 0 0 0 0px;" width="460">');
	document.write('<table cellpadding="0" cellspacing="0">');
	document.write('<tr><td align="right" style="padding: 16 5 0 0px;">');
	document.write('<img src="images/chalk-'+which+'.gif" alt="" width="207" height="77" style="z-Index: 9;">');
	document.write('</td></tr><tr><td style="padding: 15 0 0 33px;" valign="top">');
	document.write('<table cellpadding="0" cellspacing="0">');
	document.write('<tr>');
	document.write('<td>');
	document.write('	<table cellpadding="0" cellspacing="0">');
	document.write('	<tr>');
	document.write('	<td style="padding: 0 25 0 0px;">');
	if (which == "about") {
		document.write('<a href="about.html"><img src="images/nav-about-on.gif" alt="about us" width="74" height="25"></a>');
	} else {
		document.write('<a href="about.html"><img src="images/nav-about-off.gif" alt="about us" width="74" height="25" onMouseOver="rollOver(this,\'on\');" onMouseOut="rollOver(this,\'off\');"></a>');
	}
	document.write('	</td>');
	document.write('	<td style="padding: 0 24 0 0px;">');
	if (which == "menu") {
		document.write('<a href="menu.html"><img src="images/nav-menu-on.gif" alt="menu" width="46" height="23"></a>');
	} else {
		document.write('<a href="menu.html"><img src="images/nav-menu-off.gif" alt="menu" width="46" height="23" onMouseOver="rollOver(this,\'on\');" onMouseOut="rollOver(this,\'off\');"></a>');
	}
	document.write('	</td>');
	document.write('	<td style="padding: 0 21 0 0px;">');
	if (which == "locations") {
		document.write('<a href="locations.html"><img src="images/nav-locations-on.gif" alt="locations" width="74" height="23"></a>');
	} else {
		document.write('<a href="locations.html"><img src="images/nav-locations-off.gif" alt="locations" width="74" height="23" onMouseOver="rollOver(this,\'on\');" onMouseOut="rollOver(this,\'off\');"></a>');
	}
	document.write('	</td>');
	document.write('	<td style="padding: 0 2 0 0px;">');
	if (which == "events") {
		document.write('<a href="events.html"><img src="images/nav-events-on.gif" alt="events and parties" width="135" height="31"></a>');
	} else {
		document.write('<a href="events.html"><img src="images/nav-events-off.gif" alt="events and parties" width="135" height="31" onMouseOver="rollOver(this,\'on\');" onMouseOut="rollOver(this,\'off\');"></a>');
	}
	document.write('	</td>');
	document.write('	</tr>');
	document.write('	</table>');
	document.write('</td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td style="padding: 0 17 0 0px;">');
	document.write('	<table cellpadding="0" cellspacing="0">');
	document.write('	<tr>');
	pad('td', 10);
	document.write('	<td style="padding: 0 23 0 0px;">');
	if (which == "franchise") {
		document.write('<a href="franchise.html"><img src="images/nav-franchise-on.gif" alt="franchise info" width="109" height="26"></a>');
	} else {
		document.write('<a href="franchise.html"><img src="images/nav-franchise-off.gif" alt="franchise info" width="109" height="26" onMouseOver="rollOver(this,\'on\');" onMouseOut="rollOver(this,\'off\');"></a>');
	}
	document.write('	</td>');
	document.write('	<td style="padding: 0 23 0 0px;">');
	if (which == "join") {
		document.write('<a href="join.html"><img src="images/nav-join-on.gif" alt="join our team" width="114" height="28"></a>');
	} else {
		document.write('<a href="join.html"><img src="images/nav-join-off.gif" alt="join our team" width="114" height="28" onMouseOver="rollOver(this,\'on\');" onMouseOut="rollOver(this,\'off\');"></a>');
	}
	document.write('	</td>');
	document.write('	<td>');
	if (which == "news") {
		document.write('<a href="news.html"><img src="images/nav-news-on.gif" alt="pr and news" width="89" height="23"></a>');
	} else {
		document.write('<a href="news.html"><img src="images/nav-news-off.gif" alt="pr and news" width="89" height="23" onMouseOver="rollOver(this,\'on\');" onMouseOut="rollOver(this,\'off\');"></a>');
	}
	document.write('	</td>');
	document.write('	</tr>');
	document.write('	</table>');
	document.write('</td>');
	document.write('</tr>');
	document.write('</table>');
	document.write('</td>');
	document.write('</tr>');
	document.write('</table>');
	document.write('</td>');
	document.write('</tr>');
	document.write('</table>');
}

function bottomNav(which) {
	document.write('<table cellpadding="0" cellspacing="0">');
	document.write('<tr>');
	document.write('<td><a href="home.html" class="bottomNav">Home</a></td>');
	document.write('<td class="red" style="padding: 0 5px;">|</td>');
	if (which == "about") {
		document.write('<td><a href="about.html" class="bottomNav"><span class="red">About Us</span></a></td>');
	} else {
		document.write('<td><a href="about.html" class="bottomNav">About Us</a></td>');
	}
	document.write('<td class="red" style="padding: 0 5px;">|</td>');
	if (which == "menu") {
		document.write('<td><a href="menu.html" class="bottomNav"><span class="red">Menu</span></a></td>');
	} else {
		document.write('<td><a href="menu.html" class="bottomNav">Menu</a></td>');
	}
	document.write('<td class="red" style="padding: 0 5px;">|</td>');
	if (which == "locations") {
		document.write('<td><a href="locations.html" class="bottomNav"><span class="red">Locations</span></a></td>');
	} else {
		document.write('<td><a href="locations.html" class="bottomNav">Locations</a></td>');
	}
	document.write('<td class="red" style="padding: 0 5px;">|</td>');
	if (which == "events") {
		document.write('<td><a href="events.html" class="bottomNav"><span class="red">Events &amp; Parties</span></a></td>');
	} else {
		document.write('<td><a href="events.html" class="bottomNav">Events &amp; Parties</a></td>');
	}
	document.write('<td class="red" style="padding: 0 5px;">|</td>');
	if (which == "franchise") {
		document.write('<td><a href="franchise.html" class="bottomNav"><span class="red">Franchise Info</span></a></td>');
	} else {
		document.write('<td><a href="franchise.html" class="bottomNav">Franchise Info</a></td>');
	}
	document.write('<td class="red" style="padding: 0 5px;">|</td>');
	if (which == "join") {
		document.write('<td><a href="join.html" class="bottomNav"><span class="red">Join Our Team</span></a></td>');
	} else {
		document.write('<td><a href="join.html" class="bottomNav">Join Our Team</a></td>');
	}
	document.write('<td class="red" style="padding: 0 5px;">|</td>');
	if (which == "news") {
		document.write('<td><a href="news.html" class="bottomNav"><span class="red">PR &amp; News</span></a></td>');
	} else {
		document.write('<td><a href="news.html" class="bottomNav">PR &amp; News</a></td>');
	}
	document.write('</tr>');
	document.write('</table>');
}

var animDelay = 3000;
var animId = 1;
function pageImages(count) {
	which = document.getElementById("pageImg");
	ext = which.src.substring(which.src.lastIndexOf("."));
	which.src = which.src.substring(0,which.src.lastIndexOf('-')) + "-" + animId + ext;
	if (animId < count) {
		animId++;
	} else {
		animId = 1;
	}
	setTimeout("pageImages("+count+");", animDelay);
}
function drawPageImage(which) {
	if (which == "about" || which == "menu" || which == "events") {
		document.write('<div class="pageImg"><img src="images/img-'+page+'.gif" alt="" id="pageImg"></div>');
	}
	else {
		document.write('<div class="pageImg"><img src="images/img-'+page+'-1.jpg" alt="" id="pageImg"></div>');
	}
}

