/*  Initialisation des flags pour les validations de formulaires */
/* Version WWW.GOTO.FR*/

var flagmail = true ;
var flag=0 ;

/* 
FONCTION POUR REMPLACER 
un ou plusieurs caractères 
par d'autres caractères une STR 
*/
function StrReplace(Str,bad, good)
{
//alert (Str);
	while (Str.indexOf(bad) > 0 )
	{
		LEFT = Str.slice(0, Str.indexOf(bad));
		//alert ("LEFT = " + LEFT)
		RIGHT = Str.slice(Str.indexOf(bad) + bad.length, Str.length);
		//alert ("RIGHT = " + RIGHT)
		Str = LEFT + good + RIGHT;
		//alert ("Str = " + Str)
		// ReplaceFRInc++
	}
//alert (Str);
	return(Str);
}

// FONCTIONS POUR ENREGISTRER ET RECUPERER LES INFOS UTILISATEURS DANS LES PAGES DE VALIDATION DES PAIEMENTS
function getInfo() {
	var coordinit = new getCookieArray("utilisateur");
	if (coordinit[1] && coordinit[1] != "") document.mainform.genre.value = coordinit[1];
	if (coordinit[2]) document.mainform.nom.value = coordinit[2];
	if (coordinit[3]) document.mainform.eml.value = coordinit[3];
	if (coordinit[4]) document.mainform.prenom.value = coordinit[4];
	if (coordinit[5]) document.mainform.adr1.value = coordinit[5];
	if (coordinit[6]) document.mainform.adr2.value = coordinit[6];
	if (coordinit[7]) document.mainform.cp.value = coordinit[7];
	if (coordinit[8]) document.mainform.ville.value = coordinit[8];
	//if (coordinit[9] && coordinit[9] != "") document.mainform.pays.value = coordinit[9];
	}
function saveInfo() {
	var coord = new Array();
	coord[1] = document.mainform.genre.value;
	coord[2] = document.mainform.nom.value;
	coord[3] = document.mainform.eml.value;
	coord[4] = document.mainform.prenom.value;
	coord[5] = document.mainform.adr1.value;
	coord[6] = document.mainform.adr2.value;
	coord[7] = document.mainform.cp.value;
	coord[8] = document.mainform.ville.value;
	//coord[9] = document.mainform.pays.value;
	var coordonnees = new setCookieArray("utilisateur",coord[1],coord[2],coord[3],coord[4],coord[5],coord[6],coord[7],coord[8],coord[9]);
	}

// FONCTION POUR ENREGISTRER LES ABONNEMENTS NEWSLETTER
function Abonnement()
{
	email= new String(document.news.email.value) ;
	// Verif champs
	var Util = new String('')
	var Pro = new String('')
	
	if (document.news.Util.checked)
	{
		Util = 'oui'
	}
	if (document.news.Pro.checked)
	{
		Pro = 'oui'
	}
	
	if (chkForm('fr','news','email'))
	{
		var url = "http://www.goto.fr/fr/merci.asp?section=1&email="+ email +"&util="+ Util + "&pro=" + Pro;
		openVisite(url) ;
	}
	else return(false) ;
}


