// 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.pwd.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.combo_nazioni.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 = /^[0-9]/
 var str = fObj.qty.value
 var strDispo = fObj.magazzino.value
 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);
}


	
	///per registrazione utenti
	
	function inviaFormRegistrazione(){
	
	
		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 = /^[A-Za-z0-9]/
		var str = document.nuoviUtenti.city.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo Città.");
		return;
		
		}
		
		var re = /^[0-9]/
		var str = document.nuoviUtenti.tel.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo Telefono.");
		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.mail.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo E-mail.");
		return;
		
		}


		var re =/^[A-Za-z0-9]/
		var str = document.nuoviUtenti.indirizzo.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo Indirizzo.");
		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]{6,10}/
		var str = document.nuoviUtenti.pwd.value
		if(!re.test(str)){
		alert("Compilare correttamente il campo Password.");
		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 inviaForm_Noleggio() {
	
	var str = document.FormNoleggio.nome.value;
	var re = /^[A-Za-z0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo Nome");
		return;}
	
	var str = document.FormNoleggio.cog.value;
	var re = /^[A-Za-z0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo Cognome");
		return;}
		
	var str = document.FormNoleggio.tel.value;
	var re = /^[0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo Telefono");
		return;}

	var str = document.FormNoleggio.valmail.value;
	var re = /^[A-Za-z0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo E-mail");
		return;}
		
	var str = document.FormNoleggio.mess.value;
	var re = /^[A-Za-z0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo Messaggio");
		return;}
		
	if(document.FormNoleggio.RadioGroup1[1].checked){
	alert("Per inviare il messaggio accettare il trattamento dei dati personali selezionando la voce Accetta.")
	return;
	}
document.FormNoleggio.submit();
	}


//Google map----------------------------------------------------------
   

    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.setCenter(new GLatLng(41.253, 13.4198), 6);

        // Create our "tiny" marker icon
        var icon = new GIcon();
        icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
        icon.iconSize = new GSize(12, 20);
        icon.iconAnchor = new GPoint(10, 8);
        icon.infoWindowAnchor = new GPoint(5, 1);
		

		//var point = new GLatLng(41.569353,12.8613);		
		var point = new GLatLng(41.562953,12.8613);		
		function createMarker_1(point) {
		var marker = new GMarker(point, icon);
		GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml("<h3>Cerqueti s.r.l.</h3><p>FAC Fabbrica Ascensori Cerqueti <br>SEDE OPERATIVA <br> via Grotte di Nottola - 04012 Cisterna di Latina(LT)<br>Tel. +39 06.96871048<br>Fax +39 06.96021559</p>");
		});
		return marker;
		}
		
        map.addOverlay(createMarker_1(point));
		
		var point = new GLatLng(41.877013,12.540786); 		
		
		function createMarker_2(point) {
		var marker = new GMarker(point, icon);
		GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml("<h3>Cerqueti s.r.l.</h3><p>FEC Forniture Elevatori Cerqueti <br> Via Bartolino da Novara, 42/44 Roma<br>Tel. +39 06.2415486<br>Tel. +39 06.2413664<br>Tel. +39 06.2413984<br>Fax +39 06.2415532</p>");
		});
		return marker;
		}
		
        map.addOverlay(createMarker_2(point));
		
      }
    }
	

//-------------------FINR GOOGLE MAP----------------------------------------------------------------------------------------------------------------