//CALENDARIO
function show_calendar(str_target, str_datetime) {
	var arr_months = ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno",
		"Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"];
	var week_days = ["Do", "Lu", "Ma", "Me", "Gi", "Ve", "Sa"];
	var n_weekstart = 1; // day week starts from (normally 0 or 1)

	var dt_datetime = (str_datetime == null || str_datetime =="" ?  new Date() : str2dt(str_datetime));
	var dt_prev_month = new Date(dt_datetime);
	dt_prev_month.setMonth(dt_datetime.getMonth()-1);
	var dt_next_month = new Date(dt_datetime);
	dt_next_month.setMonth(dt_datetime.getMonth()+1);
	var dt_firstday = new Date(dt_datetime);
	dt_firstday.setDate(1);
	dt_firstday.setDate(1-(7+dt_firstday.getDay()-n_weekstart)%7);
	var dt_lastday = new Date(dt_next_month);
	dt_lastday.setDate(0);
	
	// html generation (feel free to tune it for your particular application)
	// print calendar header
	var str_buffer = new String (
		"<html>\n"+
		"<head>\n"+
		"	<title>Calendario</title>\n"+
		"<link rel=\"stylesheet\" type=\"text/css\" href=\"/csa8.css\">"+
		"</head>\n"+
		"<body bgcolor=\"White\">\n"+
		"<table cellspacing=\"0\" border=\"0\" width=\"100%\">\n"+
		"<tr><td bgcolor=\"#006600\">\n"+
		"<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"100%\">\n"+
		"<tr>\n	<td bgcolor=\"#006600\"><a href=\"javascript:window.opener.show_calendar('"+
		str_target+"', '"+ dt2dtstr(dt_prev_month)+"');\">"+
		"<img src=\"/immagini/prevCal.gif\" border=\"0\""+
		" alt=\"previous month\"></a></td>\n"+
		"	<td bgcolor=\"#006600\" colspan=\"5\" align=\"center\">"+
		"<font color=\"white\" size=\"2\"><b>"
		+arr_months[dt_datetime.getMonth()]+" "+dt_datetime.getFullYear()+"</b></font></td>\n"+
		"	<td bgcolor=\"#006600\" align=\"right\"><a href=\"javascript:window.opener.show_calendar('"
		+str_target+"', '"+dt2dtstr(dt_next_month)+"');\">"+
		"<img src=\"/immagini/nextCal.gif\" border=\"0\""+
		" alt=\"next month\"></a></td>\n</tr>\n"
	);

	var dt_current_day = new Date(dt_firstday);
	// print weekdays titles
	str_buffer += "<tr>\n";
	for (var n=0; n<7; n++)
		str_buffer += "	<td bgcolor=\"#99CC99\">"+
		"<font color=\"#ffffff\" face=\"tahoma, verdana\" size=\"2\"><b>"+
		week_days[(n_weekstart+n)%7]+"</b></font></td>\n";
	// print calendar table
	str_buffer += "</tr>\n";
	while (dt_current_day.getMonth() == dt_datetime.getMonth() ||
		dt_current_day.getMonth() == dt_firstday.getMonth()) {
		// print row heder
		str_buffer += "<tr>\n";
		for (var n_current_wday=0; n_current_wday<7; n_current_wday++) {
				if (dt_current_day.getDate() == dt_datetime.getDate() &&
					dt_current_day.getMonth() == dt_datetime.getMonth())
					// print current date
					str_buffer += "	<td bgcolor=\"#ffcccc\" align=\"right\">";
				else if (dt_current_day.getDay() == 0 || dt_current_day.getDay() == 6)
					// weekend days
					str_buffer += "	<td bgcolor=\"#eeeeee\" align=\"right\">";
				else
					// print working days of current month
					str_buffer += "	<td bgcolor=\"white\" align=\"right\">";

				if (dt_current_day.getMonth() == dt_datetime.getMonth())
					// print days of current month
					str_buffer += "<a href=\"javascript:window.opener."+str_target+
					".value='"+dt2dtstr(dt_current_day)+"'; window.close();\">"+
					"<font color=\"black\" face=\"tahoma, verdana\" size=\"2\">";
				else 
					// print days of other months
					str_buffer += "<a href=\"javascript:window.opener."+str_target+
					".value='"+dt2dtstr(dt_current_day)+"'; window.close();\">"+
					"<font color=\"aaaaaa\" face=\"tahoma, verdana\" size=\"2\">";
				str_buffer += dt_current_day.getDate()+"</font></a></td>\n";
				dt_current_day.setDate(dt_current_day.getDate()+1);
		}
		//+document.cal.time.value
		// print row footer
		str_buffer += "</tr>\n";
	}
	// print calendar footer
	str_buffer +=
		"<form name=\"cal\">\n</form>\n" +
		"</table>\n" +
		"</tr>\n</td>\n</table>\n" +
		"</body>\n" +
		"</html>\n";

	//tr time
	/*<tr><td colspan=\"7\" bgcolor=\"#87CEFA\">"+
		"<font color=\"White\" face=\"tahoma, verdana\" size=\"2\">"+
		"Time: <input disabled type=\"text\" name=\"time\" value=\""+dt2tmstr(dt_datetime)+
		"\" size=\"8\" maxlength=\"8\"></font></td></tr>\n*/

	var vWinCal = window.open("", "Calendar", 
		"width=350,height=230,status=no,resizable=no,top=200,left=200");
	vWinCal.opener = self;
	var calc_doc = vWinCal.document;
	calc_doc.write (str_buffer);
	calc_doc.close();
}
// datetime parsing and formatting routimes. modify them if you wish other datetime format
function str2dt (str_datetime) {
	//var re_date = /^(\d+)\/(\d+)\/(\d+)\s+(\d+)\:(\d+)\:(\d+)$/;
	var re_date = /^(\d+)\/(\d+)\/(\d+)$/;
	if (!re_date.exec(str_datetime))
		return alert("Formato della data non valido: "+ str_datetime);
	return (new Date (RegExp.$3, RegExp.$2-1, RegExp.$1, RegExp.$4, RegExp.$5, RegExp.$6));
}
function dt2dtstr (dt_datetime) {
	return (new String (
			dt_datetime.getDate()+"/"+(dt_datetime.getMonth()+1)+"/"+dt_datetime.getFullYear()));
}
function dt2tmstr (dt_datetime) {
	return (new String (
			dt_datetime.getHours()+":"+dt_datetime.getMinutes()+":"+dt_datetime.getSeconds()));
}
//FINE CALENDARIO

