
var dir = (whichPage == "members") ? ".." : ".";

function cacheImg(which) {
	eval(which + "_off = new Image();");
	eval(which + "_off.src = '"+ dir +"/pix/bttn_"+ which +"_off.gif';");
	eval(which + "_on = new Image();");
	eval(which + "_on.src = '"+ dir +"/pix/bttn_"+ which +"_on.gif';");
}

//////////////////////////////////

function swapImage(which, how) {
	eval("document.images['"+which+"Bttn'].src = " + which + "_" + how + ".src")
}

//////////////////////////////////

function doNav() {
	addBttn("home", dir+"/index.html");
	addBttn("musicians",dir+"/musicians.html");
	addBttn("recordings",dir+"/recordings.html");
	addBttn("links",dir+"/links.html");
	addBttn("faqs",dir+"/faq.html");
	if (whichPage != "members") {
		addBttn("login",dir+"/members/");
	} else {
		addBttn("members",dir+"/members/");
	}
}

//////////////////////////////////

function addBttn(page,url) {

	cacheImg(page);
	
	var str = "";
	if (whichPage == page) {
		linkStart = "";
		linkEnd = "";
		state = "on";
		mo = "";
		
	} else {
		linkStart = "<a href='"+url+"'>";
		linkEnd = "</a>";
		state = "off";
		mo = ' onMouseover="swapImage(\''+ page +'\',\'on\')" onMouseout="swapImage(\''+ page +'\',\'off\')"';
	}
	str = str + linkStart + '<img src="'+ dir +'/pix/bttn_'+ page +'_'+ state +'.gif" width="150" height="28" alt="'+ page +'" border="0" name="'+ page +'Bttn"'+ mo +'>'+ linkEnd +'<br>';
	
	str = str + hSpacer(7);
	/*
	temp = window.open()
	temp.document.open()
	temp.document.write(str)
	temp.document.close()
	*/
	document.write(str);
}

//////////////////////////////////

function hSpacer(height) {
	return '<img src="'+ dir +'/pix/spacer.gif" width="1" height="'+ height +'" alt="" border="0"><br>';
}

//////////////////////////////////

function checkFrame() {
	return;
	if (parent.frames.length) {
		// uses frames 
		parent.frames[1].location = "http://home.comcast.net/~portlandcommunity.windband/blank.html"
	}
}
