
var ajaxcal_dir  = 'http://journal.westsidefaithcenter.com/wp-content/plugins/ajaxcalendar/';
var siteurl      = 'http://journal.westsidefaithcenter.com';
//Setup to display the calendar
//function addEvent(el,ev,fn) {
//   if (el.attachEvent)el.attachEvent('on'+ev,fn);
//   else if (el.addEventListener)el.addEventListener(ev,fn,false);
//}

function ajaxcalendar_adminAdd(){
	ajaxcalendar_refresh();
}
addEvent(window,'load',ajaxcalendar_adminAdd);


function ajaxcalendar_refresh(year,month) {
	if (typeof year == 'number') {
		new Ajax.Updater('calendar',ajaxcal_dir + 'ajaxcalendarremote.php?yearID=' + year + '&monthID='+month);
	} else {
		new Ajax.Updater('calendar',ajaxcal_dir + 'ajaxcalendarremote.php');
		//new Ajax(ajaxcal_dir + 'ajaxcalendarremote.php',{update: $('calendar')}).request();
	}
}

//functions to respond to the links given in the day
function ajaxcalendar_showday(year,month,day) {
	new Ajax.Request(ajaxcal_dir + 'ajaxcalendarredirect.php', 
	                 {method: 'get', 
                  parameters: 'yearID=' + year + '&monthID='+month+ '&dayID='+day, 
                  onComplete: ajaxResponse
                  });
}
function ajaxResponse(req) {
  window.location = req.responseText;
}
