﻿// File JScript

function ChiudiImg(){	
	window.location.reload(); 	
}





function ApriImg(){	
	CambioImmagine();
	Animazione();
	window.setTimeout("fadeIn('imgProdottoCont',0)", 1000);
	ReplaceTextWithChiudi();
	
}
function ReplaceLoadingWithImage(){
	var d = document.getElementById("imgProdottoCont");
	d.style.position = 'absolute';
	d.style.left = 20+ "px";
	d.style.top = 60+ "px";
	d.innerHTML = "<img style=\"position:relative\" alt=\"immagine prodotto\" src=\"handlers/viewImage.ashx?file=" + foto + "&type=popup\" />";
}

function ReplaceTextWithApri(){
	var d = document.getElementById("comando");
	d.innerHTML = "<a href=\"javascript:ApriImg();\">Ingrandisci</a>";
}
function ReplaceTextWithChiudi(){
	var d = document.getElementById("comando");
	d.innerHTML = "<a href=\"javascript:ChiudiImg();\">Chiudi</a>";
}
function Animazione(){
	window.setTimeout("ReplaceLoadingWithImage()", 1000);
	$('imgProdottoExp').effect('height',{
		duration: 1000,
		transition: Fx.Transitions.linear
	}).start(192,530);
}
function CambioImmagine(){
	var d = document.getElementById("imgProdottoCont");
	d.style.position = 'absolute';
	d.style.left = 240+ "px";
	d.style.top = 270+ "px";
	d.innerHTML = "<span class=\"caratteristiche\">&nbsp;&nbsp;loading image...&nbsp;&nbsp;</span>";	
}

function setOpacity(obj, opacity) {
	opacity = (opacity == 100)?99.999:opacity;
	// IE/Win
	obj.style.filter = "alpha(opacity:"+opacity+")";
	// Safari<1.2, Konqueror
	obj.style.KHTMLOpacity = opacity/100;
	// Older Mozilla and Firefox
	obj.style.MozOpacity = opacity/100;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = opacity/100;
	
	
}

function fadeIn(objId,opacity) {
	if (document.getElementById) {
		obj = document.getElementById(objId);
		if (opacity <= 100) {
			setOpacity(obj, opacity);
			opacity += 10;
			window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 50);
		}
	}
}

