var articles =[ "listhelp",	
                "marketmeasure",
                "next-generation-lists",
                "quicktips",
                "list-composition",
                "list-of-lists",
		        "list_column_headings",
                "sectors",
                "browser-tips",
                "research_help",
                "vmi_help",
                "vmi-using-help",
                "madi_help",
                "madi-using-help",
                "marketmeasure-using",
                "next-gen-lists-using",
                "cc_help",
                "sp_help",
                "np_help",
                "JohnsTradeProcess"];

var ind = getpageindex();

if (ind>0){		
  var rta = '<a href="javascript:pageit()">List Help Topic</a>'
}else{		
  var rta = '&nbsp;'
}

var pagebar = '<TABLE BORDER="0" CELLPADDING="4" CELLSPACING="0" WIDTH="100%" STYLE="border: 1 dotted" CLASS="toplinks">'

pagebar += '<TR><TD WIDTH="100" ALIGN="LEFT"><a href="javascript:pageit('+"'prev'"+')">Previous Article</a></td><TD WIDTH="*" ALIGN="CENTER">' + rta + '</td><TD WIDTH="100" ALIGN="RIGHT"><a href="javascript:pageit('+"'next'"+')">Next Article</a></td></tr></table>'

function pageit(dir){
  switch (dir)
  {
    case "next":
      ind ++;
      if (ind >= articles.length){ind = 0;}
      break;
    case "prev":
      ind --;
      if ( ind <0) {ind = articles.length - 1;}
      break;
    default:
      ind = 0;
  }
  window.location.href = articles[ind]+".htm";
}

function getpageindex() { 
  // Finds the index of the page in the articles array 
  var url = new String(window.location.href);
  // Find the nae of the page minus the extension
  var art = url.match(/.*\/(.*)\..*/);
   // Check for matches in our array.
  var re = new RegExp(art[1],"i");
  re.compile(art[1]);
  for (i=0; i<articles.length; i++) {
   if (re.exec(articles[i])) {
 //    if (re.test(articles[i])) {
      // It's a match.
      break;
    }
  }
  return i;
}
