/* ****	PM Browser and Environment Client-Side Sniffer Script External Code, version v3.1.4.1-envir 
   ****	Originally developed by <mailto:larspeemm@netscape.net> 2001-07-21  
   ****	Copyrighted by lars.pm <mailto:larspeemm@netscape.net> (C) 2001-2006  
   
   * The full version 3 was released 2005-06-01.
   * The adjusted version (v3.1.0) was made available 2006-03-25. 
   * Please DO NOT remove author info.

NOTES: 	* This script file must be used in conjunction with two other script files 
	  respectively located at <http://memo.mikaels.net/pm-public/uaexami.js>
	  and the one at <http://memo.mikaels.net/pm-public/ua.js> 
	  IS SUBJECT TO THE MOZILLA PUBLIC LICENSE VERSION 1.1.
	* Some code in this file is not implemented in JavaScript early versions like 
	  1.0 and 1.1 and may trigger syntax errors or major failures with old browsers. 
	* Editable sections are pointed out as such. 

 ****	* The deprecated /envir/ properties in /uaenvirsniff.js/ are *removed*
	  from this file *except* .oldworld  and .newworld. 				

 **** */
//Quality assurance
function QA(){if (typeof(Exami)!='function' || typeof(xbDetectBrowser)!='function'){
alert("Error! The Exami function is: "+typeof Exami +"\n"+" and the xbDetectBrowser function is: "+typeof xbDetectBrowser +"\n"+
   "\(This was a Quality Assurance alert.\)")}}
QA();

//NOTE: the Extra function should be safe on js language versions 1.2+
function Extra() {
 
/* This function is a plug-ins and Java check for some browsers only, notably *not* for MSIE. 
 * It will create custom envir.extra properties for those browsers. If not applicable for the browser in question
 * the envir.extra.implemented property will be false.
 */

this.implemented = (navigator.mimeTypes.length > 0 &&
	typeof(navigator.javaEnabled) =='function');

if (this.implemented){
  var mimetype, plugin, custom, prettyNameType, prettyNamePlug;

// **** Sun (strict) Java
/* Strict declaration for those who don't trust Microsoft Java. IE
 * returns "unknown" as the type of navigator.javaEnabled, but the
 * extra.java property declared below will only become interpreted
 * by user agents, which returns the "function" type.
 */ 
this.java = (navigator.javaEnabled()); 
/* COMMENTING OUT THE JAVA METHODS
this.screensizecolor = this.screensizewidth = this.screensizeheight = this.screenresolution = false; 
if (this.java && typeof(java)!='undefined' && typeof(java)!='null'){
if (java.awt){
var toolkit = java.awt.Toolkit.getDefaultToolkit(); 
var model = toolkit.getColorModel();
var screen_size = toolkit.getScreenSize(); 

  this.screensizewidth = screen_size.width  
  this.screensizeheight = screen_size.height 
  this.screensizecolor = model.getPixelSize();
  this.screenresolution = toolkit.getScreenResolution();
}}  //java methods end.
 */
//NOTE: 13 arguments (mime types) are currently used from the Envir function, but it can be any number
    for (var p=0;p<arguments.length;p++){
	custom=arguments[p]; var cuiO = custom.indexOf('/');
	prettyNameType = custom.substring(0,cuiO)+'_'+custom.substring(cuiO+1).replace(/-/g,"_");
	prettyNamePlug = custom.substring(cuiO+1).replace(/-(\w)/g,"_$1")

  eval("this."+prettyNameType+" = true");
  eval("this.plugin_"+prettyNamePlug+" = false");
  mimetype = navigator.mimeTypes[custom];
  if (mimetype)
  {
     plugin = mimetype.enabledPlugin;
     if (plugin) eval("this.plugin_"+prettyNamePlug+" = true");  
  }
  else eval("this."+prettyNameType+" = false");
	}

} //safety conditions ends

//Extra ends.
}

