var gg_lngSvfBoxWidth 	= 340;									/* larghezza box immagini */
var gg_lngSvfBoxHeight 	= 250;									/* altezza box immagini */
var gg_strSvfLoadingThumb = 'img/gal/thumb/loading.gif'; /* thumb per immagine "loading" */
var gg_strSvfImgPath	= 'img/creativa/'								/* percorso immagini */
var gg_strSvfThumbPath	= 'img/gal/thumb/'					/* percorso thumbs */

var gg_lngSvfCurrImage = 1;										/* immagine corrente */
var gg_lngSvfCurrImageIndex = 1;									/* primo indice immagini corrente */
var gg_lngSvfTotImage = 9;											/* totale immagini */
var gg_strSvfArrImg = new Array;									/* array per le immagini */
var gg_strSvfArrLbl = new Array;									/* array per le didascalie */
var gg_strSvfArrAdr = new Array;									/* array per gli indirizzi */
var gg_lngSvfImgPerPag = 10;										/* numero thumb per pagina */
var gg_lngSvfNumPag = 1;											/* numero pagina corrente */
var gg_bolFade = false;												/* se č in atto una transizione */
var gg_appo;

gg_strSvfArrImg[1] = 'iprs_logo.gif';
gg_strSvfArrLbl[1] = 'Ist.Psicoanalitico Ricerche Sociali - Logo'
gg_strSvfArrAdr[1] = 'img/creativa/iprs_logo.jpg'

gg_strSvfArrImg[2] = 'iprs_visitcard.gif';
gg_strSvfArrLbl[2] = 'Ist.Psicoanalitico Ricerche Sociali - Visitcard'
gg_strSvfArrAdr[2] = 'img/creativa/iprs_visitcard.jpg'

gg_strSvfArrImg[3] = 'training_on_pcmcia.gif';
gg_strSvfArrLbl[3] = 'Proposta logo prog. Carta di Credito Formativo'
gg_strSvfArrAdr[3] = 'img/creativa/training_on_pcmcia.jpg'

gg_strSvfArrImg[4] = 'need_the_route_dude.gif';
gg_strSvfArrLbl[4] = 'Proposta logo prog. Carta di Credito Formativo'
gg_strSvfArrAdr[4] = 'img/creativa/need_the_route_dude.jpg'

gg_strSvfArrImg[5] = 'going_by_the_book.gif';
gg_strSvfArrLbl[5] = 'Proposta logo prog. Carta di Credito Formativo'
gg_strSvfArrAdr[5] = 'img/creativa/going_by_the_book.jpg'

gg_strSvfArrImg[6] = 'lavoro_pross_venturo.gif';
gg_strSvfArrLbl[6] = 'Cartellina convegno "Il lavoro prossimo venturo"'
gg_strSvfArrAdr[6] = 'img/creativa/lavoro_pross_venturo.jpg'

gg_strSvfArrImg[7] = 'savvy.gif';
gg_strSvfArrLbl[7] = 'Logo "La funzione formativa dell\'impresa"'
gg_strSvfArrAdr[7] = 'img/creativa/savvy.jpg'

gg_strSvfArrImg[8] = 'funz_formativa.gif';
gg_strSvfArrLbl[8] = 'Brochure "La funzione formativa dell\'impresa"'
gg_strSvfArrAdr[8] = 'img/creativa/funz_formativa.jpg'

gg_strSvfArrImg[9] = 'funz_formativa_1.gif';
gg_strSvfArrLbl[9] = 'Brochure "La funzione formativa dell\'impresa"'
gg_strSvfArrAdr[9] = 'img/creativa/funz_formativa_1.jpg'


var gg_lngSvfProgrOffsetWidth = 10;								/* offset iniziale (primo li) dei li contenenti i numeri delle immagini */
var gg_lngSvfProgrWidth = 30;										/* larghezza li contenenti i numeri delle immagini */
var gg_lngSvfIconWidth = 16;										/* larghezza li contenenti le icone delle funzionalitą */
var gg_lngLoadingThumbWidth = 14									/* lunghezza immagine thumb per loading */

var gg_objSvfImgAppo;												/* variabile per caricamento immagine da visualizzare */
var gg_lngSvfSlideThumbTimerId;									/* id timer per slide progressivo thumbs */
var gg_lngSshowTimerId;												/* id timer per slide show immagini */

var gg_bolOnMouseOver = false;
var gg_bolOnMouseOut = false;



var gg_lngAppo;
var gg_strColor = '';

var gg_bolSvfIe4 = false; if(document.all) { gg_bolSvfIe4 = true; }
function svfGetObject(id) { if (gg_bolSvfIe4) { return document.all[id]; } else { return document.getElementById(id); } }

function svfInitProgrLi() {

	var ll_objElement

	for (var i=1;i<=gg_lngSvfImgPerPag;i++) {
		svfGetObject('svf_thumb_' + i).style.width = gg_lngSvfProgrWidth + 'px';
		svfGetObject('svf_thumb_' + i).style.left 	= (gg_lngSvfProgrOffsetWidth + (gg_lngSvfProgrWidth * (i-1))) + 'px';
		svfGetObject('svf_thumb_' + i + '_href').innerHTML = i;
	}		

	svfGetObject('svf_thumb_nav').style.display = 'block';
}

function svfInitTitleBox() {
	
	var pp_objElement = svfGetObject('svf_box_title');
}

function svfShowNextImg() {

	if (gg_lngSvfCurrImage == gg_lngSvfTotImage)
		return;
		
	if (gg_lngSshowTimerId) 
		clearTimeout(gg_lngSshowTimerId);

	ll_lngAppo = gg_lngSvfCurrImage + 1;
/*	
	if (ll_lngAppo > (gg_lngSvfImgPerPag*gg_lngSvfNumPag)){
		goForwardFfox(false);
	}
*/
	svfShowImage(ll_lngAppo,false);
	
	if (gg_lngSvfCurrImage == gg_lngSvfTotImage){
		svfGetObject('svf_thumb_succ').style.visibility='hidden';
		svfGetObject('svf_thumb_prec').style.visibility='visible';
	}else if (gg_lngSvfCurrImage == 1){
		svfGetObject('svf_thumb_succ').style.visibility='visible';
		svfGetObject('svf_thumb_prec').style.visibility='hidden';
	}else{
		svfGetObject('svf_thumb_succ').style.visibility='visible';
		svfGetObject('svf_thumb_prec').style.visibility='visible';
	}	
	
}

