
 // 1

 function openScreen(id, url, width, height, properties)
{
    if (screen)
    {
        x = (screen.availWidth - width) / 2;
        y = (screen.availHeight - height) / 2;
  }

  referentie = window.open(url, id, properties+',width='+width+',height='+height+',screenX='+x+',screenY='+y+',left='+x+',top='+y);
}
 function showreageer(pVast, pAhd, pTxt)
{
  openScreen('reageer', '/pls/m/zk2.toon_react_form?p_vast=' + pVast + '&p_ahd_id=' + pAhd + '&p_txt=' + pTxt, 600, 600, 'scrollbars=yes,status=no,resizable=yes');
}


 function Xswapstk(url, id, myReady)
{
 var i;
  i = 'LTS'+id;
  l = document.getElementById(id);
  i = document.getElementById(i);
  if (l.innerHTML.length <= 1)
  {
     melding = document.getElementById('count_'+id).innerHTML;
     l.innerHTML = '<img src="http://files.archieven.nl/0/i/loading2.gif" /> ' + melding;
    Xget(url, id, myReady);
  }
  else
  {
    (l.style.display == "") ? l.style.display = "none" : l.style.display ="";
  }
 if (l.style.display == "")

    {i.src = 'http://files.archieven.nl/0/i/m1.gif';
    i.title='sluiten';
  }
 else
  {i.src = 'http://files.archieven.nl/0/i/pl1.gif';
   i.title='openen';
  }
}
function Xswapin(url, id, myReady)
{
 var i;
  i = 'LTS'+id;
  l = document.getElementById(id);
  i = document.getElementById(i);
  if (l.innerHTML.length <= 1)
  {

    Xget(url, id, myReady);
  }
  else
  {
    (l.style.display == "") ? l.style.display = "none" : l.style.display ="";
  }
 if (l.style.display == "")

    {i.src = 'http://files.archieven.nl/0/i/m1.gif';
    i.title='sluiten';
  }
 else
  {i.src = 'http://files.archieven.nl/0/i/pl1.gif';
   i.title='openen';
  }
}

function clikker(a,g) {
a = document.getElementById(a);
g = document.getElementById(g);
      if (a.style.display =='') {
         a.style.display = 'none';
         g.src='http://files.archieven.nl/0/i/p2.gif';
         g.title='openen';
         }
      else {
         a.style.display='';
         g.src='http://files.archieven.nl/0/i/m2.gif';
         g.title='sluiten';
      }
   }
 function clik1(a,g) {
 a = document.getElementById(a);
 g = document.getElementById(g);
      if (a.style.display =='') {
         a.style.display = 'none';
         g.src='http://files.archieven.nl/0/i/pl1.gif';
         g.title='openen';
      }
      else {
         a.style.display='';
         g.src='http://files.archieven.nl/0/i/m1.gif';
         g.title='sluiten';

      }
   }


function Xswap(url, id, myReady)
{
 var i;
 i = 'LT'+id;
  l = document.getElementById(id);
  i = document.getElementById(i);
  if (l.innerHTML.length <= 1)
   {
     Xget(url, id, myReady);
   }
  else
  {
    (l.style.display == "") ? l.style.display = "none" : l.style.display = "";
  }
 if (l.style.display == "")

    {i.src = 'http://files.archieven.nl/0/i/m2.gif';
    i.title='sluiten';
  }
 else
  {i.src = 'http://files.archieven.nl/0/i/p2.gif';
   i.title='openen';
  }
}
function Xswapinv(url, id, myReady)
{
 var i;
 i = 'LT'+id;
  l = document.getElementById(id);
  i = document.getElementById(i);
  if (l.innerHTML.length <= 1)
   {
     melding = document.getElementById('count_'+id).innerHTML;
     l.innerHTML = '<img src="http://files.archieven.nl/0/i/loading2.gif" /> ' + melding;
     Xget(url, id, myReady);
   }
  else
  {
    (l.style.display == "") ? l.style.display = "none" : l.style.display = "";
  }
 if (l.style.display == "")

    {i.src = 'http://files.archieven.nl/0/i/m2.gif';
    i.title='sluiten';
  }
 else
  {i.src = 'http://files.archieven.nl/0/i/p2.gif';
   i.title='openen';
  }
}
function Xswap1(url, id, myReady)
{
var i;
 i = 'LT'+id;
  l = document.getElementById(id);
i = document.getElementById(i);
  if (l.innerHTML.length <= 1)
   {
     melding = document.getElementById('count_'+id).innerHTML;
     l.innerHTML = '<img src="http://files.archieven.nl/0/i/loading2.gif" /> ' + melding;
     Xget(url, id, myReady);
   }

  else
  {
    (l.style.display == "") ? l.style.display = "none" : l.style.display = "";
  }
if (l.style.display == "")

    {i.src = 'http://files.archieven.nl/0/i/m1.gif';
    i.title='sluiten';
  }
 else
  {i.src = 'http://files.archieven.nl/0/i/pl1.gif';
   i.title='openen';
  }
}

