
var changed = 0;
var loadDlg=null, saveDlg=null, stylesDlg=null;


function closeAllDialogs()
{
  if (loadDlg) loadDlg.close();
  if (saveDlg) saveDlg.close();
  if (stylesDlg) stylesDlg.close();
}


function newMenu()
{
  if (!confirm('Current menu parameters will be changed.\nAre you sure you want to create new menu?')) return;

  closeAllDialogs();

  parent.frames[1].window.dm_reCreateParams();

  parent.frames[2].window.clearItems();
  parent.frames[2].window.styles1 = [];
  parent.frames[2].window.styles2 = [];
  
  parent.frames[4].window.updatePreview();
  changed = 0;
}


function loadMenu()
{
  if (!confirm('Current menu parameters will be changed.\nContinue?')) return;
  closeAllDialogs();
  loadDlg = window.open('loaddlg.html', 'loaddlg', 'width=500,height=600,toolbar=no,status=0,location=no,menubar=no');
  changed = 1;
}


function saveMenu()
{
  closeAllDialogs();
  saveDlg = window.open('savedlg.html', 'savedlg', 'width=500,height=600,toolbar=no,status=0,location=no,menubar=no');
}

function openStylesDlg(far)
{
  closeAllDialogs();
  stylesDlg = window.open((far ? 'htmltuner/' : '') + 'stylesdlg.html', 'stylesdlg', 'width=650,height=600,toolbar=no,status=0,location=no,menubar=no');
}