function svfShowPrevImg() {

	if (gg_lngSvfCurrImage == 1)
		return;
		
	if (gg_lngSshowTimerId) 
		clearTimeout(gg_lngSshowTimerId);

	ll_lngAppo = gg_lngSvfCurrImage - 1;
/*	
	if (ll_lngAppo <= (gg_lngSvfImgPerPag*(gg_lngSvfNumPag-1))){
		goRewindFfox(false);
	}
*/
	svfShowImage(ll_lngAppo,false);
	
	if (gg_lngSvfCurrImage == gg_lngSvfTotImage){
		svfGetObject('svf_thumb_succ').style.visibility='hidden';
		svfGetObject('svf_thumb_prec').style.visibility='visible';
	}else if (gg_lngSvfCurrImage == 1){
		svfGetObject('svf_thumb_succ').style.visibility='visible';
		svfGetObject('svf_thumb_prec').style.visibility='hidden';
	}else{
		svfGetObject('svf_thumb_succ').style.visibility='visible';
		svfGetObject('svf_thumb_prec').style.visibility='visible';
	}	
}

function svfStartSlideShow() {

	var ll_lngAppo;
	
	if (gg_lngSshowTimerId) 
		clearTimeout(gg_lngSshowTimerId)

	if (gg_lngSvfCurrImage < gg_lngSvfTotImage)
		ll_lngAppo = gg_lngSvfCurrImage + 1
	else
		ll_lngAppo = 1
	
	if (ll_lngAppo > (gg_lngSvfImgPerPag*gg_lngSvfNumPag)){
		goForwardFfox(false);
	}
	else if (ll_lngAppo == 1){
		gg_lngSvfNumPag = 1;
		svfInitProgrLi();
		svfInitImg();
	}
		
	svfShowImage(ll_lngAppo,false);
	gg_lngSshowTimerId = setTimeout('svfStartSlideShow()',5000)
	
	svfGetObject('thumb_start').style.visibility= 'hidden';
	svfGetObject('thumb_pause').style.visibility= 'visible';
	
}

function svfStopSlideShow() {
	if (gg_lngSshowTimerId) 
		clearTimeout(gg_lngSshowTimerId)
	
	svfGetObject('thumb_pause').style.visibility= 'hidden';
	svfGetObject('thumb_start').style.visibility= 'visible';
}

/* per Ie Mac - per visualizzare i thumb */
function svfIeMacHighlight(pp_strMenuId) {
	var menuItem 			= document.getElementById(pp_strMenuId);
	menuItem.href			='#'
//	menuItem.onmouseover	='';
//	menuItem.onmouseout	='';		
}

function svfStartList() {
	
	var ll_lngAppo;
	var pp_strAppo;

	
		navRoot1 = document.getElementById('svf_thumb_nav');
		for (i=0; i<navRoot1.childNodes.length; i++) {
			node = navRoot1.childNodes[i];
			if (node.nodeName=='LI') {
/*				node.onmouseover=function() {
					this.className+='over';
				}
*/				
				node.onmouseout=function() {
					if (document.all&&document.getElementById) 
						this.className=this.className.replace('over','');
					this.className=this.className.replace('svf_li_highlight','');					
				}
   		}
  		}
  		
  	if (document.all&&document.getElementById) {
  		if((navigator.userAgent.toUpperCase().indexOf("MAC") != -1) && (navigator.userAgent.toUpperCase().indexOf('MSIE') != -1))
			svfGetObject('svf_thumb_container').id = 'svf_thumb_container_iemac';	
	}else if ((browser.isFirefox) || (browser.isSafari)) {
		navRoot1 = document.getElementById('svf_thumb_nav');
		for (i=0; i<navRoot1.childNodes.length; i++) {
			node = navRoot1.childNodes[i];
			if (node.nodeName=='LI') {
				for (j=0; j<node.childNodes.length; j++) {
					node1 = node.childNodes[j];
					if (node1.nodeName=='UL') {
						if (node1.getAttribute('class') == 'svf_thumb_subnav') {
				  			node1.setAttribute('class','svf_thumb_subnav_ffox');
				  			ll_lngAppo =  parseInt((gg_lngSvfProgrWidth - gg_lngLoadingThumbWidth) / 2);
				  			node1.style.backgroundPosition = ll_lngAppo + 'px 0px';
				  		}		
				  	}
				}
   		}	
  		}
	}
	
	if (browser.isIE) {
		svfGetObject('thumb_succ').onmouseover=function() {
			svfGetObject('thumb_succ').className+=' on';					
		}
	}
	if (browser.isIE) {
		svfGetObject('thumb_succ').onmouseout=function() {
			this.className= this.className.replace(' on','');					
		}
	}


	if ((navigator.userAgent.toUpperCase().indexOf("MAC") != -1) && (navigator.userAgent.toUpperCase().indexOf('MSIE') != -1)) {	
		svfIeMacHighlight('svf_thumb_1_href');
		svfIeMacHighlight('svf_thumb_2_href');
		svfIeMacHighlight('svf_thumb_3_href');
		svfIeMacHighlight('svf_thumb_4_href');
	}
	

/*
	if (navigator.userAgent.indexOf('Safari') != -1)
	alert('hello');
//	if (browser.isSafari)
		for(i=1;i<=gg_lngSvfImgPerPag;i++)		
			svfGetObject('svf_thumb_' + i + '_img').onmouseout=function() {
					var ll_lngAppo = this.id.lastIndexOf('_img');
					while ((svfGetObject(this.id.substr(0,ll_lngAppo)).className.indexOf('svf_li_highlight')) != -1)
						svfGetObject(this.id.substr(0,ll_lngAppo)).className = svfGetObject(this.id.substr(0,ll_lngAppo)).className.replace('svf_li_highlight','');
					alert(svfGetObject(this.id.substr(0,ll_lngAppo)).className);
				}
*/				
}



