// BEGIN BROWSER DETECT
agt = navigator.userAgent.toLowerCase();
mac = agt.indexOf("mac") != -1;
win = agt.indexOf("win") != -1;
ns = (document.layers)? true:false;
ie = (document.all)? true:false;
dom = (document.getElementById)?true:false;

// use browser detect for the correct stylesheet
if(ns && mac) {
	document.write("<link rel=stylesheet href=/inc/css/mac_ns.css type=\"text/css\">"); // Netscape 4 for Mac
} else if(ns && ie) {
	document.write("<link rel=stylesheet href=/inc/css/mac_ie.css type=\"text/css\">"); // IE, Netscape 6 for Mac
} else if(win && ns) {
	document.write("<link rel=stylesheet href=/inc/css/win_ns.css type=\"text/css\">"); // Netscape 4 for Windows
} else if(win && ie) {
	document.write("<link rel=stylesheet href=/inc/css/win_ie.css type=\"text/css\">"); // IE, Netscape 6 for Windows
} else {
	document.write("<link rel=stylesheet href=/inc/css/win_ie.css type=\"text/css\">"); // All other browsers
}

// END BROWSER DETECT

// clear the words "Enter Zip Code" from branch locator search boxes
function clearZip() {
	if(document.zipForm.zip.value.toLowerCase().indexOf("enter zip code") > -1) {
		document.zipForm.zip.value = "";
		typed = 1;
	}
}

// open a popup window
// parameters:
//  page - filename that will be loaded in the popup
//  winName - window name
//  width - width of the popup window
//  height - height of the popup window
function popUp(page, winName, width, height) 
{
	properties = 'width=' + width + ',height=' + height + ',resizable=yes,scrollbars=yes,';
	if(ns) properties+= 'screenX=15,screenY=15';
	else properties+= 'left=5,top=5';
	newwin = window.open(page, winName, properties); 
	newwin.focus();
}

// open a popup window
// parameters:
//  page - filename that will be loaded in the popup
//  winName - window name
//  width - width of the popup window
//  height - height of the popup window
function popPrint(page, winName, width, height) {
	properties = 'width=' + width + ',height=' + height + ',resizable=yes,scrollbars=yes,toolbar=1,menubar=1';
	if(ns) properties+= 'screenX=15,screenY=15';
	else properties+= 'left=5,top=5';
	newwin = window.open(page, winName, properties);
	newwin.focus();
}

// BEGIN IMAGE SWAP CODE

// image swap, on state
function imgOn(imgName) {
	if(document.images)
		document [imgName].src = eval(imgName + '_on.src');
}

// image swap, off state
function imgOff(imgName) {
	if(document.images)
		document [imgName].src = eval(imgName + '_off.src');
}	

// swap text for home page and case studies
function textOn(imgName) {
	if(document.images)
		document ['imageText'].src = eval(imgName + '.src');	
}
function textOff() {
	if(document.images)
		document ['imageText'].src = imageText.src;	
}	

// Get Definition
function getDefinition(definethis) {
	page = '/customerservice/dictionary/popup/default.asp?word=' + definethis
	winName = 'definition'
	properties = 'width=485,height=200,resizable=yes,scrollbars=yes,';
	if(ns) properties+= 'screenX=15,screenY=15';
	else properties+= 'left=5,top=5';
	newwin = window.open(page, winName, properties); 
	newwin.focus();
}
