function apriPopup(file)
{
	return window.open(file, 'popup', 'width=400,height=200,scrollbars=yes');
}


function apriPopupCentrata(file,w_popup,h_popup) {
	var w = w_popup;
	var h = h_popup;
	var l = Math.floor((screen.width-w)/2);
	var t = Math.floor((screen.height-h)/2);
	window.open(file,"","width=" + w + ",height=" + h + ",top=" + t + ",left=" + l);
}

function addGraphic(file, testo, file_popup, w_popup, h_popup) {

	//create the img tag
	var graphic = document.getElementById("aggancio");
	
	//add the attributes
	graphic.setAttribute("src", file);
	graphic.setAttribute("alt", testo);

					//create the description element
	var description = document.getElementById("aggancio_testo");
	var newText = document.createTextNode(testo);
	description.removeChild(description.childNodes[0]);
					description.appendChild(newText);
	//description.nodeValue = newText;
	
	//create the onclick event
	if ( file_popup != null )
	   graphic.onclick = function() {apriPopupCentrata(file_popup,w_popup,h_popup)} ;
	else
		graphic.onclick = null ;
}

			

