/* 	newsletter.js
	These are functions specific to the PresMsg page that contains the monthly Newsletter
 		loadPresMsgHeader():	creates and loads the page heading for PresMsg
		createPMFilename():	creates the file name for the current active newsletter and loads it into an iframe

	External Files:
		common.js	Uses shared functions for managing cookies and month conversion
*/


function loadPresMsgHeader() {
/* Create and load the page header for this page: President's Message - Month YYYY */
	var hdrString 	= new String();
	var hdrFixed  	= "President\'s Message - ";
	var hdrDate   	= wordMonth[glblSiteDate.getMonth().toString()]+' '+glblSiteDate.getFullYear().toString(); //toString not required ...
	hdrString     	= hdrFixed+hdrDate;

	document.getElementById('hdrPresMsg').innerHTML = hdrString;
	return true;
}

function createPMFilename() {
/* Create the filename for the President's Message .html file (PresMsg_YYYY_MM.html) for the current month */
	var fileString 	= new String();
	var fileDirectory = "Archive/";
	var filePrefix 	= "PresMsg_";
	var fileSuffix	= ".html";
	var fileDate   	= new String();
	var month	= new String();
	var cookieName	= "anchorName";

	month 	 = twocharMonth(glblSiteDate.getMonth() + 1);				//convert current month to 2 char string
	fileDate = glblSiteDate.getFullYear().toString()+'_'+month;			//complete file date from current year and month

	if (cookiesEnabled()) {								//Get anchor state cookie if cookies supported
		fileString = fileDirectory+filePrefix+fileDate+fileSuffix+cookies[cookieName]; 	//complete file name with cookie
		nullCookie(cookieName);							//reset the cookie value back to null
	} else {
		fileString = fileDirectory+filePrefix+fileDate+fileSuffix; 		//complete file name without the cookie
	}
	document.getElementById('iframePM').src = fileString;				//Set the iframe URI
	return true;
}