// JavaScript Document

function aggiungiAllegato()
{
	var e = prendiElementoDaId("allegati");
	var i = document.createElement("input");
	var b = document.createElement("br");
	
	i.setAttribute("type", "file");
	i.setAttribute("name", "allegato[]");
	
	e.appendChild(i);
	e.appendChild(b);
}

function aggiungiFoto()
{
	var e = prendiElementoDaId("aggiungi_foto");
	var i = e.numero;
	var br = document.createElement("br");
	var spazio = document.createTextNode(" ");
	
	if(i == null)
	{
		i = 1;
	}
	
	e.numero = ++i;
	
	var T1 = document.createTextNode("Foto " + i + ":");
	var T2 = document.createTextNode("Titolo foto " + i + ":");
	var T3 = document.createTextNode("Descrizione foto " + i + ":");
	
	var foto = document.createElement("input");
	foto.setAttribute("type", "file");
	foto.setAttribute("name", "foto[]");
	
	var titolo = document.createElement("input");
	titolo.setAttribute("type", "text");
	titolo.setAttribute("name", "titolo[]");

	var descrizione = document.createElement("input");
	descrizione.setAttribute("type", "text");
	descrizione.setAttribute("name", "descrizione[]");
	
	e.appendChild(T1);
	e.appendChild(spazio.cloneNode(0));
	e.appendChild(foto);
	e.appendChild(br.cloneNode(0));
	e.appendChild(T2);
	e.appendChild(spazio.cloneNode(0));
	e.appendChild(titolo);
	e.appendChild(br.cloneNode(0));
	e.appendChild(T3);
	e.appendChild(spazio.cloneNode(0));
	e.appendChild(descrizione);
	e.appendChild(br.cloneNode(0));
	e.appendChild(br.cloneNode(0));
}

function aggiungiFoto2()
{
	var e = prendiElementoDaId("aggiungi_foto");
	var i = e.numero;
	
	if(i == null)
	{
		i = 1;
	}
	
	e.numero = ++i;
	
	e.innerHTML += 'Foto ' + i + ':<br /><input type="file" name="foto[]" /><br />Titolo foto ' + i + ':<br /><input type="text" name="titolo[]" /><br />Descrizione foto ' + i + ':<br /><input type="text" name="descrizione[]" /><br />';
}

