function ModuleEventListMonthPrev(currMonth, currYear) { /* <<<( */

	var newLocation = '';
	var replaceParams = new Array();
	var replaceValues = new Array();
	var prevMonth = '';
	var prevYear = currYear;

	// decrement month
	prevMonth = parseInt(currMonth, 10) - 1;

	// check if month is above valid range
	if (12 < prevMonth) {
		// if so, treat as if it was december and decrement to november
		prevMonth = 11;
	}

	// check if month wraps
	if (0 >= prevMonth) {

		// if so, set to december and decrement year
		prevMonth = 12;
		prevYear = parseInt(prevYear, 10) - 1;
		prevYear = prevYear.toString();
	}

	// string-ify month
	if (10 > prevMonth) {
		prevMonth = '0' + prevMonth.toString();
	}
	else {
		prevMonth = prevMonth.toString();
	}

	// set month and year params
	replaceParams.push('month');
	replaceParams.push('year');
	replaceValues.push(prevMonth);
	replaceValues.push(prevYear);

	// build new location
	newLocation = window.location.pathname + '?' + ModuleEventListReplaceQueryParams(replaceParams, replaceValues);

	// redirect
	window.location.href = newLocation;

	return;
} /* )>>> */

function ModuleEventListMonthNext(currMonth, currYear) { /* <<<( */

	var newLocation = '';
	var replaceParams = new Array();
	var replaceValues = new Array();
	var nextMonth = '';
	var nextYear = currYear;

	// increment month
	nextMonth = parseInt(currMonth, 10) + 1;

	// check if month wraps
	if (12 < nextMonth) {
		// if so, set to january and increment year
		nextMonth = 1;
		nextYear = parseInt(nextYear, 10) + 1;
		nextYear = nextYear.toString();
	}

	// check if month is below range
	if (0 >= nextMonth) {

		// if so, treat as if it was january and increment to february
		nextMonth = 2;
	}

	// string-ify month
	if (10 > nextMonth) {
		nextMonth = '0' + nextMonth.toString();
	}
	else {
		nextMonth = nextMonth.toString();
	}

	// set month and year params
	replaceParams.push('month');
	replaceParams.push('year');
	replaceValues.push(nextMonth);
	replaceValues.push(nextYear);

	// build new location
	newLocation = window.location.pathname + '?' + ModuleEventListReplaceQueryParams(replaceParams, replaceValues);

	// redirect
	window.location.href = newLocation;

	return;
} /* )>>> */

function ModuleEventListReplaceQueryParams(paramsToReplace, replaceValues) { /* <<<( */

	var params = location.search.toString(); // query string to search/replace on
	var foundParam = false; // whether or not the current parameter was found in the string

	// check that search/replace arrays are same length
	if (paramsToReplace.length == replaceValues.length) {

		// check if there were any parameters
		if ('' == params) {
			params = new Array();
		}
		else {
			// remove question mark
			if (0 == params.indexOf('?')) {
				params = params.substr(1);
			}
			// explode on ampersands
			params = params.split('&');
		}

		// loop over each search/replace parameter and 
		for (var currSearch = 0; paramsToReplace.length > currSearch; currSearch++) {

			foundParam = false;

			// loop through the parameters to find the one to replace
			for (var currParam = 0; (params.length > currParam) && (false == foundParam); currParam++) {

				// check if this is the parameter we are searching for
				if (0 == params[currParam].indexOf(paramsToReplace[currSearch] + '=')) {

					// if so, replace with the new value
					params[currParam] = params[currParam].replace(/=.*$/g, '=' + replaceValues[currSearch]);
					foundParam = true;
				}
			}

			// check if the parameter was found
			if (false == foundParam) {

				// if not, then we want to append the parameter
				params.push(paramsToReplace[currSearch] + '=' + replaceValues[currSearch]);
			}
		}
	}

	// create string of query params
	params = params.join('&');

	return params;
} /* )>>> */

function ModuleEventListDisplayPastDates() { /* <<<( */

	var today = new Date();
	var currDate = today.getDate();
	var todayDay = '';
	
	// loop over all previous dates and display them
	for (var index = 0; currDate > index; index++) {

		// pad day with zero
		if (10 > index) {
			todayDay = '0' + index;
		}
		else {
			todayDay = index;
		}

		if (null != document.getElementById('module-event-list-date-container-' + todayDay)) {
			if ('module-event-list-date-container-hidden' == document.getElementById('module-event-list-date-container-' + todayDay).className) {
				document.getElementById('module-event-list-date-container-' + todayDay).className = 'module-event-list-date-container';
			}
		}
	}

	return;
} /* )>>> */

function ModuleEventListHidePastDatesHeader() { /* <<<( */

	if (null != document.getElementById('module-event-list-past-dates-container')) {
		if ('module-event-list-past-dates-container-hidden' != document.getElementById('module-event-list-past-dates-container').className) { 
			document.getElementById('module-event-list-past-dates-container').className = 'module-event-list-past-dates-container-hidden';
		}
	}

	return;
} /* )>>> */


