//-------------------------------------------------------------------check_1
function check_1 (obj_champ,champ,param){				//check longueur et/ou non-vide
	var err_str="";
	if (param<2){			//il faut entrer au moins un caractère (check non-vide)
		if (obj_champ.value=="") {
			err_str=champ+": "+ErrMsg[1]+"\n";
		}
	}else{				//min length > 1
		if (obj_champ.value.length<param){
			err_str=champ+": "+ErrMsg[6]+param+ErrMsg[5]+"\n";
		}
	}
	return (err_str);
}
//-------------------------------------------------------------------check_2
function check_2 (obj_champ,champ,param){			//check champ numérique entre a et b (inclus)
	//alert("check_2");
	var err_str="";
	if ( (param[0]==0) && (param[1]==null) && (param[2]==null) && (isNaN(Number(obj_champ.value))) ){
		//err_str="*champ doit être numérique\n";
		err_str=champ+": "+ErrMsg[18]+" "+ErrMsg[16]+"\n";
	}
	if ( (param[0]==1) && (param[1]==null) && (param[2]==null) && ( (isNaN(Number(obj_champ.value))) || (obj_champ.value.length==0) ) ){
		//err_str="*champ doit être renseigné et numérique\n";
		err_str=champ+": "+ErrMsg[18]+" "+ErrMsg[19]+" "+ErrMsg[15]+ErrMsg[16]+"\n";
	}
	if (param[2]!=null && param[1]!=null) { //fourchette
		if ( (param[0]==0) && (param[1]!=null) && ( (isNaN(Number(obj_champ.value))) || (param[1]>Number(obj_champ.value)) || (param[2]<Number(obj_champ.value)) ) ){
			//err_str="*champ doit être numérique et dans fourchette\n";
			err_str=champ+": "+ErrMsg[18]+" "+ErrMsg[16]+" "+ErrMsg[15]+ErrMsg[17]+param[1]+" "+ErrMsg[15]+param[2]+"\n";
		}
		if ( (param[0]==1) && (param[1]!=null) && ( (isNaN(Number(obj_champ.value))) || (obj_champ.value.length==0) || (param[1]>Number(obj_champ.value)) || (param[2]<Number(obj_champ.value)) ) ){
			//err_str="*champ doit être renseigné, numérique et dans fourchette\n";
			err_str=champ+": "+ErrMsg[18]+" "+ErrMsg[19]+ErrMsg[14]+ErrMsg[16]+" "+ErrMsg[15]+ErrMsg[17]+param[1]+" "+ErrMsg[15]+param[2]+"\n";
		}
	} else if (param[2]==null && param[1]!=null) { // plus grand que
		if ( (param[0]==0) && (param[1]!=null) && ( (isNaN(Number(obj_champ.value))) || (param[1]>=Number(obj_champ.value)) ) ){
			//err_str="*champ doit être numérique et dans fourchette\n";
			err_str=champ+": "+ErrMsg[18]+" "+ErrMsg[16]+" "+ErrMsg[15]+ErrMsg[32]+param[1]+"\n";
		}
		if ( (param[0]==1) && (param[1]!=null) && ( (isNaN(Number(obj_champ.value))) || (obj_champ.value.length==0) || (param[1]>=Number(obj_champ.value)) ) ){
			//err_str="*champ doit être renseigné, numérique et dans fourchette\n";
			err_str=champ+": "+ErrMsg[18]+" "+ErrMsg[19]+ErrMsg[14]+ErrMsg[16]+" "+ErrMsg[15]+ErrMsg[32]+param[1]+"\n";
		}
	} else if (param[2]!=null && param[1]==null) { // plus petit que
		if ( (param[0]==0) && (param[2]!=null) && ( (isNaN(Number(obj_champ.value))) || (param[2]<=Number(obj_champ.value)) ) ){
			//err_str="*champ doit être numérique et dans fourchette\n";
			err_str=champ+": "+ErrMsg[18]+" "+ErrMsg[16]+" "+ErrMsg[15]+ErrMsg[33]+param[2]+"\n";
		}
		if ( (param[0]==1) && (param[2]!=null) && ( (isNaN(Number(obj_champ.value))) || (obj_champ.value.length==0) || (param[2]<=Number(obj_champ.value)) ) ){
			//err_str="*champ doit être renseigné, numérique et dans fourchette\n";
			err_str=champ+": "+ErrMsg[18]+" "+ErrMsg[19]+ErrMsg[14]+ErrMsg[16]+" "+ErrMsg[15]+ErrMsg[33]+param[2]+"\n";
		}
	}
	return (err_str);
}