function controlliLoginPren(){
	if(document.fPren.codiceFN.value==""){
		alert("Attenzione, campo non compilato");
		document.fPren.codiceFN.focus();
		return false;
	}else if(document.fPren.cognomeFN.value==""){
		alert("Attenzione, campo non compilato");
		document.fPren.cognomeFN.focus();
		return false;
	}
}

function controlliLoginFunz(){
	if(document.fFunz.codiceAM.value==""){
		alert("Attenzione, campo non compilato");
		document.fFunz.codiceAM.focus();
		return false;
	}else if(document.fFunz.cognomeAM.value==""){
		alert("Attenzione, campo non compilato");
		document.fFunz.cognomeAM.focus();
		return false;
	}else if(document.fFunz.passwordAM.value==""){
		alert("Attenzione, campo non compilato");
		document.fFunz.passwordAM.focus();
		return false;
	}
}

function controlliDatiFunz(){
	if(document.fDatiFunz.codiceFunz.value==""){
		alert("Attenzione, campo non compilato");
		document.fDatiFunz.codiceFunz.focus();
		return false;
	}else if(document.fDatiFunz.cognomeFunz.value==""){
		alert("Attenzione, campo non compilato");
		document.fDatiFunz.cognomeFunz.focus();
		return false;
	}else if(document.fDatiFunz.nomeFunz.value==""){
		alert("Attenzione, campo non compilato");
		document.fDatiFunz.nomeFunz.focus();
		return false;
	}else if(document.getElementById("emFunz1").value==""){
		alert("Attenzione, campo non compilato");
		document.getElementById("emFunz1").focus();
		return false;
	}else if(document.fDatiFunz.cittaFunz.value==""){
		alert("Attenzione, campo non valido");
		document.fDatiFunz.cittaFunz.focus();
		return false;
	}else if(document.fDatiFunz.CAPFunz.value==""){
		alert("Attenzione, campo non valido");
		document.fDatiFunz.CAPFunz.focus();
		return false;
	}else if(document.fDatiFunz.PatenteFunz.value==""){
		alert("Attenzione, campo non valido");
		document.fDatiFunz.PatenteFunz.focus();
		return false;
	}
}