function svfGetPosition(who,wch){
	var L=0, R=0;
	var pa=who;
	while(pa.parentNode){
		L+= ( pa.offsetLeft)? pa.offsetLeft: 0;
		R+= (pa.offsetTop)?  pa.offsetTop: 0;	

		if(pa==document.body || wch===false)break;
		pa= pa.parentNode;
		
	}
	var A=[L,R];
	return(wch===1 || wch=== 2)?  A[wch]: A;
}

function svfFadeIn(objId,opacity) {

	if (document.getElementById) {
		obj = document.getElementById(objId);
		obj1 = document.getElementById('svf_img_fade');
		if (opacity <= 100) {
			svfSetOpacity(obj1, opacity);
			svfSetOpacity(obj, 100-opacity);
			opacity += 10;
			gg_appo = setTimeout("svfFadeIn('"+objId+"',"+opacity+")", 50);
		}else{
			//ChangeImage();
			
			svfSetOpacity(obj, 100);
			svfGetObject('svf_img_full').style.visibility = 'hidden'
			
			if ((browser.isIE) && (browser.isMac)) {
				svfGetObject('svf_img_load').src = gg_objSvfImgAppo.src;			
				var appo = document.images['svf_img_load'].height;
				svfGetObject('svf_img_load').src = 'img/gal/loading.gif'
			}else{
				var appo = gg_objSvfImgAppo.height;
			}
			
			svfGetObject('svf_img_full').src = gg_objSvfImgAppo.src

			if ((browser.isIE) && (browser.isMac)) {
				image1.style.marginTop= parseInt((gg_lngSvfBoxHeight - document.images['svf_img_full'].height)/2) + 'px'
				image1.style.marginLeft= parseInt((gg_lngSvfBoxWidth - document.images['svf_img_full'].width)/2) + 'px'
			}else{
	//			image1.style.marginTop= parseInt(((gg_lngSvfBoxHeight - image1.height)/2)-2) + 'px'
	//			image1.style.marginLeft= parseInt(((gg_lngSvfBoxWidth - image1.width)/2)-2) + 'px'
				image1.style.marginTop= parseInt(((gg_lngSvfBoxHeight - gg_objSvfImgAppo.height)/2)-2) + 'px'
				image1.style.marginLeft= parseInt(((gg_lngSvfBoxWidth - gg_objSvfImgAppo.width)/2)-2) + 'px'
			}
			
//			svfGetObject('svf_img_full').style.marginTop = parseInt(((gg_lngSvfBoxHeight - appo)/2)-2) + 'px'			

////			svfSetOpacity(obj, 100);
			svfGetObject('svf_img_full').style.visibility = 'visible'
			svfGetObject('svf_img_fade').style.visibility = 'hidden'
			svfGetObject('svf_img_fade').src = ''; 
			svfGetObject('svf_box_title').innerHTML = gg_strSvfArrLbl[gg_lngSvfCurrImage]
			gg_bolFade = false;
			
			svfGetObject('svf_thumb_1').innerHTML = '<a target="_blank" href="' + gg_strSvfArrAdr[gg_lngSvfCurrImage] + '">' + gg_strSvfArrLbl[gg_lngSvfCurrImage] + '</a>';
			svfGetObject('svf_img_full_href').href = gg_strSvfArrAdr[gg_lngSvfCurrImage];
//			image.style.top='0px';
//			image.style.left='0px';
			
		}
	}
}



function svfFadeIn3(objId,opacity) {

	if (document.getElementById) {
		obj = document.getElementById(objId);
		obj1 = document.getElementById('svf_img_fade');
		if (opacity <= 100) {
			svfSetOpacity(obj, opacity);
			svfSetOpacity(obj1, 100-opacity);
			opacity += 10;
			gg_appo = setTimeout("svfFadeIn('"+objId+"',"+opacity+")", 50);
		}else{
			//ChangeImage();
			
			if ((browser.isIE) && (browser.isMac)) {
				svfGetObject('svf_img_load').src = gg_objSvfImgAppo.src;			
				var appo = document.images['svf_img_load'].height;
				svfGetObject('svf_img_load').src = 'img/gal/loading.gif'
			}else{
				var appo = gg_objSvfImgAppo.height;
			}
			
			
			svfGetObject('svf_img_full').style.marginTop = parseInt(((gg_lngSvfBoxHeight - appo)/2)-2) + 'px'			
			svfGetObject('svf_img_full').src = gg_objSvfImgAppo.src
			svfSetOpacity(obj, 100);
			svfGetObject('svf_img_fade').style.visibility = 'hidden'
			svfGetObject('svf_img_fade').src = ''; 
			svfGetObject('svf_box_title').innerHTML = gg_strSvfArrLbl[gg_lngSvfCurrImage]

//			image.style.top='0px';
//			image.style.left='0px';
			
		}
	}
}

