/* Copyright Commcam Limited 2008. All rights reserved. (See licence/licence.txt) */

function showInvoices(strStartDate, strEndDate, iPageNo)
{
	startLoading("_showInvoices('" + strStartDate + "', '" + strEndDate + "', '" + iPageNo + "')");
}

function _showInvoices(strStartDate, strEndDate, iPageNo)
{
	var objAjax = new CAjax();

	if (objAjax.open("dynamic/invoices.php?mode=LIST&startdate=" + strStartDate + "&enddate=" + strEndDate + "&page=" + iPageNo, true))
	{
		objDiv = g_objTabs.addTab("invoiceList", "Invoice List", true, true);
		objDiv.innerHTML = objAjax.getResponse();
	}
		
	endLoading();
}

function showInvoice(strDocumentNo, strType, strMagic)
{
	startLoading("_showInvoice('" + strDocumentNo + "', '" + strType + "', '" + strMagic + "')");
}

function _showInvoice(strDocumentNo, strType, strMagic)
{
	var objAjax = new CAjax();

	if (objAjax.open("dynamic/viewDocument.php?mode=LIST&documentno=" + strDocumentNo + "&documenttype=" + strType + "&magicno=" + strMagic, true))
	{
		objDiv = g_objTabs.addTab("document_" + strDocumentNo, "Document: " + strDocumentNo, true, true);
		objDiv.innerHTML = objAjax.getResponse();
	}
		
	endLoading();
}