// 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----------------------------------------------------------------------------------------------------------------


//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.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();
	}

//Preventivi


function invia_Mail_Preventivo_Traslochi() {

	//var str = document.preventivo.nome.value;
	//var re = /[A-Za-z]/ ;

		//if (!re.test(str)) {
		//alert("Compilare correttamente il campo Nome");
		//return;}

	var str = document.preventivo.Telefono.value;
	var re = /[0-9]/ ;

		if (!re.test(str)) {
		alert("Compilare correttamente il campo Telefono");
		return;}

	var str = document.preventivo.Email.value;
	var re = /[A-Za-z0-9]/ ;

		if (!re.test(str)) {
		alert("Compilare correttamente il campo E-mail");	

		return;}

	if (document.preventivo.approva.checked == ""){
	alert("Per inviare il messaggio è necessatio approvare il trattamento dei dati personali");
    return; }

document.preventivo.submit();

}

function invia_Mail_Preventivo_Trasporti() {

	//var str = document.preventivo.nome.value;
	//var re = /[A-Za-z]/ ;

		//if (!re.test(str)) {
		//alert("Compilare correttamente il campo Nome");
		//return;}

	var str = document.preventivo.Telefono.value;
	var re = /[0-9]/ ;

		if (!re.test(str)) {
		alert("Compilare correttamente il campo Telefono");
		return;}

	var str = document.preventivo.Email.value;
	var re = /[A-Za-z0-9]/ ;

		if (!re.test(str)) {
		alert("Compilare correttamente il campo E-mail");
		return;}


	if (document.preventivo.approva.checked == ""){
	alert("Per inviare il messaggio è necessatio approvare il trattamento dei dati personali");
    return; }

document.preventivo.submit();

}

function inviaFormPreventivi() {
	
	var str = document.FormPreventivi.referente.value;
	var re = /^[A-Za-z0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo Referente");
		return;}
	
	var str = document.FormPreventivi.tel.value;
	var re = /^[A-Za-z0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo Telefono");
		return;}
		

	var str = document.FormPreventivi.mail.value;
	var re = /^[A-Za-z0-9]/;
	
		if (!re.test(str)) {
		alert("Compilare correttamente il campo E-mail");
		return;}
		
		
	if(document.FormPreventivi.RadioGroup1[1].checked){
	alert("Per inviare il messaggio accettare il trattamento dei dati personali selezionando la voce Accetta.")
	return;
	}

document.FormPreventivi.submit();
	}


//apri chiudi / Faq
function toggleLayer(whichLayer) {
  var elem, vis;
  if(document.getElementById) // this is the way the standards work
    elem = document.getElementById(whichLayer);
  else if(document.all) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if(document.layers) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}
