// algemene functies

var _url;

function XpInv(popupId, url)
{
  if (!_url)
  {
    openCenter(popupId, url, 750, 500, 'scrollbars=yes,status=yes,resizable=yes');
    return;
  }

  var xmlhttp = false;

  if (window.ActiveXObject) xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
   else xmlhttp = new XMLHttpRequest();

  if (!xmlhttp) openCenter(popupId, url, 750, 500, 'scrollbars=yes,status=yes,resizable=yes');

//  url += "&hash=" + Math.random();     // nooit cachen

  try
  {
    xmlhttp.open("POST", _url, true);
    xmlhttp.onreadystatechange=function()
    {
      if (xmlhttp.readyState == 4)  //  && xmlhttp.status == 200
      {
        var id = "";
        if (xmlhttp.status == 200) id = xmlhttp.responseText;
        openCenter(popupId, url + '&p_best='+id, 750, 500, 'scrollbars=yes,status=yes,resizable=yes');
      }
    }
    xmlhttp.send(null);
  }

  catch(e)
  {
    openCenter(popupId, url, 750, 500, 'scrollbars=yes,status=yes,resizable=yes');
  }
}

function XpOpen(url)
{
  var xmlhttp = false;

  if (window.ActiveXObject) xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
   else xmlhttp = new XMLHttpRequest();

  if (!xmlhttp) return false;

//  url += "&hash=" + Math.random();     // nooit cachen

  try
  {
    xmlhttp.open("POST", _url, true);
    xmlhttp.onreadystatechange=function()
    {
      if (xmlhttp.readyState == 4)  //  && xmlhttp.status == 200
      {
        var id = "";
        if (xmlhttp.status == 200) id = xmlhttp.responseText;
        window.location.href=url + '&p_best='+id;
      }
    }
    xmlhttp.send(null);
  }

  catch(e)
  {
    window.location.href=url;  	
  }
}

function swapImg(id, img)
{
  id.style.backgroundImage = 'url('+img+')';
}

function initBlad(id)
{
	openBlad = document.getElementById(id);
	openBlad.style.display='';
}

function toonBlad(id)
{
	id = document.getElementById(id);
	id.style.display='';
	openBlad.style.display = 'none';
	openBlad = id;
}

/* nieuwe tabbladfuncties */

function initTab(p_id)
{
  if (!p_id) p_id = 0;
  if (openDiv = document.getElementById("b"+p_id))
    openDiv.style.display='';
  
  openTab = document.getElementById("t"+p_id);
  if (openTab) openTab.className='tab active';
}

function toonTab(p_id)
{
  if (openDiv)
  {
    openDiv.style.display = 'none';
    openTab.className = 'tab';
    id = document.getElementById("b"+p_id);
    id2 = document.getElementById("t"+p_id);
    id.style.display='';
    id2.className='tab active';
    openDiv = id;
    openTab = id2;
  }
}

function wisselBlad(form){
if (bladid = form.options[form.selectedIndex].value)
	toonBlad(bladid);
}

function pImg(id, url){
  openCenter(id, url, 750, 500, 'scrollbars=yes,status=yes,resizable=yes');
}

function pInv(id, url){
  url = url;
  myWin = openCenter(id, "", 750, 500, 'scrollbars=yes,status=yes,resizable=yes');
  XpInv (id, url);
}

function pDet(id, url){
  myWin = openCenter(id, "", 750, 500, 'scrollbars=yes,status=yes,resizable=yes');
  XpInv (id, url);
}

function pOpen(url)
{
  XpOpen(url);
}

function disclaimer() {
	openCenter('disc','/0/disclaimer.html', 300,430); } function
sitemap() {
	openCenter('smap','/0/sitemap.html', 300,370);
}

function MediaPlayer(p_vast, p_id, p_path, p_adt_id, p_start, p_eind, p_frag)
{
  if(!p_start) p_start = "";
  if(!p_eind) p_eind = "";
  if(!p_frag) p_frag = "";
  openCenter('mp', 'zk2.mediaplayer?p_path='+p_path+'&p_vast='+p_vast+'&p_id='+p_id+'&p_adt_id='+p_adt_id +'&p_start='+p_start+'&p_eind='+p_eind+'&p_frag='+p_frag, 1, 1);
}


