//nav.js adapted for buttons & Balls

// nav.js for the Next Page.
NS4 = (document.layers);
IE4 = (document.all);
ver4 = (NS4 || IE4);
browserOK = document.images;
isMac = (navigator.appVersion.indexOf("Mac") != -1);


// locate the image files

btnPre = "../buttons/btn-";
pgbtnPre = "../buttons/";
imBase = "../images/"
imBar = "../images/bar-";

btnUp = "sphere-heather";
btnOver = "sphere-bronze";
btnDown = "sphere-yel-pink";


// list the pages
arPages = new Array(
null,
"hotspgs-01.html",	// 1
"hotspgs-02.html",	// 2
"hotspgs-03.html",	// 3
"hotspgs-04.html",	// 4
"hotspgs-05.html",	// 5
"hotspgs-06.html",	// 6
"hotspgs-07.html"	// 7
)	

// List Spheres
arSpheres = new Array(
null,
"sphere-dark-red",	//	1
"sphere-bronze",		//	2
"sphere-yel-pink"		// 3
)

// list the urls
arUrls = new Array(
null,
"../../index.html",					// 1
"../index.html", 					// 2
"../index.html",					// 3
"mailto:pat@tylersterritory.com",	// 4

"ac-2001/index.html",	// 5
"rockies-n-2000/index.html",		// 6
"rockies-s/index.html",		// 7
"../pacific/hawaii/2000/index.html",// 8
"new_england/index.html",			// 9
"mid-south/index.html",			// 10
"alaska/index.html",					// 11
"2006/index.html"				// 12 Vancouver Island   namerica/2006/index.html
)			

// list the buttons
arButtons = new Array(
null,
"territory",		// 1
"logo-tt", 			// 2
"tt-switch",		// 3
"mail-tt",			// 4

"s-atl-can",		// 4
"can-roc",			// 5
"s-rockies",		// 6
"hawaii",			// 7
"ne",				// 8
"midsouth",			// 9
"bear",				// 11
"orca"				// 12
)		


// list the button text
arText = new Array(
null, 
"Tylers'<br>Territory",	// 1
"Tylers'<br>Travels",	// 1
"World<br>Menu",		// 2
"E-Mail<br>Link",		// 3

"Atlantic<br>Canada",	// 4
"Canadian<br>Rockies",	// 5
"Southern<br>Rockies",	// 6
"Hawaii<br>San Diego",	// 7
"New<br>England",		// 8
"Mid<br>South",			// 9
"Alaska<br>Yukon",		// 11
"Vancouver<br>Island"  // 12
)			

// controls function calls & data
function doNavBtns(txtColor, fface, btnOff, btnOv, btnDn, barColor){
	imBar = imBar + barColor;
	btnUp = "sphere-" + btnOff;
	btnOver = "sphere-" + btnOv;
	btnDown = "sphere-" + btnDn;
	//initBtns(btnOver, btnDown);
	// makeTitle("The Beijing Menu Page Navigator", 100, 3, txtColor, fface);
	//makeButs("ball", 1, 3, btnUp, btnOver, btnDown);
	drawBar(3, 125, 3);
}

// ********************************************* Page Navigator ****************
// call & send data for bottom bar
function bottom_bar(dummy){
	drawBar(3, 75, 3);
}


function movr(){this.img.src = this.img.overSrc}
function mout(){this.img.src = this.img.outSrc}
function mdown(){this.img.src = this.img.downSrc}

function makeButs(pos, start, end, btnUp, btnOver, btnDown){
	lr = btnUp;
	document.write("<P ALIGN=center>") // align the images 
	if (end<=arPages.length) {
	for (i=start; i<= end; i++){
		if (i==curPage) lr = "ani-globe";
		imstr = "<IMG SRC='"+ pgbtnPre + lr + ".gif' WIDTH=30 HEIGHT=30 BORDER=0>";
		if (i==curPage) {document.write(imstr); lr=btnUp; continue}
		document.write(imstr.link(arPages[i]));
		if(!browserOK) continue;
		tLink =	document.links[document.links.length-1];
		tImg = tLink.img = document.images[document.images.length-1];
		tImg.outSrc = tImg.src;
		tImg.downSrc = pgbtnPre + btnDown + ".gif";	// down
		tImg.overSrc = pgbtnPre + btnOver + ".gif";	// over
		tLink.onmouseover = movr;
		tLink.onmouseout = tLink.onmouseup = mout;
		tLink.onmousedown = mdown;
	}
	document.write("</P>");
}}



