var FOTO_COUNTER = 0;
function addInputFoto(destination) {
	/*
	var container = document.createElement('DIV');
	container.className = 'foto-input';
	container.id = 'font-container['+FOTO_COUNTER+']'

	var input = document.createElement('INPUT');
	input.type = 'file';
	input.name = 'foto[]';
	input.id = 'foto['+FOTO_COUNTER+']';

	var textarea =  document.createElement('TEXTAREA');
	textarea.className = 'foto-text';
	textarea.rows = 3;
	textarea.name = 'desc[]';
	textarea.id = 'desc['+FOTO_COUNTER+']';
	
	container.appendChild(input);
	container.appendChild(document.createElement('BR'));
	container.appendChild(textarea);
	*/
	var el = '';
	/*el += '<div id="foto-container['+FOTO_COUNTER+']" class="foto-container">';
	el += '     <input type="hidden" value="" name="foto-id[]">';
	el += '     <h1>Descrizione</h1>';
	el += '     <textarea name="desc['+FOTO_COUNTER+']"  id="desc['+FOTO_COUNTER+']" ></textarea>';
	el += '     <br />';
	el += '     <h1>File</h1>';
	el += '     <input type="file" name="foto['+FOTO_COUNTER+']"  id="foto['+FOTO_COUNTER+']" />';
	el += '     <br />( <a href="javascript:delInputFoto(\''+destination+'\','+FOTO_COUNTER+')">delete</a> )';
	el += '</div>'; */
	
	el += '<div id="foto-container['+FOTO_COUNTER+']" class="foto-container">';
	el += '	<input type="hidden" value="" name="foto-id[]">';
	el += '	<table style="width: 100%;">';
	el += '		<tr>';
	el += '			<th rowspan="2"><img src="'+AJAX_BASE_URL+'images/nofoto.jpg" style="height: 70px;"/><br />( <a href="javascript:delInputFoto(\'files\',\''+FOTO_COUNTER+'\')">cancella</a> )</th>';
	el += '			<td style="vertical-align:top;"><b>Descrizione:</b><br /><input type="text" name="desc['+FOTO_COUNTER+']"  id="desc[<?=$counter?>]" value="" /></td>';
	el += '		</tr>';
	el += '		<tr>';
	el += '			<td style="vertical-align:top;"><b>File:</b><br /><input type="file" name="foto['+FOTO_COUNTER+']"  id="foto['+FOTO_COUNTER+']" /></td>';
	el += '		</tr>';
	el += '	</table>';
	el += '</div>	';
		
	var parse = document.createElement('div');
	parse.innerHTML = el;
	var src = parse.getElementsByTagName('foto-container['+FOTO_COUNTER+']');
	var obj = document.getElementById(destination);
	FOTO_COUNTER++;
	obj.appendChild(parse.childNodes[0]); // += el;
}
function delInputFoto(destination,count) {
	var div = document.getElementById('foto-container['+count+']');
	var obj = document.getElementById(destination);
	obj.removeChild(div);
	
}

function showFoto(destination, url) {
	shajObj.callLink(url,'',destination,NULL,'GET');
}