function ControlliAppuntamento(){
	if(document.F_Appuntemento.T_nome.value==""){
		alert("Attenzione, campo non compilato");
		document.F_Appuntemento.T_nome.focus();
		return false;
	}else if(document.F_Appuntemento.T_cognome.value==""){
		alert("Attenzione, campo non compilato");
		document.F_Appuntemento.T_cognome.focus();
		return false;
	}else if(document.F_Appuntemento.T_indirizzo.value==""){
		alert("Attenzione, campo non compilato");
		document.F_Appuntemento.T_indirizzo.focus();
		return false;
	}else if(document.F_Appuntemento.T_citta.value==""){
		alert("Attenzione, campo non compilato");
		document.F_Appuntemento.T_citta.focus();
		return false;
	}else if(document.F_Appuntemento.T_nap.value==""){
		alert("Attenzione, campo non compilato");
		document.F_Appuntemento.T_nap.focus();
		return false;
	}else if(document.F_Appuntemento.T_paese.value==""){
		alert("Attenzione, campo non compilato");
		document.F_Appuntemento.T_paese.focus();
		return false;
	}else if(document.F_Appuntemento.T_telefono.value==""){
		alert("Attenzione, campo non compilato");
		document.F_Appuntemento.T_telefono.focus();
		return false;
	}else if(document.F_Appuntemento.T_email.value==""){
		alert("Attenzione, campo non compilato");
		document.F_Appuntemento.T_email.focus();
		return false;
	}
}

function controlliDatiPren(){
	//porto la data partenza in formato italiano
	strPartenza=document.fDatiPren.dtPartPren.value
	arrPartenza=strPartenza.split("/")
	Data_Partenza=arrPartenza[1]+"/"+arrPartenza[0]+"/"+arrPartenza[2]
	Data_Partenza = new Date(Data_Partenza+" "+document.fDatiPren.oraPartPren.value+":"+document.fDatiPren.minPartPren.value);
	//porto la data arrivo in formato italiano
	strArrivo=document.fDatiPren.dtArrPren.value
	arrArrivo=strArrivo.split("/")
	Data_Arrivo=arrArrivo[1]+"/"+arrArrivo[0]+"/"+arrArrivo[2]
	Data_Arrivo = new Date(Data_Arrivo+" "+document.fDatiPren.oraArrPren.value+":"+document.fDatiPren.minArrPren.value);
	
	Data_Attuale = new Date();
	
	if(document.fDatiPren.sLgPartPren.value=="Domicilio"){
		if(document.fDatiPren.domPartPren.value==""){
			alert("Specifica il luogo di partenza!");
			document.fDatiPren.domPartPren.focus();
			return false;
		}
	}
	if(document.fDatiPren.sLgArrPren.value=="Domicilio"){
		if(document.fDatiPren.domArrPren.value==""){
			alert("Specifica il luogo di arrivo!");
			document.fDatiPren.domArrPren.focus();
			return false;
		}
	}
	
	if ((Data_Partenza<=Data_Attuale) || (isNaN(Data_Partenza))){
		alert("Dati partenza/arrivo errati!");
		return false;
	}else	if ((Data_Arrivo<Data_Partenza) || (isNaN(Data_Arrivo))){
		alert("Dati partenza/arrivo errati!");
		return false;
	}
	if(document.fDatiPren.reperibilitaPren.value==""){
		alert("Specifica il numero di reperibilità!");
		return false;
	}
	if(document.fDatiPren.Pagamento.value==''){
		alert("Attenzione, selezionare una modalità di pagamento");
		return false;
	}
	if(document.fDatiPren.Pagamento.value!="Fattura"){
		if(document.fDatiPren.Sel4.checked == false){
			alert("Attenzione, non è stato dato il consenso di utilizzo della carta di credito");
			return false;
		}
	}
	if(document.fDatiPren.Pagamento.value!="Fattura"){
		if(document.fDatiPren.Cartacredito.value==''){
			alert("Attenzione, non è stato inserito il numero della carta di credito");
			return false;
		}
	}
}