/* Animation de la barre du milieu dans tout le site */
function SwitchPanneau(Sens,ID)
{
	//alert("SwitchPanneau")
	var SensMove = Sens;
	//alert (Sens);
	if(ID == null) /* first time : initialisation Positions*/
	{
		if(SensMove == null)
		{
			if (document.all.MediumLayer.style.top == "0px")
			{
				//ouvre la barre de navigation
				document.Pos = new Array(0,-10, -40, -70,-95);
				document.Txt = new String("Ouvrir cette barre...")				
			}
			else
			{
				// ferme la barre de navigation
				document.Pos = new Array(-95, -60, -40 , -10, -5, 0);
				document.Txt = new String("Fermer cette barre...")
			}
		}
		else
		{
			if(SensMove.toUpperCase() == 'RENTRE')
			{
				if(document.all.MediumLayer.style.top == "0px")
				{
					//Ferme la barre de navigation
					document.Pos = new Array(0,-10, -40, -70,-95);
					document.Txt = new String("Ouvrir cette barre...")
				}
				else
				{
					return(true);
				}
			}
			else
			{
				document.Pos = new Array(0,-10, -40, -70,-95);
				document.Txt = new String("Fermer cette barre...")				
			}
		};
		SwitchPanneau(SensMove,0);
	}
	else
	{
		if (ID < document.Pos.length) 
		{
			document.all.MediumLayer.style.top = "" + document.Pos[ID] + "px" ;
			if (screen.width > 800 )
			{
				document.all.MediumLayer.style.clip = "rect("+ (-document.Pos[ID]) +"px 860px 130px 0px)" ;
			}
			else
			{
				document.all.MediumLayer.style.clip = "rect("+ (-document.Pos[ID]) +"px 635px 130px 0px)" ;
			}
			document.all.BtFermer.alt = document.Txt ;
		};
		ID++;
		Timer = setTimeout('SwitchPanneau("'+ Sens +'",'+ ID +')', 0);
	};	
}

function RecupNomPage()
{
	var URL =  new String(window.location.href)
	var BASE = new String("http://www.goto.fr/fr/")
	var SortieSTR = new String("<span style='font-size: 10px'><a href='" + BASE + "index.asp' class='TopLink'>Accueil</a>");
	var RelURL = new String("");
	var ProdName = new String("")
	var TempProdName = new String("")
	URL = URL.slice(BASE.length, URL.length)
	while (URL.length > 0)
	{
		if(URL.indexOf("/") == -1)
		{
			SortieSTR +=  " > <a href='" + BASE + RelURL + URL.slice(0,URL.length) + "' class='TopLink'>" + document.title +"</a>";
				URL = "";
		}
		else
		{
			TempProdName = URL.slice(0,URL.indexOf("/")) ;
			/* On ajuste le format des noms : produit => Produit */
			ProdName = TempProdName.slice(0,1).toUpperCase() + TempProdName.slice(1,TempProdName.length)
			SelectProds :
			{
				switch(ProdName)
				{
					case "Mw" : 		ProdName = "MemoWeb 4" ; break SelectProds ;
					case "Sa" : 		ProdName = "Sarbacane" ; break SelectProds ;
					case "SA" : 		ProdName = "Sarbacane" ; break SelectProds ;
					case "Bf" : 		ProdName = "ButtonFly Edition Professionnelle V.2" ; break SelectProds ;
					case "Bh" : 		ProdName = "ButtonFly Home Edition" ; break SelectProds ;
					case "Mt" : 		ProdName = "MemoTel X-pert" ; break SelectProds ;
					case "Ach" : 		ProdName = "Achat en Ligne"; break SelectProds ;
					case "Corpo" : 		ProdName = "Sociétés"; break SelectProds ;
					case "Tel" : 		ProdName = "Téléchargements"; break SelectProds ;
					case "Inf" : 		ProdName = "Informations"; break SelectProds ;
					case "INF" : 		ProdName = "Informations"; break SelectProds ;
				}
			}
			// On élimine les _
			ProdName = StrReplace(ProdName,"_"," ")

			SortieSTR +=  " > <a href='" + BASE +RelURL + URL.slice(0,URL.indexOf('/')) +"'  class='TopLink'>"+ ProdName +"</a>"
			//alert(SortieSTR)
			RelURL += URL.slice(0,URL.indexOf("/")) + "/"
			URL = URL.slice(URL.indexOf("/")+1,URL.length+1)
		}
	}
	return(SortieSTR + "</span>")
}

function openVisite(urlArt) 
{
	newWindow = window.open(urlArt,"Article","width=600,height=370,innerWidth=600,innerHeight=350,scrollbars=0,resizable=0,dependent,screenX=50, screenY=50,titlebar=no");
	newWindow.focus();
	}

function openFlash(urlArt) 
{
	newWindow = window.open(urlArt,"Article","width=600,height=450,innerWidth=600,innerHeight=450,scrollbars=0,resizable=0,dependent,screenX=50, screenY=50,titlebar=no");
	newWindow.focus();
	}


