var objTextPopup = null;
function TextPopup(heading, msg, size)
//Open a text popup.
//Typical usage:  onCLick="TextPopup('Heading', 'Message', 1)"
//Parameters:
//  heading = a H3 style heading. If blank, the message starts on the first line.
//  msg = the body of the popup text.
//  size = multiply the windows dimensions	{	var s1 = "<title>" + "Astr&eacute;e" + "</title>"
{	var s2 = "<body>"
	var sz = 1
	if (heading != ""){s2 = s2 + "<h3>" + heading + "</h3>"}
	if (size > 1){sz = size}
	objTextPopup = window.open("", "Tpopup", "status=no,scrollbars=yes,resizable= yes,width=" + (200 * sz) + ",height=" + (160 * sz))
	objTextPopup.document.write(s2 + msg)
	objTextPopup.document.bgColor="ffffe0"
	objTextPopup.document.close()
	objTextPopup.focus()
	//window.event.cancelBubble = true
	//window.event.returnValue = false
}
//****************************************************************
function GoToPage(inc)
//Go to the next/previous/first page
//Typical usage:  onCLick="GoToPage(1)" 
//Parameters: inc =  -1 previous, 0 first, 1 next
{	var base = null
	var n = 0
	var u_orig = window.location.href
	var u = u_orig.substring(0, u_orig.lastIndexOf("."))
	// remove .html
	var i = u.lastIndexOf("_")
	//alert(i)
	if (i == -1) 
	{	alert(u_orig + " est un nom invalide.")}
	else
	{	base = u.substring(0, i + 1)
		n = u.substring(i + 1)
		// alert(base + "----" + n)
		if(inc == 0) 
		{	n = 1}
		else
		{	n = parseInt(n) + inc}
		if (n == 0)
		{	alert("Vous êtes au d&eacute;but du chapitre.")}
		else
		// if the last link -2 is Fin, there are 2 in the library copyright
		{ if ((inc == 1) && (document.links[document.links.length -3].name == "Fin"))
			{	alert("Vous êtes &agrave la fin du chapitre.")}
			else
			{	u = base + n + ".html#"
				window.location.href = u
			}
		}
	}
}
//****************************************************************
function SetCookie(cookieName,cookieValue,nDays) {
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=1;
 expire.setTime(today.getTime() + 3600000*24*nDays);
 document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();
}
function ReadCookie(cookieName) {
 var theCookie=""+document.cookie;
 var ind=theCookie.indexOf(cookieName);
 if (ind==-1 || cookieName=="") return ""; 
 var ind1=theCookie.indexOf(';',ind);
 if (ind1==-1) ind1=theCookie.length; 
 return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}
//********************************************************