// BROWSER/VERS
function SLnavigator() {
	this.computer = computerType();
	this.browser = browserName();
	this.version = browserVers();
	

	this.warning = upgrade(this.version);

}

function computerType() {

	computer = 'XX';
	if(navigator.appVersion.indexOf('Mac') != -1) {
		computer = 'MA';
	}
	if(navigator.appVersion.indexOf('Mac') == -1) {
		computer = 'PC';
	}
	return(computer);
}


function browserName() {
	browser = 'XX';
	if(navigator.appName.indexOf('Explorer') != -1) {

		browser = 'IE';
	}
	if(navigator.appName.indexOf('Netscape') != -1) {
		browser = 'NN';
	}
	return(browser);
}


function browserVers() {
	version = 5;
	if(navigator.appVersion.indexOf('4') != -1) {
		version = 4;
	}
	if(navigator.appVersion == 3) {
		version = 3;
	}
	if(navigator.appVersion == 2) {
		version = 2;
	}
	if(navigator.appVersion == 1) {
		version = 1;
	}
	return(version);
}

function upgrade(theVers) {
	if(theVers <= 3) {
		alert('This site requires you to upgrade to at least a version 4.0 browser.');
	}
}

theNavigator = new SLnavigator();



// DATE

function SLdate() {
	this.masterDate = new Date();
	this.sec = this.masterDate.getSeconds();

	this.min = this.masterDate.getMinutes();
	this.date = this.masterDate.getDate();
	
	this.militaryHour = this.masterDate.getHours();
	this.hour = theHour(this.militaryHour);
	
	this.dayNum = this.masterDate.getDay();
	this.dayList = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
	this.day = this.dayList[this.dayNum];
	this.dayAbr = this.day.substring(0,3);
	
	this.monthList = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
	this.monthNum = this.masterDate.getMonth();
	this.month = this.monthList[this.monthNum];
	this.monthAbr = this.month.substring(0,3);
	
	this.yearRaw = this.masterDate.getYear();
	this.year = fixYear(this.yearRaw);
	
	this.displayLong = (this.day + ' | ' + this.month + ' ' + this.date + ' | ' + this.year);
	this.displayShort = (this.dayAbr + ' | ' + this.monthAbr + ' ' + this.date + ' | ' + this.year);
	this.displayNum = (this.date + '/' + this.monthNum + '/' + this.yearRaw);

}

function fixYear(theYear) {
	if((theNavigator.browser == 'NN') & (theNavigator.version < 5)) {
		theYear = theYear + 1900;
	}
	return(theYear);
}

function theHour(fromMil) {
	if(fromMil < 12) {
		fromMil = fromMil + 'am';
	}
	if(fromMil >= 12) {
		fromMil = (fromMil - 12) + 'pm';
	}
	return(fromMil);
}

/*function imgSwap(imgName) {
	switch(document[imgName].src) {
		case eval(imgName + 'B.src'):
		document[imgName].src = eval(imgName + 'A.src');
		break;
		case eval(imgName + 'A.src'):
		document[imgName].src = eval(imgName + 'B.src');
		break;
		default:
		alert('This image does not have a swapable source.');
		break;
	}
}*/

function imgSwap(imgName) {
	standard = document[imgName].src;
	imgA = eval(imgName + 'A.src');

	imgB = eval(imgName + 'B.src');
	//alert(imgB);
	if(standard == imgB) {
		document[imgName].src = eval(imgName + 'A.src');

	}else if(standard == imgA) {
		document[imgName].src = eval(imgName + 'B.src');
	}else {
		alert('This image does not have a swapable source.');
	} 
}


theDate = new SLdate();

//FIND ROOT DIRECTORY
function findRoot() {
	rootDirPos = (document.location.href.indexOf('.org') + 5);
	if(document.location.href.indexOf('webmaster/') != -1) {
		rootDirPos = (document.location.href.indexOf('webmaster/') + 10);
	}
	rootDir = document.location.href.substring(0,rootDirPos);
	
}

//INITIALIZE PAGE MENU
function pageInit(siteSection) {
	findRoot();
	menuGraphicDir = rootDir + 'global/graphics/menu/';

	if(document.images) {
		homeA = new Image();
		homeA.src = menuGraphicDir + 'homeA.gif';
		homeB = new Image();
		homeB.src = menuGraphicDir + 'homeB.gif';
		
		outreachA = new Image();
		outreachA.src = menuGraphicDir + 'outreachA.gif';
		outreachB = new Image();
		outreachB.src = menuGraphicDir + 'outreachB.gif';
		
		eventsA = new Image();
		eventsA.src = menuGraphicDir + 'eventsA.gif';
		eventsB = new Image();
		eventsB.src = menuGraphicDir + 'eventsB.gif';
		
		aboutA = new Image();
		aboutA.src = menuGraphicDir + 'aboutA.gif';
		aboutB = new Image();
		aboutB.src = menuGraphicDir + 'aboutB.gif';
		
		contactA = new Image();
		contactA.src = menuGraphicDir + 'contactA.gif';
		contactB = new Image();
		contactB.src = menuGraphicDir + 'contactB.gif';
	}

	//imgSwap(siteSection);
}


//OPEN SHOW INFO WINDOW
function showInfo(theShow) {
	findRoot();
	winStats = 'scrollable=yes,scalable=no,location=no,menubar=no,';
	winStats += 'width=230,height=400';
	
	showInfoWin = window.open(rootDir + 'pages/home/showInfo/' + theShow + '.html','theShow',winStats);
}


//GET PAST SHOW ARCHIVE
function prod(theProd)
{
	if(theProd == 'select')
	{
		return false;
	}else{
		theLoc = document.location.href;
		start = theLoc.indexOf('pastShows');
		newLoc = theLoc.substring(0,start+10) + theProd + '/index.html';
		document.location = newLoc;
		//alert(newLoc);
	}

}

function getProd()
{
	var theProd = document.productions.production.value;
	prod(theProd);
}


//OPEN LARGE VIEW
function openLarge(thePhoto)
{
	largeView = window.open('largeView.html?photo='+thePhoto,'large','scrollbars=no,menu=no,resize=no,width=384,height=288');
}