
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function getPageOffsetLeft(el) {
	if(el!==null){var x = el.offsetLeft;

		if (el.offsetParent != null) x += getPageOffsetLeft(el.offsetParent);
	} else {var x =0;}
	return x;
}

function getPageOffsetTop(el) {
	if(el!==null){ var y = el.offsetTop;
		if (el.offsetParent != null) y += getPageOffsetTop(el.offsetParent);
	} else {var y =0;}
	return y;
}


function findObj(theObj, theDoc)

{
  var p, i, foundObj;

  

  if(!theDoc) theDoc = document;

  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)

  {

    theDoc = parent.frames[theObj.substring(p+1)].document;

    theObj = theObj.substring(0,p);

  }

  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];

  for (i=0; !foundObj && i < theDoc.forms.length; i++) 

    foundObj = theDoc.forms[i][theObj];

  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 

    foundObj = findObj(theObj,theDoc.layers[i].document);

  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);

  

//alert("findObj "+foundObj.id);
  return foundObj;

}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

// JavaScript Document
function initLogin(id) {
	var tmpObj=document.getElementById(id);
	tmpObj.onfocus=function () {
		if(this.value==id) this.value="";
	}
	tmpObj.onblur = function () {
		if(this.value=="") this.value=id;
	}
}

/*
window.onload = function() {
	initLogin("Login");
	initLogin("Password");
}*/

function trim(str) {
	return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}
function isBlank(str) {
	if( str == "" ) 
		return true ;
	return false ;
}

function isEmail(s){
	if (s.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]{2,4}$/) != -1)
		return true ;
	return false ;
}

function isDate(s) {
	if (s.search(/^([0]?[1-9]|[1|2][0-9]|[3][0|1])[.\/-]([0]?[1-9]|[1][0-2])[.\/-]([0-9]{4}|[0-9]{2})$/) != -1)
		return true ;
	return false ;
}
function IsNumeric(s){
	return !isNaN(s);
}
function isEmail1(s){
	var tempArr = s.split(';');
	for (i=0;i<tempArr.length;i++){
		if (!isEmail(tempArr[i]))
			return false;
	}	
	return true ;	
}

function formValidate()
{ 
	var frm=document.getElementById('frmReg');
	if (isBlank(trim(frm.email.value) )) {
		alert("Merci d'indiquer votre e-mail professionnel.");
		frm.email.focus();
		return false;
	} 
	else if (!isEmail(trim(frm.email.value) )) {
		alert("Merci d'indiquer un e-mail professionnel valide.");
		frm.email.focus();
		return false;
	} 
	if (isBlank(trim(frm.nome.value) )) {
		alert("Merci d'indiquer votre nom.");
		frm.nome.focus();
		return false;
	}
	else if (isBlank( trim(frm.prenom.value) )) {
		alert("Merci d'indiquer votre prenom.");
		frm.prenom.focus();
		return false;
	}
	return true;
}

//
function getElementsByBaseTagClass(base, tag, className) { 
    var classPat = new RegExp('\\b'+className+'\\b'); 
    var nodes = base.getElementsByTagName(tag); 
    var matching = []; 
    for (var i = 0; i < nodes.length; i++) { 
        if (classPat.test(nodes[i].className)) { 
            matching.push(nodes[i]); 
        } 
    } 
	return matching; 
}

//

function Browser() {

  var ua, s, i;

  this.isIE    = false;  // Internet Explorer
  this.isOP    = false;  // Opera
  this.isNS    = false;  // Netscape
  this.version = null;

  ua = navigator.userAgent;

  s = "Opera";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isOP = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as Netscape 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }

  s = "MSIE";
  if ((i = ua.indexOf(s))) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
}

var browser = new Browser();
var W3CDOM = (document.createElement && document.getElementsByTagName);
var mouseOvers = new Array();
var mouseOuts = new Array();
var video;


