// sostituzione caratteri in onload
function avvio() {
	document.getElementById('logolink').innerHTML = "";
    }



// 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,cartella) {
	if ( document.getElementById('nomecollezione') ) {
		document.getElementById('nomecollezione').style.display = "none";
	}
	if ( document.getElementById('testogalleria') ) {
		document.getElementById('testogalleria').style.display = "none";
	}
	if (document.cambioimmagine.valorecambioimmagine.value == 0)
		{
		document.getElementById('immaginesotto').innerHTML = "<img src='/img/"+cartella+"/big/" + nome + ".jpg' alt='foto " + nome + "' />";
		opacita('immaginesotto', 0, 100, 500);
		opacita('immagine', 100, 0, 500);;
		document.cambioimmagine.valorecambioimmagine.value = 1
		} else {
		document.getElementById('immagine').style.opacity = 0;
		document.getElementById('immagine').style.filter = 'alpha(opacity=' + 0 + ')';
		document.getElementById('immagine').innerHTML = "<img src='/img/"+cartella+"/big/" + nome + ".jpg' alt='foto " + nome + "' />";
		opacita('immagine', 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;
		}
	}
function spostagalleria(valore){
	valorenuovo = parseInt(document.cambioimmagine.valoreposizionegalleria.value) + parseInt(valore);
	maxposizione = parseInt(document.cambioimmagine.maxposizionegalleria.value)
	if ( valorenuovo < maxposizione ) {
			valorenuovo = maxposizione;
		} else if ( valorenuovo > 0 ) {
			valorenuovo = 0;
			}
	document.getElementById('rigacollezione').style.left = valorenuovo+"px";
	document.cambioimmagine.valoreposizionegalleria.value = valorenuovo;
	
	
	attivaspostagalleria(valore)
	}
	
function chiamafotovideo(div,fotoovideo,url,loop,largh,altez) {
	if (document.getElementById(div)) {
		if (fotoovideo == 1) {
			valoreinner = "<img src='/img/big/"+url+"' width='323' height='193'/>"
			} else {
			valoreinner = "<object width='"+largh+"' height='"+altez+"'><param name='movie' value='http://www.youtube.com/v/"+url+"?fs=1&amp;hl=it_IT&amp;rel=0&amp;autoplay=1&amp;loop="+loop+"&amp;autohide=1'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/"+url+"?fs=1&amp;hl=it_IT&amp;rel=0&amp;autoplay=1&amp;loop="+loop+"&amp;autohide=1' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='"+largh+"' height='"+altez+"' background='transparent'></embed></object><div class='spiegazione'></div>"
		}
	document.getElementById(div).innerHTML = valoreinner;
	}
}
