
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_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

var W3CDOM = (document.createElement && document.getElementsByTagName);
var mouseOvers = new Array();
var mouseOuts = new Array();
var activeNavId=0;

var mySlider=new Array();
function init(num){
	for(i=1;i<5;i++){
		mySlider[i]= new Fx.Slide("subnav"+i, {duration: 1000});
		mySlider[i].vertical();
		
		myNav=$("nav"+i);
		mySubNav=$("subnav"+i);
		if(num!==i){
			mySlider[i].hide();
			mySubNav.style.display="block";
			myNav.active=false;
		} else {
			myNav.active=true;
			activeNavId=i;
		}
	}
	
	if (!W3CDOM) return;
/* var subnav1Obj=MM_findObj("subnav1");
 subnav1Obj.style.display="none";*/
	/*var nav = document.getElementById('container');*/
	for(i=0;i<6;i++){
		myNav=$("nav"+i);
		var spaceImg = document.createElement("IMG");
		spaceImg.src = "images/blank.gif";
		spaceImg.style.display = "block";
		spaceImg.style.width = "147px";
		spaceImg.style.height = "4px";
		myNav.parentNode.appendChild(spaceImg);
		myNavSrc=myNav.childNodes[0].src;
		if (checkIt("msie") != 0) {
			if (myNav.childNodes[0].style.filter.indexOf("_o.png") != -1) {
				//myNav.active=true;
			}
		} else {
			if(myNavSrc.substr(myNavSrc.length-5,1)=="o"){
				//myNav.active=true;
			}
		}
	}
	var inputImgs = document.getElementsByTagName('input');
	var imageImgs = document.getElementsByTagName('img');
	var imgs = new Array();
	
	for (var i=0; i<imageImgs.length; i++) {imgs.push(imageImgs[i]);}
	for (var i=0; i<inputImgs.length; i++) {imgs.push(inputImgs[i]);}
	//alert (imgs.length);
	for (var i=0; i<imgs.length; i++)
	{
		/*if (imgs[i].src.indexOf('.png') != -1) // On cible seulement les lments input de type image avec une extension de type .png
		{		*/	
			// Get image name
			//alert ( (imgs[i].src.substring(imgs[i].src.lastIndexOf('/') + 1)).substring(0,(imgs[i].src.substring(imgs[i].src.lastIndexOf('/') + 1)).lastIndexOf('.')) );
			if (imgs[i].parentNode.nodeName.toUpperCase() == "A") {
				tmp=(imgs[i].src.substring(imgs[i].src.lastIndexOf('/') + 1)).substring(0,(imgs[i].src.substring(imgs[i].src.lastIndexOf('/') + 1)).lastIndexOf('.'));
				
				if ( tmp.indexOf('_') != -1) /* search all img have "_" */
				{
					if (tmp.substring(tmp.lastIndexOf('_')+1) == "n" || tmp.substring(tmp.lastIndexOf('_')+1) == "o" )
						{
							//alert ( (imgs[i].src.substring(imgs[i].src.lastIndexOf('/') + 1)).substring(0,(imgs[i].src.substring(imgs[i].src.lastIndexOf('/') + 1)).lastIndexOf('.')) );
							imgs[i].onmouseover = mouseGoesOver;
							imgs[i].onmouseout = mouseGoesOut;
							mouseOuts[i] = new Image();
							mouseOuts[i].src = imgs[i].src;
							mouseOvers[i] = new Image();	
							
							/*	
							if (imgs[i].src.lastIndexOf('_') != -1) { mouseOvers[i].src = imgs[i].src.substring(0,imgs[i].src.lastIndexOf('_')) + "_over" + suffix;}
							else { mouseOvers[i].src = imgs[i].src.substring(0,imgs[i].src.lastIndexOf('.')) + "_over" + suffix;}
							*/
							var suffix = imgs[i].src.substring(imgs[i].src.lastIndexOf('.'));
							if (imgs[i].src.lastIndexOf('.') != -1) { mouseOvers[i].src = imgs[i].src.substring(0,imgs[i].src.lastIndexOf('_')) + "_o" + suffix;}
							imgs[i].number = i;
						}
				}
				
				//
				if (tmp == "blank" && imgs[i].style.filter.indexOf("DXImageTransform.Microsoft.AlphaImageLoader") != -1 && (imgs[i].style.filter.indexOf("_n.png") != -1 || imgs[i].style.filter.indexOf("_o.png") != -1)) {
					imgs[i].onmouseover = pngMouseGoesOver;
					imgs[i].onmouseout = pngMouseGoesOut;
				}
			}
		//}
	} //end for
} //end init



