function invio_suoneria() {
	var browser_str = window.navigator.userAgent.toUpperCase();
	var browser = (browser_str.indexOf("MSIE")!=-1)
	
	if (browser==true) {
		document.invio.submit ();
	}
	else {
		document.forms[0].submit()
	}	

}



function Invia() {
	document.getElementById('next').value = "Invia";
	conf=Convalida();
	if (conf==true) {
		var browser_str = window.navigator.userAgent.toUpperCase();
		var browser = (browser_str.indexOf("MSIE")!=-1)
		
		if (browser==true) {
			document.abbonamento.submit ();
		}
		else {
			document.forms[0].submit()
		}			
	} 
} 

function Convalida() {
	if (document.abbonamento.tel.value == "" ) {
		alert ("Inserire un numero di Telefono!");
		document.abbonamento.tel.focus()
		return false ;
	}
	if (document.abbonamento.tel.value.length < 5) {
		alert ("Inserire un numero di Telefono valido!");
		document.abbonamento.tel.focus()
		return false ;
	}		
	if (document.abbonamento.operatore.value=="") {
		alert ("Seleziona il tuo Operatore!");
		document.abbonamento.tel.focus()
		return false ;
	}
	if (document.abbonamento.terms.checked != true) {

		var cella = document.getElementById('infocondizioni');
		alert ("Clicca nella casellina per accettare termini e condizioni del servizio!");
		cella.style.backgroundColor = "D2E3F9"; 
		document.abbonamento.terms.focus()
		return false ;
	}
	
	return true;
}	

function AccettaNumeri(e) {
	if (!e) var e = window.event;
	if (e.keyCode) pressedKey = e.keyCode;
	else if (e.which) pressedKey = e.which;
	var msg = "";
	var reg = "^[0-9]+$";
	var foo = document.getElementById('tel').value;
	if( !foo.match(reg) && foo != "" ){
		//alert('non puoi inserire lettere in questo campo');
		var re = new RegExp("[^0-9]+", "g");
		document.getElementById('tel').value = document.getElementById('tel').value.replace(re, "");
		return false;
	}
	return true;
}
