/* ______________________[ Validation du formulaire de contact ]________________________ */

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_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+'  \n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+'  .\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+'  '+min+'   '+max+'\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' \n'; }
  } if (errors) alert('Merci de remplir les champs suivants :\n'+errors);
  document.MM_returnValue = (errors == '');
}


/* ______________________[ Gestion de la taille du texte d’un article ]________________________ */

/* 
Created by: Vic Phillips :: 
http://www.vicsjavascripts.org.uk 
*/

// Application Notes

// **** Operation
//
// Clicking the area containing the text or a link referencing the unique ID name of the area
// will increase the text size, clicking again will decrease the text size
// or
// will decrease the text size, clicking again will increase the text size.
// Dependent on the event call parameters assigned to the element containing the text
// There may be as many applications on a page as required
// and all applications may be executed concurrently.

// **** The Event Call
//
// e.g.
// <a id="fred" style="font-size:14px;" onclick="zxcZoomText(this,14,20,500);" >
// The Quick Brown Fox
// </a>
// where 'zxcZoomText(this,14,20,500)' :
// parameter 0 = the element object or unique ID name (object or string)
// parameter 1 = start text size                      (digits)
// parameter 2 = finish text size                     (digits)
// parameter 3 = the speed of change                  (digits/lower number is faster)


// **** Absolute Positioning - Displacing Lower elements
//
// If the element containg the text has the default positioning of 'relative'
// the expanding text will display the elements below.
// To prevent this the element containing the text must be assigned an inline syle style position of 'position:absolute;'
// and nested in an element with a style position of relative.
// e.g.
// <div  style="position:relative;width:140px;height:100px;test-align:center;" >
// <div id="fred" style="position:absolute;left:0px;font-size:14px;background-color:#f8cd76;" onclick="zxcZoomText(this,14,20,500);" >
// The Quick Brown Fox<br>
// The Quick Brown Fox<br>
// </div>
// </div>
//

// **** BackGround Image
//
// Clicking the text area will work best if the area has a back ground image.
// The customising variables include the option to include a blank .gif as a background image
// Assign this with a black .gif image or is not required null;

// **** General
//
// All variable, function etc. names are prefixed with 'zxc' to minimise conflicts with other JavaScripts
// These character are easily changed to characters of choice using global find and replace.
//
// The Functional Code(about 1.5K) is best as an External JavaScript
//
// Tested with IE6 and Mozilla FireFox
//

// **** Customising Variables

var zxcBlankImg=''; // a blank .gif as a background image or null if not required null;


// Functional Code - NO NEED to Change

var zxcOOPCnt=0;

function zxcZoomText(zxcobj,zxcssz,zxcfsz,zxcspd){
 if (typeof(zxcobj)=='string'){ zxcobj=document.getElementById(obj); }
 if (!zxcobj.oopct){
  zxcspd=zxcspd||100;
  if (zxcBlankImg){ zxcobj.style.backgroundImage='url('+zxcBlankImg+')'; }
  zxcobj.oopct=new zxcOOPTxtZoom(zxcobj,zxcssz,zxcfsz,zxcspd);
 }
 clearTimeout(zxcobj.oopct.to);
 zxcobj.oopct.minmax[4]*=-1;
 zxcobj.oopct.cngtxt();
}

function zxcOOPTxtZoom(zxcobj,zxcssz,zxcfsz,zxcspd){
 this.obj=zxcobj;
 if (zxcobj.style.position){
  if (zxcobj.style.position='absolute'){
   this.abs=[zxcobj.offsetLeft,zxcobj.offsetWidth];
  }
 }
 this.ref='zxcoopct'+zxcOOPCnt++;
 window[this.ref]=this;
 this.minmax=[zxcssz,Math.min(zxcssz,zxcfsz),Math.max(zxcssz,zxcfsz),zxcspd,(zxcssz<zxcfsz)?-1:1];
 this.to=null;
}

zxcOOPTxtZoom.prototype.cngtxt=function(){
 if ((this.minmax[4]>0&&this.minmax[0]<this.minmax[2])||(this.minmax[4]<0&&this.minmax[0]>this.minmax[1])){
  this.obj.style.fontSize=(this.minmax[0]+=this.minmax[4])+'px';
  if (this.abs){
   this.obj.parentNode.style.width=(this.obj.offsetWidth+parseInt(this.obj.style.fontSize))+'px';
   this.obj.parentNode.style.left=(parseInt(this.obj.style.fontSize)/2)+'px';
  }
  this.to=this.setTimeOut('cngtxt();',this.minmax[3]);
 }
}

zxcOOPTxtZoom.prototype.setTimeOut=function(zxcf,zxcd){
 this.to=setTimeout('window.'+this.ref+'.'+zxcf,zxcd);
}

/* ______________________[ Lancement d’une impression pour les navigateurs compatibles ]________________________ */

/* Les utilisateur de MacOS ne peuvent bénéficier de cette fonctionnalité : il peut être intéressant de prévoir une explication 
à ces utilisateurs sur la page d’aide par exemple. */

function DirectPrint() {
	if (window.print) self.print();
}

/* ______________________[ Lancement des scripts ]________________________ */

window.onload=function() {
	SmartSize();
}


