function check_form_mail(form){
	var exist = 0;
	var checker = '';
	
	if(form.txtNome.value != ""){
		if(checkString(form.txtNome.value) == '1') { checker += "\t* Nome\n"; }
		exist += 1;
	}
	if(form.txtMessaggio.value != ""){
		exist += 1;
	}
	if(form.txtEmail.value != ""){
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.txtEmail.value)) {} else { checker += "\t* Email\n"; }
		exist += 1;
	}
	
	if(exist<3){
	 alert("Completare tutti i campi per proseguire");
	 return false;
	}
	if(checker != '') { 
		message = "Hai inserito dei valori non validi!\nControllare i seguenti campi:\n\n" + checker; 
		alert(message); 
		return false; }
  
	else return true;
}

function sweep(campo){
	campo.value="";
}

function doveSiamoBig(campo){
	window.open('http://www.tuttocitta.it/','','fullscreen,scrollbars');
}

function isInt(s){
	var i, c;
	for (i=0; i<s.length; i++) {
		c = s.charCodeAt(i);
		if ((c < 48) || (c > 57))
			return false;
	}
		return true;
}

function checkString(field)
{
    var checker = "";
    var checkOK = "abcdefghilmnopqrstuvzjywxABCDEFGHILMNOPQRSTUVZXWYJ.,!?:;-@()'1234567890/\ ";
    var checkStr = field;
    var allNum = "";
    for (i = 0;  i < checkStr.length;  i++)
    {
        ch = checkStr.charAt(i);
        for (j = 0;  j < checkOK.length;  j++) if (ch == checkOK.charAt(j)) break;
        if (j == checkOK.length)
        {
            checker = '1';
            break;
        }
        if (ch != ",")
        allNum += ch;
    }
    
    return checker;
}

function checkDate(giorno, mese, anno) {

	var c = 0;
	var bisestile ="anno non bisestile";
	var mesi = new Array(2, 11, 4, 6, 9, 1, 3, 5, 7, 8, 10, 12);
	var msg='';

	if(anno%4 == 0) {
		if(anno % 100 != 0) bisestile = "anno bisestile";
		else if(anno%400==0) bisestile = "anno bisestile";
	}

	for(i=0; i<mesi.length; i++){
		if(mesi[i] == mese){
			c = i;
			break;
		}
	}

	if(giorno > 31) return 0;
	else if(giorno > 30 && c < 5) return 0; 
	else if(c==0 && giorno > 29) return 0;
	else if(c==0 && giorno == 29 && bisestile != "anno bisestile") return 0;
	else return 1;
}

/*menu*/
var prev="null";



window.onload=function(){
	if(document.getElementsByTagName && document.getElementById){

    document.getElementById("menu").className="jsenable";

    BuildList();

  }

}

function BuildList(){
var hs=document.getElementById("menu").getElementsByTagName("h3");
for(var i=0;i<hs.length;i++){
    hs[i].onclick=function(){
				if(this!=null)
        if(this.parentNode.className!="show"){
            this.parentNode.className="show";
            if(prev && prev!=this.parentNode) prev.className="hide";
            prev=this.parentNode;
        }
        else this.parentNode.className="hide";
        }
    }
}
/*Fine Menu*/
  

