//set in doc the number of buttons and the generic name of each button
var NumOfButtons = 6;
var GenericButtonName = 'MainNav';

// browser detection
var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;

if (checkIt('konqueror'))
{
	browser = "Konqueror";
	OS = "Linux";
}
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) browser = "Internet Explorer"
else if (!checkIt('compatible'))
{
	browser = "Netscape Navigator"
	version = detect.charAt(8);
}
else browser = "An unknown browser";

if (!version) version = detect.charAt(place + thestring.length);

if (!OS)
{
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('mac')) OS = "Mac"
	else if (checkIt('win')) OS = "Windows"
	else OS = "an unknown operating system";
}

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

//******************Functions for rollovers
//buttons are named by generic name + the number of the individual button
//rollover buttons end with -over
//off buttons use no extension

function SubNavItem (name, width, height) {
	this.over = new Image();
	this.over.src = baseURL + name + "_over.gif"
	this.off = new Image();
	this.off.src = baseURL + name + ".gif"
}

function NewSubNav (name) {
	SubNavItem[name] = new SubNavItem(name);
}

function SubNavOver (imgName) {
    if (document.images) document[imgName].src = SubNavItem[imgName].over.src;
}

function SubNavOut (imgName) {
    if (document.images) document [imgName].src = SubNavItem[imgName].off.src;
}

function initRollover() {
	if (document.images != null) {
		for (i = 1; i <= NumOfButtons; i++) {	
		NewSubNav(GenericButtonName + i);
		}
	}
}
