/* *** BROWSER DETECTION*** */
function lib_bw(){ 
  this.ver=navigator.appVersion.toLowerCase();
  this.agt=navigator.userAgent.toLowerCase();
  this.maj=parseInt(this.ver);
  this.mac=this.agt.indexOf("mac")>-1?1:0;
  this.pc=(this.agt.indexOf("win")>-1||this.agt.indexOf("16bit")>-1)?1:0;
  this.op=this.agt.indexOf("opera")>-1?1:0;
  this.op5=this.agt.indexOf("opera 5")>-1?1:0;
  this.op5up=(this.op && this.maj>=4)?1:0;
  this.ie=(this.ver.indexOf("msie")>-1 && !this.op)?1:0;
  this.ie6=(this.ver.indexOf("msie 6")>-1 && this.ie)?1:0;
  this.ie7=(this.ver.indexOf("msie 7")>-1 && this.ie)?1:0;
  this.ie8=(this.ver.indexOf("msie 8")>-1 && this.ie)?1:0;
  this.ie55=(this.ver.indexOf("msie 5.5")>-1 && this.ie)?1:0;
  this.ie5=(!this.ie55 && this.ver.indexOf("msie 5")>-1 && this.ie)?1:0; 
  this.ie45=(this.ver.indexOf("msie 4.5")>-1 && this.ie)?1:0;
  this.ie4=(!this.ie45 && this.ver.indexOf("msie 4")>-1 && this.ie)?1:0;
  this.ie4up=(this.ie && this.maj>3)?1:0;
  this.ie5up=(this.ie4up && !this.ie4 && !this.ie45)?1:0;
  this.ns=((this.agt.indexOf('mozilla')>-1) && (this.agt.indexOf('spoofer')==-1) && (this.agt.indexOf('compatible')==-1) && !this.op && (this.agt.indexOf('webtv')==-1))?1:0; 
  this.ns6=(this.ns && this.maj==5)?1:0; 
  this.ns4=(this.ns && this.maj==4)?1:0;
  this.ns4up=(this.ns && this.maj>3)?1:0;
  this.ns6up=(this.ns && this.maj>4)?1:0;
  this.dhtml=(this.ie4up||this.ns4up||this.op5up)?1:0;
  this.dom=document.getElementById?1:0;
  this.mozilla=(this.agt.indexOf("gecko")>-1 && this.ns && this.agt.indexOf("netscape")==-1)?1:0;
  this.safari=(this.agt.indexOf("safari")>-1)?1:0;
  if (this.mozilla != 1) (this.mozilla=this.agt.indexOf("macintosh")>-1)?1:0;
  
  return this
}
bw=new lib_bw();


/* ***STYLE SHEET CHOOSER*** */
var strStyleID="general";

if (bw.ns4&&bw.pc) strStyleID="ns4pc";
/*
else if (bw.ns4 && bw.mac) strStyleID="ns_mac";
else if (bw.ns6up) strStyleID="ns6";
else if (bw.ie4up && bw.pc) strStyleID="ie_pc";
else if (bw.ie45) strStyleID="ie45";
else if (bw.ie5up && bw.mac) strStyleID="ie_mac";
else if (bw.ns) strStyleID="ns_pc";
else if (bw.ie) strStyleID="ie_pc";
*/

function owSealed(url,nom,dimx,dimy)
		{
		var xEcran=640;		
		if (top.screen) {
			if(screen.width && screen.height){
				xEcran = screen.width ;
			};
		}			
		xPos=xEcran - dimx - 10;
		featur = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,screenX="+xPos+",left="+xPos+",screenY=0,top=0,width="+ dimx + ",height=" + dimy + "";
        zoom = window.open(url,nom,featur);
		}	
		
function owSecurite(url,nom,dimx,dimy)
		{
		url="../cgv/securite_et_confidentialite.html";
		nom="SecuriteConfidentialite";
		dimx=540;
		dimy=420;
		var xEcran=640;		
		if (top.screen) {
			if(screen.width && screen.height){
				xEcran = screen.width ;
			};
		}			
		xPos=xEcran - dimx - 10;
		featur = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,screenX="+xPos+",left="+xPos+",screenY=0,top=0,width="+ dimx + ",height=" + dimy + "";
        zoom = window.open(url,nom,featur);
		}	
		
function ow(url,nom,dimx,dimy)
		{
		var xEcran=701;		
		var yEcran=230;
		if (top.screen) {
			if(screen.width && screen.height){
				xEcran = screen.width ;
				yEcran = screen.height ;
			};
		}			
		xPos=(xEcran - dimx - 10)/2;
		yPos=(yEcran - dimy)/2;
		featur = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,screenX="+xPos+",left="+xPos+",screenY="+yPos+",top="+yPos+",width="+ dimx + ",height=" + dimy + "";
        zoomx = window.open(url,nom,featur);
		}

// SMR création d'un cookie
function EcrireCookie(nom, valeur)
{
	var argv=EcrireCookie.arguments;
	var argc=EcrireCookie.arguments.length;
	var expires=(argc > 2) ? argv[2] : null;
	var path=(argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	document.cookie=nom+"="+escape(valeur)+
	((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
	((path==null) ? "" : ("; path="+path))+
	((domain==null) ? "" : ("; domain="+domain))+
	((secure==true) ? "; secure" : "");
}


// SMR lecture d'un cookie
function getCookieVal(offset)
{
	var endstr=document.cookie.indexOf (";", offset);
	if (endstr==-1) endstr=document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr)); 
}
function LireCookie(nom)
{
	var arg=nom+"=";
	var alen=arg.length;
	var clen=document.cookie.length;
	var i=0;
	while (i<clen)
	{
		var j=i+alen;
		if (document.cookie.substring(i, j)==arg) return getCookieVal(j);
		i=document.cookie.indexOf(" ",i)+1;
		if (i==0) break;
	}
	return null; 
}

function hasAcrobatInstalled() 
{
   
	var acrobatVersion = 0;
	var hasAdobeAcrobat = false;
	if (navigator.plugins && navigator.plugins.length)
	{
		for (i=0; i < navigator.plugins.length; i++ ) 
		{
			var plugin = navigator.plugins[i];
			if (plugin.name.indexOf("Adobe Acrobat") > -1)
			{
				acrobatVersion = parseFloat(plugin.description.substring(30));
				if (acrobatVersion>0) hasAdobeAcrobat=true;
			}
		}
	}
	else 
	{
		if (navigator.mimeTypes && navigator.mimeTypes.length)
		{
			x = navigator.mimeTypes["application/pdf"];
			y = navigator.mimeTypes["application/vnd.fdf"];
			if ((x && x.enabledPlugin) || (y && y.enabledPlugin))
			{
				hasAdobeAcrobat = true;
			}
		}
	}
	return hasAdobeAcrobat;
}
		
function hasWordInstalled() 
{
	var hasWord = false;
	if (navigator.mimeTypes && navigator.mimeTypes.length)
	{
		x = navigator.mimeTypes["application/x-msoffice"];
		if (x && x.enabledPlugin)
		{
			hasWord = true;
		}
	}
	return hasWord;
}
//fin lecture