//-------------------------------------------------------------------emailCheck
function emailCheck (emailStr,err_msg) {
/* The following pattern is used to check if the entered e-mail address
   fits the user@domain format.  It also is used to separate the username
   from the domain. */
var emailPat=/^(.+)@(.+)$/
/* The following string represents the pattern for matching all special
   characters.  We don't want to allow special characters in the address. 
   These characters include ( ) < > @ , ; : \ " . [ ]    */
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
/* The following string represents the range of characters allowed in a 
   username or domainname.  It really states which chars aren't allowed. */
var validChars="\[^\\s" + specialChars + "\]"
/* The following pattern applies if the "user" is a quoted string (in
   which case, there are no rules about which characters are allowed
   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
   is a legal e-mail address. */
var quotedUser="(\"[^\"]*\")"
/* The following pattern applies for domains that are IP addresses,
   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
   e-mail address. NOTE: The square brackets are required. */
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
/* The following string represents an atom (basically a series of
   non-special characters.) */
var atom=validChars + '+'
/* The following string represents one word in the typical username.
   For example, in john.doe@somewhere.com, john and doe are words.
   Basically, a word is either an atom or quoted string. */
var word="(" + atom + "|" + quotedUser + ")"
// The following pattern describes the structure of the user
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
/* The following pattern describes the structure of a normal symbolic
   domain, as opposed to ipDomainPat, shown above. */
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")


/* Finally, let's start trying to figure out if the supplied address is
   valid. */

/* Begin with the coarse pattern to simply break up user@domain into
   different pieces that are easy to analyze. */
var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
  /* Too many/few @'s or something; basically, this address doesn't
     even fit the general mould of a valid e-mail address. */
  if (err_msg==true){
		alert("Email address seems incorrect (check @ and .'s)")
	}
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

// See if "user" is valid 
if (user.match(userPat)==null) {
    // user is not valid
    if (err_msg==true){
    	alert("The username doesn't seem to be valid.")
    }
    return false
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
   host name) make sure the IP address is valid. */
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    // this is an IP address
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	    	if (err_msg==true){
	        alert("Destination IP address is invalid!")
	      }
		return false
	    }
    }
    return true
}

// Domain is symbolic name
var domainArray=domain.match(domainPat)
if (domainArray==null) {
	if (err_msg==true){
		alert("The domain name doesn't seem to be valid.")
	}
    return false
}

/* domain name seems valid, but now make sure that it ends in a
   three-letter word (like com, edu, gov) or a two-letter word,
   representing country (uk, nl), and that there's a hostname preceding 
   the domain or country. */

/* Now we need to break up the domain to get a count of how many atoms
   it consists of. */
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   // the address must end in a two letter or three letter word.
  if (err_msg==true){
	   alert("The address must end in a three-letter domain, or two letter country.")
	}
   return false
}

// Make sure there's a host name preceding the domain.
if (len<2) {
   var errStr="This address is missing a hostname!"
   if (err_msg==true){
   	alert(errStr)
   }
   return false
}

