// Dynamic Stylesheet Selection Script by Hank VanZile (hank@upstartdesign.com)

/* 
This script will allow you to set up 2 different Cascading Stylesheets: one for visitors using PCs and Macs with a 5.0/6.0 browser and another (with all the text generally set 2 points larger) for Mac users with 4.x or older browsers.
*/

// Set a variable for the link to the PC / Newer Mac Stylesheet
var pcnewmac = "<link href=http://www.upstartdesign.com/pcnewmac.css rel=stylesheet type=text/css>";

// Set a variable for the link to the Mac Stylesheet for 4.x or older browsers
var mac = "<link href=http://www.upstartdesign.com/mac.css rel=stylesheet type=text/css>";

// This function checks to see if the browser is a Windows-based browser.
// If that is the case, it will return true; otherwise it will return false.
function isWin() {
if(navigator.appVersion.indexOf("Win") != -1)
return true;
else return false;
}

// This function checks to see if the browser is a Mac-based browser.
// If that is the case, it will return true; otherwise it will return false.
function isMac() {
if(navigator.appVersion.indexOf("Mac") != -1)
return true;
else return false;
}

// This function checks for two things: 
// 1. if the browser is Mac-based
// 2. if the browser version contains "5.", which is an indication that
// it is either Netscape 6.0 or Internet Explorer 5.0 for the Mac
// If both conditions are true, it will return true; otherwise it will return false.
function isNewMac() {
if(navigator.appVersion.indexOf("Mac") != -1) {
	if(navigator.appVersion.indexOf("5.") != -1)
	return true;	
} 
else return false;
}

/* 
This IF ... ELSE statement runs through our various system checks in a set order.  

If the browser is determined to be Windows-based, the checking stops and a link to the "PC / Newer Mac Stylesheet" is written.

If the browser is NOT Windows-based, the statement checks to see if it's a Mac with a newer browser.  If so, a link to the "PC / Newer Mac Stylesheet" is written.

If the browser is NOT a newer Mac browser, the statement checks to see if it's a Mac (with an older browser).  If so,  a link to the "Mac Stylesheet" is written.

If NONE of the first three checks are true, then we are to assume it's something other than a Windows or Mac machine and a link to the standard "PC / Newer Mac Stylesheet" is written.
*/

if (isWin()) {
document.write(pcnewmac);
}
else if (isNewMac()) {
document.write(pcnewmac);
}
else if (isMac()) {
document.write(mac);
}
else {
document.write(pcnewmac);
}