//controllo validità ora
function oraValida(ora,tipo){
	var re_ora = /^(\d+)$/;
	if (!re_ora.exec(ora) || (ora=="")){
		alert("Formato dell'ora non valido.");
		return('hh');
	}else{
		if((ora>=24) || (ora==0)){
			ora="00"
		}
		return(ora);
	}
}

function minValidi(minuti){
	var re_min = /^(\d+)$/;
	if (!re_min.exec(minuti) || (minuti=="")){
		alert("Formato minuti non validi.");
		return('mm');
	}else{
		primaCifra=minuti.slice(0,1);
		secondaCifra=minuti.slice(1,2);
		if (secondaCifra<5){
			minuti=primaCifra+"0"
			primaCifra=Number(primaCifra)
			if(primaCifra>=5){
				minuti="00"
			}
		}else{
			primaCifra=Number(primaCifra)
			if(primaCifra>=5){
				minuti="00"
			}else{
				minuti=(primaCifra+1)+"0"
			}
		}
		return(minuti);
	}
}

function ControllaMail(EmailAddr){
	Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;

	if (Filtro.test(EmailAddr)){
		return EmailAddr;
	}else{
		alert('Attenzione! E-mail non valida');
		return '';
	}
}

function visRowsPren(elValue){
	if(elValue!=""){
		if(Number(elValue)==1){
			document.getElementById("strCodeFN").innerHTML="PID"
		}else{
			document.getElementById("strCodeFN").innerHTML="CODE"
		}
		document.getElementById("rigaPren1").className="";
		document.getElementById("rigaPren2").className="";
		document.getElementById("rigaPren3").className="";
		document.getElementById("idCl").value=elValue;
	}else{
		document.getElementById("rigaPren1").className="invisibile";
		document.getElementById("rigaPren2").className="invisibile";
		document.getElementById("rigaPren3").className="invisibile";
	}
}