// If we've gotten this far, everything's valid!
return true;
}
//-------------------------------------------------------------------check_3
function check_3 (obj_champ,champ,param){			//check champ email
	var err_str="";
	var is_email=true;
	if (emailCheck (obj_champ.value,false)==false){		//appeler fonction
		if (param==1) {
			err_str=champ+": "+ErrMsg[3]+ErrMsg[20]+"\n";
		}else if ((param!=1)&&(obj_champ.value.length!=0)){
			err_str=champ+": "+ErrMsg[3]+"\n";
		}
	}	
	return (err_str);
}
//-------------------------------------------------------------------check_4
function check_4 (obj_champ,champ,param){			//check au moins un radiobutton sélectionné
	var err_str="";
	var coche=false;
	for (j=0;j<obj_champ.length;j++){			//pour chaque bouton radio
		if (obj_champ[j].checked==true){		//regarder si checked
			coche=true;
		}
	}
	if (coche==false){
		err_str=champ+": "+ErrMsg[7]+"\n";
	}
	return (err_str);
}
//-------------------------------------------------------------------check_5
function check_5 (obj_champ,champ,param){			//combobox - au moins un sélectionné
	var err_str="";
	var valable=false;
	for (j=0;j<obj_champ.length;j++){			//pour chaque ligne du combo
		if ((obj_champ.options[j].selected)&&(obj_champ.options[j].value!=param)){		//si selected et pas une valeur interdite
			valable=true;
		}
	}
	if (valable==false){
		err_str=champ+": "+ErrMsg[11]+"\n";
	}
	return (err_str);
}
//-------------------------------------------------------------------check_6
function check_6 (obj_champ,champ,param){			//checkbox - au moins un sélectionné
	var err_str="";
	var checked_ok=false;
	var leng=param[0];
	if (obj_champ.checked==true){
		checked_ok=true;			//premier champ checked
	}else{						//chercher dans autres champs de la série
		for (k=0;k<param.length;k++){			//pour tous les checkbox listés dans la variable param du tableau
			var num=param[k];
			if ( eval('document.'+obj_champ.form.name+'.'+FormArr[num][0]+'.checked')==true ){		//si checked
				checked_ok=true;
			}else{
				if (FormArr[num][1].length!=0){
					if (k==param.length-1){
						err_str=err_str+FormArr[num][1];
					}else{
						err_str=err_str+FormArr[num][1]+", ";			//ajouter nom du champ au string d'erreur
					}
				}
			}
		}
	}
	//si deux derniers caractères ", " on les vire
	if (checked_ok==false){			//si on a toujours pas trouvé de box checked
		if (err_str.length!=0){
			err_str=champ+", "+err_str+": "+ErrMsg[10]+"\n";
		}else{
			err_str=champ +": "+ ErrMsg[10]+"\n";
		}
	}else{
		err_str="";			//si on a trouvé, on remet le string à "" (il y avait une liste des boxes pas checkés dedans)
	}
	return (err_str);
}
//-------------------------------------------------------------------check_7
//	FormArr[7]=["password1","password",7,[1,8]];			//param:indexe de celui avec lequel faire la comparaison

function check_7 (obj_champ,champ,param){			//password et confirmer password
	var err_str="";
	var meme=true;
	var leng=param[0];
	for (k=1;k<param.length;k++){			//pour tous les champs de comparaison
		var num=param[k];
		//si les valeurs diffèrent ou champ pas assez long
		if ( (obj_champ.value!=eval('document.'+obj_champ.form.name+'.'+FormArr[num][0]).value)||(obj_champ.value.length<leng) ){
			err_str=err_str+FormArr[num][1]+", ";
			meme=false;
		}
	}
	if (meme==false){			//on n'a pas trouvé
		err_str=err_str+champ+": "+ErrMsg[8]+" "+ErrMsg[9]+leng+ErrMsg[5]+"\n";
	}else{
		err_str="";			//si on a trouvé, on remet le string à "" (il y avait une liste des champs dedans)
	}
	return (err_str);
}
//-------------------------------------------------------------------divisible
function divisible (num1,num2){
	var is_divisible;
	if (num1%num2==0){
		is_divisible=true;
	}else{
		is_divisible=false;
	}
	return is_divisible;
}