function svfSetOpacity(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 svfShowImage(pp_lngCurrImage,pp_strImg) {

//	svfGetObject('svf_img_load').style.visibility = 'visible';
	
	gg_lngSvfCurrImage = pp_lngCurrImage;
	
	gg_objSvfImgAppo	= new Image;
	gg_objSvfImgAppo.src = pp_strImg;	

	setTimeout('svfFadeImage()',50);
}

*/

//pp_bolElemId = true --> pp_strElemId = nome elemento; pp_bolElemId = false --> pp_strElemId = indice foto

function svfShowImage(pp_strElemId,pp_bolElemId) {	

	
	var ll_lngAppo;
	
/*	svfStopSlideShow() */
	
	if (gg_appo)
		clearTimeout(gg_appo);
	svfGetObject('svf_img_full').style.visibility = 'visible'
	svfSetOpacity(svfGetObject('svf_img_full'), 100);
	svfGetObject('svf_img_fade').style.visibility = 'hidden'
	svfGetObject('svf_img_fade').src = ''; 
	gg_bolFade = false;
	
	ll_lngAppo = gg_lngSvfCurrImage;
	while (ll_lngAppo > gg_lngSvfImgPerPag)
		ll_lngAppo = ll_lngAppo - gg_lngSvfImgPerPag;
	
	if (pp_bolElemId) {
		var pp_lngAppo = pp_strElemId.lastIndexOf('_');
		gg_lngSvfCurrImage = parseInt(pp_strElemId.substr(pp_lngAppo+1)) + ((gg_lngSvfNumPag-1)*gg_lngSvfImgPerPag);
//		if (navigator.userAgent.indexOf('Safari') == -1)
			svfGetObject(pp_strElemId).className+=' svf_li_selez';
//		else
//			svfGetObject(pp_strElemId).className = 'svf_li_selez';			
	}else{
		gg_lngSvfCurrImage = pp_strElemId;
		while (pp_strElemId > gg_lngSvfImgPerPag)
			pp_strElemId = pp_strElemId - gg_lngSvfImgPerPag;
	}
	
	
	
	gg_objSvfImgAppo	= new Image;
	gg_objSvfImgAppo.src = gg_strSvfImgPath + gg_strSvfArrImg[gg_lngSvfCurrImage];	

	setTimeout('svfFadeImage()',50);
	
}

function svfFadeImage() {
	
	if ((gg_objSvfImgAppo.complete)) {	
		
		svfGetObject('svf_box_title').innerHTML = '&nbsp;'

		svfGetObject('svf_img_load').style.visibility = 'hidden'	

//		var ll_objImgAppo = new Image
//		ll_objImgAppo.src = document.getElementById('svf_img_full').src;
		
		imageId = 'svf_img_fade';
		image1 = document.getElementById(imageId);

		image1.src = gg_objSvfImgAppo.src;
		
		gg_bolFade = true;
		
		if ((browser.isIE) && (browser.isMac)) {
			image1.style.marginTop= parseInt((gg_lngSvfBoxHeight - document.images['svf_img_full'].height)/2) + 'px'
			image1.style.marginLeft= parseInt((gg_lngSvfBoxWidth - document.images['svf_img_full'].width)/2) + 'px'
		}else{
//			image1.style.marginTop= parseInt(((gg_lngSvfBoxHeight - image1.height)/2)-2) + 'px'
//			image1.style.marginLeft= parseInt(((gg_lngSvfBoxWidth - image1.width)/2)-2) + 'px'
			image1.style.marginTop= parseInt(((gg_lngSvfBoxHeight - gg_objSvfImgAppo.height)/2)-2) + 'px'
			image1.style.marginLeft= parseInt(((gg_lngSvfBoxWidth - gg_objSvfImgAppo.width)/2)-2) + 'px'
		}
				
//		if (!browser.isIE)
		image1.style.visibility = 'visible';
			svfSetOpacity(image1,0);		
		
		if (navigator.appName.toUpperCase().indexOf('EXPLORER') == -1) {
			setTimeout('svfSetFullImage()',250);
		}else{
			svfSetFullImage();
		}
/*		image1 = document.getElementById('svf_img_full');
		svfSetOpacity(image1,0);
		svfGetObject('svf_img_full').style.marginTop = parseInt((gg_lngSvfBoxHeight - gg_objSvfImgAppo.height)/2) + 'px'
		svfGetObject('svf_img_full').src = gg_objSvfImgAppo.src
		
		svfFadeIn('svf_img_full',0);
*/		
	}else{
		svfGetObject('svf_img_load').style.visibility = 'visible';
		setTimeout('svfFadeImage()',150);
	}
}


function svfFadeImage3() {
	
//	if ((gg_objSvfImgAppo.height > 0) && (gg_objSvfImgAppo.complete)) {	
	if ((gg_objSvfImgAppo.complete)) {	
		
		svfGetObject('svf_box_title').innerHTML = '&nbsp;'


		svfGetObject('svf_img_load').style.visibility = 'hidden'	

		var ll_objImgAppo = new Image
		ll_objImgAppo.src = document.getElementById('svf_img_full').src;
		
		imageId = 'svf_img_fade';
		image1 = document.getElementById(imageId);
//		image1.src = document.getElementById('svf_img_full').src;
		image1.src = ll_objImgAppo.src;
		if ((browser.isIE) && (browser.isMac)) {
			image1.style.marginTop= parseInt((gg_lngSvfBoxHeight - document.images['svf_img_fade'].height)/2) + 'px'
			image1.style.marginLeft= parseInt((gg_lngSvfBoxWidth - document.images['svf_img_fade'].width)/2) + 'px'
		}else{
//			image1.style.marginTop= parseInt(((gg_lngSvfBoxHeight - image1.height)/2)-2) + 'px'
//			image1.style.marginLeft= parseInt(((gg_lngSvfBoxWidth - image1.width)/2)-2) + 'px'
			image1.style.marginTop= parseInt(((gg_lngSvfBoxHeight - ll_objImgAppo.height)/2)-2) + 'px'
			image1.style.marginLeft= parseInt(((gg_lngSvfBoxWidth - ll_objImgAppo.width)/2)-2) + 'px'
		}
		
		
/*		
		if (browser.isIE) {
			if (!browser.isMac) {
				var posXY = svfGetPosition(svfGetObject('svf_img_full_href'),true);
				image1.style.top=(posXY[1]-224) + 'px';
				image1.style.left=(posXY[0]-235) + 'px';
			}else{
				var posXY = svfGetPosition(svfGetObject('svf_img_full'),true);
				image1.style.top=(posXY[1]+15) + 'px';
				image1.style.left=(posXY[0]+10) + 'px';
			}
		}else if (browser.isSafari) { 
			var posXY = svfGetPosition(svfGetObject('svf_img_full'),true);
			image1.style.top=(posXY[1]+0) + 'px';
			image1.style.left=(posXY[0]+0) + 'px';
		}else{
			var posXY = svfGetPosition(svfGetObject('svf_img_full'),false);		
			image1.style.top=posXY[1] + 'px';
			image1.style.left=(posXY[0]) + 'px';
		}
*/	
		svfSetOpacity(image1,0);		
		image1.style.visibility = 'visible';
		
		if (navigator.appName.toUpperCase().indexOf('EXPLORER') == -1) {
			setTimeout('svfSetFullImage()',250);
		}else{
			svfSetFullImage();
		}
/*		image1 = document.getElementById('svf_img_full');
		svfSetOpacity(image1,0);
		svfGetObject('svf_img_full').style.marginTop = parseInt((gg_lngSvfBoxHeight - gg_objSvfImgAppo.height)/2) + 'px'
		svfGetObject('svf_img_full').src = gg_objSvfImgAppo.src
		
		svfFadeIn('svf_img_full',0);
*/		
	}else{
		svfGetObject('svf_img_load').style.visibility = 'visible';
		setTimeout('svfFadeImage()',150);
	}
}

function svfSetFullImage() {

		image1 = document.getElementById('svf_img_full');
		svfFadeIn('svf_img_full',0);
}


function svfSetFullImage3() {

		image1 = document.getElementById('svf_img_full');
		if ((browser.isIE) && (browser.isMac)) {
			svfGetObject('svf_img_load').src = gg_objSvfImgAppo.src;			
			var appo = document.images['svf_img_load'].height;
			var appo1 = document.images['svf_img_load'].width;
			svfGetObject('svf_img_load').src = 'img/gal/loading.gif'
		}else{
			var appo = gg_objSvfImgAppo.height;
			var appo1 = gg_objSvfImgAppo.width
		}
		
		svfGetObject('svf_img_full').style.marginTop = parseInt(((gg_lngSvfBoxHeight - appo)/2)-2) + 'px'
		svfGetObject('svf_img_full').style.marginLeft = parseInt(((gg_lngSvfBoxWidth - appo1)/2)-2) + 'px'
		svfGetObject('svf_img_full').src = gg_objSvfImgAppo.src
		svfSetOpacity(image1,0);
		svfGetObject('svf_img_full').style.visibility='visible';

		svfFadeIn('svf_img_full',0);
}


function BrowserDetectLite() {
	var ua = navigator.userAgent.toLowerCase(); 
	this.ua = ua;

	// browser name
	this.isGecko     = (ua.indexOf('gecko') != -1);
	this.isMozilla   = (this.isGecko && ua.indexOf("gecko/") + 14 == ua.length);
	this.isNS        = ( (this.isGecko) ? (ua.indexOf('netscape') != -1) : ( (ua.indexOf('mozilla') != -1) && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('opera') == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -1) ) );
	this.isIE        = ( (ua.indexOf("msie") != -1) && (ua.indexOf("opera") == -1) && (ua.indexOf("webtv") == -1) ); 
	this.isOpera     = (ua.indexOf("opera") != -1); 
	this.isFirefox     = (ua.indexOf("firefox") != -1); 
	this.isKonqueror = (ua.indexOf("konqueror") != -1); 
	this.isIcab      = (ua.indexOf("icab") != -1); 
	this.isAol       = (ua.indexOf("aol") != -1); 
	this.isWebtv     = (ua.indexOf("webtv") != -1); 
	this.isOmniweb   = (ua.indexOf("omniweb") != -1);
	this.isDreamcast   = (ua.indexOf("dreamcast") != -1);
	this.isSafari   	= (ua.indexOf("safari") != -1);
	
	// spoofing and compatible browsers
	this.isIECompatible = ( (ua.indexOf("msie") != -1) && !this.isIE);
	this.isNSCompatible = ( (ua.indexOf("mozilla") != -1) && !this.isNS && !this.isMozilla);
	
	// browser version
	this.versionMinor = parseFloat(navigator.appVersion); 
	
	// correct version number for NS6+ 
	if (this.isNS && this.isGecko) {
		this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('/') + 1 ) );
	}
	
	// correct version number for IE4+ 
	else if (this.isIE && this.versionMinor >= 4) {
		this.versionMinor = parseFloat( ua.substring( ua.indexOf('msie ') + 5 ) );
	}
	
	// correct version number for Opera 
	else if (this.isOpera) {
		if (ua.indexOf('opera/') != -1) {
			this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera/') + 6 ) );
		}
		else {
			this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera ') + 6 ) );
		}
	}
	
	// correct version number for Konqueror
	else if (this.isKonqueror) {
		this.versionMinor = parseFloat( ua.substring( ua.indexOf('konqueror/') + 10 ) );
	}
	
	// correct version number for iCab 
	else if (this.isIcab) {
		if (ua.indexOf('icab/') != -1) {
			this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab/') + 6 ) );
		}
		else {
			this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab ') + 6 ) );
		}
	}
	
	// correct version number for WebTV
	else if (this.isWebtv) {
		this.versionMinor = parseFloat( ua.substring( ua.indexOf('webtv/') + 6 ) );
	}
	
	this.versionMajor = parseInt(this.versionMinor); 
	this.geckoVersion = ( (this.isGecko) ? ua.substring( (ua.lastIndexOf('gecko/') + 6), (ua.lastIndexOf('gecko/') + 14) ) : -1 );
	
	// platform
	this.isWin   = (ua.indexOf('win') != -1);
	this.isWin32 = (this.isWin && ( ua.indexOf('95') != -1 || ua.indexOf('98') != -1 || ua.indexOf('nt') != -1 || ua.indexOf('win32') != -1 || ua.indexOf('32bit') != -1) );
	this.isMac   = (ua.indexOf('mac') != -1);
	this.isUnix  = (ua.indexOf('unix') != -1 || ua.indexOf('linux') != -1 || ua.indexOf('sunos') != -1 || ua.indexOf('bsd') != -1 || ua.indexOf('x11') != -1)
	
	// specific browser shortcuts
	this.isNS4x = (this.isNS && this.versionMajor == 4);
	this.isNS40x = (this.isNS4x && this.versionMinor < 4.5);
	this.isNS47x = (this.isNS4x && this.versionMinor >= 4.7);
	this.isNS4up = (this.isNS && this.versionMinor >= 4);
	this.isNS6x = (this.isNS && this.versionMajor == 6);
	this.isNS6up = (this.isNS && this.versionMajor >= 6);
	
	this.isIE4x = (this.isIE && this.versionMajor == 4);
	this.isIE4up = (this.isIE && this.versionMajor >= 4);
	this.isIE5x = (this.isIE && this.versionMajor == 5);
	this.isIE55 = (this.isIE && this.versionMinor == 5.5);
	this.isIE5up = (this.isIE && this.versionMajor >= 5);
	this.isIE6x = (this.isIE && this.versionMajor == 6);
	this.isIE6up = (this.isIE && this.versionMajor >= 6);
	
	this.isIE4xMac = (this.isIE4x && this.isMac);
	