function init()
{
	if (!W3CDOM) return;
	/*var nav = document.getElementById('container');*/
	var inputImgs = document.getElementsByTagName('input');
	var imageImgs = document.getElementsByTagName('img');
	var images = new Array();
	for (var i=0; i<imageImgs.length; i++) {images.push(imageImgs[i]);}
	for (var i=0; i<inputImgs.length; i++) {images.push(inputImgs[i]);}
	//alert (images.length);
	for (var i=0; i<images.length; i++)
	{
		if (images[i].src.indexOf('.gif') != -1) // On cible seulement les lments input de type image avec une extension de type .gif
		{			
			// Get image name
			//alert ( (images[i].src.substring(images[i].src.lastIndexOf('/') + 1)).substring(0,(images[i].src.substring(images[i].src.lastIndexOf('/') + 1)).lastIndexOf('.')) );
			tmp=(images[i].src.substring(images[i].src.lastIndexOf('/') + 1)).substring(0,(images[i].src.substring(images[i].src.lastIndexOf('/') + 1)).lastIndexOf('.'));
			
			if ( tmp.indexOf('_') != -1) /* search all img have "_" */
			{
				if (tmp.substring(tmp.lastIndexOf('_')+1) == "n" )
					{
						//alert ( (images[i].src.substring(images[i].src.lastIndexOf('/') + 1)).substring(0,(images[i].src.substring(images[i].src.lastIndexOf('/') + 1)).lastIndexOf('.')) );
						images[i].onmouseover = mouseGoesOver;
						images[i].onmouseout = mouseGoesOut;
						mouseOuts[i] = new Image();
						mouseOuts[i].src = images[i].src;
						mouseOvers[i] = new Image();	
						
						/*	
						if (images[i].src.lastIndexOf('_') != -1) { mouseOvers[i].src = images[i].src.substring(0,images[i].src.lastIndexOf('_')) + "_over" + suffix;}
						else { mouseOvers[i].src = images[i].src.substring(0,images[i].src.lastIndexOf('.')) + "_over" + suffix;}
						*/
						var suffix = images[i].src.substring(images[i].src.lastIndexOf('.'));
						if (images[i].src.lastIndexOf('.') != -1) { mouseOvers[i].src = images[i].src.substring(0,images[i].src.lastIndexOf('_')) + "_o" + suffix;}
						images[i].number = i;
					}
			}
		}
		
	} 
	setBox();
	//end for  ImgAbsoluteAlignBottom
	if(!window.captureEvents) document.onmousemove = getMousePos;
	if (window.captureEvents) {
		window.captureEvents(Event.MOUSEMOVE)
		window.onmousemove = getMousePos //e should not be defined
	}
	if (!document.showFlash) document.showFlash = false;
	
} //end init

function setBox() {
	var MyImgDiv=findObj('ImgAbsoluteAlignBottom');
	variation=30;

	if(MyImgDiv == null){
		var MyImgDiv=findObj('ImgAbsoluteAlignBottom2');
		variation=35;
	}

	if(MyImgDiv !== null){
		var MyDivLine = findObj('ContentType1_div');
		botImg = parseInt(getPageOffsetTop(MyImgDiv))+parseInt(MyImgDiv.clientHeight);
		botDiv = parseInt(getPageOffsetTop(MyDivLine))+parseInt(MyDivLine.clientHeight);
		newtop = botDiv-botImg;
		//alert((getPageOffsetTop(MyImgDiv)+newtop+variation)+"px");
		MyImgDiv.style.top = (getPageOffsetTop(MyImgDiv)+newtop+variation)+"px";
	}
}

function initreset()
{
	if (!W3CDOM) return;
	var images = document.getElementsByTagName('img');
	for (var i=0; i<images.length; i++)
	{
		if (images[i].src.indexOf('.gif') != -1) // On cible seulement les lments input de type image avec une extension de type .gif
		{			
			tmp=(images[i].src.substring(images[i].src.lastIndexOf('/') + 1)).substring(0,(images[i].src.substring(images[i].src.lastIndexOf('/') + 1)).lastIndexOf('.'));
			
			if ( tmp.indexOf('_') != -1) /* search all img have "_" */
			{
				if (tmp.substring(tmp.lastIndexOf('_')+1) == "o" )
				{
					//alert ( (images[i].src.substring(images[i].src.lastIndexOf('/') + 1)).substring(0,(images[i].src.substring(images[i].src.lastIndexOf('/') + 1)).lastIndexOf('.')) );
					var suffix = images[i].src.substring(images[i].src.lastIndexOf('.'));
					var tmpimg= new Image();
						tmpimg.src=images[i].src.substring(0,images[i].src.lastIndexOf('_')) + "_n.gif";
					images[i].src=tmpimg.src;
				}
			}
		}
	} //end for
} //end initreset

var fsub=false;
var mobj;
var osrc="";
function mouseGoesOver(fsub, mEvent) {
	if (checkIt("msie") != 0) { // use in IE
		if (fsub==true) {
			mobj.src=osrc;
			fsub=false;
		} else {
			this.src = mouseOvers[this.number].src;
		}
		osrc=event.srcElement.src;
		mobj=event.srcElement;
	}
	else {	// use in firefox
		if (fsub==true) {
			mobj.src=osrc;
			fsub=false;
		} else if (fsub=='')  {
			osrc=mEvent.target.src;
			mobj=mEvent.target;
		} else {
			this.src = mouseOvers[this.number].src;
		}
	}
}

