function showInvoices(strStartPeriod, strEndPeriod)
{
	startLoading();
	
	setTimeout("_showInvoices('" + strStartPeriod + "', '" + strEndPeriod + "', 1)", 1);
}

function showInvoicesPage(iPageNo)
{
	objStartPeriod = document.getElementById("page_startPeriod");
	objEndPeriod = document.getElementById("page_endPeriod");
	startLoading();
	
	setTimeout("_showInvoices('" + objStartPeriod.value + "', '" + objEndPeriod.value + "', " + iPageNo + ")", 1);
}

function _showInvoices(strStartPeriod, strEndPeriod, iPageNo)
{
	var objAjax;

	objAjax = new CAjax();
	objAjax.create();

	if (objAjax.open("ajax/ajax_getInvoices.php?startPeriod=" + strStartPeriod + "&endPeriod=" + strEndPeriod + "&pageNo=" + iPageNo, true))
	{
		objTab.addTab("tab_invoices", lang("Invoices"), true);
		objTab.showTab("tab_invoices");
		
		var objTabDiv = document.getElementById("tab_invoices");
		objTabDiv.innerHTML = objAjax.getResponse();	
	}
	else
	{
		alert("There has been a problem, please contact an administrator");
	}
	
	resizeInvoiceList();
	
	endLoading();
}

function account_requestPriceList()
{
	var objAjax, objDiv, objXmlDom, strStatus, strMessage;
	
	objAjax = new CAjax();
	objAjax.create();

	if (objAjax.open("ajax/ajax_requestPriceList.php", true))
	{
		objXmlDom = xml_createXmlDom();
		
		objXmlDom.loadXML(objAjax.getResponse());
		
		strStatus = objXmlDom.selectSingleNode("/kmsg/kmsgresponse/result").getAttribute("status");
		
		if (strStatus == "true")
		{
			alert(lang("Price list requested successfully"));
		}
		else
		{
			strMessage = objXmlDom.selectSingleNode("/kmsg/kmsgresponse/message/text()").nodeValue;
			alert(lang("Price list request failed\n") + strMessage);
		}
	}
	else
	{
		alert(lang("There has been a problem, please contact an administrator"));
	}
}