function visRowsPren2(elValue){
	if(elValue=="Visa"){
		document.getElementById("Cartacredito").className="";
		document.getElementById("GGPagamento").className="";
		document.getElementById("MMPagamento").className="";
		document.getElementById("Sel4").className="";
		document.getElementById("Sel10").className="";
		document.getElementById("Sel11").className="";
		document.getElementById("Sel12").className="";
		document.getElementById("Sel13").className="";
	}else if(elValue=="MasterCard"){
		document.getElementById("Cartacredito").className="";
		document.getElementById("GGPagamento").className="";
		document.getElementById("MMPagamento").className="";
		document.getElementById("Sel4").className="";
		document.getElementById("Sel10").className="";
		document.getElementById("Sel11").className="";
		document.getElementById("Sel12").className="";
		document.getElementById("Sel13").className="";
	}else if(elValue=="American Express"){
		document.getElementById("Cartacredito").className="";
		document.getElementById("GGPagamento").className="";
		document.getElementById("MMPagamento").className="";
		document.getElementById("Sel4").className="";
		document.getElementById("Sel10").className="";
		document.getElementById("Sel11").className="";
		document.getElementById("Sel12").className="";
		document.getElementById("Sel13").className="";
	}else if(elValue=="Dainers"){
		document.getElementById("Cartacredito").className="";
		document.getElementById("GGPagamento").className="";
		document.getElementById("MMPagamento").className="";
		document.getElementById("Sel4").className="";
		document.getElementById("Sel10").className="";
		document.getElementById("Sel11").className="";
		document.getElementById("Sel12").className="";
		document.getElementById("Sel13").className="";
	}else{
		document.getElementById("Cartacredito").className="invisibile";
		document.getElementById("GGPagamento").className="invisibile";
		document.getElementById("MMPagamento").className="invisibile";
		document.getElementById("Sel4").className="invisibile";
		document.getElementById("Sel10").className="invisibile";
		document.getElementById("Sel11").className="invisibile";
		document.getElementById("Sel12").className="invisibile";
		document.getElementById("Sel13").className="invisibile";
	}
}





function visRowsNoleggio(elValue){
	if(elValue==1){
		document.getElementById("Dettagli1").className="";
		document.getElementById("Dettagli2").className="invisibile";
		document.getElementById("Dettagli3").className="invisibile";
		document.getElementById("T_noleggio2").className="invisibile";
	}else if(elValue==2){
		document.getElementById("Dettagli1").className="invisibile";
		document.getElementById("Dettagli2").className="";
		document.getElementById("Dettagli3").className="invisibile";
		document.getElementById("T_noleggio2").className="invisibile";
	}else if(elValue==8){
		document.getElementById("Dettagli1").className="invisibile";
		document.getElementById("Dettagli2").className="invisibile";
		document.getElementById("Dettagli3").className="invisibile";
		document.getElementById("T_noleggio2").className="";
	}else if(elValue==3){
		document.getElementById("Dettagli1").className="invisibile";
		document.getElementById("Dettagli2").className="invisibile";
		document.getElementById("Dettagli3").className="";
		document.getElementById("T_noleggio2").className="invisibile";
	}	
}

function visRowsFormPrenPart(elValue){
	if(elValue=="Domicilio"){
		document.getElementById("Part").className="";
	}else if(elValue!="Domicilio"){
		document.getElementById("Part").className="invisibile";
	}	
}

function visRowsFormPrenArr(elValue){
	if(elValue=="Domicilio"){
		document.getElementById("Arr").className="";
	}else if(elValue!="Domicilio"){
		document.getElementById("Arr").className="invisibile";
	}	
}

function visRowsRiconsegna(elValue){

		if(elValue==1){
		document.getElementById("RDettagli1").className="";
		document.getElementById("RDettagli2").className="invisibile";
		document.getElementById("RDettagli3").className="invisibile";
		document.getElementById("T_riconsegna2").className="invisibile";
	}else if(elValue==2){
		document.getElementById("RDettagli1").className="invisibile";
		document.getElementById("RDettagli2").className="";
		document.getElementById("RDettagli3").className="invisibile";
		document.getElementById("T_riconsegna2").className="invisibile";
	}else if(elValue==8){
		document.getElementById("RDettagli1").className="invisibile";
		document.getElementById("RDettagli2").className="invisibile";
		document.getElementById("RDettagli3").className="invisibile";
		document.getElementById("T_riconsegna2").className="";
	}else if(elValue==3){
		document.getElementById("RDettagli1").className="invisibile";
		document.getElementById("RDettagli2").className="invisibile";
		document.getElementById("RDettagli3").className="";
		document.getElementById("T_riconsegna2").className="invisibile";
	}	
}

