function Cancel(page)
{
  window.location = page;
};

function Filter(page, sortorder)
{
  var FilterByComboBox = document.getElementById("fb");
  var ContainsTextBox = document.getElementById("cont");
  if (sortorder != "")
  {
    window.location = page+"?filterby="+FilterByComboBox.value+"&contains="+ContainsTextBox.value+"&sortorder="+sortorder;
  }
  else
  {
    window.location = page+"?filterby="+FilterByComboBox.value+"&contains="+ContainsTextBox.value;
  };
};

function Edit(page, id)
{
  window.location = page+"?id="+id;
};

function Print(page, id)
{
  window.open(page+"?cid="+id);
};

function Confirm(message, page, id) 
{
  if (confirm(message+"?")) 
  {
    window.location = page+"?id="+id;
  }
  else
  {
  // Отказ
  }
};

function Edit2(page, id, origid)
{
  window.location = page+"?id="+id+'&oid='+origid;
};

function Confirm(message, page, id) 
{
  if (confirm(message+"?")) 
  {
    window.location = page+"?id="+id;
  }
  else
  {
  // Отказ
  }
};

function Confirm2(message, page, id, cid, origid) 
{
  if (confirm(message+"?")) 
  {
    window.location = page+"?id="+id+"&cid="+cid+'&oid='+origid;
  }
  else
  {
  // Отказ
  }
};
  
function New(page)
{
  window.location = page;
};

function SetCursorToPointer()
{
  document.body.style.cursor = "hand"
};

function SetDefaultCursor()
{
  document.body.style.cursor = "default"
};

function setms(fmarka,fmodel,hv)
{

        marka='';
        if ( fmarka.selectedIndex>=0 )
          marka=fmarka.options[fmarka.selectedIndex].text;
        fmodel.length=0;

        marki=hv.split('**');

        i=0;
        while ( (i<marki.length)&&(fmodel.length==0) )
          {
            marki[i]=marki[i].split('~');
            if ( marki[i][0]==marka )
              {
                k=1;
                while ( k<marki[i].length )
                  {
                    optval=marki[i][k];
                    if ( optval=='' )
                      optval='---';
                    fmodel.options[k-1]=new Option(optval,marki[i][k]);
                    k++;
                  }
              }
            i++;
          }
        if ( fmodel.length==0 )
          fmodel.options[0]=new Option('','');

};

function Upload(page)
{
  window.location = page+"?f1="+document.getElementById("uploadedfile1").value+
                         "&f2="+document.getElementById("uploadedfile2").value+
                         "&f3="+document.getElementById("uploadedfile3").value+
                         "&f4="+document.getElementById("uploadedfile4").value;
};

function Filter2(page, sortorder)
{
  var FilterByComboBox = document.getElementById("fb");
  if (sortorder != "")
  {
    window.location = page+"?filterby="+FilterByComboBox.value;
  }
  else
  {
    window.location = page+"?filterby="+FilterByComboBox.value;
  };
};
