/*  Forms of the application are :     - registerForm, loginForm    - refisterProForm    - alertForm        - registerAppliForm    - register*/var items_fr = new Array();items_fr["name"]    = "votre nom";items_fr["object"]  = "l'objet";items_fr["date_1"]    = "la 1ière date";items_fr["checkPass"] = "le mot de passe";    //fictive, not in a formitems_fr["message"]   = "le message";items_fr["email"]     = "l'email";items_fr["myEmail"]   = "votre email";items_fr["firstname"] = "votre prénom";items_fr["password"]  = "le mot de passe";items_fr["password_2"]= "le 2ième mot de passe";items_fr["email_1"]     = "l'email du 1ier destinataire";items_fr["confirm"]     = "la confirmation";items_fr["file"]        = "de fichier. Cliquez sur le bouton Parcourir pour en ajouter un.";items_fr["fileSimple"]  = "de fichier. Cliquez sur le bouton Parcourir pour en sélectionner un.";items_fr["team"]       = "l'équipe";items_fr["location"]   = "du lieu (domicile/extérieur)";items_fr["adverseTeam"]= "le club rencontré";var items_en = new Array();/* TO DOitems_fr["email"] = "the Email";items_fr["password"] = "the Password";*/var items = new Array();items["fr"] = items_fr;items["en"] = items_en;var errorsLabels_fr = new Array();errorsLabels_fr["ERROR_SAME_NAME"] = "Il existe un répondant du même nom (ajoutez par exemple un numéro à votre nom) !";errorsLabels_fr["ERROR_NO_DATE"]   = "Vous devez au moins saisir une date !";errorsLabels_fr["ERROR_NO_ADDRESS_BUT_MAP"] = "Si vous souhaitez afficher le plan, vous devez saisir une adresse !";errorsLabels_fr["ERROR_ON_PASSWORD"] = "Le mot de passe est incorrect !";errorsLabels_fr["ERROR_NOT_SAME_PASSWORD"] = "Les deux mots de passe ne sont pas identiques !";errorsLabels_fr["ERROR_ACCOUNT_CREATION"] = "Il existe déjà un compte pour cet email !";errorsLabels_fr["ERROR_MAIL_ACCOUNT_CREATION"] = "Votre demande de compte a bien été enregistrée mais il est survenu un problème lors de l'envoi de mail. Merci de nous contacter.";errorsLabels_fr["ERROR_MAIL_NOT_ADDED"] = "Vous devez valider l'email que vous avez saisi avec la touche 'Entrée' ou en cliquant sur le +";errorsLabels_fr["ERROR_NO_MAIL"] = "Vous devez saisir au moins un email de destinataire";errorsLabels_fr["ERROR_PROCESS_RUNNING"] = "Les données envoyées sont en cours de traitement. Merci d'attendez un peu !";errorsLabels_fr["ERROR_NO_DATE_MATCH"]   = "Vous devez saisir la date du match !";errorsLabels_fr["ERROR_ENTRY_DATE"]      = "Le format de date n'est pas correct : saisir jour, mois, année";var errorsLabels_en = new Array();/* TO DO*/var errorsLabels = new Array();errorsLabels["fr"] = errorsLabels_fr;errorsLabels["en"] = errorsLabels_en;var mandatory = new Array();mandatory["invitation"] = new Array("name", "object");mandatory["invitationAnswer"]  = new Array("name");mandatory["alertForm_contact"] = new Array("message");mandatory["alertForm_viral"]   = new Array("message", "email_1", "email");mandatory["loginForm"] = new Array("email", "password");mandatory["registerAppliForm"] = new Array("email");mandatory["registerForm"]   = new Array("firstname", "password", "password_2");mandatory["changePassword"] = new Array("password", "password_2");mandatory["unregister"] = new Array("confirm");mandatory["personalDataForm"] = new Array("firstname", "email");mandatory["uploadimage"] = new Array("file");mandatory["uploadimageSimple"] = new Array("fileSimple");mandatory["invitationPublish"] = new Array("myEmail");mandatory["newEmail"] = new Array("email");   //onClickmandatory["player_rugby"] = new Array("name", "firstname");mandatory["match"] = new Array("team", "location", "adverseTeam");var format = new Array();format["invitationPublish"] = new Array( ["myEmail",EMAIL, "Votre email n'est pas valide."] );format["newEmail"] = new Array( ["email",EMAIL, "Cet email n'est pas valide."] );format["alertForm_contact"] = new Array( ["email",EMAIL, "Votre email n'est pas valide."] );format["alertForm_viral"] = new Array( ["email",EMAIL, "Votre email n'est pas valide."],       ["email_1",EMAIL, "L'email 1 n'est pas valide."], ["email_2",EMAIL, "L'email 2 n'est pas valide."], ["email_3",EMAIL, "L'email 3 n'est pas valide."],      ["email_4",EMAIL, "L'email 4 n'est pas valide."], ["email_5",EMAIL, "L'email 5 n'est pas valide."] );format["loginForm"] = new Array( ["email",EMAIL, "Cet email n'est pas valide."] );format["registerAppliForm"] = new Array( ["email",EMAIL, "Cet email n'est pas valide."] );format["personalDataForm"] = new Array( ["email",EMAIL, "Votre email n'est pas valide."],          ["birthYear", INTEGER, "Votre année de naissance n'est pas valide."]    );format["player_rugby"]     = new Array( ["email",EMAIL, "Cet email n'est pas valide."] );var specificFunction = new Array();specificFunction["invitation"] = checkInvitation;specificFunction["invitationAnswer"] = checkUniqueName;specificFunction["registerForm"] = checkSamePassword;specificFunction["changePassword"] = checkSamePassword;specificFunction["invitationPublish"] = checkPublicationMail;specificFunction["match"] = checkMatchDate;specificFunction["player_rugby"] = checkDateEntry;//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$//  Specific functions//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$function checkInvitation(theForm, language, errorDiv)//==================================================={  // Check that if we have selected to display a map we have entered an address	if( theForm["map"][0].checked )	{    var address = trimAll(  theForm["address"].value );    if( address == "" )    {      //we do not display into the standard errorDiv      displayError( errorsLabels[language]["ERROR_NO_ADDRESS_BUT_MAP"] , "errorMessageAddress");      theForm["address"].focus();      return false;    }  }  // Check that at least one date has been answered  var theTable = document.getElementById('datesTable');	var nbRows   = theTable.tBodies[0].rows.length;	if( nbRows == 0 )	{	  //we do not display into the standard errorDiv	  displayError( errorsLabels[language]["ERROR_NO_DATE"] , "errorMessageDate");    return false;  }  return true;}function checkUniqueName(theForm, language, errorDiv)//==================================================={  var theValue = trimAll(theForm.name.value).toLowerCase();  var i = 1;  while(true)  {    var fieldName = document.getElementById("name_" + i);    if( !fieldName )      break;    if( theValue == fieldName.value.toLowerCase() )    {      displayError( errorsLabels[language]["ERROR_SAME_NAME"] , errorDiv);      theForm.name.focus();      return false;    }    i++;  }  return true;}function checkSamePassword(theForm, language, errorDiv)//====================================================={  var val1 = theForm["password"].value;  var val2 =  theForm["password_2"].value;  if( val1 != val2 )  {    displayError( errorsLabels[language]["ERROR_NOT_SAME_PASSWORD"] , errorDiv);    theForm["password"].focus();    return false;  }  return true;}function checkPublicationMail(theForm, language, errorDiv)//========================================================{  var theEmail = trimAll(theForm.email.value);  if( theEmail != "" )  {    displayError( errorsLabels[language]["ERROR_MAIL_NOT_ADDED"] , "errorMessageMail");    theForm.email.focus();    return false;  }  return true;}function checkMatchDate(theForm, language, errorDiv)//=================================================={  var content = getTextContent( document.getElementById('matchDate') );  if( content == "" )  {    //we do not display into the standard errorDiv	  displayError( errorsLabels[language]["ERROR_NO_DATE_MATCH"] , "errorMessageDate");    return false;  }  return true;}function checkDateEntry(theForm, language, errorDiv)//=================================================={  return verifyAndReturnDate( 'player_rugby', 'birthdate',               errorsLabels[language]["ERROR_ENTRY_DATE"] , errorDiv ); }