function Popup(apri) {
	var w = 600;
	var h = 403;
	var l = Math.floor((screen.width-w)/2);
	var t = Math.floor((screen.height-h)/2);
	var stile = "top="+t+", left="+l+", width="+w+", height="+h+", status=no, menubar=no, toolbar=no, scrollbars=yes";
	window.open(apri, "", stile);
}

function PopupCondiz(apri) {
	var w = 480;
	var h = 403;
	var l = Math.floor((screen.width-w)/2);
	var t = Math.floor((screen.height-h)/2);
	var stile = "top="+t+", left="+l+", width="+w+", height="+h+", status=no, menubar=no, toolbar=no, scrollbars=yes";
	window.open(apri, "", stile);
}
function PopupInfo(apri) {
	var w = 280;
	var h = 203;
	var l = Math.floor((screen.width-w)/2);
	var t = Math.floor((screen.height-h)/2);
	var stile = "top="+t+", left="+l+", width="+w+", height="+h+", status=no, menubar=no, toolbar=no, scrollbars=yes";
	window.open(apri, "", stile);
}
function PopupInfoOcc(apri) {
	var w = 480;
	var h = 403;
	var l = Math.floor((screen.width-w)/2);
	var t = Math.floor((screen.height-h)/2);
	var stile = "top="+t+", left="+l+", width="+w+", height="+h+", status=no, menubar=no, toolbar=no, scrollbars=yes";
	window.open(apri, "", stile);
}

function visRowsFunz(elValue){
	if(elValue!=""){
		if(Number(elValue)==1){
			document.getElementById("strCodeAM").innerHTML="PID"
		}else{
			document.getElementById("strCodeAM").innerHTML="CODE"
		}
		document.getElementById("rigaFunz1").className="";
		document.getElementById("rigaFunz2").className="";
		document.getElementById("rigaFunz3").className="";
		document.getElementById("rigaFunz4").className="";
		document.getElementById("idClAM").value=elValue;
	}else{
		document.getElementById("rigaFunz1").className="invisibile";
		document.getElementById("rigaFunz2").className="invisibile";
		document.getElementById("rigaFunz3").className="invisibile";
		document.getElementById("rigaFunz4").className="invisibile";
	}
}

function ControlliPrenotazione() {
	if (F_Prenotazione.S_noleggio.value=='0'){
		alert('Attenzione! selezionare una stazione di noleggio');
		return false;
	}else if (F_Prenotazione.S_noleggio.value=='8'){
		if (F_Prenotazione.T_noleggio2.value=='Indirizzo - Domicilio'){
			alert('Attenzione! Indicare il domicilio per il noleggio');
			return false;
		}
	}else if (F_Prenotazione.S_riconsegna.value=='0'){
		alert('Attenzione! selezionare una stazione di riconsegna');
		return false;
	}else if (F_Prenotazione.S_riconsegna.value=='8'){
		if (F_Prenotazione.T_riconsegna2.value=='Indirizzo - Domicilio'){
			alert('Attenzione! Indicare il domicilio per la riconsegna');
			return false;
		}			
	}else if (F_Prenotazione.S_anno_noleggio.value>=F_Prenotazione.S_anno_riconsegna.value){
		if (F_Prenotazione.S_mese_noleggio.value>=F_Prenotazione.S_mese_riconsegna.value){
			if (F_Prenotazione.S_giorno_noleggio.value>=F_Prenotazione.S_giorno_riconsegna.value){
				if (F_Prenotazione.S_ora_noleggio.value>=F_Prenotazione.S_ora_riconsegna.value){
					if (F_Prenotazione.S_minuti_noleggio.value>=F_Prenotazione.S_minuti_riconsegna.value){
						alert('Attenzione! Data e Ora di ritiro e di riconsegna errate');
						return false;
					}
				}
			}
		}
	}
	
}

