
function Sort(field, dir) {
   var sort_fld, sort_dir;
   var parms = document.URL.split('&');
   var newurl = parms[0];
   for (var i=1; i<parms.length; i++) {
      var s = parms[i].split('=');
      var parmname = s[0];
      var parmvalue = s[1];
      if (parmname == 'sort') {
         sort_fld = parmvalue;
         parmvalue = field;
      }
      else if (parmname == 'sort_fmt') {
         sort_dir = parmvalue;
         parmvalue = dir;
      }
      newurl += '&' + parmname + '=' + parmvalue;
   }
  
   if (sort_fld==field && sort_dir==dir) return;
// run the new sort
   location = newurl; 
}

function help() {
   alert(
        "File saving instructions:\n\n" +
        "When you click the 'Download' button,\n" +
        "a 'Save As' dialogue box will appear.\n" +
        "The file is a comma-delimited text file\n" +
        "so it should be given extension of .CSV"
        );
}



function changeTime( disp ) {
  var now= new Date();
  var hrs= now.getHours();
  var time_now= (( hrs > 12 ) ? ( hrs + (-12)) : hrs ) + ":";
  time_now += now.getMinutes() + ":" + now.getSeconds();
  time_now += (( hrs > 12 ) ? " PM" : " AM" );
  /* document.form1.currentTime.value= disp; */
  window.status= disp + ", " + time_now;   
  theTimer= setTimeout( "changeTime( disp )", 1000 );
}

