  function cint(chrVal) {
    if (isNumeric(chrVal)) {
      return(chrVal);
    }
    else {
      return(0);
    }
  }
    
  function isNumeric(str) {
    for (var i=0; i < str.length; i++) {
      var ch = str.substring(i, i+1);
      if( ch < "0" || ch>"9" || str.length == null) {
        return(false);
      }
    }
    return(true);
  }	
  
  function chCreatePageList(iPageNo, sTotalPages) {
    var pCursor=1;
    var sTmp="";
    var iListCount = cint(document.srchForm.listqty.value);
      
    var iTotalPages = cint(sTotalPages);
      
    if (iPageNo > iTotalPages) {
      iPageNo = 1    
    }
      
    if (iTotalPages==1) {
      document.write ("<b>" + iPageNo + "<\/b>");
    }
    else {
      sTmp = "<select name=\"pgno" + iListCount + "\" onchange=\"javascript:document.srchChangePage.pgno.value=document.srchForm.pgno" + iListCount + ".value;document.srchChangePage.submit();\">";
      while (pCursor <= iTotalPages) {
        if (iPageNo == pCursor) {
          sTmp = sTmp + "<option selected value=\"" + pCursor + "\">" + pCursor + "</option>";          
        }
        else {
          sTmp = sTmp + "<option value=\"" + pCursor + "\">" + pCursor + "</option>";          
        }
        pCursor = pCursor + 1
      }
      sTmp = sTmp + "</select>";
      document.srchForm.listqty.value=(iListCount + 1);
      document.write(sTmp);
    }
  }
    
/*
  THIS FUNCTION IS USED FOR GENERAL BROWSER CHECKING
    FAMILY : jsCommon
*/
function gdBrowserType() {
  this.name = navigator.appName;
  this.version = navigator.appVersion;			                    //Version string
  this.dom=document.getElementById?1:0			                    //w3-dom
  this.op5=(this.name.indexOf("Opera") > -1 && (this.dom))?1:0	    //Opera Browser
  this.ie4=(document.all && !this.dom)?1:0			                //ie4
  this.ie5=(this.dom && this.version.indexOf("MSIE 5") > -1)?1:0	//IE5
  this.ie6=(this.dom && this.version.indexOf("MSIE 6") > -1)?1:0	//IE6
  this.ns4=(document.layers && !this.dom)?1:0			            //NS4
  this.ns5=(this.dom && this.version.indexOf("MSIE ") == -1)?1:0    //NS6, Mozilla5
  
  if (this.ie4 || this.ie5) {
    document.write('<DIV id=testOpera style="position:absolute; visibility:hidden">TestIfOpera5</DIV>');
    if (document.all['testOpera'].style.clip=='rect()') {
      this.ie4=0;
      this.ie5=0;
      this.op5=1;
    }
  }
  
  this.ok=(this.ie4 || this.ie5 || this.ie6 || this.ns4 || this.ns5 || this.op5) //any DHTML
  eval ("bt=this");
}
gdBrowserType();

/*
  THIS FUNCTION RETURNS FORMATTED INFO ON THE BROWSER
    FAMILY : jsCommon
*/
function gdBrowserTestResults() {
  dbgBrowser = "";  
  
  dbgBrowser += bt.name + "\n" + bt.version + "\n";
  dbgBrowser += "\nBrowser Tested :";
  dbgBrowser += "\nOP5 = " + bt.op5;
  dbgBrowser += "\nIE4 = " + bt.ie4;
  dbgBrowser += "\nIE5 = " + bt.ie5;
  dbgBrowser += "\nIE6 = " + bt.ie6;
  dbgBrowser += "\nNS4 = " + bt.ns4;
  dbgBrowser += "\nNS5 = " + bt.ns5;
  dbgBrowser += bt.ok?"\n\n:)  This browser uses the DOM model":"\n\nWARNING:\nThis browser DOES NOT SUPPORT the DHTML OBJECT MODEL";
  
  return dbgBrowser;
}

/*
  THIS FUNCTION RETURNS CHECKS THE BROWSER VALIDITY
  NOTE: WE'RE ONLY ACCEPTING IE5.0 AND HIGHER..
    FAMILY : jsCommon
*/
function gdScrollSafe() {
  bIsReady = (bt.ie5||bt.ie6);
  return bIsReady;
}

/*
  THIS FUNCTION TURNS THE HISTORY ITEM OFF IF THERE
  IS NO HISTORY ITEMS IN THE BROWSER
    FAMILY : jsCommon
*/
function showHistoryButton() {
  if(window.history.length==0) {
    document.getElementById("ecTPTBIconHistory").style.display = "none";
  }
}

/*
   THIS FUNCTION GETS THE CHANGE THE ICON SRC APPROPRIATELY TO SHOW THE 
   CORRENT ICON FOR EACH FILETYPE WE MAY USE - NOTE: PDF IS DEFAULT
     FAMILY : jsCommon
*/
function changeDocIcon(sItemId,sDocName) {
  var oDocIcon;
  var sDocExt;
  var sImgSrc;
  var sDefImg;
  var sNewSrc;
  oDocIcon = document.getElementById(sItemId);
  sDocName = sDocName.toLowerCase();
  sDefImg = "ecPDFIcon.gif";
  sNewSrc = "";
  
  if(oDocIcon!=null) {  
    sDocExt = sDocName.substr(sDocName.length-3,3);
  
    switch (sDocExt) {
      case "doc" :
        sImgSrc = "ecDOCIcon.gif";
        break;
    }
    sNewSrc = oDocIcon.src.replace(sDefImg,sImgSrc);
    oDocIcon.src = oDocIcon.src.replace(sDefImg,sImgSrc);  
  }
}