imagepath = 'http://sherwoodspirit.com/images/nav/';

//set where to pull images from
var pathMap = new Array()
var nongallery = new Array()
nongallery['/home.html'] = 'home';
nongallery['/new-collector.html'] = 'new_coll';
nongallery['/terms.html'] = 'terms';
nongallery['/our-gallery.html'] = 'about';
pathMap['nongallery'] = nongallery;

var crntPath = location.pathname

if (pathMap['nongallery'][crntPath])
{
	imagepath += 'nongallerymain/';
}
else
{
	imagepath += 'main/';
}

var goodBrowser = 0;
// let's make sure you can use this script!!
if(navigator.appName == "Netscape")
{
        if(parseInt(navigator.appVersion) >=3)
                {
                 goodBrowser=1;
                }
}
if(navigator.appName == "Microsoft Internet Explorer")
{       
        if(parseInt(navigator.appVersion) >=4)
                {
                goodBrowser=1;
                }
        }
if(goodBrowser == 1)
{
// preload onmouseover images
homeImage = new Image();
homeImage.src = imagepath + "home_on.gif";
aboutImage = new Image();
aboutImage.src = imagepath + "about_on.gif";
galleryImage = new Image();
galleryImage.src = imagepath + "gallery_on.gif";
museumImage = new Image();
museumImage.src = imagepath + "museum_on.gif";
cornerImage = new Image();
cornerImage.src = imagepath + "corner_on.gif";
new_collImage = new Image();
new_collImage.src = imagepath + "new_coll_on.gif";
staffImage = new Image();
staffImage.src = imagepath + "staff_on.gif";
searchImage = new Image();
searchImage.src = imagepath + "search_on.gif";
mailingImage = new Image();
mailingImage.src = imagepath + "mailing_on.gif";
catalogsImage = new Image();
catalogsImage.src = imagepath + "catalogs_on.gif";
locImage = new Image();
locImage.src = imagepath + "loc_on.gif";
contactImage = new Image();
contactImage.src = imagepath + "contact_on.gif";
termsImage = new Image();
termsImage.src = imagepath + "terms_on.gif";
// preload onmouseout images
homeImage1 = new Image();
homeImage1.src = imagepath + "home_off.gif";
aboutImage1 = new Image();
aboutImage1.src = imagepath + "about_off.gif";
galleryImage1 = new Image();
galleryImage1.src = imagepath + "gallery_off.gif";
museumImage1 = new Image();
museumImage1.src = imagepath + "museum_off.gif";
cornerImage1 = new Image();
cornerImage1.src = imagepath + "corner_off.gif";
new_collImage1 = new Image();
new_collImage1.src = imagepath + "new_coll_off.gif";
staffImage1 = new Image();
staffImage1.src = imagepath + "staff_off.gif";
searchImage1 = new Image();
searchImage1.src = imagepath + "search_off.gif";
mailingImage1 = new Image();
mailingImage1.src = imagepath + "mailing_off.gif";
catalogsImage1 = new Image();
catalogsImage1.src = imagepath + "catalogs_off.gif";
locImage1 = new Image();
locImage1.src = imagepath + "loc_off.gif";
contactImage1 = new Image();
contactImage1.src = imagepath + "contact_off.gif";
termsImage1 = new Image();
termsImage1.src = imagepath + "terms_off.gif";
}


// this is the rollover
function over_img(imagename, action) {
  if(goodBrowser==1 && imagename != pathMap['nongallery'][crntPath]) 
  {
  	if(action=='over') {document[imagename].src=eval(imagename + 'Image.src')}
  	if(action=='out') {document[imagename].src=eval(imagename + 'Image1.src')}
	}
	else
	{
	  //alert('alert');
	}
}

// Two below functions for search form in mainnav
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
  }

function init()
{
	var imagename = pathMap['nongallery'][crntPath];
	document.getElementById(imagename).src = imagepath + imagename + "_on.gif";
}

window.onload = init;