//Clear method
function ClearSearch()
{
  if (search.first_name)
    search.first_name.value = "";
  if (search.last_name)
    search.last_name.value = "";
}

//Validats the search page to make sure the correct or enough
//info was provided
function validate()
{
  var fname="";
  var lname="";
            
      fname=document.search.first_name.value;
      lname=document.search.last_name.value;
        if (lname=="")
        {
 		    alert("Please enter Last Name");
			return false;
        }
        else
        {
		  return true;
		}                                 
}
//Validats the login page to make sure  a userID/Password were entered
function validateLogin()
{
  var userID="";
  var password="";
            
    userID =document.login.user_id;
    password =document.login.password;
    if (userID.value == "")
    {
 		alert("Please enter User ID");
		userID.focus(); 		
		return false;
    }
    else if (password.value == "")
    {
        alert("Please enter a password");
        password.focus();
        return false
    }

  return true;
}

//Prints out the progress bar for piresults.asp page when
// a query is being executed
var maxbars = 30;
function PrintProgressBar()
{
	document.writeln("<div id=ProgressBar>")
	document.writeln("<center>")
	document.writeln("<table id=pbTable border=1>")
	document.writeln("<tr>")
	document.writeln("<td colspan=5>Searching...</td>")
	
	for (i=0;i< maxbars;i++)
      document.write("<td>&nbsp;</td>")
    document.writeln("<td>0:00</td>");
	document.writeln("</tr>")
	document.writeln("</table>")
	document.writeln("</center>")
    document.writeln("</div>")
}

//Increments the progress bar while query is being executed
var index = 1,last=1,timer,mins=0,secs=0;
function IncrementProgressBar()
{
var time;

    pbTable.cells.item(last).bgColor = document.body.style.backgroundColor;
    pbTable.cells.item(index).bgColor = "blue";
    if (secs<10)
      time = mins + ":0" + secs;
    else
      time = mins + ":" + secs;
      
    pbTable.cells.item(pbTable.cells.length-1).innerHTML = time;
    secs++;
    if (secs%60 == 0)
    {
      secs = 0;
      mins++;
    }
    last = index;
    index++;
    index = index%(maxbars+1)   //take into account no zero element
    if (index == 0)
    {
      index = 1;
    }
}

function ShowDetails(lic_no,exp_date)
{
	window.open("moreinfo.asp?license_number=" + lic_no + "&exp_date=" + exp_date,'','height=150px;width=50px')
}