/* Auteur: S.LAFARGUETTE CDTI 15 */
/* Date de creation: 18/06/07    */

function changeOpacity(idImg, newOpacity)
{
  elemdst=self.document.getElementById(idImg);
  if (elemdst)
  {
    elemdst.style.opacity=newOpacity;
  }
}

function showDiv(idDiv)
{
  elemdst=self.document.getElementById(idDiv);
  elemdst.style.display="inline";
}

function hideDiv(idDiv)
{
  elemdst=self.document.getElementById(idDiv);
  elemdst.style.display="none";
}

function showSubMenu(idSubMenu)
{
  showDiv(idSubMenu);
  elemdst=self.document.getElementById(idSubMenu);
  elemdst.parentNode.className="on";
}

function hideSubMenu(idSubMenu)
{
  hideDiv(idSubMenu)
  elemdst=self.document.getElementById(idSubMenu);
  elemdst.parentNode.className="";
}

function popSubMenu(idSubMenu)
{
  if (!self.currentSubMenu)
  {
    self.subMenuExpanded=false;
    self.currentSubMenu=idSubMenu;
  }
  if (self.currentSubMenu==idSubMenu)
  {
    if (self.subMenuExpanded==true)
    {
      hideSubMenu(idSubMenu);
      self.subMenuExpanded=false;
    }
    else
    {
      showSubMenu(idSubMenu);
      self.subMenuExpanded=true;
    }
  }
  else
  {
    hideSubMenu(self.currentSubMenu);
    showSubMenu(idSubMenu);
    self.subMenuExpanded=true;
    self.currentSubMenu=idSubMenu;
  }
}

function displayTabPage(idTabPage, idTab)
{
  elemdst=self.document.getElementById(self.tabDisplayed);
  elemdst.className="";
  elemdst=self.document.getElementById(self.tabPageDisplayed);
  elemdst.style.display="none";
  self.tabDisplayed=idTab;
  self.tabPageDisplayed=idTabPage;
  elemdst=self.document.getElementById(self.tabDisplayed);
  elemdst.className="on";
  elemdst=self.document.getElementById(self.tabPageDisplayed);
  elemdst.style.display="block";
}

function documentResized()
{
  // Resising content
  theWidth=0
  currentWidth=document.body.clientWidth;
  if (currentWidth>960)
  {
    theWidth=960
  }
  else
  {
    if (currentWidth<770)
    {
      theWidth=770
    }
  }
  if (theWidth!=0)
  {
    elemdst=self.document.getElementById('page');
    elemdst.style.width=theWidth+'px';
    elemsrc=self.document.getElementById('layout-two-columns');
    if (elemsrc)
    {
      elemdst=self.document.getElementById('left-column');
      elemdst.style.height=elemsrc.clientHeight+'px';
    }
  }
}

/* Code entierement recupere sur le site du ministere de l education nationale */
function impression()
{
  if (typeof(window.print) != 'undefined')
  {
    window.print();
  } 
}

function toggleFontSize()
{
  if (!self.currentFontSize)
  {
    self.currentFontSize=1;
  }
  self.currentFontSize++;
  if (self.currentFontSize>4)
  {
    self.currentFontSize=1;
  }
  switch (self.currentFontSize)
  {
    case 1:
      fontSize="11px";
      break;
    case 2:
      fontSize="14px";
      break;
    case 3:
      fontSize="17px";
      break;
    case 4:
      fontSize="21px";
      break;
  }
  self.document.body.style.fontSize=fontSize;
}

window.onresize=documentResized;
