
var ajaxcal_dir  = 'http://thehudsonpulse.com/wp-content/plugins/ajaxcalendar/';
var siteurl      = 'http://thehudsonpulse.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');
	}
}

//functions to respond to the links given in the day
 
var combo=null;
function ajaxcalendar_showday(year,month,day) {
	if (combo) combo.toggle();    var d = $('ajaxcal_dayinsert');
   if (!d) {
      new Insertion.Bottom('activecalendar', '<tr><td colspan="7"><div id="ajaxcal_dayinsert" class="displayday" style="width:100%;height:100%;"></div></td></tr>');
		//then we create the effect.
		combo = new fx.Combo('ajaxcal_dayinsert',{ opacity: true });		combo.hide();   }
	if (typeof year == 'number') {
		new Ajax.Updater('ajaxcal_dayinsert',ajaxcal_dir + 'ajaxcalendardayremote.php?yearID=' + year + '&monthID='+month+ '&dayID='+day, {onComplete: ajaxcalendar_gotlist });
	} else {
		new Ajax.Updater('ajaxcal_dayinsert',ajaxcal_dir + 'ajaxcalendardayremote.php');
	}
}
function ajaxcalendar_gotlist() {
	combo.toggle(); }
