function rotation_bannieres()
{
code_html = '<a href="'+liens[chiffre]+'"><img border="0" src="'+pictures[chiffre]+'"></a>';
document.getElementById("zone_bannieres").innerHTML = code_html;
	if(chiffre == longueur)
        { chiffre = 0; }
        else
        { chiffre++; }
	changement = 1;
//durée d'affichage d'une bannière en secondes
window.setTimeout("rotation_bannieres()", (changement*4500));
}

function rotation_bannieres_thematiques()
{
code_html = '<img border="0" src="'+pictures_thematiques[chiffre]+'">';
document.getElementById("zone_bannieres_thematiques").innerHTML = code_html;
	if(chiffre == longueur_thematiques)
        { chiffre = 0; }
        else
        { chiffre++; }
	changement = 1;
//durée d'affichage d'une bannière en secondes
window.setTimeout("rotation_bannieres_thematiques()", (changement*3500));
}



/*
http://www.espacejavascript.com
*/
pictures = new Array()
pictures[0] = 'images/image_accueil_1.png';
pictures[1] = 'images/image_accueil_6.png';
pictures[2] = 'images/image_accueil_7.png';
pictures[3] = 'images/image_accueil_8.png';
longueur = pictures.length-1;

pictures_thematiques = new Array()
pictures_thematiques[0] = 'images/Bannieres_thematique_B1.jpg';
pictures_thematiques[1] = 'images/Bannieres_thematique_B2.jpg';
pictures_thematiques[2] = 'images/Bannieres_thematique_B3.jpg';
longueur_thematiques = pictures_thematiques.length-1;

liens = new Array()
liens[0] = 'http://www.itiforums.com/accueil.php?choix=RECHERCHE';
liens[1] = 'http://www.itiforums.com/accueil.php?choix=RECHERCHE';
liens[2] = 'http://www.itiforums.com/accueil.php?choix=RECHERCHE';
liens[3] = 'http://www.itiforums.com/accueil.php?choix=RECHERCHE';
chiffre = 0;

function afficher_flottant(element)
{
document.getElementById(element).style.display = 'block';
}
function cacher_flottant(element)
{
document.getElementById(element).style.display = 'none';
}
function choix_actif(element)
{
document.getElementById(element).className = 'menu_navigation_actif';
}
function choix_inactif(element)
{
document.getElementById(element).className = 'menu_navigation_inactif';
}

function ouvre_popup(page) {
       window.open(page,"IConnect","menubar=yes, status=yes, resizable=yes, scrollbars=yes, menubar=yes, width=1050, height=750");
}

function str_repeat(i, m) { for (var o = []; m > 0; o[--m] = i); return(o.join('')); }

function sprintf () {
  var i = 0, a, f = arguments[i++], o = [], m, p, c, x;
  while (f) {
    if (m = /^[^\x25]+/.exec(f)) o.push(m[0]);
    else if (m = /^\x25{2}/.exec(f)) o.push('%');
    else if (m = /^\x25(?:(\d+)\$)?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(f)) {
      if (((a = arguments[m[1] || i++]) == null) || (a == undefined)) throw("Too few arguments.");
      if (/[^s]/.test(m[7]) && (typeof(a) != 'number'))
        throw("Expecting number but found " + typeof(a));
      switch (m[7]) {
        case 'b': a = a.toString(2); break;
        case 'c': a = String.fromCharCode(a); break;
        case 'd': a = parseInt(a); break;
        case 'e': a = m[6] ? a.toExponential(m[6]) : a.toExponential(); break;
        case 'f': a = m[6] ? parseFloat(a).toFixed(m[6]) : parseFloat(a); break;
        case 'o': a = a.toString(8); break;
        case 's': a = ((a = String(a)) && m[6] ? a.substring(0, m[6]) : a); break;
        case 'u': a = Math.abs(a); break;
        case 'x': a = a.toString(16); break;
        case 'X': a = a.toString(16).toUpperCase(); break;
      }
      a = (/[def]/.test(m[7]) && m[2] && a > 0 ? '+' + a : a);
      c = m[3] ? m[3] == '0' ? '0' : m[3].charAt(1) : ' ';
      x = m[5] - String(a).length;
      p = m[5] ? str_repeat(c, x) : '';
      o.push(m[4] ? a + p : p + a);
    }
    else throw ("Huh ?!");
    f = f.substring(m[0].length);
  }
  return o.join('');
}


function ord (string) {
    var str = string + '';
    
    var code = str.charCodeAt(0);
    if (0xD800 <= code && code <= 0xDBFF) { // High surrogate (could change last hex to 0xDB7F to treat high private surrogates as single characters)
        var hi = code;
        if (str.length === 1) {
            return code; // This is just a high surrogate with no following low surrogate, so we return its value;
                                    // we could also throw an error as it is not a complete character, but someone may want to know
        }
        var low = str.charCodeAt(1);
        if (!low) {
            
        }
        return ((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;
    }
    if (0xDC00 <= code && code <= 0xDFFF) { // Low surrogate
        return code; // This is just a low surrogate with no preceding high surrogate, so we return its value;
                                // we could also throw an error as it is not a complete character, but someone may want to know
    }
    return code;
}


function encode(chaine)
{
	uid='';
	for (i=0;i<chaine.value.length;i++)
		uid=uid+sprintf("%02x",ord(chaine.value.charAt(i)));
		
	return uid;
};

