/**********************************************************************
calendar.js contains declarations for the calendar object and
declares an instance of the calendar object.
***********************************************************************/ 

// create a new event
function event (theMonth, theDay, theTitle, theIcon) {
    this.month		= theMonth
    this.day    	= theDay;
    this.title		= theTitle   
}


// calendar constructor creates a new calendar
function calendar () {
    
    this.numberEntries = 0;                            // No articles when first created
    this.entries = new Array();                        // Array of entries is initially empty
    
    // Methods for calendar object
    
    this.addEntry = calendar_addEvent;                 // Specify method for adding an event
    this.displayEvents = calendar_displayEvents	       // Specify method for displaying events
    
}


// calendar_addEvent adds an event to the calendar
function calendar_addEvent (entryMonth, entryDay, entryTitle) {    
    this.numberEntries += 1;
    this.entries[this.numberEntries-1] = new event(entryMonth, entryDay, entryTitle);    
}


function calendar_displayEvents(monthNo){

Mths = new Array("January","February","March","April","May","June","July","August","September","October","November","December");

strDisplay = "";

strDisplay = strDisplay + '<table cellspacing=0 width="100%">'
strDisplay = strDisplay + '<tr><td class="gadgetheader">Events for ' + Mths[monthNo] +'</td><td class="gadgetheaderend"></td></tr>' 
strDisplay = strDisplay + '<tr>'
strDisplay = strDisplay + '<td colspan=2 class="gadgetbody">'

	strDisplay = strDisplay +'<table border=0 cellspacing=3 cellpadding=0>'

	for (var i = 0; i <= this.numberEntries-1; i++) {
	        
	        var my = this.entries[i];    
	        
	        
	        if (monthNo + 1 == my.month){
	
		   strDisplay = strDisplay + '<tr>'
		   strDisplay = strDisplay +'<td valign="top" class="articletext" width=40><b>'
		   
		   strDisplay = strDisplay + my.day 
		   
		   strDisplay = strDisplay + '</b></td>'
		   strDisplay = strDisplay + '<td class="articletext">'
		   strDisplay = strDisplay + my.title
		   
		   strDisplay = strDisplay + '</td>'
		   strDisplay = strDisplay + '</tr>'
		}
	}

	
	
	
	strDisplay = strDisplay +'</td>'
	
	
	strDisplay = strDisplay +'</table>'
	strDisplay = strDisplay +'<p align="center">'	
	strDisplay = strDisplay +'<table cellpadding=0 cellspacing=0>'
	strDisplay = strDisplay +'<tr>'
	strDisplay = strDisplay +'<td>'
	strDisplay = strDisplay +'<a href="javascript:previousMonth(' + monthNo + ')" target="_self">'
	strDisplay = strDisplay +'<img src="images/navigation/calprevious.jpg" border=0>'
	strDisplay = strDisplay +'</a>' 	
	strDisplay = strDisplay +'</td>'
	strDisplay = strDisplay +'<td>'
	strDisplay = strDisplay +'<a href="javascript:nextMonth(' + monthNo + ')" target="_self">'
	strDisplay = strDisplay +'<img src="images/navigation/calnext.jpg" border=0>'
	strDisplay = strDisplay +'</a>' 	
	strDisplay = strDisplay +'</td>'	
	strDisplay = strDisplay +'</tr>'				
	strDisplay = strDisplay +'</table>'
	strDisplay = strDisplay +'</p>'
	
	
	
	strDisplay = strDisplay + '</td>'
	strDisplay = strDisplay + '</tr>'
	strDisplay = strDisplay + '</table>'

return strDisplay;

}




// Create an instance of the newspaper object
var Calendar = new calendar();
