<!--

function multiClass(eltId) {
	arrLinkId = new Array('_0','_1');
	intNbLinkElt = new Number(arrLinkId.length);
	arrClassLink = new Array('current tab','tab');
	strContent = new String()
	for (i=0; i<intNbLinkElt; i++) {
		strContent = "menu"+arrLinkId[i];
		if ( arrLinkId[i] == eltId ) {
			document.getElementById(arrLinkId[i]).className = arrClassLink[0];
			document.getElementById(strContent).className = '';
		} else {
			document.getElementById(arrLinkId[i]).className = arrClassLink[1];
			document.getElementById(strContent).className = 'none';
		}
	}	
}


function alternate(id){
	if(document.getElementById){						//check that browser has capabilities
		var row = document.getElementById(id);		//get just the selected table not all of them
			//manipulate rows	
			doAlternate(row);
	}
}

function doAlternate(row){
	if(!row.className){
		row.className = "select";
	}else if (row.className == "selected") {
	}else{
		row.className = "";
    }
}


function resizeMiddleCol() {
	if (document.getElementById('middleCol')) {
		 heightLeftCol = document.getElementById('leftCol').offsetHeight;
		 heightSubWrap = document.getElementById('middleCol').offsetHeight;
		 if (heightLeftCol > heightSubWrap) {
			document.getElementById('subwrap').style.height = heightLeftCol + 25 + "px"; }
		 if (heightLeftCol < heightSubWrap && document.getElementById('middleCol').style.height != "auto" ) {
			document.getElementById('subwrap').style.height = "auto"; }
	}
}

function resizeHomePortal() {
}


function resizeHomeNavigation() {
  if (document.getElementById('navH')) {
	titleHeight = document.getElementById("title_1").offsetHeight;
	height1Row = document.getElementById("block_1").offsetHeight;
	height2Row = document.getElementById("block_2").offsetHeight;
	height3Row = document.getElementById("block_3").offsetHeight;
	height4Row = document.getElementById("block_4").offsetHeight;
	height1bisRow = document.getElementById("block_1bis").offsetHeight;
	height2bisRow = document.getElementById("block_2bis").offsetHeight;
	height3bisRow = document.getElementById("block_3bis").offsetHeight;
	heightTransRow = document.getElementById("block_4bis").offsetHeight;
	heightRow = 0;
	if (heightTransRow > height1Row) {
		heightRow=heightTransRow-height1Row-titleHeight;
		document.getElementById('block_1_banner').style.height = height1Row + heightRow + "px";
		document.getElementById('block_2_banner').style.height = height2Row + heightRow + "px";
		document.getElementById('block_3_banner').style.height = height3Row + heightRow + "px";
		document.getElementById('block_4_banner').style.height = height4Row + heightRow + "px";
		document.getElementById('block_1bis_banner').style.height = height1bisRow + heightRow + "px";
		document.getElementById('block_2bis_banner').style.height = height2bisRow + heightRow + "px";
		document.getElementById('block_3bis_banner').style.height = height3bisRow + heightRow + "px";
		document.getElementById('block_4bis_banner').style.height = height4bisRow + heightRow + "px";
	}
  }
}

function resizeEntrypage() {
  if (document.getElementById('contextBoxOne')) {
	height1Col = document.getElementById("contextBoxOneContent2").offsetHeight;
	height2Col = document.getElementById("contextBoxTwoContent2").offsetHeight;
	height3Col = document.getElementById("contextBoxThreeContent2").offsetHeight;
	heightCol = 0;

	if (heightCol < height1Col) heightCol=height1Col;
	if (heightCol < height2Col) heightCol=height2Col;
	if (heightCol < height3Col) heightCol=height3Col;
	
	document.getElementById('contextBoxOneContent').style.height = heightCol+"px";
	document.getElementById('contextBoxTwoContent').style.height = heightCol+"px";
	document.getElementById('contextBoxThreeContent').style.height = heightCol+"px";
  }
  if (document.getElementById('alert')) {
	heightCol = 0;		
		$('#alert li div').each(function(index) {
			if (heightCol < $(this).innerHeight()) heightCol=$(this).innerHeight();
		});
		$('#alert li').each(function(index) {
			$(this).height(heightCol);
		});
	
  }
}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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 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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
// swapIt navigation home
function swapIt(id, newclass) {
 if (document.getElementById) {
 document.getElementById(id).className = newclass;
 }
}

// Accessibility links
aFocus = function() {
  if(document.getElementById && document.getElementById("skiplist")) {
    var aEls = document.getElementById("skiplist").getElementsByTagName("a");
    var spanEls = document.getElementById("skiplist").getElementsByTagName("span");
    for (var i=0; i<aEls.length; i++) {
      aEls[i].className="hidden";
      aEls[i].onfocus=function() {
        this.className="show";
	    for (var i=0; i<spanEls.length; i++) {
    	  spanEls[i].className="";
    	}
      }
    }
    for (var i=0; i<spanEls.length; i++) {
      spanEls[i].className="hidden";
    }
  }
}
/* BEGIN accessible select
A select list that works without a submit button but also for keyboard users.
*/
/*
	Written by Jonathan Snook, http://www.snook.ca/jonathan
	Add-ons by Robert Nyman, http://www.robertnyman.com
*/

