/** Handler for the new button on input toolbar. */

var newDlg = false;

function FormClearer(animateDialogs, newCancelButtonText, newOKButtonText) {
	this.animateDialogs = animateDialogs;
	this.newCancelButtonText = newCancelButtonText;
	this.newOKButtonText = newOKButtonText;
}

/** Show new dialog. */
FormClearer.prototype.newFile = function() {
	if (!newDlg) {
		newDlg = new YAHOO.ext.BasicDialog("new-dlg", {
			modal:true,
			autoTabs:true,
			resizable:false,
			width:350,
			height:150,
			shadow:true,
			animateTarget: (this.animateDialogs ? 'inputNewButton' : null)
		});
		newDlg.addKeyListener(27, newDlg.hide, newDlg);
		newDlg.addButton(this.newCancelButtonText, newDlg.hide, newDlg);
		newDlg.addButton(this.newOKButtonText, this.doNewFile, this);
	}
	newDlg.show();
}

/** Clear form and hide new dialog. */
FormClearer.prototype.doNewFile = function() {
	clearForm();
	if (newDlg) newDlg.hide();
}

