/* browser detection routine */
/*This script copyright 1997 Project Cool, Inc.
  It may be copied and used in your own websites so long as this notice remains
  intact. Created by Glenn Davis of Project Cool. 
  
  This code reads various properties of the navigator object to determine the
  make and model of the user client. The point is to determine if the browser
  supports 3rd and 4th generation capabilities such as dynamic html and style
  sheet support. If the browser meets the test criteria, it sets the variable
  "browser" to true so that other functions can test against it as in:
     if(browser) {...}.
  Also, the code sets flags for IE4, Netscape4 and Mac for testing in regard to 
  browser specific capabilities as in:
     if(ns4) {...}

  This has been hardly modified by David Affagard - Le Point Com
  This contains optimization for
  		Netscape 6 and 7.1,
  		Mozilla 1
  		Explorer 5, 6 and 7
  		on Windows, Macintosh 0S 9 / OS X, and Unix
   This initializes variables used in further scripts of LPClib
*/

// Find Internet Explorer version

ie4 = ((navigator.appName == "Microsoft Internet Explorer") && (navigator.appVersion.indexOf("MSIE 4.") != -1));       
ie5 = ((navigator.appName == "Microsoft Internet Explorer") && (navigator.appVersion.indexOf("MSIE 5.") != -1));
ie55 = ((navigator.appName == "Microsoft Internet Explorer") && (navigator.appVersion.indexOf("MSIE 5.5") != -1));
ie6 = ((navigator.appName == "Microsoft Internet Explorer") && (navigator.appVersion.indexOf("MSIE 6.") != -1));
ie7 = ((navigator.appName == "Microsoft Internet Explorer") && (navigator.appVersion.indexOf("MSIE 7.") != -1));

if (ie7) {
	ie4		= false ;
	ie5		= false ;
	ie55	= false ;
	ie6		= false;
} else if (ie6) {
	ie4		= false ;
	ie5		= false ;
	ie55	= false ;
} else if (ie55) {
	ie4		= false ;
	ie5		= false ;
} else if (ie5) {
	ie4		= false ;
}

// test Opera 6, MSIE 5. compatible
op6		= ((navigator.appName == "Opera") &&(navigator.userAgent.indexOf("Opera 6.") != -1));
if (op6) {
	ie5 = false;
}

// Find Netscape version
           
ns4		= ((navigator.appName == "Netscape") && (navigator.appVersion.indexOf("4.") != -1));
ns5		= (((navigator.appName == "Gecko") || (navigator.appName == "Netscape")) && (navigator.appVersion.indexOf("5.") != -1));
ns6		= ((navigator.appName == "Netscape") && (navigator.appVersion.indexOf("6.") != -1));
ns7		= (navigator.appName == "Netscape") && (navigator.userAgent.indexOf("Netscape/7.") != -1);

mo5		= (((navigator.appName == "Gecko") || (navigator.appName == "Netscape")) && (navigator.userAgent.indexOf("Mozilla/5.") != -1));


mac		= (navigator.appVersion.indexOf("Macintosh") != -1);
win		= (navigator.appVersion.indexOf("Windows") != -1);


if (ns5 || ns6 || ns7 || mo5) {
		layerVis0			= "hidden";
		layerVis1			= "visible";
		layerDisplay0		= "none";
		layerDisplay1		= "block";
		startLayerRef		= 'document.getElementById("';
		endLayerRef			= '")';
		styleSwitch			= '.style';
		startImageSwitch	= '.document.images["';
		endImageSwitch		= '"].src';		
		topSwitch			= '.top';
		leftSwitch			= '.left';
		topOffset			= 0;
		x					= "e.pageX";
		y					= "e.pageY";
		var navig			= "ns";
		windowWidth			= 'window.innerWidth';
		windowHeight		= 'window.innerHeight';
		nsMouse				= 1;
		ieMouse				= 0;
	} if (ns4) {
		layerVis0 			= "hide";
		layerVis1 			= "show";
		layerDisplay0		= "none";
		layerDisplay1		= "block";
		startLayerRef		= 'document.layers["';
		endLayerRef			= '"]';
		styleSwitch			= '';
		startImageSwitch	= '.document.images["';
		endImageSwitch		= '"].src';
		topSwitch			= '.top';
		leftSwitch			= '.left';
		topOffset			= 0;
		x					= "e.pageX";
		y					= "e.pageY";
		var navig			= "ns";
		windowWidth			= 'window.innerWidth';
		windowHeight		= 'window.innerHeight';
		nsMouse				= 0;
		ieMouse				= 0;
	}
		
if (ie5 || ie55 || ie6 || ie7 || op6) {
		layerVis0 			= "hidden";
		layerVis1			= "visible";
		layerDisplay0		= "none";
		layerDisplay1		= "block";
		startLayerRef		= 'document.getElementById("';		
		endLayerRef			= '")';
		styleSwitch			= '.style';
		startImageSwitch	= '.document.images["';
		endImageSwitch		= '"].src';
		topSwitch			= '.top';
		leftSwitch			= '.left';
		topOffset			= 0; 			// change topOffset when browse on ie5 Mac with layers positions (<div> in tables)
		x					= "event.x";
		y					= "event.y";
		var navig			= "ie";
		windowWidth			= 'document.body.clientWidth';
		windowHeight		= 'document.body.clientHeight';
		nsMouse				= 0;
		ieMouse				= 1;
	
	} else if (ie4) {
		layerVis0 			= "hidden";
		layerVis1 			= "visible";
		layerDisplay0		= "none";
		layerDisplay1		= "block";
		startLayerRef		= 'document.all.';
		endLayerRef			= '';
		styleSwitch			= ".style";
		startImageSwitch	= '.document.images["';
		endImageSwitch		= '"].src';
		topSwitch			= '.top';
		leftSwitch			= '.left';
		topOffset			= 0;
		x					= "event.x";
		y					= "event.y";
		var navig			= "ie";
		windowWidth			= 'document.body.clientWidth';
		windowHeight		= 'document.body.clientHeight';
		nsMouse				= 0;
		ieMouse				= 0;
	}



// xflag is true if browser is compatible with LPClib
xflag	= (((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 3 )) || ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 )));


function initBrowser()
{
	browser = (((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 3 )) || ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 )));
	
}

