// <script type="text/javascript">
//the bday array data can be generated from server-side
var arrBday = [
['Josh Rutty', '1/2/1988'],
['Jason Licht', '1/12/1988'],
['Mrs. Rempe', '2/10/1958'],
['Mr. Oxley', '2/11/1969'],
['Mrs. Miracle', '2/27/1960'],
['Timothy O.', '3/19/1996'],
['Mr. Licht', '5/1/1953'],
['Shawn H.', '5/1/1953'],
['Mrs. Oxley', '5/3/1970'],
['Mrs. Licht', '6/18/1955'],
['Steve R.', '7/2/1995'],
['Mr. Rempe', '7/30/1958'],
['Mrs. Holley', '8/13/1965'],
['Douglas H.', '8/28/1995'],
['Alex M.', '9/4/1995'],
['Robert M.', '9/7/1992'],
['Mr. Riley', '9/9/1955'],
['Mrs. Musial', '9/15/1968'],
['Don Brooks', '9/24/1991'],
['Dan Musial', '9/29/1991'],
['Jerry H.', '10/6/1998'],
['Jamie B.', '10/28/1994'],
['Chris Hamilla', '11/10/1990'],
['Mrs. Falcon', '12/21/1967'],
];

function getBdayList(month){
  var bday, idx;
  var today = new Date();
  var bdayList = new Array();  
  for (var i=0;i<arrBday.length;i++){
    try{
		bday = new Date(arrBday[i][1]);
		}
			catch(er){
			bday='No date'
			}
		if (typeof bday!= 'object' || bday.constructor != Date) continue;
    if (month == bday.getMonth()){
       idx = bdayList.length;
       bdayList[idx] = new Object();
       bdayList[idx].name = arrBday[i][0];
       bdayList[idx].bday = bday;
       bdayList[idx].age = today.getFullYear() - bday.getFullYear();       
    }
  }
  if (bdayList.length > 0){ //sort asc by birthdate
     bdayList.sort(
       function(a, b){
         if (a.bday.getDate() < b.bday.getDate()) return -1;
         if (a.bday.getDate() > b.bday.getDate()) return 1;
         return 0;
       }
     );
  }
  return bdayList;  
}

function displayBdayList(){
  var arrMonth = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "August", "October", "November", "December");
  var month = new Date().getMonth();
  var date = new Date().getDate();
  var monthName = arrMonth[month];
  var bdayList = getBdayList(month);
  var len = bdayList.length;
  var s = "";
  if (len>0){
    s += '<ul>';
    for (var i=0; i<len; i++){
       //no age
       s += '<li style="margin: 0 0 0 3ex"' + ((date == bdayList[i].bday.getDate())?' class="bdayToday"':'') + '>' + bdayList[i].name;
    }
    s += '</ul>';
  }
  else{
    s += "No birthdays this month.";
  }
  document.write(s);
}
// </script>