function highlight(row,new_color)
{if(typeof(row.style)=='undefined'||typeof(row.cells)=='undefined')
{return false;}
var num_rows=row.cells.length;for(var c=0;c<num_rows;c++)
{row.cells[c].bgColor=new_color;}
return true;}
function mostraora(){var x=new Date();h=x.getHours();m=x.getMinutes();s=x.getSeconds();if(s<=9)s="0"+s;if(m<=9)m="0"+m;if(h<=9)h="0"+h;time=h+":"+m+":"+s;document.orologio.tempo.value=time;setTimeout("mostraora()",1000);}
function controllaOrdine(nomeForm){if(!verificaTesto(nomeForm.nome,'Nome',1))
return false;if(!verificaTesto(nomeForm.cognome,'Cognome',1))
return false;if(!verificaTesto(nomeForm.via,'Via',1))
return false;if(!verificaNumero(nomeForm.cap,'C.a.p.',5))
return false;if(nomeForm.cap.value.length<5){alert('Il cap č Errato');return false;}
if(!verificaTesto(nomeForm.citta,'Cittā',1))
return false;if(!verificaTesto(nomeForm.prov,'Provincia',2))
return false;if(!verificaTelefono(nomeForm.tel,'numero Telefono','notNull'))
return false;if(!verificaMail(nomeForm.mail))
return false;return true;}
function verificaTesto(campo,etichetta,len){var temp=0;if(campo.value.length==0||campo.value.length<len){alert("Inserire  "+etichetta);campo.focus();return false;}
else{temp=parseInt(campo.value);if(!isNaN(temp)){alert("Formato "+etichetta+" Errato");campo.focus();campo.select();return false;}}
return true;}
function verificaNumero(campo,etichetta,len){var temp=0;if(campo.value.length==0||campo.value.length<len){alert("Inserire  "+etichetta);campo.focus();return false;}
else{if(!checkNumber(campo.value)){alert("Formato "+etichetta+" Errato");campo.focus();campo.select();return false;}}
return true;}
function verificaTelefono(campo,etichetta,obb){var temp=0;if(campo.value.length==0&&obb=="notNull"){alert("Inserire numero di "+etichetta);campo.focus();return false;}
if(campo.value.length>0){var temp=campo.value.split('/');if(temp.length>2){alert("Formato "+etichetta+" errato! (0824/88888)");campo.focus();campo.select();return false;}
else{var errore=false;for(var i=0;i<temp.length;i++){if(temp[i].length==0||isNaN(parseInt(temp[i]))||campo.value.indexOf("\\",0)>-1){errore=true;break;}}
if(errore){alert("Formato "+etichetta+" errato! (0824/88888)");campo.focus();campo.select();return false;}}}
return true;}
function verificaMail(campo){var mail=campo.value;var nocar="\\:;/";var len=nocar.length;if(mail.length==0){alert("Inserire Indirizzo E-mail");campo.focus();return false;}
for(var i=0;i<len;i++){var carattere=nocar.charAt(i);if(mail.indexOf(carattere,0)>-1){alert("Indirizzo E-mail Errato: "+carattere);campo.focus();campo.select();return false;}}
var chiocciola=mail.split('@');if(chiocciola.length!=2){alert("Indirizzo E-mail Errato :@");campo.focus();campo.select();return false;}
else{var punto=chiocciola[1].split('.');if(punto.length<2){alert("Indirizzo e-mail Errato :.");campo.focus();campo.select();return false;}}
return true;}
function checkNumber(number)
{var caratteriValidi="0123456789";if(number=="")return false;for(var i=0;i<number.length;i++){numberFound=false;for(var j=0;j<caratteriValidi.length;j++)
{charCompare=caratteriValidi.charAt(j);if(number.charAt(i)==charCompare)
{numberFound=true;break;}}
if(!(numberFound))return false;}
return true;}
