/*
Copyright (c) ScanFrame 2008.
All Rights Reserved.

$Source: /export/cvs/primo/com/jscripts/calculator.js,v $
$Author: arjan $
$Revision: 1.2 $

Identification:
  JSCRIPTS

Initial Author:
  AVO 20080909

Purpose:
	Library for using a calculator on an input.

*/
// Called from an input ar ascociated button.
function CalculatorDialog(input, lang)
{
	// Assign the control to assign the result to.
	DialogWin.CalculatorInput = input;
	// Set the handler for the modal result of the page.
	DialogWin.EvModalResult = function(result, name)
	{
		if (this.ModalResult != null && this.ModalResult != false)
		{
			// Prevent form some keys to go to the input control.
			DialogWin.CalculatorInput.blur();
			// Assign the value stored by the calculator window.
			DialogWin.CalculatorInput.value = Dialog.CalculatorValue;
			// Make the input control get focus when it lost it.
			DialogWin.CalculatorInput.focus();
		}
	}
	// Open the calculator window.
	var url = get_base_url(document.location) +	'jscripts/calculator/calculator.html';
	//
	return OpenDialogModal(url, 'calculator_dialog', 234, 335);
}