//-------------------------------------------------------------------check_8
function check_8 (obj_champ,champ,param){			//vérifier format d'une date ex. 14/02/2001 ou 14.02.2001
	var err_str="";
	var nombre_jours;
	var bad_date=false;
	var caract="";
	var date_tableau;
	var le_string=String(obj_champ.value);
	var DateSlash=/\d{1,2}\/\d{1,2}\/\d\d\d\d/;		//format 09/08/2001
	var DatePoint=/\d{1,2}\.\d{1,2}\.\d\d\d\d/;		//format 09.08.2001
	results=le_string.match(DateSlash);						//faire le match
	results2=le_string.match(DatePoint);
	if (results!=null){				//si on a trouvé le format avec des /
		caract="/";
	}else if (results2!=null){
		caract=".";							// si on a trouvé le format avec des .
	}else{
		bad_date=true;
		if (param==1){
			err_str=champ + ": " + ErrMsg[12]+ErrMsg[20]+"\n";		//format pas correct,champ obligatoire
		}else if ((param!=1)&&(obj_champ.value.length!=0)){
			err_str=champ + ": " + ErrMsg[12]+"\n";		//format pas correct
		}
	}
	if (caract!=""){ //on continue!				
		//split string dans un tableau
		date_tableau=le_string.split(caract);
		//faire les checks sur les dates
		//vérifier le mois
		if ((date_tableau[1]<1)||(date_tableau[1]>12)){ 		//dans [1,12]
			bad_date=true;
		}
		//vérifier le jour
		if (date_tableau[1]==02){		//février
			if ((date_tableau[2]%4==0 && date_tableau[2]%100!=0)||(date_tableau[2]%400==0)){  //bissextile
				nombre_jours=29;
			}else{
				nombre_jours=28;
			}
		}else if ((date_tableau[1]==4)||(date_tableau[1]==6)||(date_tableau[1]==9)||(date_tableau[1]==11)){  			//les mois avec 30 jours
			nombre_jours=30;
		}else{  				//les autres mois (31 jours)
			nombre_jours=31;
		}
		if ((date_tableau[0]<1)||(date_tableau[0]>nombre_jours)){		//jours pas dans l'ensemble [1,nombre_jours]
				bad_date=true;
		}	
	}
	if ((bad_date==true)&&(err_str=="")){			//date impossible, et on n'a pas encore imprimé d'erreur string
		if (param==1){
			err_str=champ + ": " + ErrMsg[13]+ErrMsg[20]+"\n"; //date impossible,champ obligatoire
		}else if ((param!=1)&&(obj_champ.value.length!=0)){
			err_str=champ + ": " + ErrMsg[13]+"\n"; //date impossible
		}
	}
	return (err_str);
}
//-------------------------------------------------------------------check_9
function check_9 (obj_champ,champ,param){			//série de champs texte - au moins un sélectionné
	var err_str="";
	var rempli_ok=false;
	var leng=param[0];
	if (obj_champ.value.length!=0){
		rempli_ok=true;			//premier champ renseigné
	}else{						//chercher dans autres champs de la série
		for (k=0;k<param.length;k++){			//pour tous les champs listés dans la variable param du tableau
			var num=param[k];
			if ( eval('document.'+obj_champ.form.name+'.'+FormArr[num][0]+'.value.length')!=0 ){		//si checked
				rempli_ok=true;
			}else{
				err_str=err_str+FormArr[num][1]+", ";			//ajouter nom du champ au string d'erreur
			}
		}
	}
	if (rempli_ok==false){			//si on a toujours pas trouvé de box checked
		err_str=champ+", "+err_str+": "+ErrMsg[21]+"\n";
	}else{
		err_str="";			//si on a trouvé, on remet le string à "" (il y avait une liste des boxes pas checkés dedans)
	}
	return (err_str);
}

