dojo.require("dojo.lang");
	
function changeCategory(selectorID)
{
	var lUpdater = new listUpdater("viewTabsContainer", "calendar");
	
	var selector = document.getElementById(selectorID);
	
	lUpdater.changeCategory(selector.value);
}

function flipMonth(year, month, date, offSet)
{
	month = parseInt(month, 10);
	year = parseInt(year, 10);
	date = parseInt(date, 10);
	
	var curDate = new Date(year, month-1, date, 2, 0, 0);
	
	var lUpdater = new listUpdater("viewTabsContainer", "calendar");
	
	curDate = lUpdater.tabContainerWidget.flipMonth(curDate, offSet);
	
	changeDate(curDate.getFullYear(), curDate.getMonth()+1, curDate.getDate());
}

function switchYear(month, date)
{
	var year = document.getElementById("yearSelector").value;
	
	changeDate(year, month, date);
}

function changeDate(year, month, date)
{	
	var lUpdater = new listUpdater("viewTabsContainer", "calendar");
	lUpdater.changeDate (year, month, date);
}


//list updated class
var listUpdater = function (listingId, calendarID)
{

	this.tabContainerWidget = null;

	
	var listContentEle = document.getElementById(listingId);
	
	if (listContentEle != null)
	{
		this.tabContainerWidget = dojo.widget.manager.getWidgetByNode(listContentEle);
	

	}
};

dojo.lang.extend( listUpdater, {


				
		changeDate: function (year, month, date)
		{
			year = parseInt(year, 10);
			month = parseInt(month, 10);
			date = parseInt(date, 10);
			
			//refresh the listing
			this.tabContainerWidget.dateChange(year, month, date);
			
		},
		
		changeCategory: function (category)
		{
			this.tabContainerWidget.categoryChange(category);

		}
	}
);
