// Common JavaScript routines for Advanced Techniques Section
// Web Page Design For Designers
// http://www.wpdfd.com/advanced/ch1_1.htm

var hostPath="http://www.rivaslg.com";

var an=navigator.appName; 		// tells if Netscape or Explorer
var av=navigator.appVersion; 		// tells if Mac or PC
var cssFile="";				// initial CSS file
var currentStyle="no";			// initial style
var currentInfo=null;

// this is the Netscape browser sniffer
if (an == "Netscape") {
	if (navigator.appVersion.indexOf("Macintosh") == -1) {
		cssFile=hostPath+'/css/winnn.css';
		currentStyle='Windows Netscape';
	} else {
		cssFile=hostPath+'/css/macnn.css';
		currentStyle='Macintosh Netscape';
	}
}
     		
// this is the MSIE browser sniffer
if (an == "Microsoft Internet Explorer")      		{
	if (av.indexOf("Macintosh") == -1) {
		cssFile=hostPath+'/css/winie.css';
		currentStyle='Windows Explorer';
	} else {
		cssFile=hostPath+'/css/macie.css';
		currentStyle='Macintosh Explorer';
	}
}

// loads the appropriate style sheet and images
function init() {
	l=document.URL;
        ss=cssFile;  	// loads the appropriate style sheet

	document.write("<link href='"+ss+"' rel='styleSheet' type='text/css'>");
}

// tells which style sheet is being used
function writeStyle() {
	return currentStyle;
}
	
// downloads files for Mac or PC	
function download(f) {
	if(cssFile.indexOf("mac")!= -1) {
		theFile=f+".hqx";
	} else {
		theFile=f+".zip";
	}
	window.location=theFile;
}