function makeTitle(txt, len, hi, txtColor, fface){
	document.write("<P ALIGN='center'>") // align the title line
	document.write("<img src='" + imBar + ".gif' width='" + len + "' height='" + hi + "' align='middle' border='0'>");
	document.write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
	 document.write("<font face=" + fface + " color=" + txtColor + " size='4'><b>" + txt + "</b> </font>"); 
	document.write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
	document.write("<img src='" + imBar + ".gif' width='" + len + "' height='" + hi + "' align='middle' border='0'>");
	document.write("</P>");
	}
	
function drawBar(num, len, hi){
	document.write("<P ALIGN='center'>") // align the bar
	for (i=1;i<=num;i++){
		document.write("<img src='" + imBar + ".gif' width='" + len + "' height='" + hi + "' align='middle' border='0'>")
	}
	document.write("</P>");
	}
	
// *********************************************  Section  Buttons
function button_loader(txtColor, fface){
loadButs(1, 4, txtColor, fface);
makeTitle("North American Trip Destinations", 100, 3, txtColor, fface);
loadButs(5, 12, txtColor, fface);
// loadButs(6, 13, txtColor, fface);
drawBar(3, 75, 3);
}

function loadButs(start, end, txtColor, fface){
	
	document.write("<P ALIGN='center'>"); // align the images 
	document.write("<table><tr>"); // start the table 
	if (end<=arButtons.length) {
	for (i=start; i<=end;i++){
		document.write("<td align='center' valign='top'>"); // table data
		/*
		anchStr = "<a href='"+ arUrls[i] + "' ";
		if ( i <= 2 ) { anchStr = anchStr + "target='_top'";} 
		if ( i > 2 && i < 7 ) { anchStr = anchStr + "target='_blank'";} 
		anchStr = anchStr + ">";
		*/
		
		imStr = "<IMG SRC='"+ btnPre + arButtons[i] + "-off.jpg'"
		imStr = imStr + "WIDTH=72 HEIGHT=96 BORDER=0></a><br>";
		txStr = "<font face=" + fface + " size='3' color=" + txtColor + "><b>" + arText[i] + "</b></font></td>";
		//document.write(anchStr);
		document.write(imStr.link(arUrls[i]));
		document.write(txStr);
		//document.write(imStr.link(arUrls[i]));
		if(!browserOK) continue;
		// added 
	
		tLink =	document.links[document.links.length-1];
		tImg = tLink.img = document.images[document.images.length-1];
		tImg.outSrc = tImg.src;
		tImg.downSrc = btnPre + arButtons[i] + "-dn.jpg";	// down
		tImg.overSrc = btnPre + arButtons[i] + "-ov.jpg";	// over
		if ( i > 3 && i < 12 ) { tLink.target = "_blank";} 
		tLink.onmouseover = movr;
		tLink.onmouseout = tLink.onmouseup = mout;
		tLink.onmousedown = mdown;
		 // end added
		
	}}
	document.write("</tr></table>");
	document.write("</P>");
}

function write_credits(dateTxt, txtColor){
	document.write("<P ALIGN='center'>");
	document.write("<table><tr>");
	document.write("<td align='center' valign='top'>");
	document.write("<font color=" + txtColor + " size='2'>");
	if (dateTxt==""){
	document.write("This page was last updated on "+document.lastModified+ ".<br>");}
	else {document.write("This page was last updated " + dateTxt +".<br>");}
	document.write("&copy; Tylers' Travels 1997-2007.<br>");
	document.write("Webmaster: <a href='mailto:pat@tylersterritory.com'>Pat Tyler</a>");
	document.write("</font></td></tr></table></p>");
}
	
function write_date(txtColor, fface){
// var="LAST_MODIFIED"
document.write("<center><font face=" + fface +" color=" + txtColor+  " size=3><em>");
document.write("Page last updated on "+document.lastModified);
document.write("</em></font></center>");
// document.write("<hr align=center size=2>");
}
