/*Code to detect browser*/


/*NOTE:
Wasn't sure where to put this, so I threw the note in here.  Basically, I had code in earlier to do this, (but took it out! sorry...), we need an ASP if statement that will hide the noscript content and display the "content" div when the user clicks "continue".  (The variable is already in the querystring once they use that link.  May need additional code to hide/show when user does have JS enabled, but is receiving error messages due to cookies/browser version.)  Careful that it works both when JS is enabled/disabled.

(The ul created in the code below is "dynamic", whereas the one inside the noscript tag is static.  However, it is also in a ul to give it an appearance of consistency.)

The script code would be, (for example):

var elNoscript = document.getElementById("noscript");
var elContentDiv = document.getElementById("content");

elNoScript.style.display = "none";
elContentDiv.style.display = "block";

Could at least need add this to bottom of page:

  <script type="text/JavaScript">
   document.getElementById("noscript").style.display="none";
  </script>

(This is necessary because the script area will still be there and create a margin from the top.  (ie: extra white space))

NOTE: Browser/cookie/JS detection is only implemented on the demo page currently.


*/



/*Following code from:
http://www.quirksmode.org/js/detect.html*/

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;

/*NOTE:Interotech - Took off "parseFloat" function, swapped "substring" function with "substr", and added second argument to substr to give
	length of characters returned.*/
		/*return parseFloat(dataString.substring(index+this.versionSearchString.length+1,3));*/
		return dataString.substr(index+this.versionSearchString.length+1,3);


	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	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: "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();



/*Code to detect cookies.*/
/*http://programming.top54u.com/post/Javascript-Check-Cookies-Enabled.aspx*/




 var blnCookiesError = ""
 var blnRefError = ""
 var blnBrowserError = ""

 if(!navigator.cookieEnabled)
 {
    blnCookiesError = true; 
 }
 

//PG: REV20090204: added logic to check if referrer string is blank (from firewall) then show message
var bypass = location.href
if (bypass.indexOf("bypass=Y") == -1){
//if "bypass=Y" exists in the href then don't check referer
     if(document.referrer == "")
	 {
		blnRefError = true;  
	 }
}
//PG: REV20090204: end


if(BrowserDetect.browser=="Firefox"){
   if(BrowserDetect.version < "1.5"){
        
    blnBrowserError = true;
  
   }
}

if(BrowserDetect.browser=="Explorer"){
  if(BrowserDetect.version < "6.0"){
        
    blnBrowserError = true;
  
  }
}

//PG: REV20090211: added logic to check if for Safari browser version
if(BrowserDetect.browser=="Safari"){
   if(BrowserDetect.version < "3.2"){
       
    blnBrowserError = true;
  
   }
}



//PG: REV20090211: end

/* http://www.sitepoint.com/blogs/2007/07/11/insert-in-place-without-documentwrite/ */
/* http://thewebdesignjournal.com/2006/07/javascript-and-xhtml/ */

/*NOTE:Add ul with concatenated li tags.  Of course, if no error, will be empty.*/

 

 

 
