function visPrice()
{

	//Form = document.getElementById("formprodx")
	//indice1 = Form.Opz0.selectedIndex;
	
	if (document.getElementById("AddIdArtDrop") != undefined)
		{	Drop = document.getElementById("AddIdArtDrop")
			Indice = Drop.selectedIndex;
			
			if (Indice > 0)
			{ Opz = Drop.options[Indice].value
			  Prezzo = parseFloat(GetPrezzo(Opz));
			  AddButton = true;				
			}  
			else
			{ AddButton = false;	
			  Prezzo = 0;
			}
		
			// alert (Indice + " - " + Prezzo);
		}
	else
		{	Opz = document.getElementById("AddIdArtBase").value;
			Prezzo = parseFloat(GetPrezzo(Opz));
			AddButton = true;	
		}
	
	k = 1;
	while (document.getElementById("DropOpz" + k) != undefined)
		{ 	Drop = document.getElementById("DropOpz" + k)
			Indice = Drop.selectedIndex;
			Opz = Drop.options[Indice].value
			
			Prezzo = parseFloat(Prezzo) + parseFloat(GetPrezzo(Opz));	// estrarre prezzo !
	
			// alert (Indice + " - " + Prezzo);
	
			k += 1;
		}
	
	if (AddButton)	
		{	StrPrezzo = Prezzo.toString();
			StrPrezzo = StrPrezzo.substr (0, StrPrezzo.length - 2) + "," + StrPrezzo.substr (StrPrezzo.length - 2, 2);
			document.getElementById("price").innerHTML=StrPrezzo + " €";
		}
		else
		{	document.getElementById("price").innerHTML="-";
		}
}

/* ------------------------------------------------------------------------------------------------------------------- */
function openPopBasket(page)
{		info = "width=220,height=80,menubar=no,scrollbars=yes,resizable=no";
		window.open(page, "Basket", info);
}

function addArtSPop(TBasket, UrlArea, lang, IdArt, ModePop)		
// Chiama addArt di prodotto semplice nel pop-up basket.
{
	page = UrlArea + "/PopBasket.aspx?lang=" + lang + "&TBask=" + TBasket + "&Addidart=" + IdArt + "&ModePop=" + ModePop;
	info = "width=220,height=80,menubar=no,scrollbars=no,resizable=no"
	window.open(page, "Basket", info);
}

function SubmitaddArtSPop(TBasket, UrlArea, lang, ModePop)		
// Chiama addArt di prodotto con varianti o opzioni nel pop-up basket.
{
	if (document.getElementById("AddIdArtDrop") != undefined)
		 { 	Drop = document.getElementById("AddIdArtDrop")
			Indice = Drop.selectedIndex;
			if (Indice > 0)	 {  AddButton = true; }  else   { AddButton = false; }
		 }
	else {	AddButton = true;	}

	if (AddButton) 
	{	if (ModePop == "pop") 
			{ window.opener.openPopBasket(""); }
			else
			{ openPopBasket(""); }

		page = UrlArea + "/PopBasket.aspx?lang=" + lang + "&TBask=" + TBasket + "&ModePop=" + ModePop;

		document.getElementById("formprodx").action=page;
		document.getElementById("formprodx").target="Basket";
		document.getElementById("formprodx").submit();
	}
	else
	{   alert ("E' necessario selezionare il modello!"); }	
}

function SubmitaddArt(TBasket, UrlArea, lang, ModePop)
// Chiama addArt di prodotto con varianti o opzioni direttamente sulla windows corrente 
// quando PopBasket è spento !
{
	if (document.getElementById("AddIdArtDrop") != undefined)
		 { 	Drop = document.getElementById("AddIdArtDrop")
			Indice = Drop.selectedIndex;
			if (Indice > 0)	 {  AddButton = true; }  else   { AddButton = false; }
		 }
	else {	AddButton = true;	}
	
	if (AddButton)
		{	page = UrlArea + "/Navigation.aspx?mode=Basket&lang=" + lang + "&TBask=" + TBasket + "&Type=" + ModePop;

			document.getElementById("formprodx").action = page;
			document.getElementById("formprodx").submit();
		}
	else {  alert ("E' necessario selezionare il modello!"); }	
}

