// JavaScript Document

//Google map------http://maps.google.it/maps?f=q&hl=it&geocode=&time=&date=&ttype=&q=hotel+traiano+roma&ie=UTF8&ll=41.898188,12.497635&spn=0.112951,0.2314&z=12&iwloc=B&om=1
	
	
	function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
      //  map.addControl(new GSmallMapControl());
		map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
       // map.addControl(new ContourIntervalControl());
        map.addControl(new GScaleControl());
        map.addControl(new GOverviewMapControl(new GSize(110, 110)));
        map.enableDoubleClickZoom();
        map.enableContinuousZoom();
        map.setCenter(new GLatLng(41.897422,12.483859), 12);
		
		
        // 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(5, 1);
        icon.infoWindowAnchor = new GPoint(5, 1);
		
		

        // Add 10 markers to the map at random locations
		var point = new GLatLng(41.897054,12.483859);		
		
		function createMarker_1(point) {
		var marker = new GMarker(point, icon);
		GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml("<h3>Hotel Traiano</h3>HOTEL 4 STELLE ROMA CENTRO<p>Via 4 Novembre, 154 00187 Rome (Lazio) - Tel:06 6783862 <br> </p>");
		});
		return marker;
		}
		
        map.addOverlay(createMarker_1(point));
		
		
		
      }
    }

//-------------------FINR GOOGLE MAP----------------------------------------------------------------------------------------------------------------

function inviaFormInfo() {
	
	var str = document.FormInfo.nome.value;
	var re = /^[A-Za-z0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo Nome");
		return;}
	
	var str = document.FormInfo.cognome.value;
	var re = /^[A-Za-z0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo Cognome");
		return;}

	var str = document.FormInfo.mail.value;
	var re = /^[A-Za-z0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo E-mail");
		return;}
		
	var str = document.FormInfo.telefono.value;
	var re = /^[0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo Telefono");
		return;}

	var str = document.FormInfo.citta.value;
	var re = /^[A-Za-z0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo Città");
		return;}
		

	var str = document.FormInfo.nazione.value;
	var re = /^[A-Za-z0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo Nazione");
		return;}
		
	if(document.FormInfo.RadioGroup1[1].checked){
	alert("Per inviare il messaggio accettare il trattamento dei dati personali selezionando la voce Accetta.")
	return;
	}

document.FormInfo.submit();
	}


//Contatti
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.cognome.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.mail.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();
	}
//Ricerca
function inviaRicerca() {
	
		

document.cerca.submit();
	}

function ResetRicerca() {
	
		document.cerca.destinazione.value = "";
		document.cerca.dateDal.value = "";
		document.cerca.dateAl.value = "";
		document.cerca.catID.value = "";

document.cerca.submit();
	}



//Contatti
function inviaFormRegistrazione() {
	
	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.cognome.value;
	var re = /^[A-Za-z0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo Cognome");
		return;}

	var str = document.FormContatti.azienda.value;
	var re = /^[A-Za-z0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo Azienda");
		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.mail.value;
	var re = /^[A-Za-z0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo E-mail");
		return;}
		
	var str = document.FormContatti.login.value;
	var re = /^[A-Za-z0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo Login");
		return;}

	var str = document.FormContatti.pwd.value;
	var re = /^[A-Za-z0-9]{6,10}/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo Password");
		return;}



		
	if(document.FormContatti.RadioGroup1[1].checked){
	alert("Per terminare la registrazione accettare il trattamento dei dati personali selezionando la voce Accetta.")
	return;
	}

document.FormContatti.submit();
	}


function inviaFormRicordaPassword() {
	
	var str = document.FormRicordaPwd.mailRicordaPwd.value;
	var re = /^[A-Za-z0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo E-mail");
		return;}
	

document.FormRicordaPwd.submit();
	}

//Ricerca
function inviaRicerca() {
	
		

document.cerca.submit();
	}



//Newsletter
function Newsletter(){

		var re = /^[A-Za-z0-9]/
		var str = document.newsletter.mail_newsletter.value
		if(!re.test(str)){
		alert("Compilare il campo E-mail.");
		return;
		
		}


		if(document.newsletter.privacy[1].checked){
		alert("Per inviare il messaggio leggere e accettare il trattamento dei dati personali selezionando la voce Accetta.")
		return;
		}

	document.newsletter.submit();
}

//mostra div alle coordinate del mouse
function ShowDivAtPoint(id){
     var x=event.x; //Cordinata X del Mouse
     var y=event.y; //Cordinata Y del Mouse
     var doc=window.opener.getElementById(id);
     doc.style.left=x;
     doc.style.top=y;
} 


//ShowDivAtPoint('divColor') 

