function viewReport(iReportId)
{
	var strURL = "/Public/ViewReport.aspx?id=" + iReportId + "&username=IntAegisWS";
	openReport(strURL);
}

function viewReportMisc(iReportId, miscType)
{
	var strURL = "/Public/ViewReport.aspx?id=" + iReportId + "&username=IntAegisWS&misc=" + miscType;
	openReport(strURL);
}

function viewPrintableReport(strType)
{
	// get security for report
	var oSecId = document.getElementById("SecIdValue");

	if (oSecId != null)
	{
		viewPrintableReportForSecurity(strType, oSecId.value, "")
	}
}

function viewPrintableReportReco(strType, forceLTReco)
{
	// get security for report
	var oSecId = document.getElementById("SecIdValue");
	if (oSecId != null)
	{
		viewPrintableReportForSecurity(strType, oSecId.value, forceLTReco)
	}
}

function viewPrintableReportForSecurity(strType, strSecId, strMisc)
{
	var strURL = "";

	if (strType == "ondemandbrief")
		strURL = "/Public/ViewReport.aspx?id=1";

	if (strType == "ondemanddetail")
		strURL = "/Public/ViewReport.aspx?id=2";

	if (strType == "ondemandnocoverage")
		strURL = "/Public/ViewReport.aspx?id=4";

	if (strType == "ondemandhybriddetail")
		strURL = "/Public/ViewReport.aspx?id=7";

	if (strType == "ondemandhybridbrief")
		strURL = "/Public/ViewReport.aspx?id=8";

	if (strType == "ondemandclient1")
		strURL = "/Public/ViewReport.aspx?id=19";

	if (strType == "ondemandclient2")
		strURL = "/Public/ViewReport.aspx?id=20";

	if (strType == "ondemandclient3")
		strURL = "/Public/ViewReport.aspx?id=21";

	if (strType == "ondemandclient4")
		strURL = "/Public/ViewReport.aspx?id=22";
		
	if (strURL != "")
	{
		if (strSecId != "")
			strURL = strURL + "&e=asx&m=" + strSecId;

		if (strMisc != "")
			strURL = strURL + "&misc=" + strMisc;

		openReport(strURL);
	}
}

function openHelp(freshurl)
{
	 HelpWin = window.open(freshurl, 'smallwindow', 'status,scrollbars,resizable,toolbar,height=600,width=800');
	 if (window.focus) {
		 HelpWin.focus();
	 }
	 if (HelpWin.opener == null)
		 HelpWin.opener = window;
	 HelpWin.opener.name = "ParentWindow";
}

function openContact()
{
	openHelp('/Help/Answer.aspx?SubId=262&Qid=210')
}

function countChars(me, iLimit)
{
	var iChars = me.value.length;

	if ((oCounter = document.getElementById(me.name + "Count")) != null)
		oCounter.innerHTML = iChars.toString();

	if (iChars >= iLimit)
		event.returnValue = false;
}
