// opacita per galleriafotografica
function cambiaopacita(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
} 
function opacita(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("cambiaopacita(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("cambiaopacita(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
}
function img(nome) {
	if (document.cambioimmagine.valorecambioimmagine.value == 0)
		{
		document.getElementById('immaginesotto').innerHTML = "<img src='/img/collezione_primavera_estate_2009/big/" + nome + ".jpg' alt='foto " + nome + "' />";
		opacita('immaginesotto', 0, 100, 500);
		opacita('immagine_testata', 100, 0, 500);;
		document.cambioimmagine.valorecambioimmagine.value = 1
		} else {
		document.getElementById('immagine_testata').style.opacity = 0;
		document.getElementById('immagine_testata').style.filter = 'alpha(opacity=' + 0 + ')';
		document.getElementById('immagine_testata').innerHTML = "<img src='/img/collezione_primavera_estate_2009/big/" + nome + ".jpg' alt='foto " + nome + "' />";
		opacita('immagine_testata', 0, 100, 500);
		opacita('immaginesotto', 100, 0, 500);
		document.cambioimmagine.valorecambioimmagine.value = 0
		}
    }

function attivaspostagalleria(valore) {
	var idtimeout;
	idtimeout = parseInt(document.cambioimmagine.valoretimeout.value)
	window.clearTimeout(idtimeout)
	if (valore != 0) {
		var intValue;
		intValue=window.setTimeout( "spostagalleria("+valore+")", 10);
		document.cambioimmagine.valoretimeout.value = intValue;
		}
	}


