function add_prodotto()
{ var nome = document.getElementById("nome").value;
  var codrif  = document.getElementById("codrif").value;
  var prezzo  = document.getElementById("prezzo").value;
  var categoria = document.getElementById("categoria").value;
  if (nome=="" || codrif=="" || prezzo=="" || categoria=="") 
    alert("Attenzione, tutti i campi sono obbligatori!");
  else document.form1.submit();
}

function add_categoria()
{ var nome = document.getElementById("nome").value;
  if (nome=="") 
    alert("Attenzione, tutti i campi sono obbligatori!");
  else document.form2.submit();
}

function delete_prodotto(id)
{ if (confirm("Si conferma l'eliminazione di questo prodotto?")) 
	location.replace('?action=delete&id='+id);
}

function delete_categoria(id)
{ if (confirm("Si conferma l'eliminazione di questa categoria?")) 
	if (confirm("ATTENZIONE, procedendo tutti i prodotti legati a questa categoria saranno cancellati!"))
	 location.replace('?action=delete&id='+id);
}

function delete_offerta(id)
{ if (confirm("Si conferma l'eliminazione di questa offerta?")) 
   location.replace('?action=delete&id='+id);
}

function delete_richiesta(id)
{ if (confirm("Si conferma l'eliminazione di questa richiesta?")) 
   location.replace('?action=delete&id='+id);
}

function delete_user(id)
{ if (confirm("Si conferma l'eliminazione di questo utente?")) 
   location.replace('?action=delete&id='+id);
}

function gestioneimm(id)
 {
  location.replace('?action=gestione&id='+id);
 }
 
function cancellaimm(id)
 { if (confirm("Cancellare questa immagine?"))
    location.replace('?action=cancellaimm&id='+id);
 }
 
function aggiungiimm(id)
 {
  location.replace('?action=aggiungiimm&id='+id);
 }
 
function verificacontatti()
 {
  if ((document.getElementById('Nome').value!='') && (document.getElementById('Cognome').value!='') && (document.getElementById('email').value!=''))
   {
    document.FormContatti.submit();
   }
  else
   {
    alert ("Campi Incompleti!");
   }
 }
 
function verificarichieste()
 {
  if ((document.getElementById('Nome').value!='') && (document.getElementById('Cognome').value!='') && (document.getElementById('Indirizzo').value!='') && (document.getElementById('email').value!='') && (document.getElementById('Telefono').value!='') && (document.getElementById('Descrizione').value!=''))
   {
    document.formRichieste.submit();
   }
  else
   {
    alert ("Campi Incompleti!");
   }
 } 

function verificaofferte()
 {
  if ((document.getElementById('Nome').value!='') && (document.getElementById('Cognome').value!='') && (document.getElementById('Indirizzo').value!='') && (document.getElementById('email').value!='') && (document.getElementById('Telefono').value!='') && (document.getElementById('Descrizione').value!='') && (document.getElementById('Conservazione').value!='') && (document.getElementById('Prezzo').value!=''))
   {
    document.formOfferte.submit();
   }
  else
   {
    alert ("Campi Incompleti!");
   }
 }
 
function showrows(i)
{ document.getElementById("row"+i).style.display=''; }