//nav.js adapted for buttons & Balls

// nav-granbury.js for the San Antonio 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-dark-green";
btnUp = "sphere-pearl-pearl";
btnOver = "sphere-pearl-aqua";
btnDown = "sphere-pearl-blue";


// list the pages
arPages = new Array(
null,
"index.html",			// 01
"antonio-02.html",		// 02	
"antonio-03.html",		// 03	
"antonio-04.html",		// 04
"antonio-05.html",		// 05	
"antonio-06.html",		// 06
"antonio-07.html",		// 07
"antonio-08.html",		// 08
"antonio-09.html",		// 09
"antonio-10.html",		// 10
"antonio-11.html",		// 11
"antonio-12.html",		// 12	
"antonio-13.html",		// 13	
"antonio-14.html",		// 14
"antonio-15.html",		// 15	
"antonio-16.html",		// 16
"antonio-17.html",		// 17
"antonio-18.html",		// 18
"antonio-19.html",		// 19
"antonio-20.html"		// 20

)	


// list the urls
arUrls = new Array(
null,

"../../../../index.html", 	// 1
"../../../index.html", 		// 2
"../../index.html", 		// 3
"../index.html",			// 4
"index.html",				// 5
"map-sa.html",					// 6	
"mailto:pat@tylersterritory.com", 	// 7
"../../../../index.html", // 1
"timber_cove/index.html"	 // 2
)			



// list the buttons
arButtons = new Array(
null,


"territory",
"world",
"na-sw",
"tex",
"antonio",
"map-sa",
"mail-tt"

)		


// list the button text
arText = new Array(
null,

 
"Tylers'<br>Territory", // 1
"Tylers'<br>Travels",	// 2
"North<br>America",		// 3
"Texas<br>Index",		// 4	
"San<br>Antonio", 		// 5
"S. A.<br>Map",			// 6
"Send<br>Mail",			// 7
"Greetings<br>From Granbury<br>&amp; Consturction",	// 1
"Pics from<br>When Our Model<br>Was a Model"	// 2		
)			

// 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);
	// drawBar(3, 175, 3);
	makeTitle("San Antonio Page Navigator", 100, 3, txtColor, fface);
	makeButs("ball", 1, 13, btnUp, btnOver, btnDown);
	drawBar(3, 125, 3);
	// loadGenealogy(11, txtColor, fface);
	// drawBar(3, 125, 3);
}

// ********************************************* Page Navigator ****************

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-world";
		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){
	if (fface == "Dauphin") txt = "<b>" + txt + "</b>";
	
	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(8, 10, txtColor, fface);
imBar = imBar + "blue-green";
// loadButs(1, 1, txtColor, fface);
drawBar(3, 75, 3);
loadButs(1, 7, txtColor, fface);
drawBar(3, 75, 3);
write_date(txtColor, fface);
}

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
	
		txt = arText[i];
		if (fface == "Dauphin") txt = "<b>" + txt + "</b>";
		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 + ">" + txt + "</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
		tLink.target = "_blank";
		// if ( i > 7 && i < 11 ) { tLink.target = "_blank";} 
		tLink.onmouseover = movr;
		tLink.onmouseout = tLink.onmouseup = mout;
		tLink.onmousedown = mdown;
		 // end added
		
	}}
	document.write("</tr></table>");
	document.write("</P>");
}

function loadGenealogy(num,  txtColor, fface){
btnGen = btnPre + arButtons[num] + "-off.gif";
btnGenSize = " width='72' height='96' border='0'";
btnAcro = btnPre + "acrobat-reader.gif";
imSpace = "'spacer.gif' width='15' height='1' border='0'"

document.write("<div align='center'>");
document.write("<table><tr><td>");
document.write("<a href=" + arUrls[num] + ">")
document.write("<img src=" + btnGen + btnGenSize + ">");
	tLink =	document.links[document.links.length-1];
	tImg = tLink.img = document.images[document.images.length-1];
	tImg.outSrc = tImg.src;
	tImg.downSrc = btnPre + arButtons[num] + "-dn.gif";	// down
	tImg.overSrc = btnPre + arButtons[num] + "-ov.gif";	// over
	tLink.target = "_blank";
	tLink.onmouseover = movr;
	tLink.onmouseout = tLink.onmouseup = mout;
	tLink.onmousedown = mdown; 
document.write("</a></td>");
document.write("<td><img src='" + imBase + imSpace + "></td>");
txt = arText[num];
if (fface == "Dauphin") txt = "<b>" + txt + "</b>";
document.write("<td><p align='center'><font face=" +fface + " size='3' color=" + txtColor + ">" + txt + "</font></p></td>");
document.write("<td><img src='"  + imBase + imSpace + "></td>");
document.write("<td><a href=" + arUrls[num + 1] + " target='_blank'>");
document.write("<img src=" + btnAcro + " width='88' height='31' border='0'></a>");
txt = arText[num + 1];
if (fface == "Dauphin") txt = "<b>" + txt + "</b>";
document.write("<p align='center'><font face=" +fface + " size='3' color=" + txtColor + ">" + txt + "</font></p>");
document.write("</td></tr></table>");
document.write("</div>");
}

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>");
}
