var ViewModel;

function PrintReport_OnClick()
{
	GetReportParameter(function(paramStr, errorStr)
	{
		if(errorStr == "")
		{
			ViewModel.ReportModel.closeReport();

			var URLParam = "ReportID=" + selectedReportID;
			if(paramStr != "")
			{
				URLParam += "&Param=" + paramStr;
			}
			OpenWinEx("ReportGenerate.asp?" + URLParam, 600, 600, 1);
		}
		else
		{
			toastr.warning("The following error(s) occurred.<br>" + errorStr);
		}
	});
}

// Viewmodel
function MainViewModel()
{
	var self = this;

	self.ReportModel = new ReportViewModel(); 
}

function Initialise()
{
	ViewModel = new MainViewModel();
	ko.applyBindings(ViewModel);
}

$(document).ready(function(){
	Initialise();
});