function openMulti(urlArt) 
{
	newWindow = window.open(urlArt,"Article","width=700,height=600,innerWidth=700,innerHeight=600,scrollbars=0,resizable=0,dependent,screenX=50, screenY=50,titlebar=no");
	newWindow.focus();
	}



function openWin(urlArt,larg,lng) 
{
	newWindow = window.open(urlArt,"Article","width="+larg+",height="+lng+",innerWidth="+larg+",innerHeight="+lng+",scrollbars,resizable=1,");
	newWindow.focus();
	}

function swapImg(urlImg,nameImg) 
{
	if (document.images) 
	{
		document.images[nameImg].src = urlImg;
	}
}

function imprimer() 
{
	if (window.print()) 
	{
		window.print();
	}
}

function sendForm() 
  {
  	
  	
//  	alert("sendForm");
    // Variable du texte de confirmation
  var TxtConf = '' ;
// crée la variable de langue  
 	if (!arguments[0]) 
	{
		var lang='fr'
	}
	else
	{
		var lang = arguments[0].toLowerCase() ;
	}
// remplit la variable de texte de confirmation
	if (lang == 'fr')    TxtConf = "Souhaitez-vous confirmer votre paiement ?" ;
	if (lang == 'uk')    TxtConf = "Would you like to confirm your payment ?"  ;
	if (lang == 'us')    TxtConf = "Would you like to confirm your payment ?"  ;
	if (lang == 'es')    TxtConf = "¿ Quiere Usted confirmar su pago ?"        ;
	if (lang == 'de')    TxtConf = "Bitte bestätigen Sie Ihre Zahlung"         ;
	if (lang == 'nl')    TxtConf = "Wilt U uw betaling bevestigen ?"           ;
	if (lang == 'it')    TxtConf = "Desiderate confermare il vostro pagamento?"; 
	if (lang == 'qc')    TxtConf = "Souhaitez-vous confirmer votre paiement ?" ;
	if (lang == 'ca')    TxtConf = "Would you like to confirm your payment ?"  ;


// ajouté pour prendre en compte le débridage de produits en uk, Italien, Espagnol, anglais US
	if (lang == 'debuk')    TxtConf = "Would you like to confirm your payment ?"  ;
	if (lang == 'debus')    TxtConf = "Would you like to confirm your payment ?"  ;
	if (lang == 'debit')    TxtConf = "Desiderate confermare il vostro pagamento?";
	if (lang == 'debes')    TxtConf = "¿ Quiere Usted confirmar su pago ?"        ;
	if (lang == 'debfr')    TxtConf = "Souhaitez-vous confirmer votre paiement ?" ;
	if (lang == 'debde')    TxtConf = "Bitte bestätigen Sie Ihre Zahlung"         ;
	if (lang == 'debus')    TxtConf = "Would you like to confirm your payment ?"  ;
	if (lang == 'debqc')    TxtConf = "Souhaitez-vous confirmer votre paiement ?" ;
	if (lang == 'debca')    TxtConf = "Would you like to confirm your payment ?"  ;


// ajouté le 10/10/2001 pour NetGammon
	if (lang == 'nguk')    TxtConf = "Would you like to confirm your payment ?"  ;
	if (lang == 'ngus')    TxtConf = "Would you like to confirm your payment ?"  ;
	if (lang == 'ngit')    TxtConf = "Desiderate confermare il vostro pagamento?";
	if (lang == 'nges')    TxtConf = "¿ Quiere Usted confirmar su pago ?"        ;
	if (lang == 'ngfr')    TxtConf = "Souhaitez-vous confirmer votre paiement ?" ;
	if (lang == 'ngde')    TxtConf = "Bitte bestätigen Sie Ihre Zahlung"         ;
	if (lang == 'ngus')    TxtConf = "Would you like to confirm your payment ?"  ;
	
// ajouté pour prendre en compte la page d'achat par courrier et fax et chèque

  if (arguments[1] == "coufaxchq") 
	{ 
	  formOk = chkForm(lang,'mainform','nom','adr1','cp','ville','eml');
	  // vérifie le formOK
	  if (formOk)
		{ 
		  if (flag == 0)
			{
				//ShowLayer(lang) ;
				setTimeout("document.mainform.submit()",100);
				flag = 1;
			}
	    }
	}
  else
	{
	formOk = chkForm(lang,'mainform','nom','adr1','cp','ville','eml','cardnumber');
	// vérifie le formOK
	if (formOk)
	{ 
		if (confirm(TxtConf)) // demande confirmation
		{
		  if (flag == 0)
			{
				ShowLayer(lang) ;
				setTimeout("document.mainform.submit()",2000);
				flag = 1;
			}
	  }
	}
	}

}


