// This function performs form validation by // looping through the elements of the form// looking for any in the 'required' or // 'numeric' class.  // This function is passed a reference to // the form (document._NotesFormName)function validateFields(theForm)  {         var msg='';  var empty_fields = "";  var numeric_fields="";  var date_fields="";  var tel_fields="";  var cp_fields="";  var mail_fields="";  // The next three variables are used when  // checking radio buttons and checkboxes.  possibleError = new Object();  var noError ="";      var x=0;  // Loop through the elements of the form,   // looking for all text and textarea elements   // in the "required" class. Then, check for   // fields that are empty and make a list of them.      // Put together an error message for fields that  // fail validation.  for(var i = 0; i < theForm.length; i++) {    var e = theForm.elements[i];      if (e.className.indexOf("required") != -1 ) {      // Check for the type of field and then      // edit accordingly.       if ((e.type == "text" || e.type == "textarea") &&     	           (e.value == null || e.value == "" ))  {        empty_fields += "\n          * " + e.title;        continue;        }      if (e.type == "select-multiple" &&        e.selectedIndex == -1) {           empty_fields += "\n          * " + e.title;        continue;        }      // The first option in the select-one      // list is "Select One" and should      // produce an error.      if (e.type == "select-one" &&      e.selectedIndex == 0)  {        empty_fields += "\n          * " + e.title;        continue;                 }      // Process each checkbox and radio button.      // If checked, add to the no error list, otherwise      // add to the possible error list.      if (e.type == "radio" || e.type == "checkbox") {        if (e.checked == false)          possibleError[x++] = e.title;                else          noError += e.title;        }    } //End of check for required fields        // Check for numeric fields.    if (e.className.indexOf("numeric") != -1 &&    (e.type == "text" || e.type == "textarea"))  {      if ( !isNumber (e.value)) {        numeric_fields += "\n          * " + e.title;                }            } // end checking for numerics    	if (e.className.indexOf("date") != -1 &&    (e.type == "text" || e.type == "textarea"))  {      if (!(isDate(e.value))) {        date_fields += "\n          * " + e.title;                }            } // end checking for date         	if (e.className.indexOf("tel") != -1 &&    (e.type == "text" || e.type == "textarea"))  {      if (!(isTel(e.value))) {        tel_fields += "\n          * " + e.title;                }            } // end checking for tel          	if (e.className.indexOf("cp") != -1 &&    (e.type == "text" || e.type == "textarea"))  {      if (!(isCP(e.value))) {        cp_fields += "\n          * " + e.title;                }            } // end checking for tel    	if (e.className.indexOf("mail") != -1 &&    (e.type == "text" || e.type == "textarea"))  {      if (!(isMail(e.value))) {        mail_fields += "\n          * " + e.title;                }            } // end checking for tel  } // End looping through form elements    // Loop through the possible errors in   // radio button and checkboxes and   // find out which are actual errors.  for (count in possibleError) {    if (noError.indexOf (possibleError[count]) ==-1) {      empty_fields += "\n          * " +       possibleError[count];      noError += possibleError[count];      }        }  // If there were any errors display  // the error message, otherwise give the  // user the option of submitting the form.  if (!empty_fields && !numeric_fields && !date_fields && !tel_fields && !cp_fields && !mail_fields)  {		return true; }  else {    if (empty_fields) {      msg = "Veuillez remplir ces champs qui sont obligatoires\n";      msg += empty_fields + "\n\n";         }    if (numeric_fields) {      msg += " Les champs num\u00E9riques sont incorrects :\n";      msg += numeric_fields + "\n";      }    if (date_fields) {      msg += " Les champs date suivants sont incorrects\n";      msg += date_fields + "\n";      }    if (tel_fields) {      msg += " Les champs de t\u00E9l\u00E9phone suivants sont incorrects\n";      msg += tel_fields + "\n";      }    if (cp_fields) {      msg += " Les champs de code postal suivants sont incorrects\n";      msg += cp_fields + "\n";      }    if (mail_fields) {      msg += " Les champs d'email suivants sont incorrects\n";      msg += mail_fields + "\n";      }    return msg;	        }}//Check if a string is a number. //Numbers have 0-9, "-", and "."function isNumber (inputNum) {  decimalPoint=false;  for (var i = 0; i< inputNum.length; i++) {        var oneChar = inputNum.charAt(i);      if (i==0 && oneChar == "-") {        continue      }      if (oneChar == "." && !decimalPoint) {        decimalPoint = true;        continue        }             if (oneChar < "0" || oneChar > "9") {        return false      }    } //end of looping through inputNum    return true}function isBlank(fieldname) {//	window.status = fieldname; // uncomment this line for debugging	fieldobject = eval("document.TechForumMain." + fieldname);	if (fieldobject.type == "select-multiple" && fieldobject.selectedIndex == -1) {		return true;		}	if (fieldobject.type == "select-one" && fieldobject.selectedIndex == 0) {		return true;	}	if (fieldobject.type == "text" && (fieldobject.value == null || fieldobject.value == 'undefined' || fieldobject.value == "")) {		return true;		}	if (fieldobject.type == "hidden" && (fieldobject.value == null || fieldobject.value == 'undefined' || fieldobject.value == "")) {		return true;		}	return false;}function isDate(d) {     // Cette fonction permet de v\u00E9rifier la validit\u00E9 d'une date au format jj/mm/aa ou jj/mm/aaaa     // Par Romuald          if (d != ""){ // si la variable est vide on retourne vrai           e = new RegExp("^[0-9]{1,2}\/[0-9]{1,2}\/([0-9]{2}|[0-9]{4})$");          if (!e.test(d)) // On teste l'expression r\u00E9guli\u00E8re pour valider la forme de la date         return false; // Si pas bon, retourne faux       // On s\u00E9pare la date en 3 variables pour v\u00E9rification, parseInt() converti du texte en entier     j = parseInt(d.split("/")[0], 10); // jour     m = parseInt(d.split("/")[1], 10); // mois     a = parseInt(d.split("/")[2], 10); // ann\u00E9e       // Si l'ann\u00E9e n'est compos\u00E9e que de 2 chiffres on compl\u00E8te automatiquement     if (a < 1000) {         if (a < 10)    a+=2000; // Si a < 89 alors on ajoute 2000 sinon on ajoute 1900         else a+=1900;     }       // D\u00E9finition du dernier jour de f\u00E9vrier     // Ann\u00E9e bissextile si annn\u00E9e divisible par 4 et que ce n'est pas un si\u00E8cle, ou bien si divisible par 400     if (a%4 == 0 && a%100 !=0 || a%400 == 0) fev = 29;     else fev = 28;       // Nombre de jours pour chaque mois     nbJours = new Array(31,fev,31,30,31,30,31,31,30,31,30,31);       // Enfin, retourne vrai si le jour est bien entre 1 et le bon nombre de jours, idem pour les mois, sinon retourn faux     return ( m >= 1 && m <=12 && j >= 1 && j <= nbJours[m-1] );     }     else		return true;     	}function isTel(Tel) {     // Cette fonction permet de v\u00E9rifier la validit\u00E9 d'une date au format jj/mm/aa ou jj/mm/aaaa     // Par Romuald          if (Tel != ""){ // si la variable est vide on retourne vrai           e = new RegExp("^0[0-9]{9}$");          if (!e.test(Tel)) // On teste l'expression r\u00E9guli\u00E8re pour valider la forme de la date         return false; // Si pas bon, retourne faux     else     	return true;       }     else		return true;     	}function isCP(CP) {     // Cette fonction permet de v\u00E9rifier la validit\u00E9 d'une date au format jj/mm/aa ou jj/mm/aaaa     // Par Romuald          if (CP != ""){ // si la variable est vide on retourne vrai           e = new RegExp("[0-9]{5}$");          if (!e.test(CP)) // On teste l'expression r\u00E9guli\u00E8re pour valider la forme de la date         return false; // Si pas bon, retourne faux     else     	return true;       }     else		return true;     	}function isMail(Mail) {     // Cette fonction permet de v\u00E9rifier la validit\u00E9 d'une date au format jj/mm/aa ou jj/mm/aaaa     // Par Romuald          if (Mail != ""){ // si la variable est vide on retourne vrai           e = new RegExp("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$");          if (!e.test(Mail)) // On teste l'expression r\u00E9guli\u00E8re pour valider la forme de la date         return false; // Si pas bon, retourne faux     else     	return true;       }     else		return true;     	}function getWindowHeight() {			var windowHeight = 0;			if (typeof(window.innerHeight) == 'number') {				windowHeight = window.innerHeight;			}			else {				if (document.documentElement && document.documentElement.clientHeight) {					windowHeight = document.documentElement.clientHeight;				}				else {					if (document.body && document.body.clientHeight) {						windowHeight = document.body.clientHeight;					}				}			}			return windowHeight;		}		function setFooter() {			if (document.getElementById) {				var windowHeight = getWindowHeight();				if (windowHeight > 0) {					var contentHeight = document.getElementById('content').offsetHeight;					var footerElement = document.getElementById('footer');					var footerHeight  = footerElement.offsetHeight;					if (windowHeight - (contentHeight + footerHeight) >= 18) {						footerElement.style.position = 'relative';						footerElement.style.top = (windowHeight - (contentHeight + footerHeight+20)) + 'px';					}					else {						footerElement.style.position = 'static';					}				}			}		}				window.onload = function() {			setFooter();		}		window.onresize = function() {			setFooter();		}