//nav.js adapted for buttons & Balls

// nav.js for the Pacific 2007 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-black";

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


// list the pages
arPages = new Array(
null,
"buenos-01.html",	// 1
"buenos-02.html",	// 2
"buenos-03.html",	// 3
"buenos-04.html",	// 4
"buenos-05.html",	// 5
"buenos-06.html",	// 6
"buenos-07.html",	// 7
"buenos-08.html",	// 8
"buenos-09.html",	// 9
"buenos-10.html",	// 10
"buenos-11.html",	// 11
"buenos-12.html",	// 12
"buenos-13.html",	// 13
"buenos-14.html",	// 14
"buenos-15.html",	// 15
"buenos-16.html",	// 16
"buenos-17.html",	// 17
"buenos-18.html",	// 18
"buenos-19.html",	// 19
"buenos-20.html",	// 20
"buenos-21.html",	// 21
"buenos-22.html",	// 22
"buenos-23.html"	// 23
)	

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


// list the urls
arUrls = new Array(
null,
"flight/flight-01.html",									// 1	Index Row 1
"../../namerica/washington/seattle/seattle-2007-01.html",	// 2		
"../../namerica/calif/sanfran/index.html",		// 3	
"../../pacific/hawaii/hilo2/index.html",	// 4	
"../../pacific/hawaii/lahaina/index.html",	// 5		
"../../pacific/bora/index.html",				// 6
"../../pacific/tahiti/index.html",				// 7			
"../../pacific/rarotonga/index.html",			// 8	
"../../pacific/pago/index.html",				// 9
"../../pacific/fiji/index.html",				// 10

"../../pacific/nz/auckland/index.html",			// 11	Row 2	
"../../pacific/nz/church/index.html",			// 12
"../../pacific/nz/dunedin/index.html",			// 13
"../../australia/sydney/index.html",				// 14
"../../australia/blue/index.html",				// 15
"../../australia/douglas/index.html",			// 16	
"../../australia/reef/index.html",				// 17
"../../australia/rainforest/index.html",			// 18
"flight/flight-03.html",							// 19

"../../../index.html", 	// 20	Row 3
"../../index.html", 	// 21	
"itinerary.html",		// 22	
"calendar.html",		// 23
"map-itinerary.html",	// 24
"weather.html",			// 25	
"sun/index.html",	// 26	SunPrincess		
"sea/sea-01.html", 		// 27
"sitemap.html",			// 28
"links.html",			// 29	
"mailto:pat@tylersterritory.com",	// 30
"dummy"					// 31					
)	

		


// list the buttons
arButtons = new Array(
null,
"aa-logo",			// 1	Row 1
"seattle",			// 2
"goldengate",		// 3
"yellow-hibiscus",	// 4
"chantress",  		// 5
"bora",				// 6		
"tahiti",			// 7
"rarotonga",		// 8
"pago",				// 9 
"fiji",				// 10
"auckland",			// 11	Row 2
"church",			// 12
"dunedin",			// 13
"sydney",			// 14
"blue",				// 15
"douglas",			// 16
"reef",				// 17
"rainforest",		// 18
"qantas",			// 19

"territory",		// 20    Row 3
"world", 			// 21	
"itinerary-2007",	// 22  	 
"calendar-2007",	// 23
"map-pacific",		// 24
"weather-2007",		// 25
"SunPrincess",		// 26
"sea",				// 27
"sitemap",			// 28
"links",			// 29
"mail-tt",			// 30
"dummy"				// 31
)		


// list the button text
arText = new Array(
null, 
"Seattle<br>Flight",		// 1
"Seattle<br>Wash.",			// 2
"San<br>Francisco",			// 3
"Hilo<br>Hawaii",			// 4
"Lahaina<br>Maui",			// 5
"Bora Bora<br>Polynesia",	// 6
"Papeete<br>Tahiti",		// 7
"Rarotonga<br>Cook Is.",	// 8	
"Pago Pago<br>Am. Samoa",	// 9
"Suva<br>Fiji",				// 10

"Auckland<br>N. Z.",		// 11  Row 2
"ChristChurch<br>N. Z.",	// 12
"Dunedin<br>N. Z.",			// 13
"Sydney<br>Australia",		// 14
"Blue<br>Mountains",		// 15
"Port<br>Douglas",			// 16
"Barrier<br>Reef",			// 17
"Rainforest<br>Queensland",	// 18
"Flight<br>to LAX",			// 19

"Tylers'<br>Territory",		// 20  Row 3
"Tylers'<br>Travels", 		// 21
"Cruise<br>Itinerary",		// 22
"Trip<br>Calendar",			// 23
"Interactive<br>Map",		// 24
"Weather<br>Page",			// 25
"Sun<br>Princess",			// 26
"Sea<br>Days",				// 27
"Site<br>Index",			// 28
"Related<br>Links",			// 29
"E-Mail<br>Link",			// 30
"dummy"						// 31
)			

// 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("Seattle to Sydney Page Navigator", 100, 3, txtColor, fface);
	makeButs("ball", 1, 2, btnUp, btnOver, btnDown);  // start & end numbers here 
	makeButs("ball", 3, 23, 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, 10, txtColor, fface);
loadButs(11, 19, txtColor, fface);
loadButs(20, 30, 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='2' 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 < 11 ) { tLink.target = "_blank";} 
		tLink.target = "_blank";
		tLink.onmouseover = movr;
		tLink.onmouseout = tLink.onmouseup = mout;
		tLink.onmousedown = mdown;
		 // end added
		
	}}
	document.write("</tr></table>");
	document.write("</P>");
}


function writeCredits(dateTxt){
	document.write("<div ALIGN='center'><p>");
	document.write("<font color='#ffcc00' 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; Pat Tyler 2008.<br>");
	document.write("Webmaster: <a href='mailto:pat@tylersterritory.com'>Pat Tyler</a>");
	document.write("</font></p></div>");
}
