//nav.js adapted for buttons & Balls

// nav.js for the Buenos Aires Site.
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,
"antarctica-01.html",	// 1
"antarctica-02.html",	// 2
"antarctica-03.html",	// 3
"antarctica-04.html",	// 4
"antarctica-05.html",	// 5
"antarctica-06.html",	// 6
"antarctica-07.html",	// 7
"antarctica-08.html",	// 8
"antarctica-09.html",	// 9
"antarctica-10.html",	// 10	End Day 1
"../day-2/antarctica-11.html",	// 11
"../day-2/antarctica-12.html",	// 12
"../day-2/antarctica-13.html",	// 13
"../day-2/antarctica-14.html",	// 14
"../day-2/antarctica-15.html",	// 15
"../day-2/antarctica-16.html",	// 16
"../day-2/antarctica-17.html",	// 17
"../day-2/antarctica-18.html",	// 18
"../day-2/antarctica-19.html",	// 19
"../day-2/antarctica-20.html",	// 20
"../day-2/antarctica-21.html",	// 21
"../day-2/antarctica-22.html",	// 22
"../day-2/antarctica-23.html",	// 23
"../day-2/antarctica-24.html",	// 24
"../day-2/antarctica-25.html",	// 25
"../day-2/antarctica-26.html",	// 26
"../day-2/antarctica-27.html",	// 27
"../day-2/antarctica-28.html",	// 28	End Day 2
"../day-3/antarctica-29.html",	// 29
"../day-3/antarctica-30.html",	// 30
"../day-3/antarctica-31.html",	// 31
"../day-3/antarctica-32.html",	// 32
"../day-3/antarctica-33.html",	// 33
"../day-3/antarctica-34.html",	// 34
"../day-3/antarctica-35.html",	// 35	
"../day-3/antarctica-36.html"	// 35	End Day 3
)	

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

// list the urls
arUrls = new Array(
null,
"http://www.tylerstravels.com", 			// 1
"../../index.html",							// 2
"../../maps/sa-switch.html",					// 3
"../map-antarctica.html",					// 4
"../antarctica-chart.html",					// 5
"../antarctica-team.html",					// 6
"mailto:pat@tylersterritory.com",		// 6
"../../itinerary/itinerary.html#esperanza",	// 7
"../../itinerary/weather.html",				// 8
"../../resources/links.html",					// 9
"../../resources/sitemap.html",				// 10
"dummy"										// 11
)			



// list the buttons
arButtons = new Array(
null,
"logo-tt", 			// 1
"antarctica",		// 2
"sa-sw",			// 3
"map-antarctica",	// 4
"antarctica-chart",	// 5
"penguin",			// 6
"mail-tt",			// 6
"itinerary",		// 7
"weather",			// 8
"links",			// 9
"sitemap",			// 10
"dummy"				// 11
)		


// list the button text
arText = new Array(
null, 
"Tylers'<br>Travels",	// 1
"Cruise<br>Home",		// 2
"South<br>America",		// 3
"Antarctica<br>Map",	// 4
"Cruise<br>Route",		// 5
"Antarctic<br>Team",	// 6
"E-Mail<br>Link",		// 5
"Tour<br>Itinerary",	// 6
"Weather<br>Page",		// 7
"Related<br>Links",		// 8
"Site<br>Index",		// 9
"dummy"					// 10
)			

// 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("Antarctica Page Navigator", 100, 3, txtColor, fface);
	makeButs("ball", 1, 10, btnUp, btnOver, btnDown);  // start & end numbers here 
	makeButs("ball", 11, 28, btnUp, btnOver, btnDown);  // start & end numbers here 
	makeButs("ball", 29, 36, btnUp, btnOver, btnDown);  // start & end numbers here 
	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 = "sphere-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'>" + txt + " </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, 3, txtColor, fface);
loadButs(4, 6, txtColor, fface);
loadButs(7, 11, txtColor, fface);
// loadButs(6, 13, txtColor, fface);
drawBar(3, 150, 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
		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 + ">" + arText[i] + "</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>");
}

