var preloadedNav = false;

// only full-sized main windows include this file, so it's safe to do this here:
window.name = "main";

// this is needed for building /-relative vs. page-relative IMG URLs
var Pathways_SiteRoot = document.location.href.substr(0, document.location.href.indexOf('pathways'));
if (Pathways_SiteRoot.length < 2) {
	Pathways_SiteRoot = "/wgbh/";
}
Pathways_SiteRoot += 'pathways/';
Pathways_SiteRoot="/";

function newImage(arg) {
if (document.images) {
ret=new Image();
ret.src=arg;
return ret;
}
}
function preloadNav() {
if (document.images)
{
jb_on=newImage(Pathways_SiteRoot + "images/nav/button_jb_on.gif");
cc_on=newImage(Pathways_SiteRoot + "images/nav/button_cc_on.gif");
fl_on=newImage(Pathways_SiteRoot + "images/nav/button_fl_on.gif");
preloadedNav=true;
}
}

function preloadNavOR() {
if (document.images)
{
oh_on=newImage(Pathways_SiteRoot + "images/nav/button_oh_on.gif");
rb_on=newImage(Pathways_SiteRoot + "images/nav/button_rb_on.gif");
tf_on=newImage(Pathways_SiteRoot + "images/nav/button_tf_on.gif");
rs_on=newImage(Pathways_SiteRoot + "images/nav/button_rs_on.gif");
preloadedNav=true;
}
}

function rollin(name) {
if (document.images && preloadedNav==true) {
document.images[name].src =  Pathways_SiteRoot + "images/rec/button_" + name + "_on.gif";
}

}


function rollout(name,keep) {
if (document.images && preloadedNav==true && keep != "_on") {
document.images[name].src = Pathways_SiteRoot + "images/rec/button_" + name + ".gif";
}

}

function clearnav(name)
{
	arr=new Array("oh","rb","tf","rs");
	if (document.images && preloadedNav==true) {

		for (i=0; i<=3;i++)
		{
check=arr[i];
			if (name != check)
			{
				document.images[name].src = Pathways_SiteRoot + "images/rec/button_" + name + ".gif";
			}
		}
	}
}



// in addition to window targets listed here, there are also:
// "main": the main browser window, name set by nav.js
// "external": full-sized second window, the target of all outbound links


function vidPop(str) {
	var vidWin = window.open(Pathways_SiteRoot + "videos/" + str + ".html", "video", "scrollbars=yes,status=yes,width=560,height=356");
	vidWin.focus();
	return false;
}

