//#####################################################
// Miscellaneous Functions
//#####################################################

// Messenger Variables

	var messengerPDF = 0;
	var nbrPDF = -1;
	var messengerPdfDesc = new Array();
	var messengerPdfFile = new Array();
	
// Music Variables

	var curMusic = 0;
	var musicFile = new Array();
	var musicTitle = new Array();
	var musicPerformer = new Array();
	var musicComposer = new Array();
	
// Contact Variables

	var email = '';
	var telephone = '';

	var address = new Array();
	var curAddress = 0;

	var officeTitle = new Array();
	var officeName = new Array();
	var curOffice = 0;

	var officeHours = new Array();
	var curHours = 0;
	
//------------------------------------------------------------------------------------------------------------
//- MESSENGER FUNCTIONS --------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------
function addMessengerPDF(vDesc, vFile, vYearMonth)
{
	setThisYM(vYearMonth);
	if (isYMgeToday(getThisYM()) > 0) {
		nbrPDF += 1;
		messengerPdfDesc[nbrPDF] = vDesc;
		messengerPdfFile[nbrPDF] = vFile;
	}
}
//------------------------------------------------------------------------------------------------------------
function writeMessengerPDF(vDesc, vFile, vMonth, vYear)
{
	var htmlString = ' ';
	if (nbrPDF >= 0) {
		for (var i = 0; i <= nbrPDF; i++) {	
			if (i == 0) {
				htmlString += '<table width="'+getPageWidth()+'" border="0"><tbody>';
				htmlString += '<TR><TD colspan="3" class="diary-title"><IMG border="0" name="messenger_logo" alt="logo" src="../images/styling/messengerlogo.jpg"></TD></TR>';
				htmlString += '<TR></TR>';
				htmlString += '<TR><TD colspan="2"><BR>To view the PDF version of an issue, select a link';
				htmlString += '<BR>To download the PDF version of an issue, Right click the link, and select "Save Target As..."<BR><BR></TD>';
				htmlString += '<TD><A id="adobe_reader" href="http://get.adobe.com/reader/" target="_blank"><IMG border="0" name="adobe_reader" alt="adobe_reader" src="../images/styling/get_adobe_reader.gif"></A></TD></TR>';
			}
			htmlString += '<TR><TD width="20%">&nbsp;</TD><TD class="diary-details"><IMG border="0" name="adobe_reader" alt="adobe_reader" src="../images/styling/reader_icon.gif">&nbsp;&nbsp;&nbsp;<A href="../files/'+messengerPdfFile[i]+'" target="_blank">'+messengerPdfDesc[i]+'</A></TD><TR>';
		}
		htmlString += '</tbody></table>';
		document.write(htmlString);
	}
}
//------------------------------------------------------------------------------------------------------------
//- MUSIC FUNCTIONS -----------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------
function addMusic(vFile, vTitle, vPerformer, vComposer)
{
	curMusic += 1;
	musicFile[curMusic] = vFile;
	musicTitle[curMusic] = vTitle;
	musicPerformer[curMusic] = vPerformer;
	musicComposer[curMusic] = vComposer;
}
//------------------------------------------------------------------------------------------------------------
function outputMusic()
{
	var i = getRandomNumber(curMusic)+1;
	var browser = getBrowser();
	var htmlString = '';
	if (curMusic > 0) {
		htmlString = 'You are listening to <I>'+musicTitle[i]+'</I><BR>Performed by <I>'+musicPerformer[i]+'</I><BR>Composed by <I>'+musicComposer[i]+'</I>';
		if (browser == 'msie') {
			htmlString += '<bgsound src="../music/'+musicFile[i]+'" loop=1 />';
		} 
		else {
			htmlString += '<BR><BR><EMBED src="../music/'+musicFile[i]+'" width="290" height="40" autostart="true" loop="false" showcontrols="true" volume="100"></EMBED>';
		}
	}
	else {
		htmlString += '&nbsp;';
	}
	document.write(htmlString);
}

//------------------------------------------------------------------------------------------------------------
//- CONTACT FUNCTIONS -----------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------
function setContactEmail(vEmail)
{
	email = vEmail;
}
function outputContactEmail()
{
	document.write('<A href="mailto:'+email+'">'+email+'</A>');
}
//------------------------------------------------------------------------------------------------------------
function setContactTelephone(vTelephone)
{
	telephone = vTelephone;
}
function outputContactTelephone()
{
	document.write(telephone);
}
//------------------------------------------------------------------------------------------------------------
function addContactAddress(vAddress)
{
	curAddress += 1;
	address[curAddress] = vAddress;
}
//------------------------------------------------------------------------------------------------------------
function outputContactAddress(vIndentNbr)
{

	var spacestring = '';
	for (var j = 1; j <= vIndentNbr; j++) {	
		spacestring += '&nbsp;';
	}
	var htmlString = '';
	for (var i = 1; i <= curAddress; i++) {	
		if (i == 1) {
			htmlString = spacestring+address[i];
		}
		else {
			htmlString += '<BR>'+spacestring+address[i];
		}
	}
	document.write(htmlString);
}
//------------------------------------------------------------------------------------------------------------
function addContactOffice(vTitle, vName)
{
	curOffice += 1;
	officeTitle[curOffice] = vTitle;
	officeName[curOffice] = vName;
}
//------------------------------------------------------------------------------------------------------------
function outputContactOffice()
{
	var htmlString = '';
	for (var i = 1; i <= curOffice; i++) {	
		if (i == 1) {
			htmlString = officeTitle[i]+':  '+officeName[i];
		}
		else {
			htmlString += '<BR>'+officeTitle[i]+':  '+officeName[i];
		}
	}
	document.write(htmlString);
}

//------------------------------------------------------------------------------------------------------------
function addContactHours(vText)
{
	curHours += 1;
	officeHours[curHours] = vText;
}
//------------------------------------------------------------------------------------------------------------
function outputContactHours()
{
	var htmlString = '';
	if (curHours > 0) {
		htmlString = '<UL>';
	}
	for (var i = 1; i <= curHours; i++) {	
		htmlString += '<LI>'+officeHours[i]+'</LI>';
	}
	if (curHours > 0) {
		htmlString += '</UL>';
	}
	document.write(htmlString);
}

//------------------------------------------------------------------------------------------------------------