//-------------------------------------------------------------------check_10
function check_10 (obj_champ,champ,param){			//check champ représente un prix (p.ex. 45.08 CHF est exclu)
	//nb: malheureusement il y a un problème avec % (mod) donc on ne peut pas tester divisibilité par 0.05 
	//(même en multipliant par 100  -  (100*v%5) pas assez précis)
	var err_str="";
	var v=obj_champ.value;
	var is_montant=true;
	var temp_array;
	if ( isNaN(Number(v)) ) {
		is_montant=false;
		//if (is_montant==false){alert("pas un nombre");}
	}else{
		//chercher s'il y a un point
		if (v.indexOf(".")!=-1) {
			if ( (v.length - v.indexOf(".") -1 ) >2 ) {  //nombre décimales > 2
				is_montant=false;
				//if (is_montant==false){alert("trop de décimales");}
			}else if ( (v.length - v.indexOf(".") -1 ) ==2 ) {  //il y 2 décimales
				//exploser dans un array
				temp_array=v.split("");
				if (temp_array[(v.length-1)]!=0 && temp_array[(v.length-1)]!=5) {
					is_montant=false;
					//if (is_montant==false){alert("pas un multiple de 5 centimes");}
				}
			}
		}
	}
	
	if ( ((isNaN(Number(v))) || (is_montant==false) )																	&& (param[0]==0 && param[1]==1) ) {
		err_str=champ + ": " + ErrMsg[22]+"\n";
	} else if ( ((isNaN(Number(v))) || (is_montant==false) || (v<0)) 									&& (param[0]==0 && param[1]==0) ) {
		err_str=champ + ": " + ErrMsg[22]+ ErrMsg[23]+"\n";
	} else if ( ((isNaN(Number(v))) || (is_montant==false) || (v.length==0)) 					&& (param[0]==1 && param[1]==1) ) {
		err_str=champ + ": " + ErrMsg[22]+ ErrMsg[20]+"\n";
	} else if ( ((isNaN(Number(v))) || (is_montant==false) || (v.length==0) || (v<0)) 	&& (param[0]==1 && param[1]==0) ) {
		err_str=champ + ": " + ErrMsg[22]+ ErrMsg[23]+ ErrMsg[20]+"\n";
	}
	return (err_str);
}


//-------------------------------------------------------------------check_11
function check_11 (obj_champ,champ,param){			//check 2 dates et vérifier que le 2ème est plus "grand"
	var err_str="";
	var date_1_oblig=param[0];
	var champ_comp=param[1];
	var date_2_oblig=param[2];
	var obj_champ_2=eval('document.'+obj_champ.form.name+'.'+FormArr[champ_comp][0]);
	var champ_2=FormArr[champ_comp][1];

	var rexp=/./g;
	
	var date_1,date_2;

	err_str=check_8(obj_champ,champ,date_1_oblig);
	err_str=err_str+check_8(obj_champ_2,FormArr[champ_comp][1],date_2_oblig);
	
	if (err_str.length==0 && obj_champ.length!=0 && obj_champ_2.value.length!=0) {
		//on a 2 dates valides donc on peut comparer
		date_1=obj_champ.value;
		date_2=obj_champ_2.value;
		//on split dans des tableaux
		if (date_1.indexOf("/")!=-1) {
			date_1=date_1.split("/");
		} else {
			date_1=date_1.split(".");
		}	
		if (date_2.indexOf("/")!=-1) {
			date_2=date_2.split("/");
		} else {
			date_2=date_2.split(".");
		}	
		//on convertit en date
		date_1=new Date(date_1[2],(date_1[1]-1),date_1[0]);
		date_2=new Date(date_2[2],(date_2[1]-1),date_2[0]);
		//on parse pour convertir en millisecondes
		date_1=Date.parse(date_1);
		date_2=Date.parse(date_2);
		//on compare (en format number et pas string)
		if (parseInt(date_1)>parseInt(date_2)) {
			err_str=champ_2 + ErrMsg[24] + champ + "\n";
		}
	}
	return err_str;
}

