
// set to relative help directory
var szHelpDir = "help/";

// print the current calculator page
function printPage () {
	window.print();
}

// invoke specified help
var hlpwin;
function showHelpWindow ( helpURL ) {
	var sz = "width=500,height=250,resizable=yes,scrollbars=yes,screenX=100,screenY=100,top=100,left=100";
	hlpwin = window.open ( szHelpDir+helpURL, "hlpwin", sz+",menubar=no,status=no,location=no" );
	if (!hlpwin.opener) { hlpwin.opener = self; }
}

// invoke specified calculator
var calcwin;
function showCalculator ( calcURL ) {
	window.location.href=calcURL;
}

// saveexit button handling
function saveexitButton () {
    var retval = doSaveExit ( "stdcalcs" );
    //alert("return = " + retval);
}

// saveexit button handling
function saveButton () {
    var retval = doSave ( "stdcalcs" );
    //alert("return = " + retval);
}

// performVCAction ( save )
function doSave ( section ) {
    // Build parameter string using format: save,sss,sectionname,fmt
    var verb = "save,";
    var subaction = "sss,";
    var sectionname = section + ",";
    var fmt = "nvpairs";
    var parmstr = verb + subaction + sectionname + fmt + ";"; 

    return document.vcapp.performSubstitutedVCAction ( parmstr, true );

}

// performVCAction ( saveexit )
function doSaveExit ( section ) {
    // Build parameter string using format:
    //   saveexit,sssssss,sectionname,servobj,xtraparms,href,target,fmt
    var verb = "saveexit,";
    var subaction = "sssssss,";
    var sectionname = section + ",";
    var servobj = "calcserhndlr.jsp,"
    var xtraparms = "decode=true,";
    var desthref = "index.html,"
    var target = "_self,";
    var fmt = "nvpairs";
    var parmstr = verb + subaction + sectionname + servobj + xtraparms + desthref + target + fmt + ";"; 

    return document.vcapp.performSubstitutedVCAction ( parmstr, true );
}
