//======================================
//  FUNZIONE CHE APRE UNA FINESTRA 
//======================================
function apripagina(pagina,dx,dy,rsz,scrl,pos,menub){
	
	var settings, TopPosition, LeftPosition;

	//	screen.width    DIMENSIONE DELLO SCHERMO IN LARGHEZZA	
	//	screen.height  	DIMENSIONE DELLO SCHERMO IN ALTEZZA
	//	dx				DIMENSIONE DELLA FINESTRA IN LARGHEZZA
	//	dy				DIMENSIONE DELLA FINESTRA IN ALTEZZA

	if (pos==""){
		pos = "center";
	}
	if (pos=="center"){
		// allineamento della finestra in mezzo
		TopPosition = ((screen.height) / 2) - (dy/2);
		// allineamento della finestra in mezzo
		LeftPosition = ((screen.width) / 2) - (dx/2);
	}
	if (pos=="right"){
		// allineamento della finestra in alto a destra
		TopPosition = 0;
		// allineamento della finestra a destra
		LeftPosition = (screen.width) - dx -10;
	}
	if (pos=="left"){
		// allineamento della finestra in alto a sinistra
		TopPosition = 0;
		// allineamento della finestra a destra
		LeftPosition = 0;
	}
	
	if (menub==""){
		menub = "yes";
	}
		
	// settaggio delle caratteristiche della finestra da aprire
	settings ='height='+dy+',width='+dx+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scrl+',resizable='+rsz+',titlebar=no,status=yes,menubar='+menub;
	
	// se esite gia' una finestra aperta allora la chiudo e la distruggo;
	//if (win != null){
	//	win.close();
	//	win = null;
	//}
	
	// apro una nuova finestra e le assegno il focus il nome della nuova finestra
	// (secondo campo nell'elenco parametri) non deve contenere nulla ;
	
	win = window.open(pagina,'',settings)
	win.window.focus();
}

//==========================================
//  FUNZIONE CHE RIDIMENSIONA UNA FINESTRA 
//==========================================

function ridimensiona(x, y, pos) {
	
	//self.resizeTo(x+10,y+28);
	self.resizeTo(x+10,y+50);
	self.moveTo((screen.width - x)/2, (screen.height - y)/2)
	
	if (pos==""){
		pos = "center";
	}
	if (pos=="center"){
		// allineamento della finestra in mezzo
		self.moveTo((screen.width - x)/2, (screen.height - y)/2)
	}
	if (pos=="right"){
		// allineamento della finestra in alto a destra
		self.moveTo((screen.width) - x -10, 0)
	}
	if (pos=="left"){
		// allineamento della finestra in alto a sinistra
		self.moveTo(0 , 0)
	}
}

//=========================================================
//	FUNZIONE CHE SERVE PER CAMBIARE UNA IMMAGINE PASSANDO
//  CON IL MAUSE SOPRA I VARI LINK
//==========================================================

function Dettaglio(nomeimg)
{
	
	
	var immagine = "'" + nomeimg + "'";
	
	//var immagine = "'../../files/catalogue/images/categories/medium/" + nomeimg + "'";
	//var immagine = "'../dati/img-prodotti/img-prodotto-grossa-" + id + ".jpg'";
	//alert(immagine)
	
	document.images['img_prodotto'].src = eval(immagine);
	
//	var nome_prodotto = "nome_" + id + ".style.visibility = 'visible'";
//	eval(nome_prodotto);
//	
//	var descrizione = "descrizione_" + id + ".style.visibility = 'visible'";
//	eval(descrizione);
//	
//	var abilita_ciccio = "abilita_ciccio_" + id + ".value";
//	
//	if (eval(abilita_ciccio) == "1")	
//	{
//		var link_ciccio = "link_ciccio_" + id + ".style.visibility = 'visible'";
//		eval(link_ciccio);
//	}
//	
//	var link_formaggio = "link_formaggio_" + id + ".style.visibility = 'visible'";
//	eval(link_formaggio);
	
}

function Pulisci(id)
{
	document.images['img_prodotto'].src = '../../files/catalogue/images/categories/medium/nofoto.gif';
	
//	var nome_prodotto = "nome_" + id + ".style.visibility = 'hidden'";
//	eval(nome_prodotto);
//	
//	var str2 = "descrizione_" + id + ".style.visibility = 'hidden'";
//	eval(str2);
}