function sendFormMin(lng)
 {
	if (!lng) lng='fr';
	formOk = chkForm(lng,'mainform','nom','adr1','cp','ville','eml');

	if (formOk) {
		if (flag == 0){
			setTimeout("document.mainform.submit()",1000);
			flag = 1;
		}
	}
 }

// FONCTION POUR EFFACER LES BOUTONS DANS ACHLI.ASP
function ShowLayer()
{
	if (navigator.appName == "Microsoft Internet Explorer") 
	{
		if (document.all["cache"])
		{
			//alert (lng)
			var ctn = '<table width="100%" cellPading=0 cellSpacing="0" border="0" id="cache" bgcolor="#003366"  ><tr>';
			ctn += '<td align=center><img src="/fr/images/paiement/veuillez-patienter.gif" alt="Veuillez patienter."></td>';
			ctn += '</tr></table>';
			document.all["cache"].innerHTML = ctn;
			//document.all["cache"].style.visibility = "visible" ;
			
		}
	}
}


function setCookie (name, value)
{
  var ojourdhui  = new Date() ;
  var expiration = new Date() ;
  expiration.setTime(ojourdhui.getTime() + 1000 * 60 * 60 * 24 * 60)
  document.cookie = name + "=" + escape (value) +"; path=/ ; expires=" + expiration.toGMTString();
}

function getCookie(name)
{
  var dcookie = document.cookie; 
  var cname = name + "=";
  var clen = dcookie.length;
  var cbegin = 0;
  
	while (cbegin < clen)
	{
		var vbegin = cbegin + cname.length;
		if (dcookie.substring(cbegin, vbegin) == cname)
		{ 
			var vend = dcookie.indexOf (";", vbegin);
			if (vend == -1)
			{
				vend = clen;
			}
		return (unescape(dcookie.substring(vbegin, vend)));
		}
		cbegin = dcookie.indexOf(" ", cbegin) + 1;
		if (cbegin == 0)
		{
			break ;
		}
	}
	return null;
}

function setCookieArray(name)
{
	this.length = setCookieArray.arguments.length - 1;
  for (var i = 0; i < this.length; i++) 
	{
  	data = setCookieArray.arguments[i + 1]
    setCookie (name + i, data);
  }        
}
    
function getCookieArray(name)
{
	var i = 0;
	while (getCookie(name + i) != null) 
	{
		this[i + 1] = getCookie(name + i);
		i++; this.length = i; 
	}
}

//FONCTIONS DE VERIFICATION DES FORMULAIRES
function chkField(champ)
{
	if(document.obli.length != 0)
	{
		var bool = new Number(0)
		var i=0;
		while( i < document.obli.length)
		{		
			if(champ == document.obli[i])
			{
				if(champ == "email" || champ == "eml" || champ == "destemail")
				{
					var email = document.forms[0].elements[champ].value;
					if (!testEmail(email)) 
					{
						bool += 1;
						alertMsg(champ,'fr');
						break ;
					}
				}
				else if (document.forms[0].elements[champ].name == document.obli[i])
				{
					if (document.forms[0].elements[champ].value == "")
					{
						bool += 1;
						alertMsg(champ,'fr');
						break ;
					}
				} ;	
			} ;
			i++ ;
		} 
	}
	else
	{
		alert("Pas de document.obli") ;
	} ;
	if (bool == 0) 
	{
		return(true) ;
	} 
	else 
	{
		return(false) ;
	} ;
}


