function ValidateNextBill(value) {
/**************************************************/
/* Validate bill number.  Bill number is composed */
/* of chamber, billtype, and number.              */
/* If valid bill, transfer to appropriate page.   */
/* If on billlookup page and no infotype selected,*/
/* stay on same infotype.                         */
/**************************************************/
 var bill = document.getElementById('NextBill');
 var infotype = document.getElementById('NextBillInfoType').value;
 var bv = bill.value.toUpperCase();
 bv = bv.replace(' ','');
 var billpattern = "^(H|S)(B|R|JR|CR|MM|CM)([0-9]{1,5})$";
 var reg = new RegExp(billpattern);
 if (infotype == "")
 {
   if ((location.href.indexOf("BillLookup") == -1) ||
       (location.href.indexOf("BillNumber") > 0) ||
       (location.href.indexOf("BillCompare") > 0) ||       
       (location.href.toLowerCase().indexOf("mytlis") > 0))
   {
     infotype = "history";
   }
   else
   {
     start = location.href.lastIndexOf("/") + 1;
     end = location.href.indexOf(".aspx");
     currentpage = location.href.substring(start,end);
     infotype = currentpage;
   }
 }
 if (bv.match(reg) != null)
  {
	if (location.href.indexOf("localhost") > 0)
		rootPath = "/TLO";
	else
		rootPath = "";
    var legSess = document.getElementById('NextBillLegSess').value;
  	location = rootPath + "/BillLookup/"+infotype+".aspx?LegSess="+legSess+"&Bill="+bv;  
  	return(false);
  }
 else
  {
  	document.getElementById('NextBill').focus();
	alert("Please enter a valid bill number.");
 	return(false);
  }  
}

function EditBill(bill) {
 if (bill == null)
	return new Array(0);
/**************************************************/
/* Validate bill number.  Bill number is composed */
/* of chamber, billtype, and number.              */
/* If valid bill, transfer to appropriate page.   */
/* If on billlookup page and no infotype selected,*/
/* stay on same infotype.                         */
/**************************************************/
 var bv = bill.toUpperCase();
 bv = bv.replace(/ /g,'');
 if (bv == "")
	return new Array(0);
 var billpattern = "^(H|S)(B|R|JR|CR|MM|CM)([0-9]{1,5})$";
 var reg = new RegExp(billpattern);
 var m = bv.match(reg);
 var billElements = new Array(0);
 if (m != null)
 {
	billElements = new Array(3);
	billElements[0] = m[1].toUpperCase();
	billElements[1] = m[2].toUpperCase();
	billElements[2] = "00000"+m[3];
	billElements[2] = billElements[2].substring(billElements[2].length-5,billElements[2].length);
 }
 return billElements;
}

