function ajaxConnect( strURL, method, formID ) {
	if ( method == undefined ) {
		method = "get";
	}
	var xmlHttpReq = false;
	if ( window.XMLHttpRequest ) {
		xmlHttpReq = new XMLHttpRequest();
	} else if ( window.ActiveXObject ) {
		xmlHttpReq = new ActiveXObject( "Microsoft.XMLHTTP" );
	} else {
		alert( "Il browser in uso non supporta la tecnologia Ajax" );
	}
	if ( method.toLowerCase() == "get" && formID != undefined ) {
	    strURL += ( ( strURL.indexOf( "?" ) == - 1 ) ? "?" : "&" ) + getquerystring( formID );
	}
	xmlHttpReq.open( method, strURL );
	xmlHttpReq.setRequestHeader( "Content-Type", "application/x-www-form-urlEncoded" );
	if ( formID != undefined && method.toLowerCase() == "post" ) {
	    xmlHttpReq.send( getquerystring( formID ) ); 
	} else {
	    xmlHttpReq.send( null ); 
	}
	xmlHttpReq.onreadystatechange = function() {
		if ( xmlHttpReq.readyState == 4 ) {
			eval( xmlHttpReq.responseText );
		}
	};
}
sfHover = function() {
	var sfEls = document.getElementById("menu").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
function externalLinks() {
	if ( ! document.getElementsByTagName ) {
		return;
	}
	var anchors = document.getElementsByTagName( "a" );
	for ( var i = 0; i < anchors.length; i++ ) {
		var anchor = anchors[i];
		if ( anchor.getAttribute( "href" ) && anchor.getAttribute( "rel" ) == "external" ) {
			anchor.target = "_blank";
		}
	}
}
function addOnloadFunction( functionName ) {
	if ( window.addEventListener ) {
		window.addEventListener( "load", functionName, false );
	}
	if ( window.attachEvent ) {
		window.attachEvent( "onload", functionName );
	}
}
if ( window.attachEvent ) {
	window.attachEvent( "onload", sfHover );
}
addOnloadFunction( externalLinks );
function convalidaInfo() {
	if ( document.info.firstName.value == "" ) {
		alert( "Il campo 'Nome' è obbligatorio" );
		document.info.firstName.focus();
		return false;
	} else if ( document.info.lastName.value == "" ) {
		alert( "Il campo 'Cognome' è obbligatorio" );
		document.info.lastName.focus();
		return false;
	} else if ( document.info.email.value == "" ) {
		alert( "Il campo 'e-mail' è obbligatorio" );
		document.info.email.focus();
		return false;
	} else if ( document.info.description.value == "" ) {
		alert( "Il campo 'Richiesta' è obbligatorio" );
		document.info.description.focus();
		return false;
	} else if ( ! (document.info.l196group[0].checked || document.info.l196group[1].checked)  ) {
		alert( "La scelta sull'informativa Dlgs. 196/2003 è obbligatoria" );
		document.info.description.focus();
		return false;
	} else {
		return true;
	}
}
function descrizioneProdotto( identificatore ) {
	if ( identificatore == 0 ) {
		document.getElementById( "descrizioneProdotto" ).innerHTML = "&nbsp;";
	} else {
		ajaxConnect( "/js/descrizione-prodotto.php?identificatore=" + identificatore );
	}
}
function contenutoHomePage( identificatoreContenutoPrecedente ) {
	setTimeout( 'ajaxConnect( "/js/contenuto-home-page.php?identificatoreContenutoPrecedente=' + identificatoreContenutoPrecedente + '")', 20000 );
}
function setOpacity( objName, opacity ) {
	obj = document.getElementById( objName );
	obj.style.opacity = opacity / 10;
	obj.style.filter = "alpha(opacity=" + opacity + ")";
}
function zoom( identificatoreProdotto ) {
	ajaxConnect( "/js/zoom.php?identificatoreProdotto=" + identificatoreProdotto );
}
function chiudiZoom() {
	document.getElementById( "zoom" ).style.display = "none";
}
function prodottiLinea() {
	document.getElementById( "prodotti" ).style.display = "block";
}