// This is built on a script found on the internet for detecting browsers, and the
// script generated by Flash 8 for detecting flash version, but also uses (and
// requires) the SWFObject script.

// Globals
// Major version of Flash required
var requiredMajorVersion = 8;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Revision of Flash optional
var requiredRevision = 0;
// the version of javascript required
var jsVersion = 1.0;

// Flash detection results
var flashInstalled = false;
var flashVersion = 0;
var flashWMode = false;
var flashExtInt = false;
var hasRightVersion = false;

// browser detection results
var ieActivationFix = false;
var dom0 = false;
var dom1 = false;
var isIE = false;
var isIE5 = false;
var isIE5mac = false; 
var isOpera = false;
var isMoz = false;
var isNS = false;
var isSaf = false;
var isKonq = false;
var browser, browserVer;

// platform detection
var isWin = false;
var isLinux = false;
var isMac = false;


jsVersion = 1.1;
// If called with no parameters this function returns a floating point value 
// which should be the version of the Flash Player or 0.0 
// ex: Flash Player 7r14 returns 7.14
// If called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) {
 	reqVer = parseFloat(reqMajorVer + "." + reqRevision);
	// this requires SWFObject.js	
	var version = deconcept.SWFObjectUtil.getPlayerVersion();
	versionString = version["major"] + "." + version['minor'];   // 7.0r24 == 7.24
	versionNum = parseFloat(versionString);
	if (versionNum > 0 ) { flashInstalled = true }
	flashVersion = version["major"];
	if ( (version["major"] > reqMajorVer) && (versionNum >= reqVer) ) {
		return true;
	} else {
		return ((versionNum >= reqVer && version['minor'] >= reqMinorVer) ? true : false );	
	}
	return (reqVer ? false : 0.0);
}
hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

/*
This script is a shortened and expanded version of ...
Script Name: Full Featured Javascript Browser/OS detection
Authors: Harald Hope, Tapio Markula, Websites: http://techpatterns.com/
http://www.nic.fi/~tapio1/Teaching/index1.php3
Script Source URI: http://techpatterns.com/downloads/javascript_browser_detection.php
Version 4.2.2
Copyright (C) 08 July 2005
*/
//initialization, browser, os detection
var ver='', brow='';
var moz_rv_sub, release_date='', moz_brow, moz_brow_ver='', moz_brow_ver_sub='', rv_full=''; 

nav = navigator.appVersion;
nan = navigator.appName;
nua = navigator.userAgent;
isMac = (nav.indexOf('Mac')!=-1);
isWin = ( ( (nav.indexOf('Win')!=-1) || (nav.indexOf('NT')!=-1) ) && !isMac)	//?true:false;
isLin = (nua.indexOf('Linux')!=-1);
//  Marks short version
if (document.getElementById) dom0 = true;

isOpera = (nua.indexOf('Opera')!=-1);
isSaf = (nua.indexOf('Safari')!=-1);
isKonq = (!isSaf && (nua.indexOf('Konqueror')!=-1) )	// ? true : false;
isMoz = ( (!isSaf && !isKonq ) && ( nua.indexOf('Gecko')!=-1 ) )	// ? true : false;
isIE=((nua.indexOf('MSIE')!=-1)&&!isOpera);
if (isOpera) {
	str_pos = nua.indexOf('Opera');
	ver = nua.substr((str_pos+6),4);
	brow = 'Opera';
} else if (isSaf) {
	str_pos = nua.indexOf('Safari');
	ver = nua.substr((str_pos+7),5);
	brow = 'Safari';
} else if (isKonq) {
	str_pos=nua.indexOf('Konqueror');
	ver=nua.substr((str_pos+10),3);
	brow = 'Konqueror';
} else if (isMoz) {
	// regular expression pattern that will be used to extract main version/rv numbers
	pattern = /[(); \n]/;
	// moz type array, add to this if you need to
	moz_types = new Array( 'Firebird', 'Phoenix', 'Firefox', 'Galeon', 'K-Meleon', 'Camino', 'Epiphany', 'Netscape6', 'Netscape', 'MultiZilla', 'Gecko Debian', 'rv' );
	rv_pos = nua.indexOf( 'rv' );// find 'rv' position in nua string
	rv_full = nua.substr( rv_pos + 3, 6 );// cut out maximum size it can be, eg: 1.8a2, 1.0.0 etc
	// search for occurance of any of characters in pattern, if found get position of that character
	rv_slice = ( rv_full.search( pattern ) != -1 ) ? rv_full.search( pattern ) : '';
	//check to make sure there was a result, if not do  nothing
	// otherwise slice out the part that you want if there is a slice position
	( rv_slice ) ? rv_full = rv_full.substr( 0, rv_slice ) : '';
	// this is the working id number, 3 digits, you'd use this for 
	// number comparison, like if ver >= 1.3 do something
	ver = rv_full.substr( 0, 3 );
	for (i=0; i < moz_types.length; i++) {
		if ( nua.indexOf( moz_types[i]) !=-1 ) {
			moz_brow = moz_types[i];
			break }
	}
	if ( moz_brow ) {// if it was found in the array
		str_pos = nua.indexOf(moz_brow);// extract string position
		moz_brow_ver = nua.substr( (str_pos + moz_brow.length + 1 ) ,3);// slice out working number, 3 digit
		// if you got it, use it, else use ver
		moz_brow_ver = ( isNaN( moz_brow_ver ) ) ? moz_brow_ver = ver: moz_brow_ver;
		moz_brow_ver_sub = nua.substr( (str_pos + moz_brow.length + 1 ), 8);
		// this makes sure that it's only the id number
		sub_ver_slice = ( moz_brow_ver_sub.search( pattern ) != -1 ) ? moz_brow_ver_sub.search( pattern ) : '';
		//check to make sure there was a result, if not do  nothing
		( sub_ver_slice ) ? moz_brow_ver_sub = moz_brow_ver_sub.substr( 0, sub_ver_slice ) : '' }
	if ( moz_brow == 'Netscape6' ) moz_brow = 'Netscape';
	else if ( moz_brow == 'rv' || moz_brow == '' ) moz_brow = 'Mozilla';
	if ( !moz_brow_ver ) {// use rv number if nothing else is available
		moz_brow_ver = ver;
		moz_brow_ver_sub = ver }
	if (navigator.productSub) release_date = navigator.productSub;
} else if (isIE) {
	str_pos = nua.indexOf('MSIE');
	ver = nua.substr((str_pos+5),3);
	brow = 'Microsoft Internet Explorer';
} else brow = nan;
// default to get number from navigator app version.
if(!ver) ver = nav.substring(0,1);
isIE5 = (isIE && (ver.substring(0,1)==5));
isIE5mac = (isMac && isIE5);   

