//___________start of the second separate js-file (if any)___version 1.9.9________________________
/* ****	This is the Browser and Environment Sniffer Client-Side Relocation Script 
   ****	for Personal and Small Business Sites. 	This is part two of the script. 
   **** It should only be used in conjunction with another scriptfile located at
   ****	<http://web.comhem.se/peemm/public/uasupport.js>.
   ****	It is FREE for use. Please, do not remove author info.

 Originally made by PeEmm <larspeemm@netscape.net> 2001-07-21  
 revision 2005-11-02 (1.9.9): loosening /envir.deluxe/ condition back to earlier definition 
 revision 2005-05-18 (1.9.8): ameliorating the conditions for envir.standards and envir.strict 
 revision 2004-10-25 (1.9.7): ameliorating the condition for envir.ebusiness, making the 
 		timezone control ECMA dependent
 revision 2004-03-07 (1.9.6): adjusting for some property value changes
 revision 2003-12-30 (1.9.5): modifying conditions for envir.decimalcss,
		envir.allround, .dhtml, .modern, .xhtmlmod, .threshold, adding envir.common 
 revision 2003-12-13: adding envir.xhtmlmod and envir.threshold, changing envir.small,
 				debugging the UseDynamic function 
 revision 2003-11-28: adding the /fbURL/ argument to the UseStatic command 
 				in the UseDynamic function and reverting back to the
 				argument /exami.js>=1.2/ for calling /new Envir/
 revision 2003-11-01: changes to conditions for envir.strict
 revision 2003-07-05: changes to the UseDynamic function to cater for the version 2 HEAD code
 				

 This sniffer is an elaboration on the Practical Browser Sniffing Script and is making
 further checks of the browser environment - such as the computer screen's resolution
 and the language of the user agent or computer - in order to decide on the best suited
 hypertext markup, and to relocate the surfing visitor to an appropriate page or to bring
 an alert. The function Envir will make comparisons and an estimate of the environment
 and return none, one or several true's when fulfilling certain criteria. Then the
 webmaster may put up conditional statements to decide what will happen next.
 ** YOU ARE ENCOURAGED TO EDIT PARTS OF THE ENVIR AND EXTRA FUNCTIONS ****************** **** */

