var CalendarControl = {};
CalendarControl = function() {
	this.CalendarForm;
	this.WhatToDo;
	this.MonthSelect;
	this.YearSelect;
	this.MonthYearButton;
	this.DateSelect;
	this.OpponentSelect;
	this.MediaSelect;
	this.LocationSelect;
	this.Initialize();
}

CalendarControl.prototype = {
	Initialize : function () {
		this.CalendarForm   = document.getElementById("CalendarForm");
		this.WhatToDo   		= document.getElementById("WhatToDo");
		this.MonthSelect    = document.getElementById("MonthSelect");
		this.YearSelect     = document.getElementById("YearSelect");
		this.MonthYearButton= document.getElementById("MonthYearButton");
		this.DateSelect     = document.getElementById("DateSelect");
		this.OpponentSelect = document.getElementById("OpponentSelect");
		this.MediaSelect    = document.getElementById("MediaSelect");
		this.LocationSelect = document.getElementById("LocationSelect");
		
		//WireUp Functions
		var pointer = this;
		this.MonthYearButton.onclick = function () { return pointer.MonthYearButton_OnClick(); };
		this.DateSelect.onchange = function () { return pointer.DateSelect_OnChange(); };
		this.OpponentSelect.onchange = function () { return pointer.OpponentSelect_OnChange(); };
		this.MediaSelect.onchange = function () { return pointer.MediaSelect_OnChange(); };
		this.LocationSelect.onchange = function () { return pointer.LocationSelect_OnChange(); };
	},
	MonthYearButton_OnClick : function () {
		this.WhatToDo.value = ".month=" + this.MonthSelect.value + "&year=" + this.YearSelect.value;
		this.CalendarForm.submit();
	},
	DateSelect_OnChange : function () {
		this.WhatToDo.value = ".date=" + this.DateSelect.value;
		this.CalendarForm.submit();
	},
	OpponentSelect_OnChange : function () {
		this.WhatToDo.value = ".opponent=" + this.OpponentSelect.value;
		this.CalendarForm.submit();
	},
	MediaSelect_OnChange : function () {
		this.WhatToDo.value = ".media=" + this.MediaSelect.value;
		this.CalendarForm.submit();
	},
	LocationSelect_OnChange : function () {
		this.WhatToDo.value = ".location=" + this.LocationSelect.value;
		this.CalendarForm.submit();
	}
}

function openCsvWindow()
{
	window.open('/outlookcsv.php', 'outlook', 'width=750,height=650,toolbar=0,resizable=1,scrollbars=1');
}