(checkversion = function(){
  // change as fit
  var versions = {
    'documentexample.html':'1.0',
    'documentexample2.html':'2.0'
  };
  var errorID = 'versionerror';
  var errorMessage = 'This document is outdated, please go to the homepage to download the new version!';

  // checking code
  var d = document;
  // get the version number
  var cv = d.title.match(/\(version (.*)\)$/); 
  // get the file name
  var cn = window.location.href.split('/'); 
  cn = cn[cn.length-1].split('#')[0];
  // check and create error message if there is a mismatch
  if(cv[1] && versions[cn]){
    if(versions[cn] !== cv[1]){
      if(!d.getElementById(errorID)){
        var m = d.createElement('div');
        m.id = errorID;
        m.appendChild(d.createTextNode(errorMessage));
        d.body.insertBefore(m,d.body.firstChild);
      }
    }
  }
}());