// (a.walling 2009-11-23 12:10) - PLID 36395 - Use the header and footer information for the current document
var newHeader = allDocuments[currentDocumentIndex].header;
var newFooter = allDocuments[currentDocumentIndex].footer;
// (a.walling 2009-09-24 10:11) - PLID 33531 - use a global regular expression to replace all occurrences. a string or non-global regexp will only replace the first occurence.
var modHeader = newHeader.replace(/\{\{NXPAGENUM\}\}/gm, pageNum);
var modFooter = newFooter.replace(/\{\{NXPAGENUM\}\}/gm, pageNum);