function open_popup(sPath, sName, sWidth, sHeight, sScroll)
{
	 window.open(sPath, sName, 'scrollbars = ' + sScroll + ', width = ' + sWidth + ', height = ' + sHeight + ', left=' + ((screen.width - (sWidth + 16)) / 2) + ', top = '+((screen.height - sHeight) / 2));
}


function SelectAllItem(selectBox, selectAll)
{
	//nel caso sia una selezione singola
	if(typeof selectBox == "string")
	{
		selectBox = document.getElementById(selectBox);
	}
	
	//nel caso sia una selezione multipla (array)
	if(selectBox.type == "select-multiple")
	{
		for(var i = 0; i < selectBox.options.length; i++)
		{
			selectBox.options[i].selected = selectAll;
		}
	}
}


function MM_validateForm()
{ //v4.0
	if (document.getElementById)
	{
		var i, p, q, nm, test, num, min, max, errors = '', args = MM_validateForm.arguments;
		
		for (i = 0; i < (args.length - 2); i+=3) 
		{ 
			test = args[i + 2]; 
			val = document.getElementById(args[i]);
			
			if (val) 
			{ 
				nm = val.name; 
				if ((val = val.value) != "") 
				{
					if (test.indexOf('isEmail') != -1) 
					{ 
						p=val.indexOf('@');
						if (p < 1 || p == (val.length-1)) errors+='il campo '+nm+' deve contenere un indirizzo mail valido.\n';
					} 
					else if (test != 'R') 
					{ 
						num = parseFloat(val);
						if (isNaN(val)) errors+='il campo '+nm+' deve contenere un numero.\n';
						if (test.indexOf('inRange') != -1) 
						{ 
							p=test.indexOf(':');
							min=test.substring(8,p); 
							max=test.substring(p+1);
							if (num<min || max<num) errors+='il campo '+nm+' deve contenere un numero compreso da '+min+' a '+max+'.\n';
						} 
					} 
				} 
				else if (test.charAt(0) == 'R') errors += 'il campo '+nm+' e\' obbligatorio.\n'; 
			}
		} 
		
		if (errors) alert('Attenzione!\n'+errors);
		
		document.MM_returnValue = (errors == '');
	} 
}



function Confirm(sText, sLink)
{
	var c = confirm(sText);
	
	if(c)
	{
		if(sLink != '')
		{
			location.href=sLink;
		}

		return true;
	}
	else
	{
		return false;
	}
}




function SubmitForm(sText, sCampo, sValore)
{
	var c = confirm(sText);
	
	if(c)
	{
		oCampo = document.getElementById(sCampo);
		oCampo.value = sValore; 
		document.Form.submit();
		
		return true;
	}
	else
	{
		return false;
	}
}




function ConfirmEnterSite()
{
	oStep1 = document.getElementById('iNota1');
	oStep2 = document.getElementById('iNota2');
	oStep3 = document.getElementById('iNota3');

	if(oStep1.checked == true && oStep2.checked == true && oStep3.checked == true)
	{
		return true;
	}
	else
	{
		alert("Attenzione!\n\nSelezionare tutte le caselle 'SONO MAGGIORENNE E PROSEGUO'");
		return false;
	}
}




function OpenCloseDiv()
{
	oStep1 = document.getElementById('iNota1');
	oStep2 = document.getElementById('iNota2');
	oStep3 = document.getElementById('iNota3');
	
	oDiv1 = document.getElementById('oDiv1');
	oDiv2 = document.getElementById('oDiv2');
	oDiv3 = document.getElementById('oDiv3');

	if(oStep1.checked == true)
	{
		oDiv1.visi
	}
	else
	{
		alert("Attenzione!\n\nSelezionare tutte le caselle 'SONO MAGGIORENNE E PROSEGUO'");
		return false;
	}
}