function ControlliSupplementi() {	
		if (F_Supplementi.T_Km.value==''){
			alert('Attenzione! indicare i Km previsti');
			return false;
		}else if (isNaN(document.F_Supplementi.T_Km.value)){ 
			alert('Attenzione! valore Km previsti non valido');
			return false;
		}	
	}

function ControlliPreventivo() {
	Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
	
	 if(document.F_Preventivo.T_nome.value==''){
		alert('Attenzione! Inserisca il suo nome');
		return false;
	}else if (F_Preventivo.T_cognome.value==''){
		alert('Attenzione! Inserisca il suo cognome');
		return false;
	}else if (F_Preventivo.T_indirizzo.value==''){
		alert('Attenzione! Inserisca il suo indirizzo');
		return false;
	}else if (F_Preventivo.T_citta.value==''){
		alert('Attenzione! Inserisca la sua città');
		return false;
	}else if (F_Preventivo.T_nap.value==''){
		alert('Attenzione! Inserisca il suo N.A.P.');
		return false;
	}else if (F_Preventivo.T_paese.value==''){
		alert('Attenzione! Inserisca il suo paese');
		return false;
	}else if (F_Preventivo.T_telefono.value==''){
		alert('Attenzione! Inserisca il suo telefono');
		return false;
	}else if (isNaN(F_Preventivo.T_telefono.value)){ 
		alert('Attenzione! Il numero di telefono inserito non è corretto');
		return false;
	}else if (F_Preventivo.T_email.value==''){
		alert('Attenzione! Inserisca la sua mail');
		return false;
	}else if (F_Preventivo.T_pagamento.value=='Seleziona'){
		alert('Attenzione! Inserisca la modalità di pagamento');
		return false;
	}else if (F_Preventivo.Ch_termini.checked == false){
		alert('Attenzione! è necessario accettare i termini e le condizioni di pagamento');
		return false;
	}else if (F_Preventivo.T_email.value!=''){
		if (Filtro.test(F_Preventivo.T_email.value)){
			return F_Preventivo.T_email.value;
		}else{
			alert('Attenzione! E-mail non valida');
			return false;
		}
		}
}

function ControlliDatiLav() {
	var oggi = new Date();
	var giorno = oggi.getDate();
	var mese = oggi.getMonth() + 1;
	var anno = oggi.getYear();
	var ora = oggi.getHours();
	var minuti = oggi.getMinutes();

	if (F_Dati.S_anno_lavaggio.value<anno){
		alert('Attenzione! Data di richiesta errata');
		document.F_Dati.S_anno_lavaggio.focus();
		return false;
	}else if ((F_Dati.S_anno_lavaggio.value==anno)&&(F_Dati.S_mese_lavaggio.value<mese)){
		alert('Attenzione! Data di richiesta errata');
		document.F_Dati.S_mese_lavaggio.focus();
		return false;
	}else if ((F_Dati.S_anno_lavaggio.value==anno)&&(F_Dati.S_mese_lavaggio.value==mese)&&(F_Dati.S_giorno_lavaggio.value<giorno)){
		alert('Attenzione! Data di richiesta errata');
		document.F_Dati.S_giorno_lavaggio.focus();
		return false;
	}else if ((F_Dati.S_anno_lavaggio.value==anno)&&(F_Dati.S_mese_lavaggio.value==mese)&&(F_Dati.S_giorno_lavaggio.value==giorno)&&(F_Dati.S_ora_lavaggio.value<ora)){
		alert('Attenzione! Orario di richiesta errata');
		document.F_Dati.S_giorno_lavaggio.focus();
		return false;
	}else if ((F_Dati.S_anno_lavaggio.value==anno)&&(F_Dati.S_mese_lavaggio.value==mese)&&(F_Dati.S_giorno_lavaggio.value==giorno)&&(F_Dati.S_ora_lavaggio.value==ora)&&(F_Dati.S_minuti_lavaggio.value<minuti)){
		alert('Attenzione! Orario di richiesta errata');
		document.F_Dati.S_giorno_lavaggio.focus();
		return false;	
	}else if (F_Dati.T_Ditta.value==''){
		alert('Attenzione! Inserire la ditta');
		document.F_Dati.T_Ditta.focus();
		return false;
	}else if (F_Dati.T_Possessore.value==''){
		alert('Attenzione! Inserire il possessore');
		document.F_Dati.T_Possessore.focus();
		return false;
	}else if (F_Dati.T_Ritiro.value==''){
		alert('Attenzione! Inserire indirizzo di ritiro del veicolo');
		document.F_Dati.T_Ritiro.focus();
		return false;
	}else if (F_Dati.T_Numero.value==''){
		alert('Attenzione! Inserire il numero di reperibilità');
		document.F_Dati.T_Numero.focus();
		return false;
	}else if (F_Dati.T_Marca.value==''){
		alert('Attenzione! Inserire la marca');
		document.F_Dati.T_Marca.focus();
		return false;
	}else if (F_Dati.T_Targa.value==''){
		alert('Attenzione! Inserire la targa');
		document.F_Dati.T_Targa.focus();
		return false;
	}else if (F_Dati.Ch_Privacy.checked==false){
		alert('Attenzione! Autorizzazione all utilizzo dei dati mancante');
		document.F_Dati.Ch_Privacy.focus();
		return false;
	} 
	
}

