// utilisé par main.htm, agrandissement.htm

// setCookie()
// getCookie()
// register()
// testCookie()
// affiche_image2()
// cree_mosaique()
// agr()
// menu_bas()


function setCookie(name, value, expire)
{
  document.cookie = name + "=" + escape(value) + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
}

function getCookie(Name)
{
  var search = Name + "=";
  if (document.cookie.length > 0) // if there are any cookies
 {
    offset = document.cookie.indexOf(search)
    if (offset != -1)  // if cookie exists 
   {
     offset += search.length;   // set index of beginning of value
     end = document.cookie.indexOf(";", offset);     // set index of end of cookie value
     if (end == -1)   end = document.cookie.length;
     return unescape(document.cookie.substring(offset, end));
   }
  }
 return null;
}

function register( nom, valeur )
{
  var today = new Date();
  var expires = new Date();
  expires.setTime(today.getTime() + 1000*60*60*24);
  setCookie(nom, valeur, expires);
}

function testCookie()
{
  register( "test", 0 );
  return( getCookie("test") );
}


// utilisé par benoitdavid.net/photo/repertoire/agrandissement.htm
// désuet depuis création de 2e page sur main.htm
function affiche_image2()
{
  ligne = "<img src=\"" + oeuvre[num][1] + ".jpg\" border=\"" + oeuvre[num][5] + "\" hspace=\"0\"";
  if( oeuvre[num][5] != null ) ligne = ligne + " width=\"" + oeuvre[num][6] + "\" height=\"" + oeuvre[num][7] + "\"";
  ligne = ligne +">";
  document.write(ligne);
}



// origine: benoitdavid.net/peinture/accueil.htm
// utilisé par benoitdavid.net/photo/repertoire/main.htm
function cree_mosaique()
{
  largeur = 5;
  hauteur = 3;
  nitems = hauteur * largeur;
  ver_cookies = 0;
  if( testCookie() == null ) { ver_cookies = 1; alert("Vous devez accepter les cookies pour voir cette page."); } // le client n'accepte pas les cookies

  document.write( "<table cellspacing='1px' cellpadding='0px'><tr>" );

  for(n=0; n<nitems; n++)
  {
    if( n%largeur == 0 && n != 0 ) document.write( "</tr><tr>" );

    document.write( "<td align='center' valign='center' width='80px' height='90px'>" );

     ni = n+1;
     if( ni < 10 ) num = "0" + ni;
     else num = ni;

    if( oeuvre[n] == null )
    {
     chaine = "<img src='../spacer.gif' border='0'>";
     document.write( chaine );
    }

    else
    {
     if( ver_cookies == 1 )
       extension = "php?numero=" + n + "'";
     else
       extension = "htm' onClick=\"register('numero'," + n + ")\"";
     nom = "c" + n;
     chaine = "<img src='" + oeuvre[n][1] + "s.jpg' border='1' name='" + nom + "' onClick=\"agr(" + n + ")\" style='cursor:hand' />";
     document.write( chaine );
    }

    document.write( "</td>" );
  }

  document.write( "</tr></table>" );

}


// utilisé par cree_mosaique()
function agr( n )
{
  document.agrandissement.src = oeuvre[n][1] + ".jpg";
  document.formulaire.legende.value = oeuvre[n][0] + " - " + oeuvre[n][2] + " - " + oeuvre[n][3];

}


function menu_bas( pref )
{
  document.write( "<span style='position:absolute; left:122; top:527; font-size:8pt; font-weight:normal;color:black; text-align:center; width:760px;background:#eeeeee'><a href='" + pref + "cris/main.htm'>cris</a> - <a href='" + pref + "nouveauxcris/main.htm'>nouveaux cris</a> - <a href='" + pref + "dernierscris/main.htm'>derniers cris</a> - <a href='" + pref + "adam/main.htm'>adam</a> - <a href='" + pref + "esclaves/main.htm'>esclaves</a> - <a href='" + pref + "christ/main.htm'>christ</a> - <a href='" + pref + "porteurs/main.htm'>porteurs</a> - <a href='" + pref + "foules/main.htm'>foules</a> - <a href='" + pref + "acrobates/main.htm'>acrobates</a> - <a href='" + pref + "chauves-souris/main.htm'>chauves-souris</a> - <a href='" + pref + "mutants/main.htm'>mutants</a> - <a href='" + pref + "martyrs/main.htm'>martyrs</a></span>" );
}