function initreset()
{
	if (!W3CDOM) return;
	var imgs = document.getElementsByTagName('img');
	for (var i=0; i<imgs.length; i++)
	{
		if (imgs[i].src.indexOf('.png') != -1) // On cible seulement les lments input de type image avec une extension de type .png
		{			
			tmp=(imgs[i].src.substring(imgs[i].src.lastIndexOf('/') + 1)).substring(0,(imgs[i].src.substring(imgs[i].src.lastIndexOf('/') + 1)).lastIndexOf('.'));
			
			if ( tmp.indexOf('_') != -1) /* search all img have "_" */
			{
				if (tmp.substring(tmp.lastIndexOf('_')+1) == "o" )
				{
					//alert ( (imgs[i].src.substring(imgs[i].src.lastIndexOf('/') + 1)).substring(0,(imgs[i].src.substring(imgs[i].src.lastIndexOf('/') + 1)).lastIndexOf('.')) );
					var suffix = imgs[i].src.substring(imgs[i].src.lastIndexOf('.'));
					var tmpimg= new Image();
						tmpimg.src=imgs[i].src.substring(0,imgs[i].src.lastIndexOf('_')) + "_n.png";
					imgs[i].src=tmpimg.src;
				}
			}
		}
	} //end for
} //end initreset

var fsub=false;
var mobj;
var osrc="";
function mouseGoesOver(fsub, mEvent) {
	//alert("this.src = "+this.src);
	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() {
	if(this.src!==OpenedLinkSrc){
		this.src = mouseOuts[this.number].src;	
	}
	
}


function pngMouseGoesOver() {
	//alert(this.style.filter);
	this.style.filter = this.style.filter.replace("_n.png", "_o.png");
}

function pngMouseGoesOut() {
	if (this.style.filter != OpenedLinkSrc){
		if (this.parentNode.id != "") {
			if (this.parentNode.id.indexOf(activeNavId) == -1) {
				this.style.filter = this.style.filter.replace("_o.png", "_n.png");
			}
		} else {
			this.style.filter = this.style.filter.replace("_o.png", "_n.png");
		}
	}
}


var PreviousOpenedSubnav="";
var PreviousOpenedLink="";
var OpenedLinkSrc="";
var PreviousOpenedLinkSrc="";
var MyInterval;
function OpenClose(el,linkObj,num){
	//OpenedLinkSrc=txt.substr(0,txt.length-5)+"n.png";
	//alert(OpenedLinkSrc);
	for(i=0;i<6;i++){
		myNav=MM_findObj("nav"+i);
		mySubNav=MM_findObj("subnav"+i);
		/*if(String(mySubNav)!=="null"){
			if(mySubNav.style.display!=="none"){
				//Effect.toggle("subnav"+i,'BLIND');
				
				//var mySlider = new Fx.Slide("subnav"+i, {duration: 500});
				//mySlider[i].slideOut()
			}
		}*/
		if(myNav.active == true){
			myNav.active=false;
			if (checkIt("msie") != 0) {
				myNavSrc = myNav.childNodes[0].style.filter;
			} else {
				myNavSrc = myNav.childNodes[0].src;
			}
			if(activeNavId != i){
				if (checkIt("msie") != 0) {
					myNav.childNodes[0].style.filter = myNavSrc.replace("_o.png", "_n.png");
				} else {
					myNav.childNodes[0].src = myNavSrc.substr(0,myNavSrc.length-5)+"n.png";
				}
			} else if (checkIt("msie") != 0) {
				myNav.childNodes[0].style.filter = myNavSrc;
			}
		} 
		if(Number(num)!==i && i>0 && i<5){
				mySlider[i].slideOut();
		}else {
				
		}
		
	}

	mySlider[Number(num)].slideIn();
	
	if (checkIt("msie") != 0) {
		OpenedLinkSrc=linkObj.childNodes[0].style.filter;
	} else {
		OpenedLinkSrc=linkObj.childNodes[0].src;
	}
	linkObj.active=true;

	
}
function OpenNew(el){
	clearInterval(MyInterval);
	Effect.toggle(el,'BLIND')	;
}

//-->

<!--
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;
}