function Envir()
{
/* In the previous script file some properties of the navigator object were set. These will
 * be used in declaring the envir object properties in this file. Always refer to the following
 * properties as "envir.[property-name]", e.g. "envir.java", "envir.modern".
 * First, we'll decide on some environmental key features, and then we'll summon our findings
 * in some usable property mixes.
 */

// CHECKING JAVA (and related functionalities)
//This check is MS java friendly. Cp. /strictjava/ further below. 
  if (navigator.javaEnabled()) {this.java = true}
  else this.java = false;

  //environment consists of the implied applications to work in tandem with HTML4 -
  this.modern = (navigator.ECMA && this.java && navigator.DOMHTML);

  if (typeof(navigator.cookieEnabled) =='undefined') navigator.cookieEnabled = false; 
  this.ebusiness = (this.modern && navigator.cookieEnabled);

// CSS COMPLIANCE CHECK

/* Cascading Style Sheets are implemented gradually in browsers and therefore the series
 * 0.5 , 0.8 - meaning closing in on CSS1 - 1.1 , 1.4 , 1.6 , 1.8 and 2.0 - almost full 
 * CSS2 - and 2.1 is used. Support info and nice testings respectively at
 * <http://www.westciv.com/style_master/academy/browser_support/index.html> 
 * <http://devedge.netscape.com/toolbox/tools/2001/feature-detection/>
 */

this.decimalcss = 0

  //Some familiar browsers' CSS compatibility which need to be preset - EDITING OK ****
  if (navigator.product == 'Opera' && navigator.version >= 5) this.decimalcss = 1.6 ;
  
  else if (navigator.product == 'Opera' && navigator.version >= 3.6) this.decimalcss = 1.1 ;

  else if (navigator.product == 'Trident') this.decimalcss = 0.8 ;
  
  else if (navigator.product == 'Netscape') this.decimalcss = 0.5 ;

  //Checking the style object - DO NOT EDIT THIS PART ****
  if (document.body)
	{
	if (document.body.style && this.decimalcss < 0.8)
  		{
		if (typeof(document.body.style.background)!='undefined' &&
		typeof(document.body.style.backgroundColor)!='undefined' &&
		typeof(document.body.style.backgroundImage)!='undefined' &&
		typeof(document.body.style.color)!='undefined' &&
		typeof(document.body.style.height)!='undefined') this.decimalcss = 0.8
		}
	if (document.body.style && this.decimalcss < 1.1)
		{
		if (typeof(document.body.style.visibility)!='undefined' &&
		typeof(document.body.style.width)!='undefined' &&
		typeof(document.body.style.zIndex)!='undefined' &&
		typeof(document.body.style.clear)!='undefined') this.decimalcss+= 0.3
		}
	if (document.body.style && this.decimalcss < 1.4)
		{
		if (typeof(document.body.style.left)!='undefined' &&
		typeof(document.body.style.top)!='undefined' &&
		(typeof(document.body.style.cssFloat)!='undefined' ||
		typeof(document.body.style.styleFloat)!='undefined')) this.decimalcss+= 0.3
		}
	if (document.body.style && this.decimalcss < 1.6)
		{
		if (typeof(document.body.style.minHeight)!='undefined') this.decimalcss+= 0.2
		}
	if (document.body.style && this.decimalcss < 1.8)
		{
		if (typeof(document.body.style.borderSpacing)!='undefined' &&
		typeof(document.body.style.clip)!='undefined' &&
		typeof(document.body.style.captionSide)!='undefined' &&
		typeof(document.body.style.maxWidth)!='undefined') this.decimalcss+= 0.2
		}
	if (document.body.style && this.decimalcss < 2.0)
		{
		if (typeof(document.body.style.tableLayout)!='undefined' &&
		typeof(document.body.style.position)!='undefined' &&
		typeof(document.body.style.display)!='undefined' &&
		typeof(document.body.style.cursor)!='undefined') this.decimalcss+= 0.2
		}
	if (this.decimalcss > 1.8 && typeof(document.createElement) != '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.decimalcss+= 0.1 
		}
	}

// CSS COMPLIANCE (rounding off) - DO NOT EDIT THIS PART ****
this.CSS = (Math.round(this.decimalcss) >= 1);
this.CSS1 = (Math.floor(this.decimalcss) >= 1);
this.CSS2 = (Math.floor(this.decimalcss) == 2);

// LANGUAGE 
  var laNg;
  this.language = ''
  this.dialect = ''
  if (navigator.language)
  {  laNg=navigator.language;
  }  else if (navigator.userLanguage)
  {  laNg=navigator.userLanguage;
  }  else laNg=''
  this.dialect = laNg; 
  //e.g. British English will be "en-GB" or most often only English "en"

//EDIT THIS: pages for alternative languages **** 
//Fill up the array and change /.language2/ according to the needs of your site!

//Note that the number ("13") must correspond to the number of languages.
 var getlang=new Array('en','es','fr','de','ar','ru','pt','ja','sv','da','no','fi','nl')
   for (var j=0;j<13;j++){
	var x=getlang[j];
	if (laNg.indexOf(x,0) > -1){this.language = x; break }
	}

//languages spoken in Scandinavia - EDITING OK ****
  this.language2 = (this.language == 'sv' || this.language == 'da' || 
	this.language == 'no' || this.language == 'fi');

// TIMEZONE
if (navigator.ECMA){
  var today = new Date();
  var month = today.getMonth();
  this.timezone = today.getTimezoneOffset()/-60 ;
  //relative to Greenwich Mean Time

  //West European timezones  (incl. West Africa), and daylight saving time taken into account -
  if (month >= 3 && month < 10)  {this.occident = (this.timezone >= 0 && this.timezone < 3);}
  else {this.occident = (this.timezone >= 0 && this.timezone < 2);}
  //New World timezones incl. the Pacific and East-Central parts of Australia -
  this.newworld = (this.timezone >= 10 || this.timezone < 0);
  //Old world timezones (from Iceland to Japan) -
  this.oldworld = (this.timezone >= 0 && this.timezone < 10);
} else {this.timezone=null; this.occident=false; this.newworld=false; this.oldworld=false; }

// 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
 * Modern browsers are able to trigger a *standards* mode if dealing with HTML4.01Frameset or
 * HTML4.01Transitional _and_ referring to the W3C DTD URI. These browsers are attached with
 * the "envir.standards" and "envir.strict" properties - the first spoofable and somewhat relaxed, 
 * the second not. To _really_ comply, the user agent should furthermore correctly apply less known 
 * elements, like 'hidden' client-side image maps. Current browsers capable of it, seem also to 
 * have incorporated W3C DOM Events, why its implementation is used here as a "fake" condition.
 * Since HTML4 Strict mode depends heavily on style sheets, compliance with CSS2 is an important prerequisite.  
 */  
  //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 = (navigator.DOMHTML && (navigator.DOMEVENTS || navigator.kin == "Netscape/5" 
  	|| (navigator.kin == "Microsoft Internet Explorer/4" && ((navigator.version >= 5 && navigator.OS == "mac") 
	|| (navigator.version >= 6 && navigator.OS == "win")))));

  //compliant with W3C Strict HTML4.01 (i.e. HTML, which is not backwards compatible) -
  this.strict = (navigator.DOMHTML && this.CSS2 && (typeof document.compatMode != 'undefined'));
  //compliant with W3C XHTML1.1 (i.e. the XHTML modules for the screen) -
  this.xhtmlmod = (navigator.DOMHTML2 && this.strict);

  //excluding screens smaller than 800x600 pixels -
  this.threshold = (this.standards && this.space);
  //suitable for portals on rich colour screens at least 1024x768 pixels -
  this.deluxe = (this.muchspace && this.decimalcss >= 1.5);
  
  //the 20th Century DHTML browsers come here -
  //including Netscape Communicator -
  this.dhtml = ((navigator.NS4 || navigator.MSIE || navigator.DOMHTML) 
  	&& (typeof(window.frames) != "undefined"));   
  //excluding Netscape Communicator -
  this.common = (this.dhtml && this.CSS1);   
  //even excluding screens smaller than 800x600 pixels -
  this.allround = (this.common && this.space);   

  //common environments
     	//environment is an Internet Explorer, but excluding the small screens -
  this.explorer = (navigator.MSIE && this.space);
  	//environment is a Netscape Communicator, but excluding the small screens -
  this.communicator = (navigator.NS4 && this.space);
  
