

function initAvailabilityGrid() {
	AG_days = new Array('MON','TUE','WED','THU','FRI','SAT','SUN');
	AG_times = new Array('Morning','Afternoon','Evening');
	
	for(d=0;d<AG_days.length;d++) {
		day = AG_days[d];
		el = document.getElementById('day_'+day);
		el.style.cursor = 'pointer';
		el.title = 'Toggle Day';
		el.setAttribute('AG_day',day);
		el.onclick = function() {
			// iterate through checkboxes
			for(t=0;t<AG_times.length;t++) {
				timeCode = AG_times[t].substr(0,1).toUpperCase();
				cbEl = document.getElementById('availability_'+this.getAttribute('AG_day')+'_'+timeCode);
				if (!t) checkStatus = (cbEl.checked) ? false : true;
				cbEl.checked = checkStatus;
			}
			if (document.getElementById('submitButtons')) document.getElementById('submitButtons').style.display = 'block';
		}
		el.onmouseover = function() {
			this.style.textDecoration = 'underline';
		}
		el.onmouseout = function() {
			this.style.textDecoration = 'none';
		}
	}
	
	for(t=0;t<AG_times.length;t++) {
		timeCode = AG_times[t].substr(0,1).toUpperCase();
		el = document.getElementById('time_'+timeCode);
		el.style.cursor = 'pointer';
		el.title = 'Toggle Time';
		el.setAttribute('AG_time',timeCode);
		el.onclick = function() {
			// iterate through checkboxes
			for(d=0;d<AG_days.length;d++) {
				day = AG_days[d];
				cbEl = document.getElementById('availability_'+day+'_'+this.getAttribute('AG_time'));
				if (!d) checkStatus = (cbEl.checked) ? false : true;
				cbEl.checked = checkStatus;
			}
			if (document.getElementById('submitButtons')) document.getElementById('submitButtons').style.display = 'block';
		}
		el.onmouseover = function() {
			this.style.textDecoration = 'underline';
		}
		el.onmouseout = function() {
			this.style.textDecoration = 'none';
		}
	}
}

loadMeUp += "initAvailabilityGrid()";