//	this.isIE4xMac=true;
	
}
var browser = new BrowserDetectLite();


/*
function svfShowThumb(pp_strLiId,pp_strThumb) {

	if (navigator.userAgent.indexOf('Safari') == -1)
		svfGetObject(pp_strLiId).className+='svf_li_highlight';
	
	if (document.all&&document.getElementById)
		svfGetObject(pp_strLiId).className+=' over';
		
	var posXY = svfGetPosition(svfGetObject(pp_strLiId),false);
	xcoord=(posXY[0]);
	
	ll_objImgAppo1	= new Image;
	ll_objImgAppo1.src = svfGetObject(pp_strLiId + '_img').src;
	
	xcoord = parseInt((ll_objImgAppo1.width-gg_lngSvfProgrWidth)/2);	
	
	svfGetObject(pp_strLiId + '_li_img').style.left = -xcoord + 'px';
	
	if (ll_objImgAppo1.src.indexOf(gg_strSvfLoadingThumb) != -1) {
		ll_objImgAppo1.src = pp_strThumb;
		if ((browser.isIE) && (!browser.isMac)) {
			setTimeout('svfSetThumb(\'' + pp_strLiId + '\', \'' + pp_strThumb + '\');',500)
		}else{
			ll_objImgAppo1.onload = setTimeout('svfSetThumb(\'' + pp_strLiId + '\', \'' + pp_strThumb + '\');',500)
		}
	}
	
}
*/

