var bookmarkurl = "http://www.kijktvonline.nl/";
var bookmarktitel = "Kijk TV Online.nl";

function favorieten()
{
  if (document.all)
  window.external.AddFavorite(bookmarkurl, bookmarktitel)
}

function GetPageWidth()
{
// Eerst ff kijken hoe breed je scherm is
  if( typeof( window.innerWidth ) == 'number' ) {
  //Non-IE
    return window.innerWidth;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
  //IE 6+ in 'standards compliant mode'
    return document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
  //IE 4 compatible
    return document.body.clientWidth;
} }

// Deze functie zorgt ervoor dat het resizen van de content niet de gehele tijd gebuurt als de browser groter of kleiner wordt. Dit zorgt ervoor dat er minder cpu nogig is voor de browser.
var wait_now = 1;
function Wait_time( id )
{
  if(wait_now == 1)
  {
    wait_now = 0;
  // Pagina-layout
    div_maxwidth( id );
    
    if(thisisTVgids == 1)
    {
      addRows();

      if(OldTotalRows == -1)
      {
        ReRowOrder();
      }
    // Rijen openen/sluiten
      if(TotalRows !== OldTotalRows)
      {
        OpenRows();
        RePlaceRows();
    } }
  }
  setTimeout('Wait_time("'+ id +'")', 2000);
}

// Standaard waardes...
var MinWidth = 770; // in "px".
var MaxWidth = 1500; // in "px".
var Width_   = 770;
var ProcentBolletjes = 60; // in "%".
var contentdiv_ = 0;
function div_maxwidth(id1)
{
  var myWidth = GetPageWidth();

  object1 = document.getElementById( id1 );

  Width_ = Math.ceil(myWidth * 0.9);
  if(Width_ < MinWidth)
  {
    Width_ = MinWidth;
  }else if(Width_ > MaxWidth)
  {
    Width_ = MaxWidth;
  }
  object1.style.width = Width_+'px';

// De header goed maken
  BolletjesBreed = Math.floor( ( (myWidth - Width_) / 2 ) * (ProcentBolletjes / 100));
  if( BolletjesBreed <= 0 ) { BolletjesBreed = 1; }

  object2 = document.getElementById( 'headLeft');
  object3 = document.getElementById( 'headRight');

  object2.style.width = BolletjesBreed+'px';
  object3.style.width = BolletjesBreed+'px';
}