function Dom() { 

this.implemented = ((typeof document.implementation != 'undefined') && (typeof document.implementation.hasFeature != 'undefined'));
if (this.implemented){
	if (document.implementation.hasFeature("HTML","1.0") ||
	 document.implementation.hasFeature("XML","1.0")) this.implemented = 1;
	if (document.implementation.hasFeature("Core","2.0")) this.implemented = 2; 
	if (document.implementation.hasFeature("Core","3.0")) this.implemented = 3;
	} else this.implemented = 0;
this.html=this.xml=0;
this.range=this.traversal=this.views=this.stylesheets=this.css=this.css2=0; 
this.events=this.uievents=this.mouseevents=this.mutationevents=this.htmlevents=0;
this.ls=this.lsasync=this.validation=0;
if (this.implemented == 1){
	if (document.implementation.hasFeature("HTML","1.0")) this.html = 1 ;
	if (document.implementation.hasFeature("XML","1.0")) this.xml = 1 ;
	}	
else if (this.implemented >= 2){
	if (document.implementation.hasFeature("HTML","2.0")) this.html = 2;
	else if (document.implementation.hasFeature("HTML","1.0")) this.html = 1;
	if (document.implementation.hasFeature("XML","2.0")) this.xml = 2;
	else if (document.implementation.hasFeature("XML","1.0")) this.xml = 1;
	if (document.implementation.hasFeature("Range","2.0")) this.range = 2;
	if (document.implementation.hasFeature("Traversal","2.0")) this.traversal = 2;
	if (document.implementation.hasFeature("Views","2.0")) this.views = 2;
	if (this.views){
		if (document.implementation.hasFeature("CSS","2.0")) this.css = 2;
		if (this.css){
			if (document.implementation.hasFeature("CSS2","2.0")) this.css2 = 2;
			}
		}
	if (document.implementation.hasFeature("StyleSheets","2.0")) this.stylesheets = 2;
	if (document.implementation.hasFeature("Events","2.0")) this.events = 2;
	if (this.events){
		if (this.views){
			if (document.implementation.hasFeature("UIEvents","2.0")) this.uievents = 2;
			if (this.uievents){
				if (document.implementation.hasFeature("MouseEvents","2.0")) this.mouseevents = 2;
				}
			}
		if (document.implementation.hasFeature("MutationEvents","2.0")) this.mutationevents = 2;
		if (document.implementation.hasFeature("HTMLEvents","2.0")) this.htmlevents = 2;
		}
//some DOM 3 features defined here
	if (document.implementation.hasFeature("LS","3.0")) this.ls = 3;
	if (this.ls){
		if (document.implementation.hasFeature("LS-Async","3.0")) this.lsasync = 3;
		}
	}	
if (this.implemented == 3){
	if (document.implementation.hasFeature("XML","3.0")) this.xml = 3;
	if (document.implementation.hasFeature("Validation","3.0")) this.validation = 3;
	}	

} //Dom ends