// **** extra conditions begin - DO NOT EDIT THIS PART EXCEPT FOR SETTING false ****
this.strictjava = false

//setting _default_ to false, might be working anyway (you must check by use of another routine)
this.flashpage = false
this.pdfpage = false
this.quickpage = false

//IF EDITING: Put additional declarations here to make them false.

if (extra){

//Now, create the extra properties, using declarations in the Extra function below, for example 
this.flashpage = (extra.flashplugin); 
	//ua has Flash plugin installed
this.pdfpage = (extra.acrobatplugin); 
	//ua has Adobe Acrobat plugin installed
this.quickpage = (extra.quickplugin); 
	//ua has Quicktime plugin installed

this.strictjava = (extra.java); 
	//ua has Sun java or equivalent enabled

//IF EDITING: Put any additional declarations here and also remember to make them false above.

}
//extra conditions end. ***
//(C) PeEmm 2001-2005 <larspeemm@netscape.net> This is author info. Please do not remove.
}
//Envir ends.

function Extra() {
//This is for JS 1.3+ browsers only. The script interpretor will read this function
//before it reads the Envir function. In the primary document you should only
//refer to conditions made in Envir, for example "envir.pdfpage" which was declared above. 

// Plug-ins - EDIT THIS: additional declarations ****

/* Here you may declare conditions about MIME types and enabled plug-ins.
 * This function is hidden for Internet Explorer (which uses another system), so
 * there is really a select group, that will watch the part of the site dependent
 * on conditions made here. 
 */

  var mimetype;
  var plugin;

  //checking plug-in for Flash
  this.flashtype = true;
  this.flashplugin = false;
  var mimetype = navigator.mimeTypes["application/x-shockwave-flash"];
  if (mimetype)
  {
     var plugin = mimetype.enabledPlugin;
     if (plugin) {this.flashplugin  = true;}  
  }
  else this.flashtype = false;
  
  //checking plug-in for Adobe Acrobat
  this.acrobattype = true;
  this.acrobatplugin = false;
  var mimetype = navigator.mimeTypes["application/pdf"];
  if (mimetype)
  {
     var plugin = mimetype.enabledPlugin;
     if (plugin) {this.acrobatplugin  = true;}  
  }
  else this.acrobattype = false;
  
  //checking plug-in for QuickTime
  this.quicktype = true;
  this.quickplugin = false;
  var mimetype = navigator.mimeTypes["video/quicktime"];
  if (mimetype)
  {
     var plugin = mimetype.enabledPlugin;
     if (plugin) {this.quickplugin  = true;}  
  }
  else this.quicktype = false;

// **** Java
/* Well, we already declared envir.java above, but here is a
 * stricter 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 ua's, that returns the type as "function".
 */ 

  this.java = (navigator.javaEnabled())

//EDITABLE SECTION ENDS ********************************************************************** *
}
//Extra ends.
var extra; var envir;
function UseDynamic()
{
 exami = new Exami();
 if (exami.foe) return;
 else if(typeof(Relocate) != 'undefined' && exami.js >= 1.3) {  extra = new Extra(); envir = new Envir(); Relocate();}
 else if(typeof(Relocate) != 'undefined' && exami.js >= 1.2) {envir = new Envir(); Relocate(); }
 else if(typeof(Dir0) != 'undefined'){CheckStatic();}
 else if(typeof(fbURL) != 'undefined'){UseStatic(fbURL);}
 else UseStatic();     
}
/* *** End of declarations (C) PM <larspeemm@netscape.net>
   FREE TO USE AND PROMOTE. ***
   Visit http://web.comhem.se/peemm for killing time only. */
//___________end of the second separate js-file (if any)_______________________________________