/* ------------------------------------------------------------------------------------------------------------------- */

function GetPrezzo(Opz)
{
	var Prezzo = Opz.split("$$$")
	return Prezzo[1]
}
 
function setimg (obj, nomeimg)
{ obj.src = nomeimg;  }

function apriProd(UrlArea, id, lang)
{
	page = UrlArea + "/PopProd.aspx?id=" + id + "&lang=" + lang + "&Type=pop";
	info = "width=640,height=500,menubar=no,scrollbars=yes,resizable=yes"
	window.open(page, "Prod"+id, info);
}

function ProdCorrelati(UrlArea, id, lang)
{
	page = UrlArea + "/nexp/" + lang + "/idProd/"+ id + "/navigation.htm#prodcorr";
	window.opener.location.href = page
	window.close()
}

function apriMakePdf(UrlArea, lang, param)
{
	page = UrlArea + "/Catalog/CatalogoPdf.aspx?lang=" + lang + param + "&UrlArea=" + UrlArea;
	info = "width=640,height=380,menubar=no,scrollbars=no,resizable=no"
	window.open(page, "Pdf", info);
}

function apriSaveBasket(UrlArea, lang)
{
	page = UrlArea + "/PopBasketSave.aspx?lang=" + lang;
	info = "width=640,height=380,menubar=no,scrollbars=no,resizable=no"
	window.open(page, "SaveBasket", info);
}


function OpenBig(UrlArea, foto)
{
	page = UrlArea + "/PopImgZoom.aspx?foto=" + foto;
	info = "width=640,height=500,menubar=no,scrollbars=yes,resizable=yes";
	window.open(page,"ProdottiBig",info);
}

function OpenPay (UrlArea)
{
		page = UrlArea + "/PopPay.aspx?modepay=Start";
		info = "width=648,height=500,menubar=no,scrollbars=yes,resizable=yes";
		window.open(page,"PopPay",info);
}

function CheckQta(Val)
{
	if (isNaN(Val.value))
	{
		alert("Inserire un numero intero!");
		Val.focus();
	}
	
	if (Val.value.match(/\./) != null)
	{
		alert("Inserire un numero intero!");
		Val.focus();
	}
}

function check()
{
	// if (event.keyCode==13) return false;
} 

function Check_Basket()
{
	if (document.getElementById("DropTrasporto") != undefined)
	{
		if (document.getElementById("DropTrasporto").value == 0 || document.getElementById("DropPagamento").value == 0)
		{	
			alert("Specificare metodi di trasporto e pagamento!");
			return false;
		}
	}
	
	return true;
}

function Resize()
{
	altezza = document.images.imma.height + 82;
	larghezza = document.images.imma.width + 30;
	
	if (altezza < 540 && larghezza < 760)
	{
		self.resizeTo(larghezza,altezza);
	}
	else
	{
		if (altezza > 540 && larghezza < 760)
		{
			self.resizeTo(larghezza,540);
		}
		else
		{
			if (altezza < 540 && larghezza < 760)
			{
				self.resizeTo(760,altezza);
			}
		}
	}
}

function CheckSize()
{
	larghezza = document.body.clientWidth;
	//alert(larghezza);
	
	if (!isNaN(larghezza))
	{
		if (larghezza > 1024)
		{
			if (document.getElementById("MainTable") != undefined)
				{ document.getElementById("MainTable").width = 1024; }
				
			if (document.getElementById("FootTable") != undefined)
				{ document.getElementById("FootTable").width = 1024; }
				
			if (document.getElementById("HeadTable") != undefined)
				{ document.getElementById("HeadTable").width = 1024; }
		}
	}
}