function trim(str) 
{
  return str.replace(/^\s+|\s+$/g, '');
}
function codificaascii(valore)//per convertire i caratteri in formato #numero# per poterli passare ad eventuali pagine ajax e viene utilizzata per l'invio di moduli)
{ 
	valore = valore.replace(/#/g,"valorecancelletto");
	valore = valore.replace(/\r/g,"valoreaccapo");
	valore = valore.replace(/0/g,"valorezero");
	valore = valore.replace(/1/g,"valoreuno");
	valore = valore.replace(/2/g,"valoredue");
	valore = valore.replace(/3/g,"valoretre");
	valore = valore.replace(/4/g,"valorequattro");
	valore = valore.replace(/5/g,"valorecinque");
	valore = valore.replace(/6/g,"valoresei");
	valore = valore.replace(/7/g,"valoresette");
	valore = valore.replace(/8/g,"valoreotto");
	valore = valore.replace(/9/g,"valorenove");
	valore = valore.replace(//g,"#1#");
	valore = valore.replace(//g,"#2#");
	valore = valore.replace(//g,"#3#");
	valore = valore.replace(//g,"#4#");
	valore = valore.replace(//g,"#5#");
	valore = valore.replace(//g,"#6#");
	valore = valore.replace(//g,"#7#");
	valore = valore.replace(//g,"#8#");
	valore = valore.replace(/	/g,"#9#");
	valore = valore.replace(//g,"#11#");
	valore = valore.replace(//g,"#12#");
	valore = valore.replace(//g,"#14#");
	valore = valore.replace(//g,"#15#");
	valore = valore.replace(//g,"#16#");
	valore = valore.replace(//g,"#17#");
	valore = valore.replace(//g,"#18#");
	valore = valore.replace(//g,"#19#");
	valore = valore.replace(//g,"#20#");
	valore = valore.replace(//g,"#21#");
	valore = valore.replace(//g,"#22#");
	valore = valore.replace(//g,"#23#");
	valore = valore.replace(//g,"#24#");
	valore = valore.replace(//g,"#25#");
	valore = valore.replace(//g,"#27#"); //il carattere 26 non permette di vedere oltre
	valore = valore.replace(//g,"#27#");
	valore = valore.replace(//g,"#28#");
	valore = valore.replace(//g,"#29#");
	valore = valore.replace(//g,"#30#");
	valore = valore.replace(//g,"#31#");
	valore = valore.replace(/ /g,"#32#");
	valore = valore.replace(/!/g,"#33#");
	valore = valore.replace(/"/g,"#34#");
	valore = valore.replace(/\$/g,"#36#");
	valore = valore.replace(/%/g,"#37#");
	valore = valore.replace(/&/g,"#38#");
	valore = valore.replace(/'/g,"#39#");
	valore = valore.replace(/\(/g,"#40#");
	valore = valore.replace(/\)/g,"#41#");
	valore = valore.replace(/\*/g,"#42#");
	valore = valore.replace(/\+/g,"#43#");
	valore = valore.replace(/\,/g,"#44#");
	valore = valore.replace(/\-/g,"#45#");
	valore = valore.replace(/\./g,"#46#");
	valore = valore.replace(/\//g,"#47#");
	valore = valore.replace(/:/g,"#58#");
	valore = valore.replace(/;/g,"#59#");
	valore = valore.replace(/</g,"#60#");
	valore = valore.replace(/=/g,"#61#");
	valore = valore.replace(/>/g,"#62#");
	valore = valore.replace(/\?/g,"#63#");
	valore = valore.replace(/@/g,"#64#");
	valore = valore.replace(/A/g,"#65#");
	valore = valore.replace(/B/g,"#66#");
	valore = valore.replace(/C/g,"#67#");
	valore = valore.replace(/D/g,"#68#");
	valore = valore.replace(/E/g,"#69#");
	valore = valore.replace(/F/g,"#70#");
	valore = valore.replace(/G/g,"#71#");
	valore = valore.replace(/H/g,"#72#");
	valore = valore.replace(/I/g,"#73#");
	valore = valore.replace(/J/g,"#74#");
	valore = valore.replace(/K/g,"#75#");
	valore = valore.replace(/L/g,"#76#");
	valore = valore.replace(/M/g,"#77#");
	valore = valore.replace(/N/g,"#78#");
	valore = valore.replace(/O/g,"#79#");
	valore = valore.replace(/P/g,"#80#");
	valore = valore.replace(/Q/g,"#81#");
	valore = valore.replace(/R/g,"#82#");
	valore = valore.replace(/S/g,"#83#");
	valore = valore.replace(/T/g,"#84#");
	valore = valore.replace(/U/g,"#85#");
	valore = valore.replace(/V/g,"#86#");
	valore = valore.replace(/W/g,"#87#");
	valore = valore.replace(/X/g,"#88#");
	valore = valore.replace(/Y/g,"#89#");
	valore = valore.replace(/Z/g,"#90#");
	valore = valore.replace(/\[/g,"#91#");
	valore = valore.replace(/\\/g,"#92#");
	valore = valore.replace(/]/g,"#93#");
	valore = valore.replace(/\^/g,"#94#");
	valore = valore.replace(/_/g,"#95#");
	valore = valore.replace(/`/g,"#96#");
	valore = valore.replace(/a/g,"#97#");
	valore = valore.replace(/b/g,"#98#");
	valore = valore.replace(/c/g,"#99#");
	valore = valore.replace(/d/g,"#100#");
	valore = valore.replace(/e/g,"#101#");
	valore = valore.replace(/f/g,"#102#");
	valore = valore.replace(/g/g,"#103#");
	valore = valore.replace(/h/g,"#104#");
	valore = valore.replace(/i/g,"#105#");
	valore = valore.replace(/j/g,"#106#");
	valore = valore.replace(/k/g,"#107#");
	valore = valore.replace(/l/g,"#108#");
	valore = valore.replace(/m/g,"#109#");
	valore = valore.replace(/n/g,"#110#");
	valore = valore.replace(/o/g,"#111#");
	valore = valore.replace(/p/g,"#112#");
	valore = valore.replace(/q/g,"#113#");
	valore = valore.replace(/r/g,"#114#");
	valore = valore.replace(/s/g,"#115#");
	valore = valore.replace(/t/g,"#116#");
	valore = valore.replace(/u/g,"#117#");
	valore = valore.replace(/v/g,"#118#");
	valore = valore.replace(/w/g,"#119#");
	valore = valore.replace(/x/g,"#120#");
	valore = valore.replace(/y/g,"#121#");
	valore = valore.replace(/z/g,"#122#");
	valore = valore.replace(/{/g,"#123#");
	valore = valore.replace(/\|/g,"#124#");
	valore = valore.replace(/}/g,"#125#");
	valore = valore.replace(/~/g,"#126#");
	valore = valore.replace(//g,"#127#");
	valore = valore.replace(//g,"#128#");
	valore = valore.replace(//g,"#129#");
	valore = valore.replace(//g,"#130#");
	valore = valore.replace(//g,"#131#");
	valore = valore.replace(//g,"#132#");
	valore = valore.replace(//g,"#133#");
	valore = valore.replace(//g,"#134#");
	valore = valore.replace(//g,"#135#");
	valore = valore.replace(//g,"#136#");
	valore = valore.replace(//g,"#137#");
	valore = valore.replace(//g,"#138#");
	valore = valore.replace(//g,"#139#");
	valore = valore.replace(//g,"#140#");
	valore = valore.replace(//g,"#141#");
	valore = valore.replace(//g,"#142#");
	valore = valore.replace(//g,"#143#");
	valore = valore.replace(//g,"#144#");
	valore = valore.replace(//g,"#145#");
	valore = valore.replace(//g,"#146#");
	valore = valore.replace(//g,"#147#");
	valore = valore.replace(//g,"#148#");
	valore = valore.replace(//g,"#149#");
	valore = valore.replace(//g,"#150#");
	valore = valore.replace(//g,"#151#");
	valore = valore.replace(//g,"#152#");
	valore = valore.replace(//g,"#153#");
	valore = valore.replace(//g,"#154#");
	valore = valore.replace(//g,"#155#");
	valore = valore.replace(//g,"#156#");
	valore = valore.replace(//g,"#157#");
	valore = valore.replace(//g,"#158#");
	valore = valore.replace(//g,"#159#");
	valore = valore.replace(//g,"#160#");
	valore = valore.replace(//g,"#161#");
	valore = valore.replace(//g,"#162#");
	valore = valore.replace(//g,"#163#");
	valore = valore.replace(//g,"#164#");
	valore = valore.replace(//g,"#165#");
	valore = valore.replace(//g,"#166#");
	valore = valore.replace(//g,"#167#");
	valore = valore.replace(//g,"#168#");
	valore = valore.replace(//g,"#169#");
	valore = valore.replace(//g,"#170#");
	valore = valore.replace(//g,"#171#");
	valore = valore.replace(//g,"#172#");
	valore = valore.replace(//g,"#173#");
	valore = valore.replace(//g,"#174#");
	valore = valore.replace(//g,"#175#");
	valore = valore.replace(//g,"#176#");
	valore = valore.replace(//g,"#177#");
	valore = valore.replace(//g,"#178#");
	valore = valore.replace(//g,"#179#");
	valore = valore.replace(//g,"#180#");
	valore = valore.replace(//g,"#181#");
	valore = valore.replace(//g,"#182#");
	valore = valore.replace(//g,"#183#");
	valore = valore.replace(//g,"#184#");
	valore = valore.replace(//g,"#185#");
	valore = valore.replace(//g,"#186#");
	valore = valore.replace(//g,"#187#");
	valore = valore.replace(//g,"#188#");
	valore = valore.replace(//g,"#189#");
	valore = valore.replace(//g,"#190#");
	valore = valore.replace(//g,"#191#");
	valore = valore.replace(//g,"#192#");
	valore = valore.replace(//g,"#193#");
	valore = valore.replace(//g,"#194#");
	valore = valore.replace(//g,"#195#");
	valore = valore.replace(//g,"#196#");
	valore = valore.replace(//g,"#197#");
	valore = valore.replace(//g,"#198#");
	valore = valore.replace(//g,"#199#");
	valore = valore.replace(//g,"#200#");
	valore = valore.replace(//g,"#201#");
	valore = valore.replace(//g,"#202#");
	valore = valore.replace(//g,"#203#");
	valore = valore.replace(//g,"#204#");
	valore = valore.replace(//g,"#205#");
	valore = valore.replace(//g,"#206#");
	valore = valore.replace(//g,"#207#");
	valore = valore.replace(//g,"#208#");
	valore = valore.replace(//g,"#209#");
	valore = valore.replace(//g,"#210#");
	valore = valore.replace(//g,"#211#");
	valore = valore.replace(//g,"#212#");
	valore = valore.replace(//g,"#213#");
	valore = valore.replace(//g,"#214#");
	valore = valore.replace(//g,"#215#");
	valore = valore.replace(//g,"#216#");
	valore = valore.replace(//g,"#217#");
	valore = valore.replace(//g,"#218#");
	valore = valore.replace(//g,"#219#");
	valore = valore.replace(//g,"#220#");
	valore = valore.replace(//g,"#221#");
	valore = valore.replace(//g,"#222#");
	valore = valore.replace(//g,"#223#");
	valore = valore.replace(//g,"#224#");
	valore = valore.replace(//g,"#225#");
	valore = valore.replace(//g,"#226#");
	valore = valore.replace(//g,"#227#");
	valore = valore.replace(//g,"#228#");
	valore = valore.replace(//g,"#229#");
	valore = valore.replace(//g,"#230#");
	valore = valore.replace(//g,"#231#");
	valore = valore.replace(//g,"#232#");
	valore = valore.replace(//g,"#233#");
	valore = valore.replace(//g,"#234#");
	valore = valore.replace(//g,"#235#");
	valore = valore.replace(//g,"#236#");
	valore = valore.replace(//g,"#237#");
	valore = valore.replace(//g,"#238#");
	valore = valore.replace(//g,"#239#");
	valore = valore.replace(//g,"#240#");
	valore = valore.replace(//g,"#241#");
	valore = valore.replace(//g,"#242#");
	valore = valore.replace(//g,"#243#");
	valore = valore.replace(//g,"#244#");
	valore = valore.replace(//g,"#245#");
	valore = valore.replace(//g,"#246#");
	valore = valore.replace(//g,"#247#");
	valore = valore.replace(//g,"#248#");
	valore = valore.replace(//g,"#249#");
	valore = valore.replace(//g,"#250#");
	valore = valore.replace(//g,"#251#");
	valore = valore.replace(//g,"#252#");
	valore = valore.replace(//g,"#253#");
	valore = valore.replace(//g,"#254#");
	valore = valore.replace(//g,"#255#");
	
	return valore;
}
function avvio() {
	//chiudiintro()
	larghezza = document.getElementById('legal').offsetWidth;
	altezza = document.getElementById('lingue').offsetHeight
	
	document.getElementById('lingue').style.top = 512-altezza + 'px';
	document.getElementById('lingue').style.left = 13+larghezza + 'px';
	document.getElementById('lingue').style.display = 'none';

	altezza = document.getElementById('legalcorpo').offsetHeight;
	document.getElementById('legalcorpo').style.top = 512-altezza + 'px';
	document.getElementById('legalcorpo').style.display = 'none';

	calcoladivmenu();
	
	//controllo se ci sono immmagini in gallery e quindi avvio lo slide
	if (document.formgallery.immaginigallery.value > 1) {
		 slideshow();
		} else  {
		opacita('immagineprincipale', 0, 100, 1000)
	}
	document.getElementById('legalcorpo').style.visibility = "visible";
	document.getElementById('lingue').style.visibility = "visible";
	
	if (document.getElementById('bottonetabella') && document.getElementById('contornotesto') ) {
		 document.getElementById('bottonetabella').style.height = document.getElementById('contornotesto').offsetHeight + "px"
		}
	
	if (document.getElementById('titolofamiglia')) {
			larghezza = document.getElementById('contornotesto').offsetWidth;
			document.getElementById('titolofamiglia').style.width = larghezza+15+"px";
			}
	if (document.getElementById('datitecnici')) {
			versionebrowser = navigator.appVersion
			if (versionebrowser.indexOf("MSIE") > -1) {
				valorealfa = 70 } else {
					valorealfa = 100
				}
			altezza = document.getElementById('datitecnici').offsetHeight;
			document.getElementById('datitecnici').style.top = 544-altezza-35+"px";
			document.getElementById('immagineprincipale').style.height = 544-altezza-35-92+"px";
			if (document.getElementById('imgprinccreata')) {
				document.getElementById('imgprinccreata').style.height = 544-altezza-35-92+"px";
			}
			opacita('datitecnici', 0, valorealfa, 1000)
			}
	if (document.getElementById('titolofamiglia')) {
		larghezza = document.getElementById('tabelladati').offsetWidth
		if (larghezza > 500 ) {
				document.getElementById('immagineprincipale').style.display = 'none'
				}
			}
}
function dimensionischermo() {
	//alert('Risoluzione Monitor '+screen.width+'x'+screen.height);
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	//window.alert( 'Larghezza Utile = ' + myWidth );
	//window.alert( 'Altezza Utile = ' + myHeight );
	document.getElementById('superocontenitorenero').style.width = myWidth + 'px';
	document.getElementById('superocontenitorenero').style.height = myHeight + 'px';
	document.getElementById('contenitorenerosopra').style.width = myWidth + 'px';
	document.getElementById('contenitorenerosopra').style.height = myHeight + 'px';
}
function calcolasottofamiglia() {
	//document.getElementById('unitamisura').innerHTML = ""
	//document.getElementById('unitamisurab').innerHTML = ""
	if( typeof( window.innerWidth ) == 'number' ) {
		spostamento = 29;
	} else {
		spostamento = 20;
	}
	larghezza = document.getElementById('tabelladati').offsetWidth;
	larghezzab = document.getElementById('titolofamiglia').offsetWidth+spostamento;
	if (larghezzab < larghezza) {
		document.getElementById('titolofamiglia').style.width = larghezza-spostamento + 'px';
		}
	
}
function mostranelbox(id) {
	document.getElementById('biancoedittesto').innerHTML = "<img src='/img/gallery/std/"+id+"'>"
}
function galleria(id,valore) {
	document.getElementById('contornotesto').style.display = 'none';
	document.getElementById('tabelladati').style.display = 'none';
	//document.getElementById('titolofamiglia').style.display = 'none';
	document.getElementById('immagineprincipale').style.display = 'none';
	if (document.getElementById('datitecnici')) {
	document.getElementById('datitecnici').style.display = 'none';
	}
	if (document.getElementById('bottonetabella')) {
	document.getElementById('bottonetabella').style.display = 'none';
	}
	if (document.getElementById('bottonetesti')) {
	document.getElementById('bottonetesti').style.display = 'none';
	}
	altezzacooliris = 340;
	larghezzacooliris = 966
	if ( valore == 0 ) {
		altezzacooliris = 308;
		larghezzacooliris = 955;
		}
	document.getElementById('cooliris').style.display = 'block';
	
	var flashvars = {
		//feed: "/ajax/coolirisxml.asp?q="+id, style: 'light', numrows: 3
		feed: "/ajax/coolirisxml.asp?q="+id, backgroundAlpha: 0.5
		 
		//style: 'light', 
	};
	var params = {
		allowscriptaccess: "always", wmode: "transparent"
	};
	swfobject.embedSWF("http://apps.cooliris.com/embed/cooliris.swf", "cooliris", larghezzacooliris, altezzacooliris, "9.0.0", "", flashvars, params);
	document.getElementById('titolo').style.width = "946px";
	if (document.getElementById('titolofamiglia')) {
			document.getElementById('titolofamiglia').style.width = "935px";
		};
	if ( valore == 0 ) {
		document.getElementById('cooliris').style.top = "198px";
		document.getElementById('cooliris').style.left = "35px";
		}
		
}
function galleriachiudi() {
	if (document.getElementById('cooliris').style.display == 'block'){
		cosamostro = document.formgallery.cosamostro.value;
		if (cosamostro.indexOf("1") > -1) {
			document.getElementById('contornotesto').style.display = 'block';
		}
		if (cosamostro.indexOf("2") > -1) {
			document.getElementById('immagineprincipale').style.display = 'block';
		}
		if (cosamostro.indexOf("3") > -1) {
			document.getElementById('tabelladati').style.display = 'block';
		}
		if (cosamostro.indexOf("4") > -1) {
			document.getElementById('titolofamiglia').style.display = 'block';
		}
		
		document.getElementById('cooliris').style.display = 'none';
	}
}
function scambio(id){
	if ( document.getElementById(id).style.display == 'block' ) {
   		document.getElementById(id).style.display = 'none';
	} else {
    	document.getElementById(id).style.display = 'block';
    }
}
function nascondi(id){
	if ( document.getElementById(id) ) {
	document.getElementById(id).style.display = 'none';
	}
}
function visualizza(id){
	document.getElementById(id).style.display = 'block';
}
function chiudi(id){
	scambio(id);
}
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 scambiaunita() {
	scambio('bloccodati');
	scambio('bloccodatib');
	nascondi('bloccodatic');
	}
function chiudiintro(ln) {
	document.getElementById('video').innerHTML = ""
	document.getElementById('video').style.display = 'none'
	document.getElementById('bandiereintro').style.display = 'none'
	opacita('contenitorenerosopra', 100, 0, 2000)
	opacita('contenitorenero', 100, 0, 2000)
	opacita('superocontenitorenero', 100, 0, 2000)
	document.getElementById('contenitore').style.opacity = (0); 
    document.getElementById('contenitore').style.MozOpacity = (0); 
    document.getElementById('contenitore').style.KhtmlOpacity = (0); 
    document.getElementById('contenitore').style.filter = "alpha(opacity=0)"; 
	setTimeout("apriintro('"+ln+"')",(2000)); 
	}
function apriintro(ln) {
	if(ln == "") { 
		opacita('contenitore', 0, 100, 2000)
		location.href = "/"
	} else 	{
		location.href = "/"+ln+"/"
	} 
	}
function intro() { 
	if(window.XMLHttpRequest)
		{
		   richiesta = new XMLHttpRequest();
		}
		else if(window.ActiveXObject)
		{
		   richiesta = new ActiveXObject("Microsoft.XMLHTTP");
		}
		richiesta.open("POST", "/ajax/intro.asp", true);
		richiesta.onreadystatechange = function() 
		{
			if(richiesta.readyState == 4)
			{	
				if(richiesta.status == 200)
				{
					location.href = "/"
				}
			}
		}
		richiesta.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		richiesta.send();
}
function larghezza(id) {
	larghezza = document.getElementById(id).offsetWidth;
	return larghezza;
	}
function altezza(id) {
	altezza = document.getElementById(id).offsetHeight;
	return altezza;
	}
function slideshow() {
	listaimmagini = document.formgallery.listaimmagini.value;
	versionebrowser = navigator.appVersion
	if (versionebrowser.indexOf("MSIE") > -1) {
		valorealfaslogan = 60 } else {
			valorealfaslogan = 100
		}
	if (listaimmagini != "") {
		window.setTimeout( "slideshow()", 5000);
		
		immaginevista = document.formgallery.immaginevista.value;
		lingua = document.formgallery.lingua.value;
		
		var myString = listaimmagini;
		var mySplitResult = myString.split("|");
		listaimmagini = mySplitResult[immaginevista];
		immaginevista = immaginevista*1+1;
		if (immaginevista < mySplitResult.length) {
				document.formgallery.immaginevista.value = immaginevista
			} else {
				document.formgallery.immaginevista.value = 1
			}
		var myStringb = listaimmagini;
		var mySplitResultb = myStringb.split("#");
		immagine = mySplitResultb[0];
		sloganimmagine = mySplitResultb[1];
		titlelink = mySplitResultb[2];
		linkstatico = mySplitResultb[3];
		
		stringadascrivere = ""
		if ( immagine != "" && immagine != null) {
				setTimeout("opacita ('immagineprincipale',0,100,500)",500)
				stringadascrivere = "<img src='/img/gallery/"+immagine+"' id='imgprinccreata'>";
				if ( linkstatico != "" && linkstatico != null) {
					stringadascrivere = "<a href='/"+lingua+"/"+linkstatico+"' title='"+titlelink+"'>"+stringadascrivere+"</a>"
					}
				document.getElementById('immagineprincipale').innerHTML = stringadascrivere;
				if (document.getElementById('datitecnici')) {
					versionebrowser = navigator.appVersion
					if (versionebrowser.indexOf("MSIE") > -1) {
						valorealfa = 70 } else {
							valorealfa = 100
						}
					altezza = document.getElementById('datitecnici').offsetHeight;
					document.getElementById('datitecnici').style.top = 544-altezza-35+"px";
					document.getElementById('immagineprincipale').style.height = 544-altezza-35-92+"px";
					if (document.getElementById('imgprinccreata')) {
						altezzaimgcreata = document.getElementById('datitecnici').offsetHeight;
						if (altezzaimgcreata > (544-altezza-35-92)) {
						document.getElementById('imgprinccreata').style.height = 544-altezza-35-92+"px";
						}
					}
					}
			} else {
				document.getElementById('immagineprincipale').innerHTML = "";
			}
		stringadascrivereslogan = "";
		document.getElementById('sloganprincipale').style.display = 'none';
		if ( sloganimmagine != "" && sloganimmagine != null) {
				setTimeout("opacita ('sloganprincipale',0,"+valorealfaslogan+",500)",500)
				stringadascrivereslogan = sloganimmagine;
				if ( linkstatico != "" && linkstatico != null) {
					stringadascrivereslogan = "<a href='/"+lingua+"/"+linkstatico+"' title='"+titlelink+"'>"+stringadascrivereslogan+"</a>"
					}
				if ( sloganimmagine != "" && sloganimmagine != null && document.formgallery.tipopagina.value != "hm") {
					altezzaimgprinccreata = document.getElementById('imgprinccreata').offsetHeight;
					document.getElementById('sloganprincipale').style.top = 170+altezzaimgprinccreata + 'px';
				}
				document.getElementById('sloganprincipale').style.display = 'block';
			}
		
		document.getElementById('sloganprincipale').innerHTML = stringadascrivereslogan;
		altezzasloganprincipale = document.getElementById('sloganprincipale').offsetHeight;
		if ( sloganimmagine != "" && sloganimmagine != null && document.formgallery.tipopagina.value != "hm") {
			altezzasloganprincipale = document.getElementById('sloganprincipale').offsetHeight;
			document.getElementById('sloganprincipale').style.top = 170+altezzaimgprinccreata*1-altezzasloganprincipale*1 + 'px';
		}
		larghezza = document.getElementById('sloganprincipale').offsetWidth;
		if ( larghezza*1 < 422 ) {
		document.getElementById('sloganprincipale').style.width = 422 + "px";
		}
		setTimeout("opacita ('immagineprincipale',100,0,500)",4500)
		setTimeout("opacita ('sloganprincipale',"+valorealfaslogan+",0,500)",4500)
	}
}
function regolabottonetabella(id) {
	versionebrowser = navigator.appVersion
	if (id == 1) {
		altezza = document.getElementById('tabelladati').offsetHeight;
		if (versionebrowser.indexOf("MSIE") > -1) {
			document.getElementById('bottonetesti').style.height = altezza-10+"px";
			} else {
			document.getElementById('bottonetesti').style.height = altezza-13+"px";
			}
		if (document.getElementById('titolofamiglia')) {
			larghezza = document.getElementById('tabelladati').offsetWidth;
			if (versionebrowser.indexOf("MSIE") > -1) {
			document.getElementById('titolofamiglia').style.width = larghezza+15+"px";
			document.getElementById('titolo').style.width = larghezza+26+"px";
			} else {
			document.getElementById('titolofamiglia').style.width = larghezza+6+"px";
			if (document.getElementById('titolo')) {
				document.getElementById('titolo').style.width = larghezza+17+"px";
				}
			}
		}
	} else {
		if (document.getElementById('titolofamiglia')) {
			larghezza = document.getElementById('contornotesto').offsetWidth;
			document.getElementById('titolofamiglia').style.width = larghezza+15+"px";
			document.getElementById('titolo').style.width = "511px";
			}
		}
	}
function cambia(formmodulo,modulo,formmoduloid,id) {
	var nuovovalore;
	eval("nuovovalore=document."+formmodulo+"."+modulo+".value");
	nuovovalore = nuovovalore.replace(/\n/g,"<br>");
	//nuovovalore = nuovovalore.replace(/\r/g,"<br>");
	if (formmoduloid == '') {
	document.getElementById(id).innerHTML = nuovovalore;
	} else {
	eval("document."+formmoduloid+"."+id+".value='"+nuovovalore+"'");
	}
}
function cambiavaloreid(id) {
	document.editimmagine.id2riferimento.value = id;
}
function mostravolley(id) {
	if (id == '1') {
		document.getElementById('fotovolleylink').style.display = "block";
		document.getElementById('fotovolley').style.display = "block";
		opacita ('fotovolley',0,100,500)
	} else {
		opacita ('fotovolley',100,0,1000)
		setTimeout("nascondi('fotovolleylink')",(1000)); 
	}
}
function impostavalore(formmoduloid,id,nuovovalore) {
		eval("document."+formmoduloid+"."+id+".value='"+nuovovalore+"'");
	}
function modificacaratteristica(id) {
		if (document.formgallery.caratteristicamodificato.value != '') {
			eval("visualizza('bottone"+document.formgallery.caratteristicamodificato.value+"')");
			eval("nascondi('input"+document.formgallery.caratteristicamodificato.value+"')");
			}
		document.formgallery.caratteristicamodificato.value= id;
		eval("nascondi('bottone"+id+"')");
		eval("visualizza('input"+id+"')");
	}
function cambianomecaratteristica(idcaratteristica) {
		formmodulo = "tabella";
		modulo = "input"+idcaratteristica;
		ln = document.edittesto.lingua.value;
		//formmodulo = "edittesto";
		//modulo = "modifica";
		eval("valore=document."+formmodulo+"."+modulo+".value");
		


		valore = codificaascii(valore);

		if(window.XMLHttpRequest)
		{
		   richiesta = new XMLHttpRequest();
		}
		else if(window.ActiveXObject)
		{
		   richiesta = new ActiveXObject("Microsoft.XMLHTTP");
		}
		richiesta.open("POST", "/ajax/cambianomecaratteristica.asp", true);
		richiesta.onreadystatechange = function() 
		{
			if(richiesta.readyState == 4)
			{	
				if(richiesta.status == 200)
				{
					eval("document.getElementById('span"+id+"').innerHTML = valore");
				}
			}
		}
		richiesta.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		richiesta.send("id="+idcaratteristica+"&valore="+valore+"&l="+ln);
}
	
function modificamodello(id) {
		if (document.formgallery.modellomodificato.value != '') {
			eval("visualizza('bottone"+document.formgallery.modellomodificato.value+"')");
			eval("nascondi('input"+document.formgallery.modellomodificato.value+"')");
			}
		document.formgallery.modellomodificato.value= id;
		eval("nascondi('bottone"+id+"')");
		eval("visualizza('input"+id+"')");
	}
function cambiavalore(id,tipo,idmodello,idcaratteristica) {
		formmodulo = "tabella";
		modulo = "input"+id;
		//formmodulo = "edittesto";
		//modulo = "modifica";
		eval("valore=document."+formmodulo+"."+modulo+".value");
		if(window.XMLHttpRequest)
		{
		   richiesta = new XMLHttpRequest();
		}
		else if(window.ActiveXObject)
		{
		   richiesta = new ActiveXObject("Microsoft.XMLHTTP");
		}
		richiesta.open("POST", "/ajax/cambiavalori.asp", true);
		richiesta.onreadystatechange = function() 
		{
			if(richiesta.readyState == 4)
			{	
				if(richiesta.status == 200)
				{
					eval("document.getElementById('span"+id+"').innerHTML = valore");
				}
			}
		}
		richiesta.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		richiesta.send("id="+id+"&valore="+valore+"&tipo="+tipo+"&idmodello="+idmodello+"&idcaratteristica="+idcaratteristica);
		
}

function preparamodifica(id) {
	mostra('menuedit');
	document.getElementById('biancoedittesto').innerHTML = '&nbsp;';
	document.getElementById('biancoedittesto').style.display = 'block';
	document.getElementById('contenitorecontatti').style.display = 'block';
	document.getElementById('biancoeditimmagine').style.display = 'none';
	document.getElementById('edittesto').style.display = 'none';
	document.getElementById('labeltitolo').style.display = 'none';
	document.getElementById('labeltesto').style.display = 'none';
	document.getElementById('labelparolalink').style.display = 'none';
	document.getElementById('labeltitlelink').style.display = 'none';
	document.getElementById('labelnomelink').style.display = 'none';
	document.getElementById('labeltagtitle').style.display = 'none';
	document.getElementById('labeltagkeywords').style.display = 'none';
	document.getElementById('labeltagdescription').style.display = 'none';
	document.getElementById('labelgiornoinizio').style.display = 'none';
	document.getElementById('labelgiornofine').style.display = 'none';
	document.getElementById('labelcalcolapercorso').style.display = 'none';
	document.getElementById('labelparolalogo').style.display = 'none';
	document.getElementById('labeltlelinkhome').style.display = 'none';
	document.getElementById('labelparolaslogan').style.display = 'none';
	document.getElementById('labelparolalogoucimu').style.display = 'none';
	document.getElementById('labeltitleucimu').style.display = 'none';
	document.getElementById('labelparolalogoiso').style.display = 'none';
	document.getElementById('labeltitleiso').style.display = 'none';
	
	document.getElementById('labeltitlelegal').style.display = 'none';
	document.getElementById('labelparolalegal').style.display = 'none';
	document.getElementById('labellegalcorpo').style.display = 'none';
	document.getElementById('labeltitlelingue').style.display = 'none';
	document.getElementById('labelparoladescrizionegenerale').style.display = 'none';
	document.getElementById('labeltitledescrizionegenerale').style.display = 'none';
	document.getElementById('labelparoladati').style.display = 'none';
	document.getElementById('labeltitledati').style.display = 'none';
	document.getElementById('labelparolastampa').style.display = 'none';
	document.getElementById('labelparolacooliris').style.display = 'none';
	document.getElementById('labeltitlecooliris').style.display = 'none';
	document.getElementById('labelparolaintro').style.display = 'none';
	document.getElementById('labeltitleintro').style.display = 'none';
	document.getElementById('labelparolacredits').style.display = 'none';
	document.getElementById('labeltitlecredits').style.display = 'none';	
	document.getElementById('labelparolachiudifinestra').style.display = 'none';	
	document.getElementById('labeltitlechiudifinestra').style.display = 'none';	
	document.getElementById('elencolingue').style.display = 'none';	
	
	document.edittesto.tipomodifica.value = id
	
	document.getElementById('testo').style.display = 'block';
	document.formgallery.listaimmagini.value = ""
	}
function preparamodificaimmagini(id) {
	mostra('menuedit');
	document.getElementById('biancoeditimmagine').style.display = 'block';
	document.getElementById('biancoedittesto').style.display = 'block';
	document.getElementById('edittesto').style.display = 'none';
	document.getElementById('labeltitolo').style.display = 'none';
	document.getElementById('labeltesto').style.display = 'none';
	document.getElementById('labelparolalink').style.display = 'none';
	document.getElementById('labeltitlelink').style.display = 'none';
	document.getElementById('labelnomelink').style.display = 'none';
	document.getElementById('labeltagtitle').style.display = 'none';
	document.getElementById('labeltagkeywords').style.display = 'none';
	document.getElementById('labeltagdescription').style.display = 'none';
	document.getElementById('labelgiornoinizio').style.display = 'none';
	document.getElementById('labelgiornofine').style.display = 'none';
	document.getElementById('labelparolalogovolley').style.display = 'none';
	document.getElementById('labeltitlelinkvolley').style.display = 'none';

	document.editimmagine.tipomodifica.value = id
	
	document.getElementById('testo').style.display = 'block';
	document.formgallery.listaimmagini.value = ""
	}
	
function azzera(lingua,id) {
	document.getElementById('immagineprincipale').style.display = 'none';
	document.getElementById('sloganprincipale').style.display = 'none';
	document.getElementById("titoloh1").innerHTML = "&nbsp;"
	document.getElementById("testo").innerHTML = ""
	
	document.edittesto.inputtitolo.value = ''
	document.edittesto.inputtesto.value = ''
	document.edittesto.inputparolalink.value = ''
	document.edittesto.inputtitlelink.value = ''
	document.edittesto.inputnomelink.value = ''
	document.edittesto.inputtagtitle.value = ''
	document.edittesto.inputkeywords.value = ''
	document.edittesto.inputtagdescription.value = ''
	document.edittesto.inputgiornoinizio.value = ''
	document.edittesto.inputgiornofine.value = ''
	document.edittesto.lingua.value = lingua
	document.edittesto.modifica.value = id
	}
function startModifica(){
	document.getElementById('erroreedittesto').innerHTML = "Updating... Please Wait"
	document.getElementById('erroreedittesto').style.visibility = 'visible';
	document.getElementById('campiedittesto').style.visibility = 'hidden';
	return true;
}
function stopModifica(success){
	var result = '';
	var mySplitResultb = success.split("#");
	errore = mySplitResultb[0];
	destinazione = mySplitResultb[1];
	//window.alert(errore)
	if (errore != "-"){
		document.getElementById('erroreedittesto').innerHTML = 'Error occurred while updating. error number//s' + errore + '' ;
		} else {
			location.href = destinazione
		} 
      return true;   
}
///////// START UPLOAD ////////////
function startUpload(){
	document.getElementById('erroreeditimmagine').innerHTML = "Uploading... Please Wait"
	document.getElementById('erroreeditimmagine').style.visibility = 'visible';
	document.getElementById('campieditimmagine').style.visibility = 'hidden';
	return true;
}

function stopUpload(success){
      var result = '';
	  //window.alert(success);
	  //window.alert(success.length);
	  if(success.length == 12) {
		  creagallery(success);
		  } else if (success.length == 1) {
		  location.href = "/"
		  } else {
			  window.alert(success)
		  }
      document.getElementById('erroreeditimmagine').style.visibility = 'hidden';
	  document.getElementById('editimmagine').style.visibility = 'hidden';
      //document.getElementById('campieditimmagine').innerHTML = result + '<label>File: <input name="myfile" type="file" size="30" /><\/label><label><input type="submit" name="submitBtn" class="sbtn" value="Upload" /><\/label>';
	  document.getElementById('campieditimmagine').style.visibility = 'visible';    
      return true;   
}

function creagallery(id) { 
	//window.alert(id);
	if(window.XMLHttpRequest)
		{
		   richiesta = new XMLHttpRequest();
		}
		else if(window.ActiveXObject)
		{
		   richiesta = new ActiveXObject("Microsoft.XMLHTTP");
		}
		richiesta.open("POST", "/ajax/creagalleria.asp", true);
		richiesta.onreadystatechange = function() 
		{
			if(richiesta.readyState == 4)
			{	
				if(richiesta.status == 200)
				{
					str = richiesta.responseText;
					//window.alert(str);
					document.getElementById('boxthumb').innerHTML = str;
				}
			}
		}
		richiesta.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		richiesta.send("id2="+id);
}
///////// END UPLOAD ////////////
///// start modifica ordine lingua /////
function spostalingua(id, tipo) { 
	if(window.XMLHttpRequest)
		{
		   richiesta = new XMLHttpRequest();
		}
		else if(window.ActiveXObject)
		{
		   richiesta = new ActiveXObject("Microsoft.XMLHTTP");
		}
		richiesta.open("POST", "/ajax/spostalingua.asp", true);
		richiesta.onreadystatechange = function() 
		{
			if(richiesta.readyState == 4)
			{	
				if(richiesta.status == 200)
				{
					str = richiesta.responseText;
					valori = str.split("#####");
					valoretesto = valori[0];
					valoreerrore = valori[1];
					if (valoreerrore != "" && valoreerrore != undefined && valoreerrore != null) {
						window.alert(valoreerrore)
						}
					document.getElementById('elencolingue').innerHTML = valoretesto;
				}
			}
		}
		richiesta.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		richiesta.send("id="+id+"&tipo="+tipo);
}
///// end modifica ordine lingua /////
///// start modifica ordine immagine /////
function movup(id, tipo, iddasostituire) { 
	ln = document.edittesto.lingua.value;
	if(window.XMLHttpRequest)
		{
		   richiesta = new XMLHttpRequest();
		}
		else if(window.ActiveXObject)
		{
		   richiesta = new ActiveXObject("Microsoft.XMLHTTP");
		}
		richiesta.open("POST", "/ajax/spostalingua.asp", true);
		richiesta.onreadystatechange = function() 
		{
			if(richiesta.readyState == 4)
			{	
				if(richiesta.status == 200)
				{
					str = richiesta.responseText;
					valori = str.split("#####");
					valoretesto = valori[0];
					valoreerrore = valori[1];
					if (valoreerrore != "" && valoreerrore != undefined && valoreerrore != null) {
						window.alert(valoreerrore)
						}
					eval("document.getElementById('"+iddasostituire+"').innerHTML = valoretesto");
				}
			}
		}
		richiesta.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		richiesta.send("id="+id+"&tipo="+tipo+"&l="+ln);
}
///// end modifica ordine lingua /////
