function formCheck(formobj){
	// Enter name of mandatory fields
	var fieldRequired = Array("nome", "cognome");
	// Enter field description to appear in the dialog box
	var fieldDescription = Array("nome", "cognome");
	// dialog message
	var alertMsg = "Compila i seguenti campi:\n";
	
	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":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
			}
			if (obj.type == undefined){
				var blnchecked = false;
				for (var j = 0; j < obj.length; j++){
					if (obj[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
	}

	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}



function validate_form2()
{

    if (document.form2.condizioni.checked == false)
    {
        alert('\nPer proseguire è necessario accettare le condizioni di registrazione.')
        document.form2.condizioni.select()
        document.form2.condizioni.focus()
        return false
    }

	if (document.uplform.f1.value =='')
    {
        alert('\nSeleziona un file da inviare.')
        document.uplform.f1.focus()
        return false
    }
/*
    if (document.jsform.email.value==document.jsform.email.defaultValue)
    {
        alert('\nNessun indirizzo email valido.')
        document.jsform.email.select()
        document.jsform.email.focus()
        return false
    }
        if (document.jsform.email.value.indexOf('@',0)==-1 ||
        document.jsform.email.value.indexOf('.',0)==-1)
        {
            alert('\nEmail non valida.')
            document.jsform.email.select()
            document.jsform.email.focus()
            return false
        }

    else
    {
            return true
    }  */

	return true
}


function validate_form2eng()
{

    if (document.form2.condizioni.checked == false)
    {
        alert('\nTo continue, you must agree to the terms of registration.')
        document.form2.condizioni.select()
        document.form2.condizioni.focus()
        return false
    }

	if (document.uplform.f1.value =='')
    {
        alert('\nSelect a file to send.')
        document.uplform.f1.focus()
        return false
    }
/*
    if (document.jsform.email.value==document.jsform.email.defaultValue)
    {
        alert('\nNessun indirizzo email valido.')
        document.jsform.email.select()
        document.jsform.email.focus()
        return false
    }
        if (document.jsform.email.value.indexOf('@',0)==-1 ||
        document.jsform.email.value.indexOf('.',0)==-1)
        {
            alert('\nEmail non valida.')
            document.jsform.email.select()
            document.jsform.email.focus()
            return false
        }

    else
    {
            return true
    }  */

	return true
}

function validate_form3()
{

	if (document.form3.luogo.value =='')
    {
        alert('\nLocation shooting fotografico è un campo obbligatorio.')
        document.form3.luogo.focus()
        return false
    }

  if (document.form3.compenso.value == '')
  {
    alert('\nCompenso in euro ad ora è un campo obbligatorio.')
    document.form3.compenso.focus();
    return (false);
  }

	return true
}


function checkBoxValidate(cb) {
    for (j = 0; j < 2; j++) {
      if (eval("document.form1.sesso[" + j + "].checked") == true) {
         document.form1.sesso[j].checked = false;
         if (j == cb) {
           document.form1.sesso[j].checked = true;
         }
      }
   }
}

var acconsento=false;
function SwitchState() {
	if(!acconsento)
	  {
	    acconsento=true;
	    form2.button_vai.disabled=false;
	    form2.button_vai2.disabled=false;
	  }
	else
	  {
	    acconsento=false;
	    form2.button_vai.disabled=true;
	    form2.button_vai2.disabled=true;
	 }

	//  alert("acconsento"+acconsento)
}


function validate_uplform()
{

	if (document.uplform.nomeFile.value =='')
    {
        alert('\nSelezionare un banner da inviare.')
        document.uplform.nomeFile.focus()
        return false
    }

	if (document.uplform.testoAlternativo.value =='')
    {
        alert('\nTesto alternativo è un campo abbligatorio\nCompare sul banner quando vi si passa sopra con il mouse.')
        document.uplform.testoAlternativo.focus()
        return false
    }

	if (document.uplform.link.value =='')
    {
        alert('\nSito da collegare è un campo abbligatorio.')
        document.uplform.link.focus()
        return false
    }

	if (document.uplform.email.value =='')
    {
        alert('\nEmail è un campo abbligatorio.')
        document.uplform.email.focus()
        return false
    }

	if (document.uplform.cliente.value =='')
    {
        alert('\nNome e cognome o azienda è un campo abbligatorio.')
        document.uplform.cliente.focus()
        return false
    }

/*
    if (document.jsform.email.value==document.jsform.email.defaultValue)
    {
        alert('\nNessun indirizzo email valido.')
        document.jsform.email.select()
        document.jsform.email.focus()
        return false
    }
        if (document.jsform.email.value.indexOf('@',0)==-1 ||
        document.jsform.email.value.indexOf('.',0)==-1)
        {
            alert('\nEmail non valida.')
            document.jsform.email.select()
            document.jsform.email.focus()
            return false
        }

    else
    {
            return true
    }  */

	return true
}

