/* This function returns all the request parameters
   as a name - value array */
function parseGetVars() {
  // Array that will hold all the url parameters
  var urlParams = new Array();

  // Get the url part after the ?
  // substring(1) will return the part without the ?
  var qString = top.location.search.substring(1);

  // Split all the parameter=value parts
  var pairs = qString.split(/\&/);

  // split each parameter=value and put it in the array
  for (var i in pairs) {
      var nameVal = pairs[i].split(/\=/);
      urlParams[nameVal[0]] = nameVal[1];
  }

  // return the array
  return urlParams;
}

/* This function performs a default search.
   The parameter is the name of the field holding the
   string to search for. */
function doSearch(fieldname,divname) {
  var getParams = parseGetVars();
  search(getParams[fieldname],divname);
}

function imagePrintLink(source, title, width, height, image){
  var pLink = standardPrintLinkProps(source, title, width, height);
  pLink += ');\"><img border="0" src="' + image;
  pLink += '" alt="icoon printversie"/></a>';
  document.write(pLink);
}

function printLink(source, title, width, height){
  var pLink = standardPrintLinkProps(source, title, width, height);
  pLink += ');\">Printvriendelijke pagina</a>';
  document.write(pLink);
}

function standardPrintLinkProps(source, title, width, height){
  var server = "http://lips.vera.be/";
  var defProps = "scrollbars=yes,location=no,menubar=no,status=no,toolbar=no,resizable=no";

  var pLink = '<a href=\"#\" onclick=\"window.open(\'';

  pLink += server;
  pLink += source;
  pLink += '\', \'' + title;
  pLink += '\', \'width='+ width +', height='+ height +', '+ defProps +'\'';
  
  return pLink;
}