function svfShowThumb(pp_strLiId) {

	var pp_lngAppo = pp_strLiId.lastIndexOf('_');
	var pp_lngImg = parseInt(pp_strLiId.substr(pp_lngAppo+1))+((gg_lngSvfNumPag-1)*gg_lngSvfImgPerPag);

	if (navigator.userAgent.indexOf('Safari') == -1)
		svfGetObject(pp_strLiId).className+=' svf_li_highlight';
		
	if (document.all&&document.getElementById)
		svfGetObject(pp_strLiId).className+=' over';
		
	var posXY = svfGetPosition(svfGetObject(pp_strLiId),false);
	xcoord=(posXY[0]);
	
	ll_objImgAppo1	= new Image;
	ll_objImgAppo1.src = svfGetObject(pp_strLiId + '_img').src;
	
	xcoord = parseInt((ll_objImgAppo1.width-gg_lngSvfProgrWidth)/2);	
	
	svfGetObject(pp_strLiId + '_li_img').style.left = -xcoord + 'px';
	
	if (ll_objImgAppo1.src.indexOf(gg_strSvfLoadingThumb) != -1) {
		ll_objImgAppo1.src = gg_strSvfThumbPath + gg_strSvfArrImg[pp_lngImg];
		if ((browser.isIE) && (!browser.isMac)) {
			setTimeout('svfSetThumb(\'' + pp_strLiId + '\', \'' + gg_strSvfThumbPath + gg_strSvfArrImg[pp_lngImg] + '\');',500)
		}else{
			ll_objImgAppo1.onload = setTimeout('svfSetThumb(\'' + pp_strLiId + '\', \'' + gg_strSvfThumbPath + gg_strSvfArrImg[pp_lngImg] + '\');',500)
		}
	}
	
}


function svfSetThumb(pp_strLiId,pp_strThumb) {
	

	ll_objImgAppo1	= new Image;
	ll_objImgAppo1.src = pp_strThumb;

	var posXY = svfGetPosition(svfGetObject(pp_strLiId),false);
	xcoord=(posXY[0]);
		
	xcoord = parseInt((ll_objImgAppo1.width-gg_lngSvfProgrWidth)/2);	
	
//	svfGetObject(pp_strLiId + '_li_img').style.display = 'none';
	svfGetObject(pp_strLiId + '_li_img').style.left = (-xcoord-4) + 'px';
	svfGetObject(pp_strLiId + '_img').src = pp_strThumb;
//	svfGetObject(pp_strLiId + '_li_img').style.display = 'block';
	
}


function svfShowThumb1(pp_strLiId,pp_strFotoId,pp_strLiImgId,pp_strThumb) {

	if (navigator.userAgent.indexOf('Safari') == -1)
		svfGetObject(pp_strLiId).className+='svf_li_highlight';
	
	if (document.all&&document.getElementById)
		svfGetObject(pp_strLiId).className+=' over';
		
	var posXY = svfGetPosition(svfGetObject(pp_strLiId),false);
	xcoord=(posXY[0]);
	
	ll_objImgAppo1	= new Image;
	ll_objImgAppo1.src = svfGetObject(pp_strFotoId).src;
	
	xcoord = parseInt((ll_objImgAppo1.width-gg_lngSvfProgrWidth)/2);	
	
	svfGetObject(pp_strLiImgId).style.left = -xcoord + 'px';
	
	if (ll_objImgAppo1.src.indexOf(gg_strSvfLoadingThumb) != -1) {
		ll_objImgAppo1.src = pp_strThumb;
		if ((browser.isIE) && (!browser.isMac)) {
			setTimeout('svfSetThumb(\'' + pp_strLiId + '\', \'' + pp_strFotoId + '\',\'' + pp_strLiImgId + '\', \'' + pp_strThumb + '\');',500)
		}else{
			ll_objImgAppo1.onload = setTimeout('svfSetThumb(\'' + pp_strLiId + '\', \'' + pp_strFotoId + '\',\'' + pp_strLiImgId + '\', \'' + pp_strThumb + '\');',500)
		}
	}
	
}