function getElementsByClassName(oElm, strTagName, strClassName){
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	strClassName = strClassName.replace(/\-/g, "\\-");
	var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
	var oElement;
	for(var i=0; i<arrElements.length; i++){
		oElement = arrElements[i];
		if(oRegExp.test(oElement.className)){
			arrReturnElements.push(oElement);
		}
	}
	return (arrReturnElements)
}
niceSelect=function(myform){    
  var f=getElementsByClassName(document, "form", "niceSelect");;
    for (var i=0;i<f.length;i++){       // Walks all the forms in the document.
    var e=f[i].elements;
    for(var j=0;j<e.length;j++){        // Walks all the elements in the form.
      if(e[j].type=="select-one"){      // Chooses elements that are select 
										// box (that does not allow multiple
										// selections).
        e[j].formnu=i;
        e[j].onclick=function(){        // selection is made with the mouse
          this.onchange=function(){
            f[this.formnu].submit()
          }
        };
        e[j].onblur=function(){         // This "disarms" the onblur function
          this.onchange=function(){return true}  
        };
        e[j].onkeydown=function(e){     // When keys are pressed on the keyboard...
          if (e){theEvent = e} else {theEvent=event};
          if (theEvent.keyCode==13){    // ...only submit when 'enter' is pressed.
            if((this.onchange+"").indexOf("submit")<0){
              f[this.formnu].submit()
            }
          }
        }
      }
    }
  }
}
/* END Nice select */

// custom animation for language tooltip
$.easing.bouncy = function (x, t, b, c, d) {
    var s = 1.70158;
    if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
    return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
}

// custom tooltip effect for jQuery Tooltip
$.tools.tooltip.addEffect("bouncy",

	// opening animation
	function(done) {
		this.getTip().animate({top: '-=10'}, 500, 'bouncy', done).show();
	},

	// closing animation
	function(done) {
		this.getTip().animate({top: '+=10'}, 500, 'bouncy', function()  {
			$(this).hide();
			done.call();
		});
	}
);




function selectPeriode(periode) {
	periode.checked=true;
	}
function addLoadEvent(func) {
  if (window.addEventListener) 
    window.addEventListener("load", func, false);
  else if (window.attachEvent) 
    window.attachEvent("onload", func);
}
function addResizeEvent(func) {
	if (window.addEventListener) {
		window.addEventListener("resize", func, false);
	} else if (window.attachEvent) {
		window.attachEvent("onresize", func);
	}
}

function resizeFormulaires() {
		$(".formulaires .list .desc").width($("ul.list").width()-305);
	}

$.maxZIndex = $.fn.maxZIndex = function(opt) {
    /// <summary>
    /// Returns the max zOrder in the document (no parameter)
    /// Sets max zOrder by passing a non-zero number
    /// which gets added to the highest zOrder.
    /// </summary>    
    /// <param name="opt" type="object">
    /// inc: increment value, 
    /// group: selector for zIndex elements to find max for
    /// </param>
    /// <returns type="jQuery" />
    var def = { inc: 10, group: "*" };
    $.extend(def, opt);    
    var zmax = 0;
    $(def.group).each(function() {
        var cur = parseInt($(this).css('z-index'));
        zmax = cur > zmax ? cur : zmax;
    });
    if (!this.jquery)
        return zmax;

    return this.each(function() {
        zmax += def.inc;
        $(this).css("z-index", zmax);
    });
}

    $(document).ready(function(){ 
			// To have Update layer over content layer
			// Set the zIndex of #foot to max + 5 
			$("#foot").maxZIndex({ inc: 5 });
			// png transparency fix
			$(document).pngFix(); 

			// closing event for language Tooltip
			function closeAcc() {
				var panel = $("#langTooltip.current").data("tooltip");
				if (panel) { panel.hide(); }
				$("#langTooltip").removeClass("current");
			}
			/* close on click event*/
			$(document).click(function(e) {
				var el = $(e.target)
				if ($(".tooltip:visible").length && !el.is(".tooltip") && !el.parents(".tooltip").length && !el.is("#langTooltip")) {
					closeAcc();
				}
			});
				
			$("#langTooltip").attr('data-tooltip','#langTooltipContent').tooltip({ 
			
				//the tip content
				offset: [-15, 0],
				effect: 'slide',
				bounce: 'true',
				position : 'bottom center',
				direction : 'down',
				events: {
					def:"click,''",
					tooltip:"mouseenter,''"},
		  onShow: function(e) {
					$("#langTooltip").addClass("current");
				},
				onBeforeHide: function(e) {
					$("#langTooltip").removeClass("current");
				}
/*						*/
				}).click(function(){ return false;});
    }); 
		


addLoadEvent(aFocus);
addLoadEvent(resizeMiddleCol);
addResizeEvent(resizeMiddleCol);

addLoadEvent(resizeHomeNavigation);
addResizeEvent(resizeHomeNavigation);

addLoadEvent(niceSelect);
//-->


