function fotopop(foto, alttekst, breed, hoog) {
  venster=window.open
  ('','','width='+breed+',height='+hoog+',left=10,top=10,screenY=10,screenX=10');
    with(venster.document) {
	  open();
	  write('<head><title>'+alttekst+'<\/title><\/head>\n');
	  write('<body marginwidth=0 marginheight=0 style="margin:0;" onBlur="window.close()" onClick="window.close()">\n');
	  write('<a href="#" style="cursor:hand;"><img src=".\/abc\/data\/'+foto+'" width='+breed+' height='+hoog+' border="0"></a>\n');
	  write('<\/body><\/html>');
	  close();
  }
}

function clearIt( box ) {
  if(box.value==box.defaultValue) {
	  box.value = "";
	}
}

//Plaats advertentie JS
function hoofdcatUpdate() {
  document.getElementById('subcatholder').style.display = 'none';
  document.getElementById('loading').style.display = 'block';
  
  f = document.forms.placeAdd;
  if (f.hoofdcat.options[0].value == '') {
    f.hoofdcat.remove(0);
  }
  
  getSubcats( f.hoofdcat.options[f.hoofdcat.selectedIndex].value );
}

var xmlhttp;
function getSubcats( id ) {
  xmlhttp = getHttpObject();
  xmlhttp.onreadystatechange = handleStateChange;
  xmlhttp.open("GET", "./includes/getSubcats.php?id="+id+'&rkey='+Math.random(), true);
  xmlhttp.send(null);
}

function handleStateChange() {
  if(xmlhttp.readyState == 4) {
    if(xmlhttp.status == 200) {
      verwerkSubcats();
    }
  }
}

function verwerkSubcats() {
  var s = document.forms.placeAdd.subcat;
  // leeg optionlist
  while(s.options[0] != null){
    s.options[0] = null;
  }
  //alert(xmlhttp.responseText);
  var subcatgegevens = null;
  var subcatarray = xmlhttp.responseText.split("%%");
  for(i = 0; i < (subcatarray.length); i++) {
    subcatgegevens = subcatarray[i].split("||");
    // zet in optionlist
    var op = document.createElement("option");
    op.value = subcatgegevens[0];
    op.text = subcatgegevens[1];
    if( window.ActiveXObject ) {
      s.options.add(op);
    } else {
      s.appendChild(op);
    }
  }
  document.getElementById('loading').style.display = 'none';
  document.getElementById('subcatholder').style.display = 'block';
}