
// JavaScript Document
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

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

function hideAllLayers() {
	var i;
	for(i=0; i<=10; i++) {
		MM_showHideLayers('Layer'+i,'','hide');
	}
}
function showLayer(num) {
	var i;
	if (typeof(num) != "undefined" && num == 0) {
		MM_showHideLayers('ml'+num,'','show');
		return;
	}
	for(i=0; i<=10; i++) {
		MM_showHideLayers('ml'+i,'',(typeof(num) != "undefined" && num == i ? 'show' : 'hide'));
	}
}

function MM_CheckFlashVersion(reqVerStr,msg){
  with(navigator){
    var isIE  = (appVersion.indexOf("MSIE") != -1 && userAgent.indexOf("Opera") == -1);
    var isWin = (appVersion.toLowerCase().indexOf("win") != -1);
    if (!isIE || !isWin){  
      var flashVer = -1;
      if (plugins && plugins.length > 0){
        var desc = plugins["Shockwave Flash"] ? plugins["Shockwave Flash"].description : "";
        desc = plugins["Shockwave Flash 2.0"] ? plugins["Shockwave Flash 2.0"].description : desc;
        if (desc == "") flashVer = -1;
        else{
          var descArr = desc.split(" ");
          var tempArrMajor = descArr[2].split(".");
          var verMajor = tempArrMajor[0];
          var tempArrMinor = (descArr[3] != "") ? descArr[3].split("r") : descArr[4].split("r");
          var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] : 0;
          flashVer =  parseFloat(verMajor + "." + verMinor);
        }
      }
      // WebTV has Flash Player 4 or lower -- too low for video
      else if (userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 4.0;

      var verArr = reqVerStr.split(",");
      var reqVer = parseFloat(verArr[0] + "." + verArr[2]);
  
      if (flashVer < reqVer){
        if (confirm(msg))
          window.location = "http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
      }
    }
  } 
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function openBrowserWin(url) {
	//wSubmitEmail = new window();
	wSubmitEmail = window.open(url, "wSubmitEmail", "width=200,height=100,status=no,toolbar=no,menubar=no,location=no,favorites=no,scrollbars=no,resizable=no");
	if (typeof(wSubmitEmail) != "undefined") {
		return(true);
	} else {
		return(false);
	}
}
function checkMail(email, msg)
{
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(email)) {
		return(true);
	} else {
		if (msg != "" && msg != null) {
			alert(msg);
		}
		return(false);
	}
}
function jumpTo(url) {
	if (typeof(url) != 'undefined' && url != null && url != '') {
		location.href = url;
	}
}

function clearmsg(){
	document.sms.abstractbody.value="";
	document.sms.charsleft.value="2000";
	document.sms.abstractbody.focus();
}


function showCharsLeft(champs,limit) {

	// if(navigator.appName!="Netscape") {
	var maxLength = limit;
	var toRemove, i, charleft;

	total = champs.form.elements["descriptif"].value.length;

	if (typeof(champs) != "undefined") {
		if (total > maxLength) {
			toRemove = total - maxLength;
			
			champs.value = champs.value.substring(0,champs.value.length - toRemove);
			charleft = 0;
		} else {
			charleft = maxLength-total;
		}
	}
	
	return(charleft);
}

function showCharsLeft_back(formulaire,champs) {

	// if(navigator.appName!="Netscape") {
	var maxLength = 400;
	var toRemove, i, charleft;

	total = formulaire.elements["descriptif"].value.length;

	if (typeof(champs) != "undefined") {
		if (total > maxLength) {
			toRemove = total - maxLength;
			
			champs.value = champs.value.substring(0,champs.value.length - toRemove);
			charleft = 0;
		} else {
			charleft = maxLength-total;
		}
	} else {
		charleft = maxLength-total;
	}

	for (i=0; i < formulaire.elements["charsleft"].length; i++) {
		formulaire.elements["charsleft"][i].value=charleft
	}

}

function confirmation(mesg,url) {
if ((url != null) && (url != '') && (mesg != null) && (mesg != ''))
	if (confirm(mesg)) location.href = url;
}