function chkForm() 
{
//  	alert("sendForm");

	nbChamp = arguments.length; // compte le nombre de champs renvoyés
	var champ = new Array();
	var flag = true ;
	var start;
	if (nbChamp > 1 ) 
	{ 
		if (arguments[0]=='fr' || arguments[0]=='uk' || arguments[0]=='de' || arguments[0]=='es' || arguments[0]=='it' || arguments[0]=='ca' || arguments[0]=='qc' || arguments[0]=='us') 
		{
			lng = arguments[0];
			formName = arguments[1];
			start = 2 ;
		} 
		else  // Si la langue n'est pas précisée, le français est choisi par defaut ...
		{
			lng = 'fr';
			formName = arguments[0];
			start = 1 ;
		}
	// démarre la vérification en faisant une boucle, si un champ est vide la boucle est arrêtée et un message d'alerte est renvoyé
		if (flag) {
			for ( var a = start ; a < nbChamp ; a++) 
			{
				//alert( arguments[a] );

				if (arguments[a] == 'eml' || arguments[a] == 'email' || arguments[a] == 'destemail') 
				// vérifie si le champs est un email
				{
					var email = document.forms[formName].elements[arguments[a]].value;
				//alert(email);
					if (!testEmail(email)) 
					{
						flag = false;
						alertMsg(arguments[a],lng);
						break;
					}
				}

				if (arguments[a] == 'cardnumber')
				{
					//alert("verif cardnumber");
					document.forms[formName].elements[arguments[a]].value = StrReplace( document.forms[formName].elements[arguments[a]].value ," ","")
				}
				else
				// autres cas de champs
				{
					var valChamp = document.forms[formName].elements[arguments[a]].value;
					valChamp = RemplaceQuote(valChamp)
					if (valChamp == "") 
					{
						flag = false;
						alertMsg(arguments[a],lng);
						break;
					}
				}
				// fin de vérification
			}
		}
	}
	else 
	{
		flag=true;
	}
	return flag;
}
// FONCTION QUI RENVOIE LES MESSAGES D'ERREUR DANS LA SAISIE DES CHAMPS DE FORMULAIRES
function alertMsg(champ,langue) 
{  // Vérifie que le champs appartient à la liste des textes
if (langue == "fr" || !langue || langue == "debfr" || langue == "ngfr" )
	{
		//alert ("fr")
		if (!testChamps(champ)) 
		{
			if (champ ==  "nom")     alert('Vous n\'avez pas saisi votre nom.');
			if (champ ==  "prenom")  alert('Vous n\'avez pas saisi votre prénom.');
			if (champ ==  "objet")   alert('Vous n\'avez pas saisi de sujet.');
			if (champ ==  "eml")     alert('N\'oubliez pas de saisir correctement votre e-mail.');
			if (champ ==  "email")	 alert('Vous n\'avez pas saisi correctement votre e-mail.');
			if (champ ==  "destemail")	 alert('Vous n\'avez pas saisi correctement l\'e-mail du destinataire.');
			if (champ ==  "msg")     alert('Vous n\'avez pas saisi de message.');
			if (champ ==  "adr1")    alert('Vous n\'avez pas saisi votre adresse.');
			if (champ ==  "tel")     alert('Vous n\'avez pas saisi votre numéro de téléphone.');
			if (champ ==  "fax")     alert('Vous n\'avez pas saisi votre numéro de fax.');
			if (champ ==  "cp")      alert('Vous n\'avez pas saisi votre code postal.');
			if (champ ==  "ville")   alert('Vous n\'avez pas saisi votre ville.');
			if (champ ==  "version") alert('Vous n\'avez pas sélectionné votre version.');
			if (champ ==  "type")    alert('Vous n\'avez pas sélectionné le type de votre version.');
			if (champ ==  "modem")   alert('Vous n\'avez pas saisi votre modem.');
			if (champ ==  "driver")  alert('Vous n\'avez pas saisi les drivers.');
			if (champ ==  "cardnumber") alert('Vous n\'avez pas saisi votre numéro de carte bleue.');
			if (champ ==  "logver")  alert('N\'oubliez pas de saisir la version de votre logiciel');
			if (champ ==  "societe") alert('Vous n\'avez pas saisi le nom de votre société.');
			if (champ ==  "soc") alert('Vous n\'avez pas saisi le nom de votre société.');
			if (champ == "fonction") alert('Vous n\'avez pas saisi votre fonction.');
			if (champ == "magazines") alert ('Vous n\'avez pas saisi de magazine(s).');
		 } // il est pas dans la liste des champs :
		else alert('Vous n\'avez pas rempli tous les champs du formulaire.');
	}
	else alertMsg(champ,"fr")
}
// FONCTION QUI TEST LE NOM DES CHAMPS VERIFIES
function testChamps()
{ // La liste des champs qui ont un texte associé
	var ChampArray = new Array("nom","prenom","objet","eml","email","msg","adr1","tel","fax","cp","ville","version","type","modem","driver","cardnumber","logver",'societe','destemail');
  var j = 0 ;
  for (i=0;i < ChampArray.length ;i++)
  { // Si le nom de champs appartient à la liste, on incrémente 
    if (arguments[0] == ChampArray[i]) j++ ;
  }  // et un return.
	
	if (j != 0) 
	{
		return(false)
	} 
	else 
	{
		return(true)
	} ;
}