// for display
if (brow == "" || typeof brow == "undefined") {
	browser = moz_brow;
	browserVer = moz_brow_ver;
} else {
	browser = brow;
	browserVer = ver;
}

// for ie 6 activeX plugin activation
if (isWin && isIE && parseFloat(ver) >= 6 ) ieActivationFix = true;

// for dom1 node support
if (document.childNodes) dom1 = true;

//---Marks flash wmode support checker
// for flash transparent and opaque modes
// For all Safari on Mac, overlaying dynamic content on flash will cause flicker.
if (isWin && isIE && parseFloat(ver) >= 3 && flashVersion > 5) flashWMode = true;
else if (isMac && isIE && parseFloat(ver) > 5 && flashVersion > 5) flashWMode = true;
//else if (isMac && isIE) flashWMode = false; // testing issues on ie 5.2 for Mac
else if (isMoz && parseFloat(ver) >= 1 && flashVersion > 5) flashWMode = true;
else if (isOpera && parseFloat(ver) >= 8 && flashVersion > 5) flashWMode = true;
else if (isSaf && parseFloat(ver) >= 1.3 && flashVersion > 5) flashWMode = true;

//---Marks flash External Interface checker
// ExternalInterface requires either ActiveX or the NPRuntime API
// Netscape 7 does not qualify but versions 8 and higher do
if (isWin && isIE && parseFloat(ver) >= 5 && flashVersion > 7) flashExtInt = true;
else if (isMoz && parseFloat(ver) > 1.7 && flashVersion > 7) flashExtInt = true;
else if (isOpera && parseFloat(ver) >= 8 && flashVersion > 7) flashExtInt = true;
else if (isSaf && parseFloat(ver) >= 1.3 && flashVersion > 7) flashExtInt = true;
// this script does not yet detect for NS
//else if (isNS && parseInt(ver) >= 8 && flashVersion > 7) flashExtInt = true;

//---Marks transparent iframe checker
//-- opera 9 requires that the content in the iframe have a body style attribute of
//   style="Background: transparent"

//-----Flash error page--------------
var noFlash = "<blockquote><h3>&nbsp;</h3><h3><font color='#999999' face='Arial, Helvetica, sans-serif'>This web site needs version ";
noFlash += requiredMajorVersion + "." + requiredMinorVersion
noFlash += " or later of the Flash<sup><font size='-2'>TM</font></sup> Player.</font><font face='Arial, Helvetica, sans-serif'></font></h3><font face='Arial, Helvetica, sans-serif'><table width='82%'><tr><td height='78' colspan='2'><p />Check here for information about <a href='http://www.macromedia.com/software/flash/' target='_new'>Macromedia<sup><font size='-1'>&reg;</font></sup>Flash<sup><font size='-2'>TM</font></sup></a> software.<p />";
if(flashVersion > 0) {
	noFlash += "You are currently using version " + flashVersion + " and should consider upgrading.";
} else {
	noFlash += "You currently do not have the Flash Player.  Please consider intalling it now.";
}
noFlash += "</td></tr><tr><td><a href='http://www.macromedia.com/go/getflashplayer'><img src='flash/alternate.gif' border='0' width='88' height='31' /></a></td><td><p />It will only take a moment to download and install the latest version.</td></tr></table></font><p /><font face='Verdana, Arial, Helvetica, sans-serif' SIZE='-2'>Macromedia and Flash are trademarks of Macromedia, Inc.</font></blockquote>";

