	function Immagine(id, commento, larghezza, altezza, larghezza_big, altezza_big, coorX, coorY, link_type, link, admin) {
		this.id = id;
		this.commento = commento;
		this.larghezza = larghezza;
		this.altezza = altezza;
		this.larghezza_big = larghezza_big;
		this.altezza_big = altezza_big;
		this.coorX = coorX;
		this.coorY = coorY;
		this.link_type = link_type;
		this.link = link;
		this.admin = admin;

		this.rapporto = Math.round(this.altezza_big / this.larghezza_big * 1000) / 1000;

		if(this.admin) {
			this.codice = "<div id=div_img_" + this.id + " onmousedown=\"JavaScript:move(this.id.substring(4))\" style=\"cursor:pointer;position:absolute;top:" + this.coorY + ";left:" + this.coorX + "\">";
		}
		else {
			this.codice = "<div id=div_img_" + this.id + " style=\"cursor:pointer;position:absolute;top:" + this.coorY + ";left:" + this.coorX + "\">";
		}
				this.codice += this.getCodiceImg();
		this.codice += "</div>";

/*
		if(this.admin) {
		this.codice = "<table id=tab_" + this.id + " style=\"position:absolute;top:0;left:0;\" cellspacing=0 cellpadding=0 border=1>";
			this.codice += "<tr>";
				this.codice += "<td colspan=2 id=row_" + this.id + " style=\"height:" + this.coorY + "\">&nbsp;</td>";
			this.codice += "</tr>";
			this.codice += "<tr>";
				this.codice += "<td id=col_" + this.id + " style=\"width:" + this.coorX + ";height:" + this.height + "\">&nbsp;</td>";
				this.codice += "<td id=div_img_" + this.id + " style=\"width:" + this.width + "; height:" + this.height + ";\" valign=top align=left";
					this.codice += this.getCodiceImg();
				this.codice += "></td>";
			this.codice += "</tr>";
		this.codice += "</table>";
		}

		if(!this.admin) {
			this.codice += this.getCodiceImg();
			this.codice += "</div>";
		}
*/

		immagini[this.id] = this;
	}

	Immagine.prototype.setCommento = function(commento) {
		this.commento = commento;
		this.aggiorna();
	}

	Immagine.prototype.setLarghezza = function(larghezza) {
		this.larghezza = larghezza;
		this.aggiorna();
	}

	Immagine.prototype.setAltezza = function(altezza) {
		this.altezza = altezza;
		this.aggiorna();
		document.immagini.altezza.value = this.altezza;
	}

	Immagine.prototype.setCoorX = function(coorX) {
		coorX = coorX.toString();

		if(coorX.indexOf("px") != -1) this.coorX = parseInt(coorX.substring(0, coorX.length - 2));
		else this.coorX = parseInt(coorX);

		document.getElementById("div_img_" + this.id).style.left = this.coorX;
		document.immagini.coorX.value = this.coorX;
	}

	Immagine.prototype.setCoorY = function(coorY) {
		coorY = coorY.toString();

		if(coorY.indexOf("px") != -1) this.coorY = parseInt(coorY.substring(0, coorY.length - 2));
		else this.coorY = parseInt(coorY);

		document.getElementById("div_img_" + this.id).style.top = this.coorY;
		document.immagini.coorY.value = this.coorY;
	}

	Immagine.prototype.setLinkType = function(link_type) {
		this.link_type = link_type;
		this.aggiorna();
	}

	Immagine.prototype.setLink = function(link) {
		this.link = link;
		this.aggiorna();
	}

	Immagine.prototype.aggiorna = function() {
		document.getElementById("div_img_" + this.id).innerHTML = this.getCodiceImg();
	}

	Immagine.prototype.getCodiceImg = function() {
		if(this.admin) {
			//codiceImg = " background=\"images/home/s_" + this.id + ".jpg\" title=\"Link: ingrandisci; Commento: " + this.commento + "\"";

			if(this.link_type == "nessuno") {
				codiceImg = "<img id=img_" + this.id + " title=\"" + this.commento + "\" style=\"width:" + this.larghezza + ";height:" + this.altezza + ";\" src=\"images/home/s_" + this.id + ".jpg\" border=0>";
			}
			else if(this.link_type == "esterno") {
				codiceImg = "<img id=img_" + this.id + " title=\"Link: " + this.link + "; Commento: " + this.commento + "\" style=\"width:" + this.larghezza + ";height:" + this.altezza + ";\" src=\"images/home/s_" + this.id + ".jpg\" border=0>";
			}
			else if(this.link_type == "file") {
				codiceImg = "<img id=img_" + this.id + " title=\"Link: File -> " + this.link + "; Commento: " + this.commento + "\" style=\"width:" + this.larghezza + ";height:" + this.altezza + ";\" src=\"images/home/s_" + this.id + ".jpg\" border=0>";
			}
			else {
				codiceImg = "<img id=img_" + this.id + " title=\"Link: ingrandisci; Commento: " + this.commento + "\" style=\"width:" + this.larghezza + ";height:" + this.altezza + ";\" src=\"images/home/s_" + this.id + ".jpg\" border=0>";
			}
		}
		else {
			if(this.link_type == "nessuno") {
				codiceImg = "<img id=img_" + this.id + " title=\"" + this.commento + "\" style=\"width:" + this.larghezza + ";height:" + this.altezza + ";\" src=\"images/home/s_" + this.id + ".jpg\" border=0>";
			}
			else if(this.link_type == "esterno") {
				codiceImg = "<a href=\"" + this.link + "\" target=new>";
					codiceImg += "<img id=img_" + this.id + " title=\"" + this.commento + "\" style=\"width:" + this.larghezza + ";height:" + this.altezza + ";\" src=\"images/home/s_" + this.id + ".jpg\" border=0>";
				codiceImg += "</a>";
			}
			else if(this.link_type == "file") {
				codiceImg = "<a href=\"" + this.link + "\" target=new>";
					codiceImg += "<img id=img_" + this.id + " title=\"" + this.commento + "\" style=\"width:" + this.larghezza + ";height:" + this.altezza + ";\" src=\"images/home/s_" + this.id + ".jpg\" border=0>";
				codiceImg += "</a>";
			}
			else {
				codiceImg = "<img id=img_" + this.id + " title=\"" + this.commento + "\" style=\"width:" + this.larghezza + ";height:" + this.altezza + ";\" src=\"images/home/s_" + this.id + ".jpg\" border=0 onclick=JavaScript:openWindow('pages/popup.php?image=../images/home/" + this.id + ".jpg'," + this.larghezza_big + "," + this.altezza_big + ")>";
			}
		}

		return codiceImg;
	}

	Immagine.prototype.toString = function() {
		ritorno = "commento:" + this.commento + "-";
		ritorno += "larghezza:" + this.larghezza + "-";
		ritorno += "altezza:" + this.altezza + "-";
		ritorno += "coorX:" + this.coorX + "-";
		ritorno += "coorY:" + this.coorY + "-";
		ritorno += "link_type:" + this.link_type + "-";
		ritorno += "link:" + this.link + "-fine:";

		return ritorno;
	}