// JavaScript Document

function salvaModificheUtente(){

		var re = /^[A-Za-z0-9]{6,10}/
		var str = document.modificaUtente.username.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo Nome Utente. Deve contenere almeno di 6 caratteri alfanumerici.");
		return;
		
		}

		var re = /^[A-Za-z0-9]{6,10}/
		var str = document.modificaUtente.pwd.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo Password. Deve contenere almeno di 6 caratteri alfanumerici.");
		return;
		
		}

		var re = /^[A-Za-z0-9]/
		var str = document.modificaUtente.mail.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo E-mail.");
		return;
		
		}

		var re = /^[A-Za-z0-9]/
		var str = document.modificaUtente.piva_codicefiscale.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo P.Iva in Dati Fatturazione.");
		return;
		
		}

		var re = /^[A-Za-z0-9]/
		var str = document.modificaUtente.nome.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo Nome in Dati Fatturazione.");
		return;
		
		}

		var re = /^[A-Za-z0-9]/
		var str = document.modificaUtente.cognome.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo Cognome in Dati Fatturazione.");
		return;
		
		}

		var re = /^[A-Za-z0-9]/
		var str = document.modificaUtente.azienda.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo Azienda in Dati Fatturazione.");
		return;
		
		}

		var re = /^[A-Za-z0-9]/
		var str = document.modificaUtente.via.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo Via in Dati Fatturazione.");
		return;
		
		}

		var re = /^[A-Za-z0-9]/
		var str = document.modificaUtente.civico.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo Civico in Dati Fatturazione.");
		return;
		
		}

		var re = /^[A-Za-z0-9]/
		var str = document.modificaUtente.cap.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo Cap in Dati Fatturazione.");
		return;
		
		}


		var re = /^[A-Za-z0-9]/
		var str = document.modificaUtente.provincia.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo Provincia in Dati Fatturazione.");
		return;
		
		}

		var re = /^[A-Za-z0-9]/
		var str = document.modificaUtente.nazione.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo Nazione in Dati Fatturazione.");
		return;
		
		}

		var re = /^[A-Za-z0-9]/
		var str = document.modificaUtente.tel.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo Telefono in Dati Fatturazione.");
		return;
		
		}

document.modificaUtente.submit();
}





function paginaSucc(pagina, cat, lingua){
document.location.href = "cat.asp"+"?page="+pagina+"&idC="+cat+"&l="+lingua
}

function paginaSucc_paginazione_articoli(pagina, nomeCat, lingua){
document.location.href = "/"+lingua+"/cat/"+nomeCat+"/index_"+pagina+".htm"
}


//aggiumgi ai preferiti
function addbookmark(url, title){
	var bookmarkurl = url
	var bookmarktitle = title
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)
}

//per img gallery
function popUp(url,name,features){
html = '<HTML>\n<HEAD>\n<TITLE> GALLERIA </TITLE>\n</HEAD>\n<BODY LEFTMARGIN=0 MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=20>\n<CENTER><IMG SRC="'+url+'" BORDER=0 NAME=imageTest onLoad="window.resizeTo(document.imageTest.width,document.imageTest.height + 100)"></CENTER>\n</BODY>\n</HTML>';
	popupImage = window.open('','_blank','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0,statusbar=0');
	popupImage.document.open();
	popupImage.document.write(html);
	popupImage.document.close()
}


//per carrello

function addQty(fObj){
 var re = /^[1-n]/
 
 var str = fObj.qty.value
 var strDispo = fObj.magazzino.value
 
 //alert(str+'&'+strDispo);
 // return false;
 if(!re.test(str)){
  alert("Inserire quantità");
  return false;
 }
 
 if(parseInt(str) > parseInt(strDispo)){
  alert("La quantità indicata non è disponibile. Disponibilità massima di "+strDispo+" articoli.");
  return false;
 }

 return true;
}