//NOTE: the Envir function should be safe on js language versions 1.2+
function Envir(gen,vers)
{
//code version compliance check
if (vers.indexOf('v3.1')==-1) alert("The Script files uasniff.js/uaexami.js and uaenvir.js mismatch.\n"+
   "\(This was a Quality Assurance alert.\)");
   
//completing the javascript client-side check
  if (navigator.js == 1.3 && navigator.examined.ecma3) var num = 1;
	 if (num == 0){
	   function NoFunc() {
	   }} else if (num == 1){
	   function RealFunc() {
	   }};
	if (typeof(RealFunc) =='function'  && typeof(NoFunc) !='function') navigator.js = 1.5;

// CHECKING OS
  var platform = navigator.platform.toLowerCase();
    if (platform.indexOf('win') != -1)
      this.OS = 'win';
    else if (platform.indexOf('mac') != -1)
      this.OS = 'mac';
    else if (platform.indexOf('x11') != -1 || platform.indexOf('unix') != -1 || platform.indexOf('linux') != -1 || platform.indexOf('sun') != -1)
      this.OS = 'nix';
/* future changes!
  var uA = navigator.userAgent, i = 0;
  this.OS = new Array() ;
    if (platform.indexOf('win') != -1)
      {this.OS[0] = 'win'; i = uA.indexOf('Windows NT ');
      if (i > -1) this.OS=this.OS.concat('nt',parseFloat('0' + uA.substring(i+11)));
      else if (uA.indexOf('Win 9x 4.90') > -1
	|| uA.indexOf('Windows ME') > -1) this.OS=this.OS.concat('nt',4.90);
      else if (uA.indexOf('Windows 2000') > -1) this.OS=this.OS.concat('nt',5.0);
      else if (uA.indexOf('Windows XP') > -1) this.OS=this.OS.concat('nt',5.1);
      else if (uA.indexOf('WinNT') > -1
	|| uA.indexOf('Windows NT') > -1
	|| uA.indexOf('WinNT4.0') > -1) this.OS=this.OS.concat('nt',4.0);
      }
    else if (platform.indexOf('mac') != -1)
      this.OS[0] = 'mac';
    else if (platform.indexOf('x11') != -1 || platform.indexOf('unix') != -1 || platform.indexOf('linux') != -1 || platform.indexOf('sun') != -1)
      this.OS[0] = 'nix'; */
    else this.OS = '';

// checking Java 
//This check is MS java friendly. Strict Java (i.e. from Sun) will be reported as envir.extra.java if available.
  this.java = (navigator.javaEnabled())

// calling the Extra function for strict Java and JavaScript MIME types and plug-ins check
//Popular plug-ins list - suitable for EDITING ***
	var a0 = "application/x-shockwave-flash"
/* Returns boolean values for property names on the basis of the MIME type, for example: 
 * if MIME type is available, then true for envir.extra.application_x_shockwave_flash
 * if also plugin is available, then true for plugin_x_shockwave_flash
 */
	var a1 = "application/futuresplash"
	var a2 = "application/x-director" 
	var a3 = "application/pdf" 
	var a4 = "video/quicktime" 
	var a5 = "image/x-quicktime"
	var a6 = "application/x-mtx" 
	var a7 = "audio/x-pn-realaudio-plugin" 
	var a8 = "application/asx" 
	var a9 = "video/x-ms-asf-plugin"
	var aA = "application/x-mplayer2"
	var aB = "application/x-java-applet"
	var aC = "application/x-java-bean"
	var aD = "ADD_ANY_MIME/TYPE-HERE"
	var aE = "ADD_ANY_MIME/TYPE-HERE"
	var aF = "ADD_ANY_MIME/TYPE-HERE"

//Add or subtract arguments (mime types) from the list above to the array below
this.extra = new Extra(a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,aA,aB,aC);


  //environment consists of the implied applications to work in tandem with HTML4 **** DEPRECATED - DO NOT USE!
  this.modern = (navigator.examined.ecma && this.java && navigator.examined.w3cdom);

  //e-shop reliable **** DEPRECATED - DO NOT USE! 
  if (typeof(navigator.cookieEnabled) =='undefined') navigator.cookieEnabled = false; 
  this.ebusiness = (this.modern && navigator.cookieEnabled);

// checking implementations of the W3C DOM
if (gen>=5) this.dom = new Dom()
	 else {this.dom = new Object(); this.dom.implemented = false;
	 }

// CSS COMPLIANCE - DO NOT EDIT THIS PART ****
/* Cascading Style Sheets are implemented gradually in browsers and therefore two approximate
 * implementation series are used for level 1 and 2 respectively:
 * 0.3 , 0.6 , 0.8 and 1.0 is for CSS1
 * 0.5 , 1.0 , 1.2 , 1.4 , 1.6 , 1.8 , 1.9 , 2.0 and 2.1 for CSS2
 * A selection of well-known browsers are used as targets for consideration of CSS compatibility. 
 * The values for these are preset to a certain degree. For other browsers we rely on checkings
 * of the style object. Browser support info and nice testings respectively found at
 * <http://www.westciv.com/style_master/academy/browser_support/index.html> 
 * <http://devedge.netscape.com/toolbox/tools/2001/feature-detection/>
 */

this.CSS2 = this.CSS1 = 0;

  //presetting the target compatibility (allowing spoofing of appName and appVersion)
if (navigator.kin == 'Netscape/5') {this.CSS2 = 1.8; this.CSS1 = 1}
else if (navigator.kin.indexOf('Opera') == 0){ this.CSS1 = 1;
	if (parseInt(navigator.kin.charAt(6)) >= 5) this.CSS2 = 1.6;
	else this.CSS2 = 1.2; }
else if (navigator.kin == 'MSIE/4' && this.OS == 'mac') {
	if (navigator.version >= 5) {this.CSS2 = 1.4; this.CSS1 = 1}
	else {this.CSS2 = 1; this.CSS1 = 0.6}
	}
else if (navigator.kin == 'MSIE/4' && this.OS == 'win') {
	if (navigator.version >= 5.5) {this.CSS2 = 1.6; this.CSS1 = 1}
	else if (navigator.version >= 5){this.CSS2 = 1.2; this.CSS1 = 0.8}
	else {this.CSS2 = 1; this.CSS1 = 0.6}
	}
else if (navigator.kin == 'Netscape/4') {this.CSS2 = 0.5; this.CSS1 = 0.3};  

  //Checking the style object

  if (document.body && document.body.style){
  	if (this.CSS2 < 0.5 || this.CSS1 < 0.3)
  		{
		if (typeof document.body.style.background !='undefined' &&
		typeof document.body.style.color !='undefined') { this.CSS2 = 0.5; this.CSS1 = 0.3}
		}
	if (this.CSS2 < 1 || this.CSS1 < 0.6)
		{ //buggy with NC4
		if (typeof document.body.style.backgroundColor !='undefined' &&
		typeof document.body.style.backgroundImage !='undefined' &&
		typeof document.body.style.width !='undefined') {this.CSS1+= 0.3;
			if (typeof document.body.style.visibility !='undefined') this.CSS2+= 0.5}
		}
	if (this.CSS2 < 1.2 || this.CSS1 < 0.8)
		{ //buggy with NC4 and IE4
		if (typeof document.body.style.clear !='undefined') {if (this.CSS1 < 0.8) this.CSS1+= 0.2;
			if (typeof document.body.style.zIndex !='undefined') this.CSS2+= 0.2}
		}
	if (this.CSS2 < 1.4 || this.CSS1 < 1)
		{ //supported by IE5.5/Win, IE5/Mac, Netscape/5, Opera5
		if (typeof document.body.style.cssFloat !='undefined' ||
		typeof document.body.style.styleFloat !='undefined') {if (this.CSS1 < 1) this.CSS1+= 0.2;
			if (typeof document.body.style.clip !='undefined') this.CSS2+= 0.2}
		}
	if (navigator.examined.domelementstyle && typeof document.body.style.display !='undefined'){
      		if (this.CSS2 < 1.6)
      			{ 
      			if (typeof document.body.style.position !='undefined'){
      			var elementPos = document.createElement('div');
      			elementPos.style.position = 'absolute';
      			 if (elementPos.style.position == 'absolute'
      			 && typeof elementPos.style.left !='undefined'
      			 && typeof elementPos.style.top !='undefined') this.CSS2+= 0.2}
      			}
      		if (this.CSS2 < 1.8)
      			{ 
      			if (typeof document.body.style.maxWidth !='undefined'
      			 && typeof document.body.style.minHeight !='undefined') this.CSS2+= 0.2
      			}
      		if (this.CSS2 > 1.7)
      			{ //checking tables, NOTE: style.display chokes on IE
      			var elementTbl = document.createElement('table');
      			elementTbl.style.display = 'table';
      			if (elementTbl.style.display == 'table'
      			 && typeof elementTbl.style.tableLayout !='undefined'
      			 && typeof elementTbl.style.borderSpacing !='undefined'
      			 && typeof elementTbl.style.captionSide !='undefined') this.CSS2+= 0.1
      			}
      		if (this.CSS2 > 1.8)
      			{ //checking a rare value, NOTE: style.display chokes on IE
      			var elementHdr = document.createElement('h1');
      			elementHdr.style.display = 'run-in';
      			if (elementHdr.style.display == 'run-in') this.CSS2+= 0.1
      			}
      		if (this.CSS2 > 1.9 && typeof document.body.style.cursor !='undefined')
      			{ //checking CSS 2.1 support
      			var element1 = document.createElement('p');
      			element1.style.display = 'inline-block';
      			var element2 = document.createElement('div');
      			element2.style.cursor = 'progress';
      			 if(element1.style.display == "inline-block" && 
      			 element2.style.cursor == "progress") this.CSS2+= 0.1 
      			}
      		}
      	}

this.CSS1 = (Math.round(this.CSS1*10)/10);
this.CSS2 = (Math.round(this.CSS2*10)/10);

// LANGUAGE - DO NOT EDIT THIS PART ****
//language-COUNTRY code 
  if (navigator.language){
       this.dialect=navigator.language }
  else if (navigator.userLanguage){
       this.dialect=navigator.userLanguage }
  else if (navigator.browserLanguage) {
       this.dialect=navigator.browserLanguage } else this.dialect = ''; 
  //e.g. British English will be "en-GB" or most often only English "en"
//language code 
  this.language = ''; if (this.dialect.length >=2) this.language =this.dialect.charAt(0)+this.dialect.charAt(1);
this.language = this.language.toLowerCase();

// TIMEZONE 
  var today = new Date();
  this.timezone = today.getTimezoneOffset()/-60; //relative to Greenwich Mean Time
  //Old world timezones (from Cape Verde to Japan and Australia) ***DEPRECATED
  this.oldworld = (this.timezone > -2 && this.timezone <= 10);
  //New World timezones incl. the Pacific and Far Eastern parts of Russia ***DEPRECATED
  this.newworld = !this.oldworld;

var d1 = new Date(2006, 0, 1);
var d2 = new Date(2006, 6, 1);
var bSupportsDaylightSavingTime = d1.getTimezoneOffset() != d2.getTimezoneOffset();
if (bSupportsDaylightSavingTime){ //DST taken into account
	if ((today.getTimezoneOffset() < d1.getTimezoneOffset()) || (today.getTimezoneOffset() < d2.getTimezoneOffset()))
	{this.timezone = this.timezone-1}; 
	}

// SCREEN 
//checking number of colours - DO NOT EDIT THIS PART ****
  if ((screen.colorDepth >= 32) || (screen.pixelDepth >= 32)) this.screencolor = 4;
  else if ((screen.colorDepth >= 24) || (screen.pixelDepth >= 24)) this.screencolor = 3;
  else if ((screen.colorDepth >= 16) || (screen.pixelDepth >= 16)) this.screencolor = 2;
  else if ((screen.colorDepth >= 8) || (screen.pixelDepth >= 8)) this.screencolor = 1;
  else this.screencolor = 0;
  
//checking screen resolution - DO NOT EDIT THIS PART ****
  if ((screen.width >= 1600 || screen.availWidth >= 1596) &&
  (screen.height >= 1200 || screen.availHeight >= 1168)) this.screensize = 6;
  else if ((screen.width >= 1280 || screen.availWidth >= 1276) &&
  (screen.height >= 1024 || screen.availHeight >= 992)) this.screensize = 5;
  else if ((screen.width >= 1152 || screen.availWidth >= 1148) &&
  (screen.height >= 864 || screen.availHeight >= 832)) this.screensize = 4;
  else if ((screen.width >= 1024 || screen.availWidth >= 1020) &&
  (screen.height >= 768 || screen.availHeight >= 736)) this.screensize = 3;
  else if ((screen.width >= 800 || screen.availWidth >= 796) &&
  (screen.height >= 600 || screen.availHeight >= 568)) this.screensize = 2;
  else if ((screen.width >= 640 || screen.availWidth >= 636) &&
  (screen.height >= 480 || screen.availHeight >= 448)) this.screensize = 1;
  else this.screensize = 0;
  
//screen qualities - EDITING OK ****
  //environment is a 640x480 pixels screen or smaller -
  this.small = (this.screensize <= 1);
  //environment is 800x600 pixels and up -
  this.space = (this.screensize >= 2 && this.screencolor >= 1);
  //environment is 1024x768 pixels and up -
  this.muchspace = (this.screensize >= 3 && this.screencolor >= 2);
    
/* HTML RENDERING MODES
 * Recent browsers are able to trigger a *standards* mode if dealing with HTML4.01 and referring
 * to the W3C DTD URI. Those browsers are attached with the "envir.standards" property. In order
 * not to exclude competent browsers, which use odd ways of identifying themselves, the decision
 * on this property should be lax, and therefore it's spoofable to some extent. The non-spoofable 
 * equivalent property is "envir.strict", which applies to HTML4.01 Strict and CSS level 2 
 * reasonably compliant applications.
 */  

  //the 20th Century DHTML browsers come here -
  //including Netscape Communicator -
  this.dhtml = (gen >= 4);   
  //excluding Netscape Communicator -
  this.common = (this.dhtml && this.CSS1 == 1);   

  //the 21st Century DOM browsers come here -
  //compliant with W3C Frameset and Transitional HTML4.01 and DTD URI reference -
  //NOTE: Spoofing is possible in /standards/ but not in /strict/ -
  this.standards = (gen >= 5);

  //compliant with W3C Strict HTML4.01 (i.e. HTML, which is not backwards compatible) -
  this.strict = ((typeof document.compatMode != 'undefined') && navigator.examined.w3cdom && this.CSS2 >= 1.8);

//(C) PeEmm 2001-2006 <larspeemm@netscape.net> This is author info. Please do not remove.
//Envir ends.
}
var envir;