function mouseGoesOut() {this.src = mouseOuts[this.number].src;	}

//-->

<!--
var detect = navigator.userAgent.toLowerCase();
var OS,browser,total,thestring;
var version = 0;

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

// Slide Content
document.orgH;
document.maxH=0;
document.curobj;
document.flagSlideUp=false;
document.Objselected;
document.flaggetH=true;

function slidemenu(id,curfaq) {
	for (i=0; i<curfaq.length; i++){
		if (i != id) {
			curfaq[i].style.display = "none";
		}		
	}
	curfaq[id].style.display="block";
	curfaq[id].style.overflow="hidden";
	document.maxH=curfaq[id].offsetHeight; /*get the current Height of Div */
	document.curobj=curfaq[id];
	curfaq[id].style.height=0 + "px";	
	aniHeightDown(8,80);
	//alert(document.curobj.className+document.curobj.parentNode.className+document.curobj.parentNode.childNodes[0].className+document.curobj.parentNode.childNodes[1].className+document.curobj.parentNode.childNodes[2].className+document.curobj.parentNode.childNodes[3]);
}

function aniHeightDown (pxmove, waittime) {	/*Slide Div Down*/
	mobj=document.curobj;
	mobj.style.height = mobj.offsetHeight + pxmove + "px";
	if (mobj.offsetHeight>=document.maxH) {		
		//alert (document.maxH);
		//alert (mobj.offsetHeight);		
		mobj.style.height = document.maxH - 5 + "px";
		return;
	}
	setTimeout("aniHeightDown("+pxmove+","+waittime+")", waittime);
}

function aniHeightUp (pxmove, waittime) { /*Slide Div Up*/
	mobj=document.curobj;
	mobj.style.height = mobj.offsetHeight - pxmove + "px";	
	if (mobj.offsetHeight<pxmove) {
		mobj.style.height = 0 + "px";
		mobj.style.display="none";
		document.flagSlideUp=false;
		return;
	}
	setTimeout("aniHeightUp("+pxmove+","+waittime+")", waittime);
}

function highlight (id, curfaq) {
	for (i=0; i<curfaq.length; i++){
		if (i != id) {
			curfaq[i].className="linkarr";
		}
	}
	curfaq[id].className="linkhilight";
}

function showError(formobj,err_str,err_div,input) {
	var x = getPageOffsetLeft(input);
	var y = getPageOffsetTop(input);
	var objCon = MM_findObj(err_div+"Content");
	var divObj = MM_findObj(err_div);
	if (objCon != null) {
		objCon.innerHTML="<p>"+err_str+"</p>";
	}
	if (divObj != null) {
		divObj.style.left = (x+70)+"px";
		divObj.style.top = y+16+"px";
		divObj.style.visibility = "visible";
	}

	if (browser.isIE) {
		var iframeObj = MM_findObj(err_div+"Iframe");
		if (iframeObj != null && divObj!=null) {
			iframeObj.style.width = divObj.offsetWidth+"px";
			iframeObj.style.height = divObj.offsetHeight+"px";
			iframeObj.style.left = divObj.style.left;
			iframeObj.style.top = divObj.style.top;
			iframeObj.style.visibility = "visible";
		}
	}
	//resetFrmFeedBack(formobj);
	input.focus();
	input.className="errorField";
	return false;
}

function closeError(err_div) {
	var divObj=MM_findObj(err_div);
	if (divObj!=null) {
		divObj.style.visibility="hidden";
	}
}
function getPageOffsetLeft(el) {
  var x;
  // Return the x coordinate of an element relative to the page.
  x = el.offsetLeft;
  if (el.offsetParent != null)
    x += getPageOffsetLeft(el.offsetParent);
  return x;
}

function getPageOffsetTop(el) {
  var y;
  // Return the x coordinate of an element relative to the page.
  y = el.offsetTop;
  if (el.offsetParent != null)
    y += getPageOffsetTop(el.offsetParent);
  return y;
}

function hideFaq(curid,totalQuest,clickObj) {

if (document.flag) {
	tooglePlusRun1(document.getElementById("quest1"));
}

	for (i=0; i<=totalQuest;i++) {
		if (i!=curid) {
			var mObj=document.getElementById('DirBloc'+i);
			mObj.style.display="none";
			if(document.Objselected&&document.Objselected!=clickObj){
				if(document.Objselected.innerHTML.indexOf("+")==-1)
				togglePlus(document.Objselected);
			}
		}
	}
	document.Objselected=clickObj;
}

function togglePlus(obj) {
	var mstr= obj.innerHTML;
	var quest = mstr.substring(5,mstr.length);
	obj.innerHTML = (obj.innerHTML.indexOf("+") == -1) ? "( + )"+quest : "( - )"+quest;
}

