function apri(url)
{
window.location.href=url;
}
function apri_pop(width,height,popindirizzo,nome) {
	var SHeight = screen.availHeight;
	var SWidth = screen.availWidth;
	var PHeight = height;
	var PWidth = width;
	var PPosH = ((SHeight - PHeight) / 2);
	var PPosW = ((SWidth - PWidth) / 2);
	var dimensioni = 'width='+PWidth+',height='+PHeight+',left='+PPosW+',top='+PPosH;
	var prova1 = window.open(popindirizzo,nome,dimensioni);
}

function soloNumeri(s)
{  
	Filtro = /[^0-9-]/;  s.value = s.value.replace(Filtro,"");
}

function soloSoldi(s)
{  
	Filtro = /[^0-9.-]/;  s.value = s.value.replace(Filtro,"");
}

function soloData(s)
{  
	Filtro = /[^0-9/-]/;  s.value = s.value.replace(Filtro,"");
}

function stampa()
{
window.print();  
}

function parref(pag)
{
window.opener.location.href = pag;
self.close();
}

function formCheck(formobj){
	var fieldDescription = fieldRequired
	var alertMsg = "I campi con asterisco sono obbligatori";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				var n = obj.selectedIndex;
				if (obj[n].text == "SCEGLIERE..."){
					document.getElementById(fieldDescription[i]).style.borderColor = '#FF7400';
					document.getElementById(fieldDescription[i]).focus();
					alert(alertMsg);
					return false;
				}
				else{
					document.getElementById(fieldDescription[i]).style.borderColor = '#EFEFEF';
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					document.getElementById(fieldDescription[i]).style.borderColor = '#FF7400';
					document.getElementById(fieldDescription[i]).focus();
					alert(alertMsg);
					return false;
				}
				else{
					document.getElementById(fieldDescription[i]).style.borderColor = '#EFEFEF';
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					document.getElementById(fieldDescription[i]).style.borderColor = '#FF7400';
					document.getElementById(fieldDescription[i]).focus();
					alert(alertMsg);
					return false;
				}
				else{
					document.getElementById(fieldDescription[i]).style.borderColor = '#EFEFEF';
				}
				break;
			default:
				if (obj.value == "" || obj.value == null){
					document.getElementById(fieldDescription[i]).style.borderColor = '#FF7400';
					document.getElementById(fieldDescription[i]).focus();
					alert(alertMsg);
					return false;
				}
				else{
					document.getElementById(fieldDescription[i]).style.borderColor = '#EFEFEF';
				}
			}
		}
	}
}

function abilitaImpresa()
{
var index = document.form1.RagSoc.selectedIndex;
var valore = document.form1.RagSoc.options[index].value;

if (valore == "")
{
document.form1.RagSoc2.style.visibility='visible';
}
else
{
document.form1.RagSoc2.style.visibility='hidden';
document.form1.RagSoc2.value='';
}
}

function datiModulo()
{
var index = document.form1.Modulo.selectedIndex;
var valore = document.form1.Modulo.options[index].value;

if (valore == "A")
{
document.form1.OreModulo.value='42';
document.form1.CostoModulo.value='420';
}
else if (valore == "B")
{
document.form1.OreModulo.value='24';
document.form1.CostoModulo.value='240';
}
else if (valore == "C")
{
document.form1.OreModulo.value='54';
document.form1.CostoModulo.value='540';
}
else
{
document.form1.OreModulo.value='';
document.form1.CostoModulo.value='';
}
}

function oreGiorno()
{
var index = document.form1.Ora1.selectedIndex;
var valore = document.form1.Ora1.options[index].value;

if (valore == "") {
document.form1.Min1.disabled=true;
document.form1.Ora2.disabled=true;
document.form1.Min2.disabled=true;
}
else if (valore != "") {
document.form1.Min1.disabled=false;
document.form1.Ora2.disabled=false;
document.form1.Min2.disabled=false;
}
}

function oreGiorno2()
{
var index2 = document.form1.Ora3.selectedIndex;
var valore2 = document.form1.Ora3.options[index2].value;

if (valore2 == "") {
document.form1.Min3.disabled=true;
document.form1.Ora4.disabled=true;
document.form1.Min4.disabled=true;
}
else if (valore2 != "") {
document.form1.Min3.disabled=false;
document.form1.Ora4.disabled=false;
document.form1.Min4.disabled=false;
}
}
