
	//Affichage du formulaire d'identification

	function IdLogin(){
	GetCookieValue (GetCookie ("sessionkey"));

	if (oCurrentCookie.sessionkey == 'na' || oCurrentCookie.sessionkey == 'deleted' ){
		document.write ('<form action=\"/cgi-bin/Identification\" name=\"idlogin\" method=\"POST\" tmt:validate=\"true\" tmt:callback=\"errorOnLabels\">');
		document.write ('<input type=\"hidden\" name=\"Commande\" value=\"email\" />');
		document.write ('<input type=\"hidden\" name=\"language\" value=\"fr\" />');
		document.write ('<input type=\"hidden\" name=\"pageloc\" value=\"' + currPage + '\" />');
		document.write ('<input type=\"hidden\" name=\"category\" value=\"inscription\" />');
		document.write ('<input type=\"hidden\" name=\"pagedyn\" value=\"gestion_login\" />');
		document.write ('<p><label for="email">Entrez votre adresse courriel&nbsp;:</label></p>');
		document.write ('<input class=\"x06\" type=\"text\" name=\"email\" value=\"\" tmt:required=\"true\" tmt:errorclass=\"invalid\" tmt:message=\"L\'adresse de courriel semble inexacte. Elle doit avoir le format: nom@server.com\" tmt:pattern=\"email\">&nbsp;');
		document.write ('<input class=\"button\" type=\"submit\" value=\"OK\" /><br>');
		document.write ('</form>');
		document.write ('<p>D&eacute;couvrez les avantages de <a href="/fr/membres/" title="devenir membre du CEFRIO">devenir membre du CEFRIO</a>.</p>');
	}
	else {
		document.write('<b>Bonjour ' + oCurrentCookie.prenom + ' ' + oCurrentCookie.nom + "</b><br/>" );
		document.write('&raquo;&nbsp;<a href="/cgi-bin/GestionProfil?Commande=select&category=inscription&language=fr&pk_profil=' + oCurrentCookie.pkprofil + '&sessionkey=' + oCurrentCookie.sessionkey +'&fk_membership_type=' + oCurrentCookie.memType +'">Modifiez votre profil</a><br/>');
		document.write('&raquo;&nbsp;<a href="javascript:logout(\'sessionkey\',\'fr\',currPage);">Fermez votre session</a>');	
		}
	}
		
var url = "/" ;
var expDays = 360;
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function getCookieVal (offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
	endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {

	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) 
	{
	   var j = i + alen;
	   if (document.cookie.substring(i, j) == arg)
	      return getCookieVal (j);
	i = document.cookie.indexOf(" ", i) + 1;
	if (i == 0) break;
	}
	return null;
}

function SetCookie (name, value ) {

	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) +
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
	((path == null) ? "" : ("; path=" + path)) +
	((domain == null) ? "" : ("; domain=" + domain)) +
	((secure == true) ? "; secure" : "");
}

function DeleteCookie (name) {
	//var exp = new Date();
	//exp.setTime (exp.getTime() - 10 );
	//var cval = GetCookie (name);
	document.cookie = name + "=deleted; path=/; expires Thu, 01-Jan-1970 00:00:00 GMT";
}

function WriteCookies ( nom1, val1, nom2, val2, nom3, val3, nom4, val4 ) {

	SetCookie(nom1 , val1 , exp, '/cgi-bin/') ;
	SetCookie(nom2 , val2 , exp, '/cgi-bin/') ;
	SetCookie(nom3 , val3 , exp, '/cgi-bin/') ;
	SetCookie(nom4 , val4 , exp, '/cgi-bin/') ;
}

function DeleteCookies ( nom1, nom2, nom3, nom4 ) {

	DeleteCookie(nom1) ;
	DeleteCookie(nom2) ;
	DeleteCookie(nom3) ;
	DeleteCookie(nom4) ;
}

function SetMemType ( memType )
{
   this.memType = memType ;
}

function SetNom ( nom )
{
   this.nom = nom ;
}

function SetPrenom ( prenom )
{
   this.prenom = prenom ;
}

function SetEmail ( email)
{
   this.email = email;
}

function SetSessionKey ( sessionkey )
{
   this.sessionkey = sessionkey ;
}

function SetPkProfil ( pkprofil )
{
   this.pkprofil = pkprofil ;
}

function SetCRC ( crc )
{
   this.crc = crc ;
}

function SetT ( t )
{
   this.t = t ;
}


function MyCookie ( nom, prenom, email, sessionkey, pkprofil, crc, t, memType )
{
   this.memType = memType ;
   this.nom = nom ;
   this.prenom = prenom ;
   this.email  = email ;
   this.sessionkey = sessionkey ;
   this.pkprofil = pkprofil ;
   this.crc = crc ;
   this.t = t ;

   this.SetMemType = SetMemType ;
   this.SetNom = SetNom  ;
   this.SetPrenom = SetPrenom  ;
   this.SetEmail = SetEmail ;
   this.SetSessionKey = SetSessionKey  ;
   this.SetPkProfil   = SetPkProfil   ;
   this.SetCRC = SetCRC ;
   this.SetT = SetT ;

}

//var oCurrentCookie = new MyCookie ( "", "", "", "na", "", "", "", "" ) ;

function GetCookieValue ( valeur )
{
 if ( valeur != null )
  {
   var tab = valeur.split ( "|" ) ;
   oCurrentCookie.SetSessionKey ( tab [ 0 ] ) ;
   oCurrentCookie.SetPkProfil   ( tab [ 1 ] ) ;
   oCurrentCookie.SetPrenom     ( tab [ 2 ] ) ;
   oCurrentCookie.SetNom        ( tab [ 3 ] ) ;
   oCurrentCookie.SetMemType    ( tab [ 4 ] ) ;
  }
   else
   {
     oCurrentCookie.SetSessionKey ( "na" ) ;
     oCurrentCookie.SetEmail ( "na" ) ;
   }
return tab;
}



	