function svfSetThumb1(pp_strLiId,pp_strFotoId,pp_strLiImgId,pp_strThumb) {
	

	ll_objImgAppo1	= new Image;
	ll_objImgAppo1.src = pp_strThumb;

	var posXY = svfGetPosition(svfGetObject(pp_strLiId),false);
	xcoord=(posXY[0]);
		
	xcoord = parseInt((ll_objImgAppo1.width-gg_lngSvfProgrWidth)/2);	
	
//	svfGetObject(pp_strLiImgId).style.display = 'none';
	svfGetObject(pp_strLiImgId).style.left = -xcoord + 'px';
	svfGetObject(pp_strFotoId).src = pp_strThumb;
//	svfGetObject(pp_strLiImgId).style.display = 'block';
	
}

function goForwardFfox(pp_bolDiretto) {   // true--> cambia immagine
	
	if ((gg_lngSvfNumPag*gg_lngSvfImgPerPag) >= gg_lngSvfTotImage)
		return;
		
	gg_lngAppo = 1;
	gg_lngSvfNumPag = gg_lngSvfNumPag + 1;
	if (gg_strColor = '')
		gg_strColor = svfGetObject('svf_thumb_1_href').style.color;
	svfGetObject('thumb_avanti').onclick='';
	gg_lngSvfSlideThumbTimerId = setInterval('forwardFfox(' + pp_bolDiretto + ')',50);
	
}

function forwardFfox(pp_bolDiretto) {  // true--> cambia immagine

	var ll_objElement;
	if (gg_lngAppo == gg_lngSvfImgPerPag+1) {
		clearInterval(gg_lngSvfSlideThumbTimerId);
		for(i=1;i<=gg_lngSvfImgPerPag;i++) {		
			ll_objElement = svfGetObject('svf_thumb_' + i + '_href');
			ll_objElement.style.color = gg_strColor;
			if (parseInt(ll_objElement.innerHTML) !== gg_lngSvfCurrImage){
				svfGetObject('svf_thumb_' + i).className = svfGetObject('svf_thumb_' + i).className.replace(' svf_li_selez','');
				svfGetObject('svf_thumb_' + i).className = svfGetObject('svf_thumb_' + i).className.replace('svf_li_selez','');
			}else{
				svfGetObject('svf_thumb_' + i).className+=' svf_li_selez';
			}
		}
		svfInitImg();
		svfGetObject('thumb_avanti').onclick=function() {
			goForwardFfox(true);
		}
		if (pp_bolDiretto)
			svfShowImage(parseInt(svfGetObject('svf_thumb_1_href').innerHTML));
	}else{
		for(i=1;i<=gg_lngSvfImgPerPag;i++) {		
			ll_objElement = svfGetObject('svf_thumb_' + i + '_href');
			if (gg_lngAppo == 1)
				ll_objElement.style.color = '#aaa';
			ll_objElement.innerHTML = parseInt(ll_objElement.innerHTML) + 2;
			if (parseInt(ll_objElement.innerHTML) >= gg_lngSvfTotImage)
				svfGetObject('svf_thumb_' + i).style.display = 'none';
		}
		gg_lngAppo = gg_lngAppo + 2;
	}

/*
	if (gg_lngAppo == 5) {
		clearInterval(gg_lngSvfSlideThumbTimerId);
		svfGetObject('svf_thumb_1_href').style.color = gg_strColor;
		svfGetObject('svf_thumb_2_href').style.color = gg_strColor;
		svfGetObject('svf_thumb_3_href').style.color = gg_strColor;
		svfGetObject('svf_thumb_4_href').style.color = gg_strColor;
		svfGetObject('thumb_avanti').onclick=function() {
			goForwardFfox();
		}
	}else{
		if (gg_lngAppo == 1) {
			svfGetObject('svf_thumb_1_href').style.color = '#aaa';
			svfGetObject('svf_thumb_2_href').style.color = '#aaa';
			svfGetObject('svf_thumb_3_href').style.color = '#aaa';
			svfGetObject('svf_thumb_4_href').style.color = '#aaa';
		}
		svfGetObject('svf_thumb_1_href').innerHTML = parseInt(svfGetObject('svf_thumb_1_href').innerHTML) + 1;
		svfGetObject('svf_thumb_2_href').innerHTML = parseInt(svfGetObject('svf_thumb_2_href').innerHTML) + 1;
		svfGetObject('svf_thumb_3_href').innerHTML = parseInt(svfGetObject('svf_thumb_3_href').innerHTML) + 1;
		svfGetObject('svf_thumb_4_href').innerHTML = parseInt(svfGetObject('svf_thumb_4_href').innerHTML) + 1;
		gg_lngAppo = gg_lngAppo + 1;
	}
*/	
}

function goRewindFfox(pp_bolDiretto) {   // true--> cambia immagine
	
	if (gg_lngSvfNumPag == 1)
		return;

	gg_lngAppo = 1;
	gg_lngSvfNumPag = gg_lngSvfNumPag - 1;
	if (gg_strColor = '')
		gg_strColor = svfGetObject('svf_thumb_1_href').style.color;
	svfGetObject('thumb_indietro').onclick='';
	gg_lngSvfSlideThumbTimerId = setInterval('rewindFfox(' + pp_bolDiretto + ')',50);
	
}

function rewindFfox(pp_bolDiretto) {    // true--> cambia immagine

	var ll_objElement;
	if (gg_lngAppo == gg_lngSvfImgPerPag+1) {
		clearInterval(gg_lngSvfSlideThumbTimerId);
		for(i=1;i<=gg_lngSvfImgPerPag;i++) {		
			ll_objElement = svfGetObject('svf_thumb_' + i + '_href');
			ll_objElement.style.color = gg_strColor;
			if (parseInt(ll_objElement.innerHTML) !== gg_lngSvfCurrImage){
				svfGetObject('svf_thumb_' + i).className = svfGetObject('svf_thumb_' + i).className.replace(' svf_li_selez','');
				svfGetObject('svf_thumb_' + i).className = svfGetObject('svf_thumb_' + i).className.replace('svf_li_selez','');
			}else{
				svfGetObject('svf_thumb_' + i).className+=' svf_li_selez';
			}
		}
		svfInitImg();
		svfGetObject('thumb_indietro').onclick=function() {
			goRewindFfox(true);
		}
		if (pp_bolDiretto)
			svfShowImage(parseInt(svfGetObject('svf_thumb_10_href').innerHTML));
	}else{
		for(i=1;i<=gg_lngSvfImgPerPag;i++) {		
			ll_objElement = svfGetObject('svf_thumb_' + i + '_href');
			if (gg_lngAppo == 1)
				ll_objElement.style.color = '#aaa';
			ll_objElement.innerHTML = parseInt(ll_objElement.innerHTML) - 2;
			if (parseInt(ll_objElement.innerHTML) <= gg_lngSvfTotImage)
				svfGetObject('svf_thumb_' + i).style.display = 'block';
		}
		gg_lngAppo = gg_lngAppo + 2;
	}
}