//flashObject
var FlashObject = function(swf, id, w, h, ver, c) {
	this.swf = swf;
	this.id = id;
	this.width = w;
	this.height = h;
	this.version = ver;
	this.align = "middle";

	this.params = new Object();
	this.variables = new Object();

	this.redirect = "";
	this.sq = document.location.search.split("?")[1] || "";
	this.bypassTxt = "<p>Already have Macromedia Flash Player? <a href='?detectflash=false&"+ this.sq +"'>Click here if you have Flash Player "+ this.version +" installed</a>.</p>";
	
	if (c) this.color = this.addParam('bgcolor', c);
	this.addParam('quality', 'high'); // default to high
	this.doDetect = getQueryParamValue('detectflash');
}

var FOP = FlashObject.prototype;

FOP.addParam = function(name, value) { this.params[name] = value; }

FOP.getParams = function() { return this.params; }

FOP.getParam = function(name) { return this.params[name]; }

FOP.addVariable = function(name, value) { this.variables[name] = value; }

FOP.getVariable = function(name) { return this.variables[name]; }

FOP.getVariables = function() { return this.variables; }

FOP.getParamTags = function() {
    var paramTags = "";
    for (var param in this.getParams()) {
        paramTags += '<param name="' + param + '" value="' + this.getParam(param) + '" />';
    }
    return (paramTags == "") ? false:paramTags;
}

FOP.getHTML = function() {
    var flashHTML = "";
    if (navigator.plugins && navigator.mimeTypes.length) { // netscape plugin architecture
        flashHTML += '<embed type="application/x-shockwave-flash" src="' + this.swf + '" width="' + this.width + '" height="' + this.height + '" wmode="transparent" id="' + this.id + '" align="' + this.align + '"  scale="noborder" ';
        for (var param in this.getParams()) {
            flashHTML += ' ' + param + '="' + this.getParam(param) + '"';
        }
        if (this.getVariablePairs()) {
            flashHTML += ' flashVars="' + this.getVariablePairs() + '"';
        }
        flashHTML += '></embed>';
    } else { // PC IE
        flashHTML += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + this.width + '" height="' + this.height + '" id="' + this.id + '" align="' + this.align + '">';
        flashHTML += '<param name="movie" value="' + this.swf + '" />';
		 flashHTML += '<param name="SCALE" value="noborder" />';
		 flashHTML += '<param name="wmode" value="transparent" />';
        if (this.getParamTags()) {
            flashHTML += this.getParamTags();
        }
        if (this.getVariablePairs() != null) {
            flashHTML += '<param name="flashVars" value="' + this.getVariablePairs() + '" />';
        }
        flashHTML += '</object>';
    }
    return flashHTML;	
}

FOP.getVariablePairs = function() {
    var variablePairs = new Array();
    for (var name in this.getVariables()) { 
    	variablePairs.push(name + "=" + escape(this.getVariable(name))); 
    }
    return (variablePairs.length > 0) ? variablePairs.join("&"):false;
}

FOP.write = function(elementId) {
	if(detectFlash(this.version) || this.doDetect=='false') {
		if (elementId) {
			document.getElementById(elementId).innerHTML = this.getHTML();
		} else {
			document.write(this.getHTML());
		}
	} else {
		if (this.redirect != "") {
			document.location.replace(this.redirect);
		} else if (this.altTxt) {
			if (elementId) {
				document.getElementById(elementId).innerHTML = this.altTxt +""+ this.bypassTxt;
			} else {
				document.write(this.altTxt +""+ this.bypassTxt);
			}
		}
	}		
}

