// JavaScript Document
function popit(cosa){
	newwindow=window.open(cosa,"Register","width=550,height=450,scrollbars=yes")
	newwindow.creator=self
	newwindow.focus();
}
function pophelp(cosa){
	newwindow=window.open(cosa,"Help","width=250,height=350,scrollbars=yes")
	newwindow.creator=self
	newwindow.focus();
}
function popnoti(cosa){
	newwindow=window.open(cosa,"Notifica","width=400,height=170,scrollbars=yes")
	newwindow.creator=self
	newwindow.focus();
}
function ShowTransientMessage() {
	window.status="Caricamento dati in corso...";
	DisplayMessageBox.style.display='';
	DisplayMessageBox.style.pixelTop=(document.body.clientHeight/2)-(DisplayMessageBox.offsetHeight/2)+(document.body.scrollTop);
	DisplayMessageBox.style.pixelLeft=(document.body.clientWidth/2)-(DisplayMessageBox.offsetWidth/2)+(document.body.scrollLeft);
}

function HideTransientMessage() {
	window.status="";
	DisplayMessageBox.style.display='none';
}

function checkMaxCompare(){
	var contatore=0;
	for (i = 0; i < document.prodotti.controllo.length; i++){
		if (document.prodotti.controllo[i].checked==true){
			contatore+=1;
			if (contatore>5){
				alert("Non è possibile comparare pù di 5 prodotti.");
				document.getElementById("prodCompCount").innerHTML = contatore;
				return false;
			}
		}
	}
	document.getElementById("prodCompCount").innerHTML = contatore;
	return true;
}

function checkMinCompare(){
	var contatore=0;
	for (i = 0; i < document.prodotti.controllo.length; i++){
		if (document.prodotti.controllo[i].checked==true) contatore+=1;
	}
	if (contatore>1){
		//alert("Stiamo effettuando una manutenzione al sistema di comparazione. Scusate i disagi.");
		return true;
	}
	else
	{
		alert("Seleziona almeno 2 prodotti per procedere con la comparazione.");
		return false;
	}
}
