// Browser and Operating System Sniffer
//
// Version: 01.00.01.08
var sn_Ver="01.00.01.08"
// Date:    01.30.2004
//
// Derek Davies, Jeremy D. Young -- Viewpoint NYC
//
// This file sets up variables to aid in browser and
// operating system sniffing commonly needed for content.
//
// For deployment of this file to the web you can remove
// all lines like this that begin with // although you will
// probably want to save this original file for reference.
//
// This file declares the following true or false variables
// which you can use in your own content.
//
// Operating Systems:	os_Win   os_Mac   os_MacOSX  os_Unsupported
// Browsers:			br_IE    br_IE4   br_IE5     br_IE5_5  br_IE6
// Browsers:			br_NN    br_NN4   br_NN4su   br_NN6    br_NN7
// Browsers:			br_AOL   br_AOL4  br_AOL5    br_AOL6   br_AOL7
// Browsers:			br_AOL8  br_AOL9
// Browsers:			br_Gecko br_Opera br_Safari  br_Compuserve
// Browsers:			br_Supported br_Unsupported
// Misc:				us_Layer us_DIV
//
// Everything else you see in this file is there mainly just
// to support the functions/variables above and aren't really
// designed to be used in your page. We may have to change these
// "internal" variables/functions in order to keep this file
// up to date.

// User Agent information
var usrAgt=navigator.userAgent.toLowerCase()
// Browser appname
var appName=navigator.appName.toLowerCase()
// Browser Version Number
var versNum=parseInt(navigator.appVersion.substring(0,1))
var versNum_nn=parseFloat(navigator.appVersion)

// Windows OS
var os_Win=(usrAgt.indexOf("win")!=-1)
// Macintosh OS
var os_Mac=(usrAgt.indexOf("mac")!=-1)
// neither windows or macintosh
var os_Unsupported=(!os_Win&&!os_Mac)

// OS X Sniffer detection using the best-known methods available
// This function normally wouldn't be called directly in your
// code. You would use the os_MacOSX variable declared directly
// after this function.
function sniff_MacOSX()
{
	// it can't be OS X if it's not even Mac
	if(!os_Mac)return false
	// some OS X native browsers have mac os x in the agent string, but not all of them :(
	if(usrAgt.indexOf("mac os x")!=-1)return true
	//is there a carbon default plugin in the plugins array? if so then it must be OS X
	if(navigator.plugins)
		for(var i=0;i<navigator.plugins.length;i++)if(navigator.plugins[i].name.toLowerCase()=="default plugin carbon.cfm")return true
	//if none of the above tests confirms OS X then it can't be.
	return false
}

// sniff if this is Mac OS X. This is what you should use in your content, not the function above.
var os_MacOSX=sniff_MacOSX()

// Generic Internet Explorer test. This is true for ANY IE.
var br_IE=(appName.indexOf("microsoft")!=-1)
// Specifically IE4
var br_IE4=(br_IE&&(usrAgt.charAt(usrAgt.indexOf('msie')+5)=='4'))
// Specifically IE5
var br_IE5=(br_IE&&(usrAgt.charAt(usrAgt.indexOf('msie')+5)=='5'))
// Specifically IE5.5
var br_IE5_5=(br_IE&&(usrAgt.substring(usrAgt.indexOf('msie')+5,usrAgt.indexOf('msie')+8)=='5.5'))
// Specifically IE6
var br_IE6=(br_IE&&(usrAgt.charAt(usrAgt.indexOf('msie')+5)=='6'))


// Opera browser.
var br_Opera=(usrAgt.indexOf("opera")!=-1)
// All Gecko browsers - NN6/7, Mozilla, CompuServe etc.
var br_Gecko=(usrAgt.indexOf("gecko")!=-1)
// CompuServe
var br_Compuserve=(usrAgt.indexOf('cs 2000 7')!=-1)
// Safari browser.
var br_Safari=((usrAgt.indexOf("safari/")!=-1)&&(parseInt(usrAgt.substring(usrAgt.indexOf("safari/")+7,usrAgt.length))>=100))

// Generic Netscape test. This is mostly for internal use here
// as there isn't really much reason for needing to know if a
// browser belongs to the generic Netscape family. Normally you
// want to know if the browser is Netscape 6.x or 4.x and this
// variable doesn't tell you that, the other variables that are
// declared later do that.
var br_NN=(appName.indexOf("netscape")!=-1)
// Netscape 4.xx - use this for writing "layer" tags for layers.
var br_NN4=(br_NN&&(versNum==4))
// Netscape 4.xx with smartupdate enabled - use this for writing "layer" tags for layers.
var br_NN4su=(br_NN4&&!os_Mac&&netscape.softupdate.Trigger.UpdateEnabled())
// Netscape 6.xx
var br_NN6=br_NN&&(parseInt(navigator.vendorSub)==6)
// Netscape 7.xx
var br_NN7=br_NN&&(parseInt(navigator.vendorSub)==7)&&!br_Compuserve


// All AOL browsers
var br_AOL=(usrAgt.indexOf('aol')!=-1)
// Specifically AOL 4
var br_AOL4=(br_AOL&&(usrAgt.charAt(usrAgt.indexOf('aol')+4)=='4'))
// Specifically AOL 5
var br_AOL5=(br_AOL&&(usrAgt.charAt(usrAgt.indexOf('aol')+4)=='5'))
// Specifically AOL 6
var br_AOL6=(br_AOL&&(usrAgt.charAt(usrAgt.indexOf('aol')+4)=='6'))
// Specifically AOL 7
var br_AOL7=(br_AOL&&(usrAgt.charAt(usrAgt.indexOf('aol')+4)=='7'))
// Specifically AOL 8
var br_AOL8=(br_AOL&&(usrAgt.charAt(usrAgt.indexOf('aol')+4)=='8'))
// Specifically AOL 9
var br_AOL9=(br_AOL&&(usrAgt.charAt(usrAgt.indexOf('aol')+4)=='9'))

// Unsupported browser.
var br_Supported=br_IE||br_NN4||br_Compuserve||br_AOL||br_NN7||br_Safari
var br_Unsupported=!br_Supported

// Miscellaneous
var us_Layer=br_NN4
var us_DIV=!us_Layer
