<!-- hide JavaScript from non-JavaScript browsers

/*-- HOW TO DEBUG ---------------------------------------------------------------------------------------
   To debug the script, erase the two slashes before the alert, beneath the browser you're debugging for.
   Example: To see if the script is working for Internet Explorer 5.x
            change: // alert("Internet Explorer 5.x...")
            to:     alert("Internet Explorer 5.x...")
   That way, the next time the script is run, a system alert should show.
   If an alert does not show, erase the slashes before the alerts for other types of browsers, until
   you find the one that does show you a system alert when the script is run.
-------------------------------------------------------------------------------------------------------*/

/* --- BROWSER, VERSION, and OS SNIFFER -----------------------------------------------------------------
   Date: April 1, 2007
   Original Script Available At: http://www.quirksmode.org/js/detect.html
   
   With this script you can query the following:
   BrowserDetect.browser - returns the name of the user's web browser or "an unknown browser"
   BrowserDetect.version - returns the version number of the user's web browser or "an unknown version"
   BrowserDetect.OS - returns Windows, Mac, Linux, or "an unknown OS"

-------------------------------------------------------------------------------------------------------*/

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "an unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
                        string: navigator.userAgent,
                        subString: "AOL",
                        identity: "AOL"
                },
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();

/* --- PLATFORM SNIFFER -------------------------------------------------------------------------------
   Date: April 1, 2007
   Variables: useIE - detects if the user's browser should use the IE css file
              useNET - detects if the user's browser should use the NET css file
              If a browser should use the IE css file, place its BrowserDetect.browser entry beneath 
              the useIE variable. Otherwise, place its entry beneath the useNET variable. Additional
              criteria such as version number and OS can be queried.

   Output: FILENAME - Stores a portion of the CSS filename to be assigned to the client.
-------------------------------------------------------------------------------------------------------*/
var useNET = BrowserDetect.browser == "Netscape"
             || BrowserDetect.browser == "OmniWeb"
             || BrowserDetect.browser == "Safari"
             || BrowserDetect.browser == "Opera"
             || BrowserDetect.browser == "iCab"
             || ((BrowserDetect.browser == "AOL") && (BrowserDetect.os == "Mac"))
             || BrowserDetect.browser == "Firefox"
             || BrowserDetect.browser == "Konqueror"
             || BrowserDetect.browser == "Camino"
             || BrowserDetect.browser == "Mozilla"
            
// alert("Your browser, "+ BrowserDetect.browser +" "+ BrowserDetect.version +" will use the NET css file: "+ useNET);

var useIE = ((BrowserDetect.browser == "AOL") && (BrowserDetect.os == "Windows"))
            || BrowserDetect.browser == "Explorer"


// alert("Your browser, "+ BrowserDetect.browser +" "+ BrowserDetect.version +" will use the IE css file: "+ useIE);

if (useIE) FILENAME = "ie";
else if (useNET) FILENAME = "net";
else FILENAME = "ie";


/* --- RESOLUTION SNIFFER -------------------------------------------------------------------------------
   Date: April 30, 2003
   UPDATE: February 20, 2007, now detects screen widths of 1280, 1024, or smaller
   Variables: screen_height - A DOM property to determine the client's screen height.

   Output: SCREENRES - Variable used in the construction of a CSS filename. (eg: "netscape_10x7.css")
                       Possible values include: "_12x10" , "_10x7" or "_6x4"

-------------------------------------------------------------------------------------------------------*/

var screen_width = screen.width;

  if (screen_width >= 1280) {
//  alert("The screen width is at least 1280 pixels ");
  SCREENRES = "_12x10";

} else if ((screen_width >= 1024) && (screen_width < 1280)) {
//  alert("The screen width is between 1024 and 1280 pixels");
  SCREENRES = "_10x7";

} else {
//  alert("The screen width is less than 1024 pixels");
  SCREENRES = "_6x4";
}

/* --- ASSIGN APPROPRIATE STYLESHEET --------------------------------------------------------------------
   Date: April 30, 2003
   Variables: rootLevel - The relative or absolute path of the folder where CSS files are store.
                          rootLevel can either be set in each HTML document (eg: "var rootLevel = "../../")
                          or set as an absolute link in the script below
              FILENAME  - The first half of the CSS filename, stating the browser name to be used.
                          FILENAME is assigned by the browser/platform sniffer
              SCREENRES - The last half of the CSS filename, stating the Screen's resolution.
                          SCREENRES is assigned by the resolution sniffer

   Output: Writes the link for the appropriate stylesheet in the client's HTML document.
--------------------------------------------------------------------------------------------------------*/

var rootLevel = "http://www.bodyjoy.org/styles/";   // Absolute link to folder where CSS file are stored

// alert("The stylesheet for this browser is at "+ rootLevel + FILENAME + SCREENRES +".css");
document.write('<link rel="stylesheet" type="text/css" href="'+ rootLevel + FILENAME + SCREENRES +'.css">');

//--> end hide Javascript
