var timeoutID;

function ismobile(){ 
  var device = [ "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"];
  var uagent = navigator.userAgent.toLowerCase();

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

function resize() {
  //** la taille du flash original
  var txtmobile = "";
  var wi = 2048;
  var hi = 250; //305;
  var ID_main = document.getElementById("MAIN");
  var ID_bandeau = document.getElementById("bandeau");
  var ID_img = document.getElementById("img");

  //** si mobile on change taille
  if( ismobile() ) {
    txtmobile = "-";
    ws = 1024;
    //** le div main
    ID_main.style.width = ws;
  }
  else {
    //** FireFox
    if ("Netscape" == navigator.appName) {
      ws=innerWidth-24;
      //hs=innerHeight;
    }
    //** "Microsoft Internet Explorer"
    else {
      //*** il semble que ça, fonctionne maintenat aussi sur firefox et chrome
      ws=document.body.clientWidth;
      //hs=document.body.clientHeight;
    };
  };

  //ID_img.style.width=ws;
  //ID_img.style.height=(hi*(ws/wi));
  //ID_img.style.visibility="visible";
  //document.getElementById("img").innerHTML = "<img src='/pictures/noflash.gif' width='"+ws+"' height='"+(hi*(ws/wi))+"' BORDER='0'>";
  ID_img.innerHTML = "<img src='/pictures/noflash.gif' width='"+ws+"' height='"+(hi*(ws/wi))+"' BORDER='0'>"+txtmobile;

  //** le flash
  ID_bandeau.style.width=ws;
  ID_bandeau.style.height=(hi*(ws/wi));
  ID_bandeau.style.visibility="visible";

  //** image pour décaler le tableau vers le bas si flash, sinon fond fixe.
  document.theimg.height = (hi*(ws/wi));
};

function placeLayer() {
  haut5 = document.theimg.height+10;
  ie4 = document.all
  ns6 = document.getElementById&&!document.all
  ns4 = document.layers

  if (ie4) {sommaire.style.pixelTop=document.body.scrollTop+haut5}
  else if (ns6) {document.getElementById("sommaire").style.top=window.pageYOffset+haut5}
  else if (ns4) {eval(document.sommaire.top=eval(window.pageYOffset+haut5));}

  if(ie4 || ns6 || ns4)
    setTimeout("placeLayer()",20);
};

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 = document.body.innerHTML;
};

function starttimer()
{
  var f = document.getElementById('agendasommaire');
  f.src = f.src;
  //window.frames['agendasommaire'].location.reload;
  timeoutID = window.setTimeout("starttimer()",6000);
};

function stoptimer()
{
  window.clearTimeout(timeoutID);
};