function swapDiv(id,button)
{

  l = document.getElementById(id);
  i = document.getElementById(button);

    (l.style.display == "") ? l.style.display = "none" : l.style.display ="";

     if (l.style.display =="")
     {i.value = 'verbergen'
     }
     else
     {i.value =  'afronden'
     }
}

function Swapdiv(id,txt,button)
{

  l = document.getElementById(id);
  i = document.getElementById(button);

    (l.style.display == "") ? l.style.display = "none" : l.style.display ="";

     if (l.style.display =="")
     {i.value = 'verbergen'
     }
     else
     {i.value = txt + ' afronden'
     }
}

function Swapdiv2(id)
{

  l = document.getElementById(id);


    (l.style.display == "") ? l.style.display = "none" : l.style.display ="";


}

function Toondiv(id)
{

  l = document.getElementById(id);
  //i = document.getElementById(button);

    (l.style.display == "") ? l.style.display = "none" : l.style.display ="";

    // if (l.style.display =="")
    // {i.value = 'verbergen'
    // }
    // else
    // {i.value = txt + ' afronden'
    // }
}

function Xget(url, id, onReady)
{
  var xmlhttp = false;
  var l;
  l = document.getElementById(id);

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

  if (!xmlhttp) return false;

  try
  {
    xmlhttp.open("GET", url, true);
    xmlhttp.setRequestHeader("If-Modified-Since", "Wed, 15 Nov 1995 04:58:08 GMT");
    xmlhttp.onreadystatechange = function()
    {
      if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
      {
        if (xmlhttp.responseText)
          if (l)
            l.innerHTML = xmlhttp.responseText;
            tb_init('a.thickbox, area.thickbox, input.thickbox'); // reload thickbox !!!!!!!
// event handler:
        if (onReady) onReady(xmlhttp.responseText);
      }
    }
    xmlhttp.send(null);
  }
  catch(e)
  {
    alert ('XMLHTTP: Fout opgetreden: ' + e.name + ' ' + e.message);
  }
}


function Xpost(url, p, onReady, id)
{
  var xmlhttp = false;
  var l;

  if (id) l = document.getElementById(id);

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

  try
  {
    xmlhttp.open("POST", url, true);
    xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');

    xmlhttp.onreadystatechange=onReady;

    xmlhttp.onreadystatechange=function()
    {
      if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
      {
        if (xmlhttp.responseText && l) l.innerHTML = xmlhttp.responseText;
        onReady(xmlhttp.responseText);


      }
    }
    xmlhttp.send(p);

  }
  catch(e)
  {
    alert ('XMLHTTP: Fout opgetreden: ' + e.name + ' ' + e.message);
  }
}

function SubmitForm(f, id)
{
  var p = "";

  for (x=0; x<f.elements.length; x++)
    if (f.elements[x].name && f.elements[x].value)
    {
      if (x>0) p += '&';
      p += f.elements[x].name + '=' + f.elements[x].value;
    }

  url = f.action;
  Xpost(url, p, function(){}, id);
  return false;
}

function emptyvalidation(entered, alertbox)
{

  with (entered)
  {
    if (value==null || value=="")
    {
      if (alertbox!="") {alert(alertbox);} return false;}
      else {return true;}
    }
}

function emptyfield(entered)
{

  with (entered)
  {
    if (value==null || value=="")
    {
       return false;}
      else {return true;}
    }
}

function bookmarkpage(title,url){
if (window.sidebar) // firefox
    window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
    var elem = document.createElement('a');
    elem.setAttribute('href',url);
    elem.setAttribute('title',title);
    elem.setAttribute('rel','sidebar');
    elem.click();
}
else if(document.all)// ie
    window.external.AddFavorite(url, title);
}

function Formvalidate(thisform,thisid){
 thisform[thisid].disabled = true;
}

var ie = (document.all) ? true : false;

function toggleClass(objClass,id,tExt,tSimp){
//  This function will toggle obj visibility of an Element
//  based on Element's Class
//  Works with IE and Mozilla based browsers

  if (getElementByClass(objClass).style.display=="none"){
    showClass(objClass);
    id.innerHTML = tSimp;
  }else{
    hideClass(objClass);
    id.innerHTML = tExt;
  }
}

function hideClass(objClass){
//  This function will hide Elements by object Class
//  Works with IE and Mozilla based browsers

var elements = (ie) ? document.all : document.getElementsByTagName('*');
  for (i=0; i<elements.length; i++){
    if (elements[i].className==objClass){
      elements[i].style.display="none"
    }
  }
}

function showClass(objClass){
//  This function will show Elements by object Class
//  Works with IE and Mozilla based browsers
var elements = (ie) ? document.all : document.getElementsByTagName('*');
  for (i=0; i<elements.length; i++){
    if (elements[i].className==objClass){
      elements[i].style.display=""
    }
  }
}
function getElementByClass(objClass){
//  This function is similar to 'getElementByID' since there
//  is no inherent function to get an element by it's class
//  Works with IE and Mozilla based browsers
var elements = (ie) ? document.all : document.getElementsByTagName('*');
  for (i=0; i<elements.length; i++){
    //alert(elements[i].className)
    //alert(objClass)
    if (elements[i].className==objClass){
    return elements[i]
    }
  }
}



