function Calendar_Display(cl_container, preview_container, intro_container, url_container, title, fname, query) {
    this._varpos = null; this._varname = null; this._cbData = new Array();
    $Lib.createGlobalVarName(this);
    
	this.Calendar = new Calendar(cl_container, true, false, title);
	
	this.fname = fname;
	this.query = $Lib.objConcat(query);
	
	this.preview_container = document.getElementById(preview_container);
	this.url_container = document.getElementById(url_container);
	
	this.intro_container_id = intro_container;
	this.intro_container = null;
	
	this.shown = false;
	
	this._preview = {info: new Array(), indices: new Array(), currentIndex: 0};

	this._Info = new Array();
	
	this.ajax = new MyAjaxDoc(false);
	this.ajax.addDataHandler("_handleData", this);
	this.ajax.setErrorHandler("_handleError", this);
	this.ajax.useP2J(true);	
	
	this.showCalendar = function () {
		this.Calendar.showCalendar();
		
		if (this.Calendar.shown && !this.shown) {			
			this.setStatus("Loading Data...");		
			this.shown = true;
			this._getData();			
		}
		this._ResetAll();
	}
	this.changeFName = function (fname, query) {
		this.fname = fname;
		this.query = query;
	}
	this._loadData = function (JSOBJ) {
		var arr = new Array(), _yr = this.Calendar.getFullYear(), _mn = this.Calendar.getMonth();
		var i, days_len = 0, items_len = 0, dt, events_item;
		
		for (i in JSOBJ.events) {
			events_item = JSOBJ.events[i];
			if (!events_item.EVENT_DATE) continue;
			
			dt = events_item.EVENT_DATE.split("-");
			
			if (dt[0] == _yr && dt[1] == _mn) {
				items_len++;
				if (typeof arr[dt[2]] == 'undefined') {
					days_len++;
					arr[dt[2]] = new Array();
				}
				
				arr[dt[2]][i] = events_item;
			}
 		}
		
 		this._Info = arr;
 		this.setStatus("(" + days_len + " Days, " + items_len + " Items)");
 		this._Refresh();
	}
	this.setStatus = function (stext) {
	    this.Calendar.setStatus(stext);
    }
	this._Refresh = function () {
		
 		this._ResetAll();
 		var acount = 0, hcolor = "#FF9933", cellData, clitem;		
		var a, b, i, _mn = this.Calendar.getMonth(), singleCell, day, count;
		
		for (a = 1; a <= 6; a++) {
			for (b = 1; b <= 7; b++) {
				acount++;
				cellData = this.Calendar.MonthData[acount];
				
				if (cellData[1] != _mn) continue; //Only current month
				day = cellData[2];
				
				clitem = this.Calendar.clitems[acount];
				
				if (typeof this._Info[day] == 'undefined') continue;
				
				singleCell = this._Info[day];
				
				clitem.style.cursor = "pointer";
				clitem.style.backgroundColor = "#70A76E";
				clitem.style.border = "1px inset #BBBBBB";
				clitem.style.fontWeight =  "bold";
				
				clitem.title = "";				
				
				count = 0;
				for (i in singleCell) {
					count++;
					clitem.title += count + ") " + singleCell[i].TITLE + " \n ";
				}
				
				clitem.onmouseover = new Function(
					'this.style.backgroundColor="' + hcolor + '";');
				clitem.onmouseout = new Function('this.style.backgroundColor="' + 
						clitem.style.backgroundColor + '";');
				clitem.onclick = new Function(this._varname + '.showTip(' + day + ');');
				
			}
		}
	}
	this._handleData = function (docobj, JSOBJ, ajax) {		
		if (typeof JSOBJ.events != 'undefined' && typeof JSOBJ.events_count != 'undefined') {
			this._loadData(JSOBJ);
		}
	}
	this._handleError = function (docobj, Msg, ajax) {
		this.setStatus(Msg);
	}
	this._ResetAll = function () {
		if (!this.Calendar.shown) return;
		var a, b, acount = 0, _mn = this.Calendar.getMonth();
		
		for (a = 1; a <= 6; a++) {
			if (acount == (this.Calendar.MonthData.length - 1)) break;
			for (b = 1; b <= 7; b++) {
				acount++;
				var clitem = this.Calendar.clitems[acount];
				var cell = this.Calendar.MonthData[acount];
				
				clitem.style.cursor = "default";
				
				if (cell[1] < _mn || cell[1] > _mn) clitem.style.backgroundColor = "#F7FCF8";
				else clitem.style.backgroundColor = "transparent";
				
				clitem.style.border = "0px solid #FFFFFF";
				clitem.style.fontWeight =  "normal";
				clitem.title = "";
				clitem.onmouseover = clitem.onmouseout = clitem.onclick = 
					new Function("return false;");
			}
		}
	}
	this._onUpdate = function (info) {
		if (info.date && this.shown) {
			//for (a=0; a< x.attributes.length;a++) alert(x.attributes[a].nodeName);
			//return;
			//this.showTip(0, 0);
			//return this.setStatus("WOY: " + this.Calendar.getWeekOfYear());
			this._ResetAll();
			if (info.year || info.month) {//Year or Month Changed
				this.setStatus("Loading Data...");
				this._getData();
			}
		} 
	}
	this.ReloadInfo = function () {
		if (this.shown) this._onUpdate(new Array(this.Calendar, 0, false, false, false, false, 0), true);
	}			
	this._getData = function () {
		this.query["m"] = this.Calendar.getMonth();
		this.query["y"] = this.Calendar.getFullYear();
		this.query["_rand_key"] = $Lib.genUID(20, 8, 9);
		
        var query = $Lib.buildQuery(this.query);
		this.ajax.load(this.fname, "get", query, null);
	}
	this.showTip = function (day) {				
		var i;
		
		if (typeof this._Info[day] == 'undefined') return;
		
		this._preview.info = this._Info[day];
		this._preview.indices = new Array();
		
		for (i in this._preview.info) this._preview.indices.push(i);
		
		this.showFirstEvent();		
	}
	this.hideTip = function () {				
		this.preview_container.style.display = "none";
		try { this.intro_container.parentNode.removeChild(this.intro_container); } catch (e) { }
		this.intro_container = null;
	}
	this._showEvent = function (index) {
		var count, event, op = "", control, coll, beforeme;
		var hcolor = "#5D874C", gcolor = "#BBBBBB";
		
		if (typeof this._preview.indices[index - 1] == 'undefined') return false;
		
		count = this._preview.indices.length;
		eventData = this._preview.info[this._preview.indices[index - 1]];
		
		try { this.intro_container.parentNode.removeChild(this.intro_container); } catch (e) { }
		this.intro_container = null;
		
		this.intro_container = document.createElement("DIV");
		this.intro_container.id = this.intro_container_id;
		
		coll = this.preview_container.getElementsByTagName("DIV");
		
		control = coll[0];
		beforeme = coll[1];
		
		coll = control.getElementsByTagName("A");
		
		coll[0].style.color = index == 1 ? gcolor : hcolor;
		coll[1].style.color = index > 1 ? hcolor : gcolor;
		coll[2].style.color = index < count ? hcolor : gcolor;
		coll[3].style.color = index == count ? gcolor : hcolor;
		
		coll = control.getElementsByTagName("SPAN");
		coll[0].innerHTML = index + '/' + count;
		
		this.intro_container.innerHTML = 
		'<strong>' + eventData.TITLE + '</strong><br />' + eventData.DESCRIPTION +
		'<br />Event Date: ' + eventData.EVENT_DATE +
		'<br />Pub Date: ' + eventData.PUB_DATE + '<br /><hr />' +
		'Category: ' + eventData.CATEGORY + '<br />' +
		'Provider: <a href="' + eventData.SOURCE_URL + '" target="_blank">' + eventData.SOURCE + '</a>';
		
		coll = this.intro_container.getElementsByTagName("A");
		for (i = 0; i < coll.length; i++) coll[i].target = "_blank";
		
		this.intro_container = this.preview_container.insertBefore(this.intro_container, beforeme);		
		
		this.url_container.href = eventData.LINK;
		this.preview_container.style.display = "block";
		
		this._preview.currentIndex = index;
	}
	this.showFirstEvent = function () {
		var count = this._preview.indices.length;
		if (count > 0) return this._showEvent(1);
		else return false;
	}
	this.showPreviousEvent = function () { 
		var count = this._preview.indices.length;
		if (this._preview.currentIndex > 1 && count > 0) return this._showEvent(this._preview.currentIndex - 1);
		else return false;
	}
	this.showNextEvent = function () { 
		var count = this._preview.indices.length;
		if (this._preview.currentIndex < count && count > 0) return this._showEvent(this._preview.currentIndex + 1);
		else return false;
	}
	this.showLastEvent = function () { 
		var count = this._preview.indices.length;
		if (count > 0) return this._showEvent(count);
		else return false;
	}
	this.getIndexFromNode = function (node_id) {
		var i;
		for (i in this._preview.indices) if (node_id == this._preview.indices[i]) return (i + 1);
		return -1;
	}
	this.Show = function () {
		this.Calendar.Show();
	}
	this.Hide = function () {
		this.Calendar.Hide();
	}
	this.Close = function () {
		try {
		    var i;
		    this.Calendar.Close();
		    this.ajax.Close();
		    $Lib.deleteGlobalVarName(this);

		    for (i in this) {
		        try {
		            delete this[i];
		        }
		        catch (e) {}
		    }
		}
		catch (e) { }
		this.Close = new Function("return;");
	}	
	this.Visible = function () {
		return this.Calendar.Visible();
	}	 
	this.Calendar.setCallBacks("_onUpdate", this, null);
}