// Fonction pour remplacer les ' par des ´
function RemplaceQuote(Str)
{
	while (Str.indexOf("'") > 0)
	{
		var IndexQuote = Str.indexOf("'")
		var LeftStr = Str.slice(0,IndexQuote)
		var RightStr = Str.slice(IndexQuote + 1 ,Str.length + 1 )
		Str = LeftStr + "´" + RightStr
	}
	return (Str)
}

// FONCTIONS DE VERIFICATION D'EMAIL
// est LocalPart
function isLocalPart(STR)
{
  if (isDotString(STR))
  {
    return(true) ;
  }
  else
  {
    return(false) ;
  }
}


// est Domaine
function isDomaine(STR)
{
  var POINT = STR.indexOf(".")
  var IncDom = 0 ;
  if (POINT > 0)
  {
    //alert ('IL Y A UN POINT ' + POINT)
		var LeftPart = STR.slice(0,POINT);// alert(LeftPart) ;
    var RightPart = STR.slice(POINT + 1 , STR.length); //  alert (RightPart) ;
    if (!isName(LeftPart)) 
    {
      IncDom++ ; // alert(LeftPart + ' = Left N\'est pas un isName + ' + IncDom)
    }
    if( ! (isDomaine(RightPart) || isString(RightPart)) )
    {
      IncDom++; // alert(RightPart + ' = Right Part n\'est pas un isName' + IncDom)
    }
  }
  else 
  {
    IncDom++ ; // alert ( STR + 'N\' est pas isName' + IncDom)
  }
  if (IncDom == 0)
  {
    return(true) ;
  }
  else
  {
    return(false) ;
  }
}

// est ldh-str
	function isLdhStr(CAR)
{
  if (!(isLetDigHyp(CAR)))
	{
	  return(false) ;
	}
	else
	{
	  return(true) ;
	}
}

// est let-Dig-Hyp
function isLetDigHyp(CAR)
{
  //  alert('entre dans isLetDigHyp(CAR)')
  if (!(isA(CAR) || isD(CAR) || (CAR == "-")))
  {
    // alert ('pas bon...') ;
    return(false)
  }
  else
  {
    // alert("Cool ! Le char est une lettre, un chiffre ou un \"-\"") ;
    return(true)
  }
}
// est un nombre ou une lettre [a..z] && [A..Z]
function isLetDig(CAR)
{
  if (!(isA(CAR) || isD(CAR)) )
  {
    return(false)
  }
  else
  {
    return(true)
  }
}

