// cookies - rajout du 2/11
// Set up cookies for backtracking
  var now = new Date();
  now.setTime(now.getTime() + 90 * 24 * 60 * 60 * 1000);  // CAD d'ici trois mois
  var cameto = getCookie("cameto");
  var camefrom = getCookie("camefrom");
  //var firstcame = getCookie("firstcame");
  //var firstref = getCookie("firstref");
  if (!cameto) {    // CAD on sort ici si cookies déjà posés pour cette session
    camefrom = ((!document.referrer)||(document.referrer=="")) ? "none" : document.referrer ;
    cameto = location.href;
    setCookie("camefrom", camefrom, null, "/",".bull.com") ;
    setCookie("cameto",   cameto,   null, "/",".bull.com") ;
    //if (!firstcame) {  // Les cookies rémanents mémorisent la première visite
    //  setCookie("firstcame", cameto, now, "/",".bull.com");
    //} else {  // Extend for 3 months
    //  setCookie("firstcame", firstcame, now, "/",".bull.com") ;
    //}
    //if (!firstref) {
    //  setCookie("firstref", camefrom, now, "/",".bull.com");
    //} else {  // Extend for 3 months
    //  setCookie("firstref", firstref, now, "/",".bull.com") ;
    //}
  }


function setCookie(name, value, expires, path, domain, secure){
  var curCookie=name + "=" + escape(value) +
  ((expires) ? "; expires=" + expires.toGMTString() : "") +
  ((path)    ? "; path="    + path : "")                  +
  ((domain)  ? "; domain="  + domain : "")                +
  ((secure)  ? "; secure" : "");
  document.cookie=curCookie;
}
function getCookie(name){
  var dc=document.cookie;
  var prefix=name + "=";
  var begin=dc.indexOf("; " + prefix);
  if (begin==-1){
    begin=dc.indexOf(prefix);
    if (begin !=0) return null;
  } else begin +=2;
  var end=document.cookie.indexOf(";", begin);
  if (end==-1) end=dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}
function deleteCookie(name, path, domain){
  if (getCookie(name)){
    document.cookie=name + "=" +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}


function NObjNavigateur(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	//alert(this.ver+'\n\n'+this.agent);
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.opera=this.agent.indexOf("Opera")>-1
	this.ie=(this.ver.indexOf("MSIE")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie7=(this.ver.indexOf("MSIE 7")>-1 && this.dom && !this.opera5)?1:0;
	this.ie8=(this.ver.indexOf("MSIE 8")>-1 && this.dom && !this.opera5)?1:0;
	this.mac=this.agent.indexOf("Mac")>-1
	this.ff=this.agent.indexOf("Firefox")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.ok=((this.ie && !this.ie5 && !this.ie4) || this.ff);
	return this
}
var navigateur=new NObjNavigateur()

function findLI(e) {
	var sOName = e.tagName;
	if (sOName=="LI") return e;
  	else if (sOName=='BODY') return null;
  	else return findLI(e.parentNode);
}

function fnReturnWindowSizes() {
	var scrollH = 0;	// scrollY
	var scrollW = 0;	// scrollX
	var windowH = 0;	// largeur de la fenêtre
	var windowW = 0;	// hauteur de la fenêtre
	// document.doctype n'est pas nul seulement si nous sommes sous FF et
	//qu'une doctype a été définie
	// document.documentElement.clientHeight ne vaut 0 que sous IE et sans doctype ou avec doctype HTML 4.0
	if (document.doctype == null || document.documentElement.clientHeight == 0) {
		// IE -OU- pas de doctype
		// window.innerWidth n'est définie que sous FF
		// les deux paires d'égalité suivantes sont vérifiées sous IE en absence 
		// de doctype
		if (window.innerWidth || (document.body.offsetHeight == document.documentElement.offsetHeight && document.body.offsetWidth == document.documentElement.offsetWidth)) {
			// (A)
			// Firefox ou IE sans doctype -OU- IE avec doctype HTML 4.0
			scrollH = document.body.scrollTop;
			scrollW = document.body.scrollLeft;
			windowH = document.body.clientHeight;
			windowW = document.body.clientWidth;
		}
		else {
			// (B)
			// IE avec doctype XHTML 1.0
			scrollH = document.documentElement.scrollTop;
			scrollW = document.documentElement.scrollLeft;
			windowH = document.documentElement.clientHeight;
			windowW = document.documentElement.clientWidth;
		}
	}
	else {
		// Firefox
		if (document.doctype.publicId.search(/xhtml/i) != -1) {
			// (C)
			// Firefox doctype XHTML 1.0
			scrollH = document.documentElement.scrollTop;
			scrollW = document.documentElement.scrollLeft;
		}
		else {
			// (D)
			// Firefox doctype HTML 4.0
			scrollH = document.body.scrollTop;
			scrollW = document.body.scrollLeft;
		}
	}
	// FireFox
	if (window.innerWidth && window.innerHeight) {
		// (E)
		windowH = window.innerHeight;
		windowW = window.innerWidth;
	}
	return Array(windowW,windowH,scrollW,scrollH);
}

function initSelecteur() {
	if (navigateur.ie6) {
		var oCollDiv = document.getElementsByTagName('DIV')
		if (oCollDiv) {
			for (i=0;i<oCollDiv.length;i++) {
				if (oCollDiv[i].id=='selecteurDHTML1') {
					MenuListCssForIE6(oCollDiv[i],"LI", "",0);
				}
			}
		}
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// FONCTION DE ROLLOVER DE LA SHAREBAR

function sharebar(imageid, imgurl){
var img = document.getElementById(imageid);
	if(img){
	img.src = imgurl;
	}
}

// FONCTION DE VERIFICATION DU FORMULAIRE CONTACT

function formCheck()
{
document.cv.URL.value=window.opener.document.URL;	

if (document.cv.nom.value == "")
{
alert("Merci de saisir votre nom");
document.cv.nom.focus();
return false;
};

if (document.cv.email.value == "")
{
alert("Merci de saisir votre email");
document.cv.email.focus();
return false;
};

if (document.cv.emailami.value == "")
{
alert("Merci de saisir l'adresse email de votre collègue");
document.cv.emailami.focus();
return false;
};

if (document.cv.nom.value != "") 
{
document.cv.from.value = document.cv.nom.value;
};

return true;
}

// FONCTION DE POPUP pour quand overlay ne marche pas 01/10/10

function popupsend(url)
{
largeur=600;
hauteur=450;
var left=(screen.width-largeur)/2;
var top=(screen.height-hauteur)/2;
nwin=window.open(url,"ami","top="+top+",left="+left+",width="+largeur+",height="+hauteur+",scrollbars=auto");
nwin.focus();}