function tabContent (id, curfaq) {
	for (i=0; i<curfaq.length; i++){
		if (i != id) {
			curfaq[i].style.display = "none";
		}
		curfaq[id].style.display="block";
	}
}
function tabContentHighLight (id, hili) {
	for (i=0; i<hili.length; i++){
		if (i != id) {
			hili[i].style.background = "url(images/bgd_tab.gif)";
		}else{
			hili[i].style.background = "url(images/bgd_tab_hover.gif)";
		}
		//hili[id].className="unactive";
	}
}

////////////////////////////////////////////////////////
function playVideo(linktag){	
	var noFlash = document.getElementById('nonFlash');
	var hasFlash = document.getElementById('Flash');
	if (hasFlash.style.display == "none" || hasFlash.style.display == ""){
		document.showFlash = true;
		noFlash.style.display = "none";	
		hasFlash.style.display = "block";
		setTimeout(function(){
			clearTimeout();
			var flashObj = getFlashMovieObject("videoPlayer");
			flashObj.SetVariable("videoStatus", "on");
			
		}, 500);
	}
	setBox();
}

function getMousePos(e) { //you need the 'e', although it does NOT need to be defined
	var mouse = new Object();
	//NS
	if (document.layers||document.getElementById&&!document.all) {
		mouse = {_xmouse:e.pageX, _ymouse:e.pageY}
	}
	//IE
	else if (document.all) {
		mouse = {_xmouse:window.event.clientX, _ymouse:window.event.clientY}
	}
	if (document.showFlash){
		var flashObj = getFlashMovieObject("videoPlayer");
		if (mouse._xmouse < getPageOffsetLeft(flashObj) || mouse._xmouse > getPageOffsetLeft(flashObj)+flashObj.clientWidth || mouse._ymouse < getPageOffsetTop(flashObj) || mouse._ymouse > getPageOffsetTop(flashObj)+flashObj.clientHeight) {
			flashObj.SetVariable("controlStatus", "off");
		}
	}
}

function stopVideo(){	
	var noFlash = document.getElementById('nonFlash');
	var hasFlash = document.getElementById('Flash');
	document.showFlash = false;
	setTimeout(function(){
		clearTimeout();
		//var flashObj = getFlashMovieObject("videoPlayer");
		//flashObj.SetVariable("videoStatus", "off");
		hasFlash.style.display = "none";
		noFlash.style.display = "block";
		setBox();
	}, 500);
	
}

function Get_Cookie(name) {
   var start = document.cookie.indexOf(name+"=");
   var len = start+name.length+1;
   if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
   if (start == -1) return null;
   var end = document.cookie.indexOf(";",len);
   if (end == -1) end = document.cookie.length;
   return unescape(document.cookie.substring(len,end));
}

function Set_Cookie(name,value,expires,path,domain,secure) {
 dada=new Date();
 dada.setDate(dada.getDate( ) + expires);
 //alert("expires.toGMTString()="+dada.toGMTString());
   var cookieString = name + "=" +escape(value) + ( (expires) ? ";expires=" + dada.toGMTString() : "") + ( (path) ? ";path=" + path : "") + ( (domain) ? ";domain=" + domain : "") + ( (secure) ? ";secure" : "");

   document.cookie = cookieString;
}

function checkVisit() {
	if (Get_Cookie("played")!="true"){
		var linkObj = MM_findObj("videoLink");
		if (linkObj != null) {
			document.showFlash = true;
			playVideo(linkObj);
		}
		Set_Cookie("played","true",0,"/","","");
	}
}

function getFlashMovieObject(movieName) {
	if (window.document[movieName]) {
		return window.document[movieName];
	}
	if (navigator.appName.indexOf("Microsoft Internet") == -1) {
		if (document.embeds && document.embeds[movieName])
			return document.embeds[movieName]; 
	} else {// if (navigator.appName.indexOf("Microsoft Internet")!=-1)
		return document.getElementById(movieName);
	}
}

function OpenNewWindow(strlink){		
	if(window.opener)
	{
		window.opener.location.href=strlink;
		window.opener.focus();
	}
	else
		window.open(strlink);
}

function filterKey(e) {
	var keynum
	var keychar
	var numcheck
	
	if(window.event) {
		keynum = e.keyCode
	} else if(e.which) {
		keynum = e.which
	}
	keychar = String.fromCharCode(keynum);
	numcheck = /[0-9/]/;
	if(!numcheck.test(keychar)) {
		if (keynum!=8&&typeof(keynum)!="undefined") {
			//alert("Please enter only numeric characters");
			return false;
		}
	}
	return true;
}