function goForward() {
	
	svfGetObject('thumb_avanti').onclick='';
	
	var ll_lngInizio = 51;
	
/*
	svfGetObject('thumb_1').style.left = '51px';
	svfGetObject('thumb_2').style.left = '101px';
	svfGetObject('thumb_3').style.left = '151px';
	svfGetObject('thumb_4').style.left = '201px';
*/	
	
//	setTimeout('moveLi(' + ll_lngInizio + ')',20);
	gg_lngSvfSlideThumbTimerId = setInterval('moveLi(' + ll_lngInizio + ')',10);
}



function moveLi(pp_lngOffset) {

	
	var pp_objEl = svfGetObject('svf_thumb_4');	
	if (parseInt(pp_objEl.style.left.substr(0,pp_objEl.style.left.lastIndexOf('px'))) <= 25) {
		pp_objEl.style.left = '201px'
		svfGetObject('svf_thumb_4_href').innerHTML = parseInt(svfGetObject('svf_thumb_4_href').innerHTML) + 4;
	}	
	else 
		pp_objEl.style.left = (parseInt(pp_objEl.style.left.substr(0,pp_objEl.style.left.lastIndexOf('px'))) -5) + 'px';		
	var pp_objEl = svfGetObject('svf_thumb_3');	
	if (parseInt(pp_objEl.style.left.substr(0,pp_objEl.style.left.lastIndexOf('px'))) <= 25) {
		pp_objEl.style.left = '201px'
		svfGetObject('svf_thumb_3_href').innerHTML = parseInt(svfGetObject('svf_thumb_3_href').innerHTML) + 4;
	}else
		pp_objEl.style.left = (parseInt(pp_objEl.style.left.substr(0,pp_objEl.style.left.lastIndexOf('px'))) -5) + 'px';
	var pp_objEl = svfGetObject('svf_thumb_2');	
	if (parseInt(pp_objEl.style.left.substr(0,pp_objEl.style.left.lastIndexOf('px'))) <= 25) {
		pp_objEl.style.left = '201px'
		svfGetObject('svf_thumb_2_href').innerHTML = parseInt(svfGetObject('svf_thumb_2_href').innerHTML) + 4;
	}else
		pp_objEl.style.left = (parseInt(pp_objEl.style.left.substr(0,pp_objEl.style.left.lastIndexOf('px'))) -5) + 'px';		
	var pp_objEl = svfGetObject('svf_thumb_1');	
	if (parseInt(pp_objEl.style.left.substr(0,pp_objEl.style.left.lastIndexOf('px'))) <= 25) {
		pp_objEl.style.left = '201px'
		svfGetObject('svf_thumb_1_href').innerHTML = parseInt(svfGetObject('svf_thumb_1_href').innerHTML) + 4;
	}else
		pp_objEl.style.left = (parseInt(pp_objEl.style.left.substr(0,pp_objEl.style.left.lastIndexOf('px'))) -5) + 'px';
	
/*
	if (pp_objEl.style.left != '51px')
		setTimeout('moveLi(' + pp_lngOffset + ')',10);
	else
		svfGetObject('thumb_avanti').onclick=function() {
			goForward();
		}
*/		
	if (pp_objEl.style.left == '51px') {
		clearInterval(gg_lngSvfSlideThumbTimerId);
		svfGetObject('thumb_avanti').onclick=function() {
			goForward();
		}
	}
}


function svfSlideDownTitle(pp_lngelement) {
	

	if ((gg_bolOnMouseOut) || (gg_bolOnMouseOver))
		return;
		
	if (gg_bolFade)
		return;
	
	Effect.SlideDown('svf_box_title', {duration:0.5});	

	svfGetObject('thumb_showlbl').style.visibility= 'hidden';
	svfGetObject('thumb_hidelbl').style.visibility= 'visible';


/*
	svfGetObject('thumb_showlbl').innerHTML = 'D-'
	svfGetObject('thumb_showlbl').onclick=function() {
		svfSlideUpTitle('svf_box_title');
	}
*/
}	

function svfSlideUpTitle(pp_lngelement) {
	
	if ((gg_bolOnMouseOut) || (gg_bolOnMouseOver))
		return;
		
	if (gg_bolFade)
		return;

	Effect.SlideUp('svf_box_title', {duration:0.5});

	svfGetObject('thumb_hidelbl').style.visibility= 'hidden';
	svfGetObject('thumb_showlbl').style.visibility= 'visible';


/*
	svfGetObject('thumb_showlbl').innerHTML = 'D-'
	svfGetObject('thumb_showlbl').onclick=function() {
		svfSlideDownTitle('svf_box_title');
	}
*/
	
}	

function svfInitImg() {
	var pp_objElement;
	for(i=1;i<=gg_lngSvfImgPerPag;i++) {
		pp_objElement = svfGetObject('svf_thumb_' + i);
		if (i + ((gg_lngSvfNumPag-1) * gg_lngSvfImgPerPag) <= gg_lngSvfTotImage) {
			pp_objElement.onclick=function() {
				 svfShowImage(this.id,true);
				}
			pp_objElement.onmouseover=function() {
				 svfShowThumb(this.id);
				}
			svfGetObject('svf_thumb_' + i + '_img').src = gg_strSvfLoadingThumb;
			pp_objElement.style.display = 'block';
		}else{
			pp_objElement.style.display = 'none';
		}
	}
}