//-------------------------------------------------------------------check_12
function check_12 (obj_champ,champ,param){			//check des heures 1) time: 05h30 ou 2) nombre heures: 123h30
	/*param contient: 
		param[0]			1 ou 0 (oblig, pas oblig); 
		param[1]			séparateur des heures (ex. "h"); 
		param[2]			0=heures illimitées (on compte un nombre d'heures donc >24h00 ok), 1=heures limitées à des heures de la journée
		param[3]			which clock: pour les heures limitées: 12 heures ou 24 heures  */
	var err_str="";
	var oblig=param[0];
	var separ_hrs=param[1];
	var heures_limitees=param[2];
	var which_clock=param[3];  				//12 ou 24 heures
	var regexp,TheString,Hrs_Mins_Arr;
	
	if (which_clock!=12 && which_clock!=24) {  //which_clock ni 12 ni 24
		alert("veuillez reconfigurer - vous devez choisir 12 ou 24 heures!");
	}

	if (obj_champ.value.length==0 && oblig==1) {		//il n'y a rien et c'est un champ obligatoire
		err_str=champ + ": " + ErrMsg[25] + separ_hrs + ErrMsg[30];  //veuillez rentrer une heure en utilisant le format ...
	} else if (obj_champ.value.length!=0) {
		if (heures_limitees==1) {
			regexp = /^\d{1,2}h\d{2}$/;
		} else {  //actuellement ok jusqu'à 9999 heures max (sinon changer 4 en 5 etc ci-dessous)
			regexp = /^\d{1,4}h\d{2}$/;
		}	
		TheString = new String(obj_champ.value);
		if (TheString.match(regexp)!=null) {  //si le format est juste
			Hrs_Mins_Arr = TheString.split(separ_hrs);  //on split dans un tableau de h et mins
			if (heures_limitees==1) {  //----------une heure de la journée
				if (which_clock==12) {
					if ( Number(Hrs_Mins_Arr[0])<1 || Number(Hrs_Mins_Arr[0])>12 || Number(Hrs_Mins_Arr[1])<0 || Number(Hrs_Mins_Arr[1])>59 ) {
						err_str = champ + ": " + ErrMsg[26];  //une heure entre 1 et 12
					}
				} else if (which_clock==24) {
					if ( Number(Hrs_Mins_Arr[0])<0 || Number(Hrs_Mins_Arr[0])>23 || Number(Hrs_Mins_Arr[1])<0 || Number(Hrs_Mins_Arr[1])>59 ) {
						err_str = champ + ": " + ErrMsg[27];  //une heure entre 0 et 23
					}
				}
			} else {  //----------un nombre d'heures
				if ( Number(Hrs_Mins_Arr[1])<0 || Number(Hrs_Mins_Arr[1])>59 ) {
					err_str = champ + ": " + ErrMsg[28];  //entre 0 et 59 minutes
				}
			} 
		} else { 
			err_str = champ + ": " + ErrMsg[29] + separ_hrs + ErrMsg[30];  //format pas conforme
		}
	}
	if (oblig==1 && err_str.length!=0) {  //ajouter champ obligatoire si nécessaire
		err_str = err_str + ErrMsg[20];
	}
	if (err_str.length!=0) {
		err_str = err_str + "\n";
	}
return err_str;
}

//-------------------------------------------------------------------check_13
function check_13 (obj_champ,champ,param){			//check si textarea ne contient pas trop de caractères
	/*param contient: 
		param[0]			1 ou 0 (oblig, pas oblig); 
		param[1]			nombre min de caractères
		param[2]			nombre max de caractères */
	var err_str="";
	if ((param[0]==0 && obj_champ.value.length > 0 && (obj_champ.value.length < param[1] || obj_champ.value.length > param[2])) 
			|| (param[0]==1 && (obj_champ.value.length < param[1] || obj_champ.value.length > param[2]))) {			//il faut entrer au moins un caractère (check non-vide)
		err_str=champ+": "+ErrMsg[6] + param[1] + ErrMsg[31] + param[2] + ErrMsg[5];
		if (param[0] == 1) { //(champ obligatoire)
			err_str = err_str + ErrMsg[20];
		}
	}
	if (err_str.length > 0) {
		err_str = err_str + "\n";
	}
	return (err_str);
}
//-------------------------------------------------------------------test_me

function test_me (obj_form){	
	var err_msg			
	err_msg="";		
	for (i=0; i<FormArr.length;i++){	//pour tous les champs mentionnés dans le tableau
		var fn;
		//alert(FormArr[i][2]);
		fn=FormArr[i][2];			//fn=numéro de la fonction (et du check) dans le tableau
		if (fn!=0) {				//si on veut checker quelque chose
			//on appelle la fonction approprié, qui retourne "" ou une chaîne de caractères contenant l'erreur
			err_msg=err_msg + eval('check_'+fn)(eval('obj_form.'+FormArr[i][0]),FormArr[i][1],FormArr[i][3]);
		}
	}
	if (err_msg.length!=0) {
		err_msg = ErrMsg[0] + "\n" + err_msg;
	}
	return(err_msg);
}

