

//** a virer plus tard agenda_sommaire et starttimer()

var timeoutID;
var timeoutStop = 0;
var timeclignoteur;
var sommaire_top = 0;
var ws = 0;

function isMobile(){ 
  var device = [ "mobile","iphone","ipod","nokia","android","windows ce","blackberry","opera mobile","opera mini","palm","acer","alcatel","audiovox","cdm","ericsson","lg\b","lge","motorola","nec","panasonic","qci","sagem","samsung","sanyo","sharp","sonyericsson","tsm","series60","symbian","avantgo","mazingo","t68","syncalot","blazer"];
  var uagent = navigator.userAgent.toLowerCase();

  for (i=0; i<(device.length-1); i++) {
    if (uagent.search(device[i]) > -1)
      return true;
  };
  return false;
};


function resize() {
  var wi = 2048; var hi = 250; //** la taille du flash original
  var wmini = 840; //** la taille mini pour mobile
  var hs = 0;  
  var ID_main;
  var ID_bandeau;
  var ID_theimg;
  var lmobile = isMobile();

  if ( (ws == 0) || (lmobile == false) ) {
    ID_main = window.document.getElementById("main");
    ID_bandeau = window.document.getElementById("bandeau");
    ID_theimg = window.document.getElementById("theimg");

    //** on prend la taille de l'écran
    ws = ( (window.document.body.clientWidth) ? (window.document.body.clientWidth-2) : (window.innerWidth-26) );

    //** si mobile et < wmini on met taille perso
    if ( (lmobile == true) && (ws < wmini) ) {
      ws = wmini;
    };
          
    //** on fixe la taille au div principal, le contenu est deja à 100%
    ID_main.style.width = ws;

    //** hauteur images et flash 
    hs = (hi*(ws/wi));

    //** le flash ou l'image prennent la hauteur, 100% en largeur.
    ID_bandeau.style.height = hs;

    //** top flèche pour remonter
    sommaire_top = hs+10;

    //** décale la 1ère ligne du tableau de la hauteur du flash
    ID_theimg.height = sommaire_top;
  };
};

function placeLayer() {
  ie4 = window.document.all
  ns6 = window.document.getElementById&&!window.document.all
  ns4 = window.document.layers
  if (ie4) {sommaire.style.pixelTop = window.document.body.scrollTop+sommaire_top}
    else if (ns6) {window.document.getElementById("sommaire").style.top = window.pageYOffset+sommaire_top}
      else if (ns4) {eval(window.document.sommaire.top = eval(window.pageYOffset+sommaire_top));}
};

function OpenNoMenu(src) {
 open(src,'DisplayWindow','scrollbars=yes,resizable=yes,width=600,height=400');
};

function demarrage() {
  resize();
  placeLayer();
};

function MakeParentDiv(todiv) {
  parent.document.getElementById(todiv).innerHTML = window.document.body.innerHTML;
};

function agendatimer() {
  var f = window.document.getElementById('agendasommaire');
  f.src = f.src;
  //window.frames['agendasommaire'].location.reload;
  if (timeoutStop == 0) {
    timeoutID = window.setTimeout("agendatimer()",9000);
  };
};

function starttimer() {
  timeoutStop = 0;
  agendatimer();
  clignotement();
};

function stoptimer() {
  window.clearTimeout(timeoutID);
  timeoutStop = 1;
};

function ShowVideo(sVideo) {
  var w = 480;
  var h = 385;
    window.document.write('<p align=center>');
    window.document.write('<object width="'+w+'" height="'+h+'">');
    window.document.write('<param name="movie" value="'+sVideo+'"></param>');
    window.document.write('<param name="allowFullScreen" value="true"></param>');
    window.document.write('<param name="allowscriptaccess" value="always"></param>');
    window.document.write('<embed src="'+sVideo+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'+w+'" height="'+h+'"></embed>');
    window.document.write('</object>');
    window.document.write('</p>');
    window.document.write('<br>');
};

function clignotement() {
  var e = window.document.getElementById("clignoteur");
  if (e.style.visibility=="visible") {
    e.style.visibility="hidden";
    timeclignoteur = window.setTimeout("clignotement()",400);
  } 
  else {
    e.style.visibility="visible";
    timeclignoteur = window.setTimeout("clignotement()",2000);
  };
};

