////////////////////////////////////////////////////////////
//    Modification de la taille du texte
////////////////////////////////////////////////////////////


function ts( trgt,inc )
{
  if (!document.getElementById) return
  var d = document,cEl = null,sz = startSz,i,j,cTags;

  sz += inc;
  if ( sz < 0 ) sz = 0;
  if ( sz > 6 ) sz = 6;
  startSz = sz;

  if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

  cEl.style.fontSize = szs[ sz ];

  for ( i = 0 ; i < tgs.length ; i++ )
  {
    cTags = cEl.getElementsByTagName( tgs[ i ] );
    for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
  }
}


////////////////////////////////////////////////////////////
//    description videos playliste youtube
////////////////////////////////////////////////////////////

var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all

function changer_description(balise, description)
{
  if (ns4)
  {
    document.eval(balise).document.write(description);
    document.eval(balise).document.close();
  }
  else if (ns6)
  {
    document.getElementById(balise).innerHTML = description;
  }
  else if (ie4)
  {
    eval(balise).innerHTML = description;
  }
}



////////////////////////////////////////////////////////////
//    scrolling du flash info
////////////////////////////////////////////////////////////

var scrollWidth = 0;
var scrollTimers = new Array();
var scrollPositions = new Array();
var stopScrolling=false;

function scrollCheckPositions(id,positions)
{
  if(!scrollPositions[id])
  {
    scrollPositions[id] = new Array();
  }
  scrollPositions[id][0] = (!scrollPositions[id][0] || scrollPositions[id][0] > positions)?0:scrollPositions[id][0];
}

function scrollCheckTimer(id)
{
  if(!scrollTimers[id])
  {
    scrollTimers[id] = new Array();
  }
}

function scrollDiv(id,step,position,amount)
{
  scrollCheckTimer(id);

  var move = document.getElementById(id).scrollLeft - position;
  if (move < 0)
  {
    scrollDivLeft(id,step,position);
  }
  else if (move > 0)
  {
    scrollDivRight(id,step,position);
  }
}


function scrollDivLeft(id,step,position)
{
  if (stopScrolling == false)
  {
    clearTimeout(scrollTimers[id][0]);
    if(document.getElementById(id).scrollLeft < position)
    {
      document.getElementById(id).scrollLeft = (document.getElementById(id).scrollLeft + step <= position)?(document.getElementById(id).scrollLeft + step):position;
      scrollTimers[id][0] = setTimeout("scrollDivLeft(\'" + id + "\'," + step + "," + position + ")", 1);
    }
  }
}

function scrollDivRight(id,step,position)
{
  if (stopScrolling == false)
  {
    clearTimeout(scrollTimers[id][0]);
    if(document.getElementById(id).scrollLeft > position)
    {
      document.getElementById(id).scrollLeft = (document.getElementById(id).scrollLeft - step >= position)?(document.getElementById(id).scrollLeft - step):position;
      scrollTimers[id][0] = setTimeout("scrollDivRight(\'" + id + "\'," + step + "," + position + ")", 1);
    }
  }
}

function scrollAutoslide(id,step,width,positions,tempo)
{
  scrollWidth = width;
  scrollCheckTimer(id);
  scrollCheckPositions(id,positions);
  var slideto = scrollPositions[id][0] * width;
  ++scrollPositions[id][0];
  scrollDiv(id,step,slideto);
  scrollTimers[id][1] = setTimeout("scrollAutoslide(\'" + id + "\'," + step + "," + width + "," + positions + "," + tempo + ")", tempo);
}







////////////////////////////////////////////////////////////
//    extenseur de textareas
////////////////////////////////////////////////////////////

function extendarea()
{
  if(!this.rowww)
  {
    this.rowww=this.rows;
  }

  how_many=strCount(this.value,"\n");
  if((how_many+1)>this.rowww)
  {
    this.rows=how_many+1;
  }

  function strCount(txt,c)
  {
    txt2=txt;

    if(txt2.indexOf(c)!=-1)
    {
      txt2=txt2.substr(txt2.indexOf(c)+1);
      return strCount(txt2,c)+1;
    }

    return 0;
  }
}
