var tab_names = new Array('index','aboutus','history','music','photos','links','contact');
var colors = new Array('ltblue','orange','gray','green','purple','yellow','dkblue');
var pre_over = new Array(7);
var border_img;
// preload tab rollover images
function preloadTabs() {
	if (document.images) {
		for(i=0;i<7;i=i+1) {
			pre_over[i] = new Image();
			pre_over[i].src = "images/tabs/"+tab_names[i]+"_over.gif";
		}
	}
}
function preloadBorders(num) {
	if (document.images) {
		for(i=0;i<7;i=i+1) {
			if(i != num) {
				border_img = new Image();
				border_img.src = "images/"+colors[i]+"/tlcorner.gif";
				border_img = new Image();
				border_img.src = "images/"+colors[i]+"/topbarPixel.gif";
				border_img = new Image();
				border_img.src = "images/"+colors[i]+"/trcorner.gif";
				border_img = new Image();
				border_img.src = "images/"+colors[i]+"/leftbarPixel.gif";
				border_img = new Image();
				border_img.src = "images/"+colors[i]+"/rightbarPixel.gif";
				border_img = new Image();
				border_img.src = "images/"+colors[i]+"/blcorner.gif";
				border_img = new Image();
				border_img.src = "images/"+colors[i]+"/bottombarPixel.gif";
				border_img = new Image();
				border_img.src = "images/"+colors[i]+"/brcorner.gif";
			}
		}
	}
}

function changeImg(num) {document.getElementById(tab_names[num]).src = pre_over[num].src;}
function revertImg(num) {document.getElementById(tab_names[num]).src = "images/tabs/"+tab_names[num]+".gif";}
function fixTabPositions() {
	for(i=0;i<7;i++)	fixImgPosition(tab_names[i]);
}
function fixImgPosition(name)	{
	document.getElementById(name).style.position = "relative";
	document.getElementById(name).style.top = "3";
}

function drawHeader(num) {
	// draw table of navigation tabs
	document.write("<center><br><div align=center style=\"width: 800px;\">\n");
	document.write("<table id=\"header\" cellspacing=0 cellpadding=0 border=0>\n");
	document.write("<tr height=131><td colspan=8>\&nbsp;\n");
	document.write("<tr height=19 align=center valign=bottom>\n");
	document.write("<td height=19 width=170>\n");

	for(i=0;i<7;i=i+1) {
		if(i == num) {
			document.write("<td height=19><img id=\""+tab_names[i]+"\" src=\"images/"+colors[i]+"/"+tab_names[i]+".gif\" alt=\"\" name=\""+tab_names[i]+"\" width=90 height=19 border=0></a>\n");
		} else {
			document.write("<td height=19><a onmouseover=\"changeImg("+i+");\" onmouseout=\"revertImg("+i+");\" href=\""+tab_names[i]+".html\">");
			document.write("<img id=\""+tab_names[i]+"\" src=\"images/tabs/"+tab_names[i]+".gif\" alt=\"\" name=\""+tab_names[i]+"\" width=90 height=19 border=0></a>\n");
		}
	}
	document.write("</table>\n");

	// if not using Firefox, shift tab positions down
	if(navigator.userAgent.match("Firefox") == null && navigator.userAgent.match("Safari") == null) {fixTabPositions();}

	document.write("<table width=100% cellspacing=0 cellpadding=0 border=0>\n");
	document.write("<tr><td height=3 style=\"background-image: url(\'images/"+colors[num]+"/tlcorner.gif\')\">\n");
	document.write("<td height=3 style=\"background-image: url(\'images/"+colors[num]+"/topbarPixel.gif\')\">\n");
	document.write("<td height=3 style=\"background-image: url(\'images/"+colors[num]+"/trcorner.gif\')\">\n");
	document.write("<tr><td rowspan=2 width=3 style=\"background-image: url(\'images/"+colors[num]+"/leftbarPixel.gif\')\">\n");
	document.write("<td id=\"content\">");
}

function drawFooter(num) {
	document.write("<td rowspan=2 width=3 style=\"background-image: url(\'images/"+colors[num]+"/rightbarPixel.gif\')\">\n");
	document.write("<tr><td height=30 style=\"background-color: white\">\&nbsp;\n");
	document.write("<tr><td height=3 style=\"background-image: url(\'images/"+colors[num]+"/blcorner.gif\')\">\n");
	document.write("<td height=3 style=\"background-image: url(\'images/"+colors[num]+"/bottombarPixel.gif\')\">\n");
	document.write("<td height=3 style=\"background-image: url(\'images/"+colors[num]+"/brcorner.gif\')\">\n");
	document.write("</table></div>\&nbsp;</center>");
}

// eMail Obfuscator Script 2.1 by Tim Williams - freeware
// http://www.u.arizona.edu/~trw/spam/spam4.htm
function generate_address( num, name ) {
	var codes = new Array(3);
	codes[0] = "bchxkcfh1m-aig3v@ivv1cft9.uxf7x9xm.xwi"
	codes[1] = "79euh9cexj@fssx9cq3.ruc1u3uj.utf"
	codes[2] = "H2I6WI@PM2GMFMX.MN8"
	coded = codes[num];

	cipher = "aZbYcXdWeVfUgThSiRjQkPlOmNnMoLpKqJrIsHtGuFvEwDxCyBzA1234567890"
		shift=coded.length
		link=""
		for (i=0; i<coded.length; i++){
			if (cipher.indexOf(coded.charAt(i))==-1){
				ltr=coded.charAt(i)
					link+=(ltr)
			}
			else {     
				ltr = (cipher.indexOf(coded.charAt(i))-shift+cipher.length) % cipher.length
					link+=(cipher.charAt(ltr))
			}				
		}

	document.write(name+"&nbsp;&ndash;&nbsp;<a href='mailto:"+link+"?Subject=[Noteworthy]'>"+link+"</a>")
}