function popUpStampaScheda(theURL,winName,features) { 
window.open(theURL,winName,features);
}


	function conferma_ordive_step1(){
	
		var re = /^[A-Za-z0-9]/
		var str = document.inviaOrdine.combo_nazioni.value
		if(!re.test(str)){
		alert("Compilare il campo Nazione nei dati di spedizione.");
		return;
		
		}

		var re = /^[A-Za-z0-9]/
		var str = document.inviaOrdine.pagamento_con.value
		if(!re.test(str)){
		alert("Scegliere una modalità di pagamento.");
		return;
		
		}
	
	document.inviaOrdine.submit();
	}
	
	function invia_richiesta_preventivo(){
	
		var re = /^[A-Za-z0-9]/
		var str = document.inviaOrdine.nome.value
		if(!re.test(str)){
		alert("Compilare il campo Nome.");
		return;
		
		}

		var re = /^[A-Za-z0-9]/
		var str = document.inviaOrdine.cognome.value
		if(!re.test(str)){
		alert("Compilare il campo Cognome.");
		return;
		
		}
		
		var re = /^[A-Za-z0-9]/
		var str = document.inviaOrdine.tel.value
		if(!re.test(str)){
		alert("Compilare il campo Telefono.");
		return;
		
		}
		
		var re = /^[A-Za-z0-9]/
		var str = document.inviaOrdine.tel.value
		if(!re.test(str)){
		alert("Compilare il campo E-mail.");
		return;
		
		}
	
	document.inviaOrdine.submit();
	}
	
	///per registrazione utenti
	
	function inviaFormRegistrazione(){
	
		var re = /^[A-Za-z0-9]{6,10}/
		var str = document.nuoviUtenti.pwd.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo Password. Deve contenere almeno di 6 caratteri alfanumerici.");
		return;
		
		}

		var re = /^[A-Za-z0-9]/
		var str = document.nuoviUtenti.username.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo Login.");
		return;
		
		}

		var re = /^[A-Za-z0-9]/
		var str = document.nuoviUtenti.mail.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo E-mail.");
		return;
		
		}

		var re = /^[A-Za-z0-9]/
		var str = document.nuoviUtenti.nome.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo Nome.");
		return;
		
		}
		
		var re = /^[A-Za-z0-9]/
		var str = document.nuoviUtenti.cognome.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo Cognome.");
		return;
		
		}
		
		//var re = /^[A-Za-z0-9]/
		//var str = document.nuoviUtenti.ditta.value
		//if(!re.test(str)){
		//alert("Compilare correttamente il campo Ditta.");
		//return;
		
		//}
		var re = /^[0-9]/
		var str = document.nuoviUtenti.tel.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo Telefono.");
		return;
		
		}

		var re =/^[A-Za-z0-9]/
		var str = document.nuoviUtenti.indirizzo.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo Via.");
		return;
		
		}

		var re =/^[A-Za-z0-9]/
		var str = document.nuoviUtenti.civico.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo Civico.");
		return;
		
		}

		var re =/^[A-Za-z0-9]/
		var str = document.nuoviUtenti.cap.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo Cap.");
		return;
		
		}

		
		var re = /^[A-Za-z0-9]/
		var str = document.nuoviUtenti.city.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo Città.");
		return;
		
		}

		var re = /^[A-Za-z0-9]/
		var str = document.nuoviUtenti.provincia.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo Provincia.");
		return;
		
		}
				
		//var re = /^[0-9]/
		//var str = document.nuoviUtenti.fax.value
		//if(!re.test(str)){
		//alert("Compilare correttamente il campo Fax.");
		//return;
		
		//}



		//var re =/^[A-Za-z0-9]/
		//var str = document.nuoviUtenti.indirizzo.value
		//if(!re.test(str)){
		//alert("Compilare correttamente il campo Indirizzo.");
		//return;
		
		//}
	
		
	if(document.nuoviUtenti.RadioGroup1[1].checked){
	alert("Per inviare il messaggio accettare il trattamento dei dati personali selezionando la voce Accetta.")
	return;
	}
	
	document.nuoviUtenti.submit();
	}

function inviaFormContatti() {
	
	var str = document.FormContatti.nome.value;
	var re = /^[A-Za-z0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo Nome");
		return;}
	
	var str = document.FormContatti.cog.value;
	var re = /^[A-Za-z0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo Cognome");
		return;}
		
	var str = document.FormContatti.tel.value;
	var re = /^[0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo Telefono");
		return;}

	var str = document.FormContatti.valmail.value;
	var re = /^[A-Za-z0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo E-mail");
		return;}
		
	var str = document.FormContatti.mess.value;
	var re = /^[A-Za-z0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo Messaggio");
		return;}
		
	if(document.FormContatti.RadioGroup1[1].checked){
	alert("Per inviare il messaggio accettare il trattamento dei dati personali selezionando la voce Accetta.")
	return;
	}
document.FormContatti.submit();
	}
	
	
function inviaFormAffiliazioni() {
	
	var str = document.FormAffiliazioni.nome.value;
	var re = /^[A-Za-z0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo Nome");
		return;}
	
	var str = document.FormAffiliazioni.cog.value;
	var re = /^[A-Za-z0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo Cognome");
		return;}
		
	var str = document.FormAffiliazioni.tel.value;
	var re = /^[0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo Telefono");
		return;}

	var str = document.FormAffiliazioni.valmail.value;
	var re = /^[A-Za-z0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo E-mail");
		return;}
		
	var str = document.FormAffiliazioni.mess.value;
	var re = /^[A-Za-z0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo Messaggio");
		return;}
		
	if(document.FormAffiliazioni.RadioGroup1[1].checked){
	alert("Per inviare il messaggio accettare il trattamento dei dati personali selezionando la voce Accetta.")
	return;
	}
document.FormAffiliazioni.submit();
	}
	

//-------------------FINR GOOGLE MAP--------------------------------------------------------
function paginaSucc_paginazione_ricerca(pagina){
document.formRicerca.pagina.value = pagina
document.formRicerca.submit()



}


function Newsletter(){
	
	var re = /^[A-Za-z0-9]/
	var str = document.newsletter.mail_newsletter.value
	if(!re.test(str)){
	alert("Compilare correttamente il campo indirizzo e-mail.");
	return;
		
	}
		
		
	if(document.newsletter.privacy[1].checked){
	alert("Per inviare il messaggio accettare il trattamento dei dati personali selezionando la voce Accetto.")
	return;
	}
	
	document.newsletter.submit();
	window.open("/popup/ok_newsletter.asp","mywindow","status=1,toolbar=1, width=400px, height=200px");
}


//--------------------------------------------------------
