// Browser detect for FAQ 
// Version 1.2



// **********************************************************
// Acknowedgment to http://www.quirksmode.org/js/detect.html
// for this code.  Modified to for local use. November 2008
// **********************************************************

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: "Chrome",
			identity: "Chrome"
		},
		
		{
			prop: window.opera,
			identity: "Opera"
		},
		
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		
	]

};
BrowserDetect.init();

var intro_all = '<ins><em>ChessWorld is optimised to run on Microsoft Internet Explorer!</em></ins><br />'
 
var intro_using = '<br />As you are using ' + BrowserDetect.browser + ' ' + BrowserDetect.version + ' '

var intro_ie6 = 'you have full functionality!<br /><br />  May we suggest that you consider upgrading to Explorer 7 at some stage when it is <br />convenient to you.  ChessWorld is always fully optimized for the latest version of Explorer.<br /><br />'

var intro_ie = 'you have full functionality!<br /><br />'

var intro_fx2 = 'we suggest that you consider upgrading to the latest version.<br /><br /> You may experience a few minor issues with some Menu options, which should not spoil <br />your enjoyment of ChessWorld. &nbsp;In this case, and for a trouble free experience, we suggest <br />that you choose one of the \'Improved menu\' options, via <i>My Stuff ... My Interface</i>.<br /><br />'

var intro_fx = 'you may experience a few minor issues with some Menu<br /> options, which should not spoil your enjoyment of ChessWorld. &nbsp;For a trouble free experience, <br />we suggest that you choose one of the \'Improved menu\' options, via <i>My Stuff ... My Interface</i>.<br /><br />'

var intro_op = 'you may find that certain ChessWorld features do not function <br />as you would expect.  You may also experience a few minor formatting  issues, although this <br />is unlikely to spoil your enjoyment of ChessWorld.<br /><br />'

var intro_ch = 'you may experience a few minor formatting <br />issues although this is unlikely to spoil your enjoyment of ChessWorld.<br /><br />'

var intro_usingUB = '<br />As you are not using a supported browser you may not have full functionality.  <br />You may find the information below helpful; however, if you continue to have <br />problems please contact the HelpDesk with full details.<br /><br />' 

var intro_finish = '</div>'


if (BrowserDetect.browser == 'Explorer' && BrowserDetect.version == 6)
            {
            
            document.write(intro_all);
            document.write(intro_using);
            document.write(intro_ie6);
            document.write(finish);
            }






if (BrowserDetect.browser == 'Explorer')
            {
            
            document.write(intro_all);
            document.write(intro_using);
            document.write(intro_ie);
            document.write(finish);
            }
   
// Firefox detect version 2    
else if (BrowserDetect.browser == 'Firefox' && BrowserDetect.version == 2)
            {
            
            document.write(intro_all);
            document.write(intro_using);
            document.write(intro_fx2);
            document.write(finish);
            }     
  
// Firefox detect later versions           
else if (BrowserDetect.browser == 'Firefox')
            {
            
            document.write(intro_all);
            document.write(intro_using);
            document.write(intro_fx);
            document.write(finish);
            }

else if (BrowserDetect.browser == 'Opera')
            {
            
            document.write(intro_all);
            document.write(intro_using);
            document.write(intro_op);
            document.write(finish);
            }

else if (BrowserDetect.browser == 'Chrome')
            {
            
            document.write(intro_all);
            document.write(intro_using);
            document.write(intro_ch);
            document.write(finish);
            }
else
            {
            
            document.write(intro_all);           
            document.write(intro_usingUB);
            document.write('<br />' + finish);
            }
