function getModificationDate() {
  return document.lastModified;
}

function getFullDate()
{
	var dayNames = new Array(6);
	dayNames[0] = "Dimanche";
	dayNames[1] = "Lundi";
	dayNames[2] = "Mardi";
	dayNames[3] = "Mercredi";
	dayNames[4] = "Jeudi";
	dayNames[5] = "Vendredi";
	dayNames[6] = "Samedi";
	
	var monthNames = new Array(11);
	monthNames[0] = "janvier";
	monthNames[1] = "février";
	monthNames[2] = "mars";
	monthNames[3] = "avril";
	monthNames[4] = "mai";
	monthNames[5] = "juin";
	monthNames[6] = "juillet";
	monthNames[7] = "août";
	monthNames[8] = "septembre";
	monthNames[9] = "octobre";
	monthNames[10] = "novembre";
	monthNames[11] = "décembre";
	
	var now = new Date();
	var day = now.getDay();
	var month = now.getMonth();
	var year = now.getFullYear();
	var date = now.getDate();
	
	thedate = dayNames[day] + ", " + date + " " + monthNames[month] + " " + year;
	return thedate;
}

function breadcrumbs(){
  sURL = new String;
  bits = new Object;
  var x = 0;
  var stop = 0;
  var skip = 0;
  var output = '<span class="bread">';
  output += "<a href=\"../index.php\">Home</a>&nbsp;&#187;&nbsp;";
  sURL = location.href;
  sURL = sURL.slice(8,sURL.length);
  chunkStart = sURL.indexOf("/");
  sURL = sURL.slice(chunkStart+1,sURL.length)
  while(!stop){
    chunkStart = sURL.indexOf("/");
    if (chunkStart != -1){
      bits[x] = sURL.slice(0,chunkStart)
      sURL = sURL.slice(chunkStart+1,sURL.length);
    }else{
      stop = 1;
    }
    x++;
  }
  for(var i in bits){
    if (i>=skip){
      output += "<a href=\"";
      for(y=1;y<x-i;y++){
        output += "../";
      }
    output += bits[i] + "/index.php\">" + bits[i] + "</a>&nbsp;&#187;&nbsp;";
    }
  }
  document.write(output + document.title + "</span>");
}

function RoundNumber(num, nr_dec)
{
  if (nr_dec > 0)
  {
    if ((num.toString().length - num.toString().lastIndexOf('.')) > (nr_dec + 1))
    {
      var rounder = Math.pow(10, nr_dec);
      var rounded = Math.round(num * rounder) / rounder;
      return rounded;
    }
    else
      return num;
  }
  else
    return num;
}

function Trim(s) 
{
  // Remove leading spaces and carriage returns
  while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r'))
  { s = s.substring(1,s.length); }

  // Remove trailing spaces and carriage returns
  while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r'))
  { s = s.substring(0,s.length-1); }

  return s;
}

function CelsiusToFahrenheit(temp_fah)
{
  if ((!isNaN(temp_fah)) && (Trim(temp_fah)!=''))
  {
    temp_cel = (temp_fah * 9 / 5) + 32;
    temp_cel = RoundNumber(temp_cel,2);
    return temp_cel;
  }
  else
    return "Erreur";
}

function FahrenheitToCelsius(temp_cel)
{
  if ((!isNaN(temp_cel)) && (Trim(temp_cel)!=''))
  {
    temp_fah = (temp_cel - 32) * 5 / 9
    temp_fah = RoundNumber(temp_fah,2);
    return temp_fah;
  }
  else
    return "Erreur";
}

function setCookie(name, value, expires, path, domain, secure)
{
/**
 * Sets a Cookie with the given name and value.
 *
 * name       Name of the cookie
 * value      Value of the cookie
 * [expires]  Expiration date of the cookie (default: end of current session)
 * [path]     Path where the cookie is valid (default: path of calling document)
 * [domain]   Domain where the cookie is valid
 *              (default: domain of calling document)
 * [secure]   Boolean value indicating if the cookie transmission requires a
 *              secure transmission
 */
   var todayDate = new Date();
   todayDate.setDate(todayDate.getDate() + expires);
 
   document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + todayDate.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

function getCookie(name)
{
/**
 * Gets the value of the specified cookie.
 *
 * name  Name of the desired cookie.
 *
 * Returns a string containing value of specified cookie,
 *   or null if cookie does not exist.
 */
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

function deleteCookie(name, path, domain)
{
/**
 * Deletes the specified cookie.
 *
 * name      name of the cookie
 * [path]    path of the cookie (must be same as path used to create cookie)
 * [domain]  domain of the cookie (must be same as domain used to create cookie)
 */
    if (getCookie(name))
    {
        document.cookie = name + "=" + 
            ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") +
            "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}

function enlargeImage($ImgName)
{
 if (document.images)
  {
  aImage = document.images[$ImgName].src;
  myWindow = window.open(aImage,"theWindow","width=500, height=500, left=100, top=150, toolbar=no, status=no, menubar=no, scrollbars=no, resizable=no");
  myWindow.focus();
  }
}