function controlliDatiAmministrazionePromozione() {

	if (F_DatiPromozione.Vettura.value==''){
		alert('Attenzione! inserisci la vettura');
		document.F_DatiPromozione.Vettura.focus();
		return false;
	}else if (F_DatiPromozione.Prezzo.value==''){
		alert('Attenzione! inserisci il prezzo');
		document.F_DatiPromozione.Prezzo.focus();
		return false;
	}
	
}

function rollover(Menu) {
	document.getElementById("Pren1").className="invisibile"
	document.getElementById("Pren2").className=""
}

function toglirollover(Menu) {
	document.getElementById("Pren1").className="invisibile"
	document.getElementById(Menu).className=""
}

function isnum(obj) {
if (isNaN(obj.value) || parseInt(obj.value)<0)
{
alert('Nel campo è possibile immettere solo numeri!');
obj.value="";
obj.focus();
}
}
function delText(obj) {
obj.value="";
obj.focus();
}


/* Pour faire une vérification sans autoriser le point ("."), suivez les instructions qui sont écrites en commentaire */

function verif_nombre(champ)
{
var chiffres = new RegExp("[a-zA-Z]"); /* Modifier pour : var chiffres = new RegExp("[0-9]"); */
var verif;
var points = 0; /* Supprimer cette ligne */

for(x = 0; x < champ.value.length; x++)
{
verif = chiffres.test(champ.value.charAt(x));
if(champ.value.charAt(x) == "."){points++;} /* Supprimer cette ligne */
if(points > 1){verif = false; points = 1;} /* Supprimer cette ligne */
if(verif == false){
alert('Nel campo è possibile immettere solo lettere!');
champ.value = champ.value.substr(0,x) + champ.value.substr(x+1,champ.value.length-x+1); 
x--;
}
}

}

function dataCalend(obj) {
	alert('Attenzione! Inserire data utilizzando il calendario');
	obj.value="";
}




function getkey(e)
{
if (window.event)
   return window.event.keyCode;
else if (e)
   return e.which;
else
   return null;
}

function caratteriok(e, goods)
{
var key, keychar;
key = getkey(e);
if (key == null) return true;

// get character
keychar = String.fromCharCode(key);
keychar = keychar.toLowerCase();
goods = goods.toLowerCase();

// check goodkeys
if (goods.indexOf(keychar) != -1)
	return true;

// control keys
if ( key==null || key==0 || key==8 || key==9 
    || key==13 || key==27 )
   return true;

// else return false
return false;
}



