//initialize glabal variables
var date=new Date();
var month=date.getMonth();
var prevMonth;
var nextMonth;

//Initialize page -- Call this function from HTML page
function init(a) {
  updateMonth(a);
  showMonth(a);
}

//update global values based on current selection
function updateMonth(a){
  month=a;
  if (a>=11) {
    nextMonth=0;
    prevMonth=a-1;
  } else if (a<=0) {
    nextMonth=a+1;
    prevMonth=11;
  } else {
    nextMonth=a+1;
    prevMonth=a-1;
  }
}

//show image for selected month
function showMonth(a) {
  var d = document.getElementById('image');
  //var myimg=documet['image'];

  var myimages=new Array();
  myimages[0]="january.jpg";
  myimages[1]="february.jpg";
  myimages[2]="march.jpg";
  myimages[3]="april.jpg";
  myimages[4]="may.jpg";
  myimages[5]="june.jpg";
  myimages[6]="july.jpg";
  myimages[7]="august.jpg";
  myimages[8]="september.jpg";
  myimages[9]="october.jpg";
  myimages[10]="november.jpg";
  myimages[11]="december.jpg";

  document['image'].src='images/cal/'+myimages[a];

}


