function toggle( targetId ){
  if (document.getElementById){
        target = document.getElementById( targetId );
           if (target.style.display == "none"){
              target.style.display = "";
           } else {
              target.style.display = "none";
           }
     }
}

function turnoff( targetId ){
 if (document.getElementById) {
  target = document.getElementById( targetId );
  if (target.style.display != "none") {
   target.style.display = "none";
  }
 }
}

function turnon( targetId ){
 if (document.getElementById) {
  target = document.getElementById( targetId );
  if (target.style.display == "none") {
   target.style.display = "";
  }
 }
}

function rollon(img_name) {
   document[img_name].src = '/files/images/button-over.gif';
}

function rolloff(img_name) {
   document[img_name].src = '/files/images/button.gif';
}

function go_saveas() {
 if (!!window.ActiveXObject) {
  document.execCommand("SaveAs");
 }
 else if (!!window.netscape) {
  var r=document.createRange();
  r.setStartBefore(document.getElementsByTagName("head")[0]);
  var oscript=r.createContextualFragment('<script id="scriptid" type="text/javascript" src="chrome://global/content/contentAreaUtils.js"><\/script>');
  document.body.appendChild(oscript);
  r=null;
  try {
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
   saveDocument(document);
  } 
  catch (e) {
   //no further notice as user explicitly denied the privilege
   alert('Uw browser staat dit niet toe.\nGebruik Menu -> Pagina opslaan als...');
  }
  finally {
   var oscript=document.getElementById("scriptid");    //re-defined
   oscript.parentNode.removeChild(oscript);
  }
 }
}

function ad(act,txt,eml) {
 var xmlHttpReq = false;
 var self = this;
 var strURL = '/ad.php';
 if (window.XMLHttpRequest) self.xmlHttpReq = new XMLHttpRequest();
 else if (window.ActiveXObject) self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
 self.xmlHttpReq.open('POST', strURL, true);
 self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
 self.xmlHttpReq.onreadystatechange = function() {
  if (self.xmlHttpReq.readyState == 4) {
   //alert(self.xmlHttpReq.responseText);
   location.reload(true);
  }
 }
 var qry='action=' + escape(act) + '&info=' +  escape(txt) + '&email=' + escape(eml);
 self.xmlHttpReq.send(qry);
}

function setCheckedValue(radioObj, newValue) {
 if(!radioObj) return;
 var radioLength = radioObj.length;
 if(radioLength == undefined) {
  radioObj.checked = (radioObj.value == newValue.toString());
  return;
 }
 for(var i = 0; i < radioLength; i++) {
  radioObj[i].checked = false;
  if(radioObj[i].value == newValue.toString()) {
   radioObj[i].checked = true;
  }
 }
}

