// first, let's get the variables we're interested in (including the ones that
// aren't available in the server ENV hash: screen resolution and color depth)
// and escape the variables that have spaces or non-alphanumeric characters in
// them (so they don't mess up the query string)

var gt = unescape("%3E");
var bn = escape(navigator.appName);
var bv = escape(navigator.appVersion);

// check to see if the browser supports the screen object
if (window.screen) { 
	// if it does, get the screen width, height and color depth
	var sr = screen.width + "%20X%20" + screen.height; 
	// and store those values in the sr and cd variables
	var cd = screen.colorDepth; 
// if the browser doesn't support the screen object, set the sr and cd variables
// to "na" (not available) - (if the user's browser version is lower than 4.0,
// the screen object will not be supported, so these variables will be undef)
} else { 
	var sr = "na"; 
	var cd = "na";
}

// now we'll write a phony 1x1 image, where the "src" attribute is actually a
// "get" request for the perl script - the query string (var "arg") contains the
// environment variables from above

var x1 = "<img src=\"http://www.pde.rpi.edu/cgi-bin/pde/environment.pl";
var arg = "?bn=" + bn + "&bv=" +bv+ "&sr=" + sr + "&cd=" + cd;
var x2 = "\" border=\"0\" height=\"1\" width=\"1\" alt=\"\"" + gt;
document.write(x1 + arg + x2);