function confirmDelete() 
{
    if (confirm('Are you sure you want to delete these record(s)?')) 
    {
        var f=document.fm;
        f.fmDeleteRecords.value = '1';    
        f.fmUpdateActive.value='0';
        f.submit();
    }  
}


function hiAll(c)
{
   var f = this.document.fm;
   for (var i=0; i < f.elements.length; i++)
      if (f.elements[i].name == 'selectBox[]')  f.elements[i].checked = c;
}

function createNewLightBox()
{
   var n = prompt('Please enter the name for the new lightbox:');
   if (n)
   {
      var f = document.service;
      f.fmAction.value = 'new';
      f.fmParam.value = n;
      f.submit();
   }
}

function renameLightBox(i)
{
   var f = document.service;
   //var v = f.fmLightbox.options[f.fmLightbox.selectedIndex].text;
   var n = prompt('Please enter the new name for this lightbox.');
   if (n)
   {
      f.fmAction.value = 'rename';
      f.fmParam.value = n;
      f.fmLightbox.value = i
      f.submit();
   }
}

function deleteLightBox(i)
{
   var f = document.service;
   if (!(i > 0)) return
   if (confirm('Are you sure to delete this lightbox?'))
   {
      var f = document.service;
      f.fmAction.value = 'delete';
      f.fmLightbox.value = i
      f.submit();
   }
}

function cancelForm(f)
{
    f.fmCancel.value=1;
    f.submit();
}

function updateCart(i)
{
    var f = document.update;
    f.fmAmount.value = document.getElementById('amount_'+i).value
    f.recKey.value = i
    f.submit()
}

function addToCart(r)
{
   var f = this.document.fm;
   var v = 0;
   for (var i=0; i < f.elements.length; i++)
      if (f.elements[i].name == 'fmPricingOption' && f.elements[i].checked)  v = f.elements[i].value
   if (v)   
   window.location.href='cart.php?fmAction=add&fmSubmit=1&fmAmount=1&recKey='+r+'x'+v;
   else alert("Please, choose pricing option")
}


