
/*=================================================================
	Purpose: Creates or modifies the value assigned to a given variable.
	Inputs:  strVariableName:  The name of the variable that will have its value set.
	         varVariableValue: The value that strVariableName should be set to.
	Notes:   This function could be expanded to include other
	         cookie attributes, such as expire date or valid
	         domains.  Cookies set with this implementation expire
	         at the end of the user's session.  If the cookie
	         should remain valid for a longer period of time,
	         an expires section can be added to the string:
	         varVariableName+';expires=01-Jan-10 GMT'
==================================================================*/
function SetVariable(strVariableName, varVariableValue) {
     document.cookie = strVariableName+'='+varVariableValue;
}

/*=================================================================
	Purpose: Delete the variable with the name held in strVariableName
	Inputs:  strVariableName:  The name of the variable to delete  		      
	Notes:   The cookie is deleted by setting the expires attribute to
	         a date that has already occurred.  If one went back time,
	         this method would break, so be sure to take that into account.
==================================================================*/
function KillVariable(strVariableName) {
 	SetVariable(strVariableName, 'NULL;expires=Monday, 01-Jan-95 12:00:00 GMT');
}

/*=================================================================
	Function: ReadVariable
	Purpose: Finds and returns the value of of the variable with
	         the name held in strVariableName
	Inputs:  strVariableName:  The name of the variable to return the value of.
	Returns: The value of the variable with the name of strVariableName.
	         If the variable is not found, returns "".
	Notes:   This function could be greatly simplified if the bounds-checking code was removed.
==================================================================*/
function ReadVariable(strVariableName) {
	intLocation = document.cookie.indexOf(strVariableName+'=');
	if (intLocation < 0) { return(""); }
	else {
	    strTemp = document.cookie.substring(intLocation+strVariableName.length+1,document.cookie.length);
		intNextSemicolon = strTemp.indexOf(";");
		if (intNextSemicolon >= 0) {
			return(strTemp.substring(0,intNextSemicolon));
			}
		else {
			return(strTemp);
		}
	}
}

/*=================================================================
	Function: ShowTooltip
	Purpose:  position, draw, and display tooltip element 
	Input:    fArg - indexes text array to display
	Comment:  Use onmouseover="ShowTooltip(x);" as control properties to use this
==================================================================*/
function ShowTooltip(fArg,extracond) {
	var tooltipOBJ = eval("document.all['tt" + fArg + "']");
	var tooltipOffsetTop = tooltipOBJ.scrollHeight + 35;
	var testTop = (document.body.scrollTop + event.clientY) - tooltipOffsetTop;
	var testLeft = event.clientX - 310;
	var tooltipAbsLft = (testLeft < 0) ? 10 : testLeft;
	var tooltipAbsTop = (testTop < document.body.scrollTop) ? document.body.scrollTop + 10 : testTop;
	if (extracond == "") {
		tooltipOBJ.style.posLeft = tooltipAbsLft;
		tooltipOBJ.style.posTop = tooltipAbsTop;
		tooltipOBJ.style.visibility = "visible";
	}
}

/*=================================================================
	Function: HideTooltip
	Purpose:  set visibility attribute of tooltip to hidden
	Comment:  Use onmouseout="HideTooltip(x);" as control properties to use this
==================================================================*/
function HideTooltip(fArg) {
	var tooltipOBJ = eval("document.all['tt" + fArg + "']");
	tooltipOBJ.style.visibility = "hidden";
}

/*=================================================================
	Function: LastRevisionLastAccess
==================================================================*/
function LastRevisionLastAccess() {
	var lastmod = new Date(document.lastModified);
	if (lastmod.getDate() > 0) {
		if (lastmod.getDate()<10) zerod="0"
		else zerod="";
		if (lastmod.getMonth()<9) zerom="0"
		else zerom=""
		year2kok=lastmod.getYear();
		if (year2kok<100) year2kok+=2000;
		if ((year2kok>=100) && (year2kok < 1970)) year2kok+=1900;
		document.writeln("Derni&egrave;re r&eacute;vision: "+zerod+lastmod.getDate()+"/"+zerom+(lastmod.getMonth()+1)+"/"+year2kok+" - ");
	}
	if (ReadVariable("Last_access") != "") {
		document.writeln("Dernier acc&egrave;s: " + ReadVariable("Last_access"));
	}
	
	var date = new Date();
	date.setYear(2005);
	var expires = date.toGMTString();
	var today = new Date();
	if (today.getDate()<10) zerod="0"
	else zerod="";
	if (today.getMonth()<9) zerom="0"
	else zerom=""
	year2kok=today.getYear();
	if (year2kok<100) year2kok+=2000;
	document.cookie="Last_access="+zerod+today.getDate()+"/"+zerom+(today.getMonth()+1)+"/"+year2kok+"; expires="+expires;
}
