private int getAvailableBus(int[] busesList, Date day, service serv)
  {
    int bus_id = 0;
    boolean temp = false;
    boolean found = false;
    for(int i=0; i<buses.length; i++)
    {
      temp = false;
      found = false;
      if(BusInfo.isAvailable(busesList[i], day))
      {
        for(int j=0; j<busesUsedIndex; j++)
        {
	  if(busesList[i] == busesUsed[j].bus_id)
	  {
	    if(serv.starttime > busesUsed[j].endTime)
	      temp = true;
	    else
	      temp = false;
            found = true;
	  }
        }
	if(temp)
	{
	  bus_id = busesList[i];	 
	}   
        else
        {
            if(!found)
              bus_id = busesList[i];
        }
      }
    }
    busesUsed[busesUsedIndex] = new busUsed(bus_id, serv.starttime, serv.endtime);
    busesUsedIndex++;
    return bus_id;
  }