/* ---- detection functions ---- */
function getFlashVersion() {
	var flashversion = 0;
	if (navigator.plugins && navigator.mimeTypes.length) {
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			var y = x.description;
   			flashversion = y.charAt(y.indexOf('.')-1);
		}
	} else {
		result = false;
	    for(var i = 15; i >= 3 && result != true; i--){
   			execScript('on error resume next: result = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))','VBScript');
   			flashversion = i;
   		}
	}
	return flashversion;
}

function detectFlash(ver) {	return (getFlashVersion() >= ver) ? true:false; }

// get value of query string param
function getQueryParamValue(param) {
	var q = document.location.search || document.location.href.split("#")[1];
	if (q) {
		var detectIndex = q.indexOf(param +"=");
		var endIndex = (q.indexOf("&", detectIndex) > -1) ? q.indexOf("&", detectIndex) : q.length;
		if (q.length > 1 && detectIndex > -1) {
			return q.substring(q.indexOf("=", detectIndex)+1, endIndex);
		} else {
			return "";
		}
	}
}

/* add Array.push if needed */
if(Array.prototype.push == null){
	Array.prototype.push = function(item) {this[this.length] = item; return this.length;}
}



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();

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;
}
/* add Array.push if needed */
if(Array.prototype.push == null){
	Array.prototype.push = function(item) {this[this.length] = item; return this.length;}
}

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 isBlank(s) {
	if(trim(s) == "" ) 
		return true ;
	return false ;
}

function trim(s) {
	return s.replace(/^\s+/g, '').replace(/\s+$/g, '');
}

function isPhone(s) {
	if (s.search(/^[0-9\_\.]+$/) != -1) return true;
	return false;
}

function doFocus (ElementName) {
	var Obj= ElementName;
	Obj.focus();
}

function doFocusSetStyle (ElementName) {
	doFocus(ElementName);
	var Obj = ElementName;
	Obj.style.borderColor="";
}


function doResetInput (frmID) {	
	var frmObj=document.getElementById(frmID);
	for (var i = 0; i < frmObj.elements.length; i++) {
		if (frmObj.elements[i].type == "text" || frmObj.elements[i].type == "select-one") {
			frmObj.elements[i].style.borderColor = "";
		}
	}
}

function resetErrMsg () {
	for (i=1; i<=20; i++) {
		if (document.getElementById("msg"+i)) {
			var curMsg = document.getElementById("msg"+i);
			curMsg.innerHTML="&nbsp;";
		}
	}
}

function inputPhone(number)
{
	var pattern = "0123456789- ().";
	
	if (len != 0)
	{
		var index = 0;
		var len = number.value.length;
		
		while ((index < len) && (len != 0))
			if (pattern.indexOf(number.value.charAt(index)) == -1)
			{
				if (index == len-1)
					number.value = number.value.substring(0, len-1);
				else if (index == 0)
					 	number.value = number.value.substring(1, len);
					 else number.value = number.value.substring(0, index)+number.value.substring(index+1, len);
				index = 0;
				len = number.value.length;
			}
			else index++;
	}
}

function inputNumber(number)
{
	var pattern = "0123456789";
	
	if (len != 0)
	{
		var index = 0;
		var len = number.value.length;
		
		while ((index < len) && (len != 0))
			if (pattern.indexOf(number.value.charAt(index)) == -1)
			{
				if (index == len-1)
					number.value = number.value.substring(0, len-1);
				else if (index == 0)
					 	number.value = number.value.substring(1, len);
					 else number.value = number.value.substring(0, index)+number.value.substring(index+1, len);
				index = 0;
				len = number.value.length;
			}
			else index++;
	}
}

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)+"px";
		divObj.style.top = (y+20)+"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 = parseInt(divObj.style.left)+"px";
			iframeObj.style.top = parseInt(divObj.style.top)+"px";
			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";
	}
	if (browser.isIE) {
		var iframeObj = MM_findObj(err_div+"Iframe");
		if (iframeObj != null) {
			iframeObj.style.visibility = "hidden";
		}
	}
}

