function CalcKeyCode(aChar) {
  var character = aChar.substring(0,1);
  var code = aChar.charCodeAt(0);
  return code;
}

function checkNumber(val, maxpage)
{
  var strPass = val.value;

  var strLength = strPass.length;
  var lchar = val.value.charAt((strLength) - 1);
  var cCode = CalcKeyCode(lchar);
  //alert(cCode);
  if (cCode < 48 || cCode > 57 )
  {
       var myNumber = val.value.substring(0, (strLength) - 1);
       val.value = myNumber;
  }
       var intbroj = parseInt(strPass);
       var maxpageint=parseInt(maxpage);
       if (intbroj > maxpageint || intbroj < 0)
       {
                 val.value =maxpageint;
       }
       if (intbroj <= 0) val.value =1;

  return false;
}

function PagingSubmitForm(docid, val, filetype)
{
		var page = val.value;
		alert(docid+", "+page+", "+filetype);
		ShowMainDocumentByID(docid, page, filetype);
}
