function CalendarGeneric(sessionId)
{
	this.sessionId = sessionId;
	this.AJAX_STATUS_FAILURE = 'AJAX_STATUS_FAILURE';
	this.AJAX_STATUS_SUCCESS = 'AJAX_STATUS_SUCCESS';
}


/**
 * The Server request starts here!
 *
 * If bricksDays and bricksMonths is set, it describes the array keys (comma separated) where the bricks are stored in the session.
 */
CalendarGeneric.prototype.startRequest = function(month, year, language, classPrefix, method, bricksDays, bricksMonths)
{
   var service = new JsService("/module/methods/", "");
   var parameters = "PHPSESSID=" + escape(this.sessionId) + "&month=" + escape(month) + "&year=" + escape(year) + "&classPrefix=" + escape(classPrefix) + "&method=" + escape(method) + "&id_language=" + escape(language) + "&bricksDays=" + escape(bricksDays) + "&bricksMonths=" + escape(bricksMonths);
   
   service.get("calendar_generic/index.php", this.onResponse, parameters, this);
}

/**
 * When the server responds, results are updated here:
 */
CalendarGeneric.prototype.onResponse = function(response)
{
   
   if (response.status ==CalendarGeneric.AJAX_STATUS_FAILURE)
   {
      return false;
   }
  
   if (response.calendarHTML != '')
   {      
      document.getElementById("calendarDIV").innerHTML = response.calendarHTML;
   }
   return true;
}

if ( !window.DEBUG )
      window.log = function() { }, window.error = alert
