var g_bPageDirty = false;
var g_sPromptSaveChanges = 'You have not saved your changes.';

function MenuEnter(td)
{
	td.className = "lt1";
}

function MenuLeave(td)
{
	td.className = "lt0";
}

function GrpDetail(sVD, sGuid)
{
	PopUpWindow(sVD + "/popGroupDetail.aspx?sG=" + sGuid, 650, 500, "");
}

function VolDetail(sVD, sGuid)
{
	PopUpWindow(sVD + "/popVolDetail.aspx?sG=" + sGuid, 740, 500, "");
}

function NavTo(sURL, bIgnoreDirty)
{
	if (bIgnoreDirty)
		window.onbeforeunload = null;
	
	window.navigate(sURL);

}

function SubmitForm(sCmd, bIgnoreDirty)
{
	if (bIgnoreDirty)
		window.onbeforeunload = null;
		
	document.frm.hidFormCmd.value = sCmd;
	
	// The frm.submit() will fail with an error (javascript unspecified) if the user hits cancel
	// on the PromptSaveChanges dialog
	if (!bIgnoreDirty)
		window.onerror = EatError;
		
	document.frm.submit();
	
	window.onerror = null;
}			

function PromptSaveChanges()
{
	if (g_bPageDirty)
		return(g_sPromptSaveChanges);
}

function EatError()
{
	return true;
}

function DirtyPage()
{
	g_bPageDirty = true;
}

function txtVolSrchKeyPress()
{
	if (window.event.keyCode == 13)
	{
		VolSearch();
		return false;
	}
}

function VolSearch()
{
	if (valTextStr(true, document.frmVolSearch.txtVolSrchLastNm, 'Last Name', 20))
		document.frmVolSearch.submit();
}

function PrintPreview()
{
	var spnSrc = GetDocumentObject(document, "spnPrintPreview");
	if (spnSrc) {
		var pWin = PopUpWindow("/PrintPreview.htm", 640, 600, "");
		while (!pWin.document.body) {} //allow page to load
		var spnTarget = GetDocumentObject(pWin.document, "spnPrintPreview");
		spnTarget.innerHTML = spnSrc.innerHTML;
	}
	else
		window.print();
}