// est un Name
function isName(STR)
{
	var IncName = 0 ;
  // Vérifie que le 1er caractère de la chaine sont des [A..Z] ou [a..z]
	  if (! ( isC( STR.charAt(0) ) ) )
		{
			IncName++ ; //alert(IncName + ' ' + STR.charAt(i) + ' n\'est pas un A ')
		}
  // Vérifie que les caractères suivants sont des [a..z] || [A..Z] || [0..9] || "-"
  for (var IndName=1 ; IndName < STR.length ; IndName++)
  {
     if (! isLetDigHyp(STR.charAt(IndName)))
     {
       IncName++ ; //alert(IncName + ' ' + STR.charAt(i) + ' n\'est pas un LetDigHyp ')
     } 
  }
  // vérifie que l'incrément est nul
  if (IncName == 0)
  {
    return(true)
  }
  else
  {
    return(false)
  }
}

// est une Chaine de caractères
function isString(STR)
{
  // alert('entre dans isString');
  var IncStr = 0 ;
	// alert("STR.length dans isString = " + STR.length);
  // vérifie chaque caractère de la chaine STR
	for (var IndStr=0; IndStr < STR.length ; IndStr++)
  {
		if (! (isC(STR.charAt(IndStr))) ) 
    {
      IncStr++ ; 
    }
  }
	// test final
  if (IncStr == 0 )
  {
    return(true) ;
  }
  else
  {
    return(false) ;
  }
}

// est Dot-String
function isDotString(STR)
{
  var POINT = STR.indexOf(".");
  if (POINT > 0 )
  {
    var LeftPart = STR.slice(0,POINT);
    var RightPart = STR.slice(POINT + 1,STR.length);
    if ((isString(LeftPart)) && (isDotString(RightPart)))
    {
      return(true)
    }
    else
    {
      return(false)
    }
  }
  else
	{
    if (isString(STR))
    {
      return(true) ;
    }
		else 
		{
		  return(false) ;
		}
  } 
}



// est un caractère [a..z] | [A..Z] 
function isA(CAR)
{
  // alert ("entredans isA(CAR)")
  if (((CAR >= "a") && (CAR <= "z")) ||  ((CAR >= "A") && (CAR <= "Z")))
  {
    // alert ("Le car est une lettre");
    return(true) ;
  }
  else
  {
    // alert ("Le car "+ CAR +"n'est pas une lettre");
    return(false)
  }
}

// Est un caractère Ascii 128 - (special && sp) ?
function isC(CAR)
{
  var IncC = 0;
  if ( (CAR.charCodeAt(0) == 127) || (CAR.charCodeAt(0) < 32) )
  {
    IncC++ ;
  }
  if (!isNotSpecial(CAR))
  {
    IncC++ ;
  }
  if ( IncC == 0) 
  {
    return(true)
  }
  else
  {
    return(false)
  }  
}

// est un caractère spécial ?
function isNotSpecial(CAR)
{
  // La liste des caractères spéciaux
  var Special = new Array("<",">","(",")","[","]","\\",".",",",";",":","#"," ","'","\"")
  // init des Incréments
  var IncSpecial = 0 ;
  var IncAutre = 0 ;
  for(var IndSpe=0;IndSpe < Special.length ; IndSpe++)
  {
		if (CAR == Special[IndSpe])
    {
      IncSpecial++ ;
    }
  }
	IncAutre+= IncSpecial ;
  if (IncAutre > 0) 
  {
    return(false) ; 
  }
  else
  {
    return(true) ;
  }
}

// est un Chiffre [0..9]
function isD(CAR)
{
  // alert("entre dans isD")
  if ((CAR >= "0") && (CAR <= "9")) 
  {
		return(true)
  } 
  else
  {  
		return(false)
  }
}


// est une adresse email

function testEmail(chaine)
{
  // prépare es variables
  var IncEmail = 0 ;
	chaine = chaine.toLowerCase() ;
	var Arobace = chaine.indexOf("@") ;
	// Commence les tests : Arobace présente et pas en premier
	if (Arobace > 1 )
	{
    var LocalPart = chaine.slice(0,Arobace) ;
    var Domaine = chaine.slice(Arobace + 1,chaine.length) ;
    if ( !(isLocalPart(LocalPart)) || !(isDomaine(Domaine)) )
    {
      IncEmail++ ;
    }
  }
	else IncEmail++ ;
	if (IncEmail == 0) 
	{
	  return(true)
	}
	else
	{
	  return(false)
  }
}