﻿var infowindow=new Array();    
var marker=new Array(); 
var map=null

function initialize() {
  
    var myLatlng = new google.maps.LatLng(46.38293906791897,8.412094391601567);
    var cnf = {
      zoom: 12,
      center: myLatlng,
      navigationControl: true,      
      mapTypeId: google.maps.MapTypeId.HYBRID,
      scrollwheel:false      
    }
    
    var RR = 'image/Struttura/geopointer/AA.gif';
	var BR = 'image/Struttura/geopointer/BR.gif';

    
    map = new google.maps.Map(document.getElementById("map_canvas"), cnf);
    
    var llCoords=new Array();        
    llCoords[0] = new google.maps.LatLng(46.34387645819206, 8.428723937103281); //Alpenrose    
    llCoords[1] = new google.maps.LatLng(46.36676491538618, 8.431674367019663); //Bar H    
    llCoords[2] = new google.maps.LatLng(46.3727760809212, 8.429110175201426); //Genzianella    
    llCoords[3] = new google.maps.LatLng(46.37629215801307, 8.426717644760142); //Camino
    llCoords[4] = new google.maps.LatLng(46.376499414439216, 8.426245575973521); //Baita    
    llCoords[5] = new google.maps.LatLng(46.37494497206916, 8.424250012466441); //Igli
    llCoords[6] = new google.maps.LatLng(46.40883657933179, 8.412984734603892); //Cascata
    llCoords[7] = new google.maps.LatLng(46.40907330255145, 8.4127701578827); //Bar frua
	llCoords[8] = new google.maps.LatLng(46.41173636798052, 8.410130864212046); //Delle Alpi
	llCoords[9] = new google.maps.LatLng(46.42296419712668, 8.415988808700571); //barulussa

    //google.maps.event.addListener(map, 'dragend', function() { document.getElementById('caz').innerHTML=map.getCenter().lat()+"-"+map.getCenter().lng() });
    
    var rName=new Array();
    rName[0]="Bar Alpenrose";
    rName[1]="Bar H";
	rName[2]="Ristorante Pizzeria Genzianella";
	rName[3]="Bar Pasticceria Il Camino";
	rName[4]="Ristorante Pizzeria La Baita";
	rName[5]="Ristorante Igli Risto Bar";
	rName[6]="Bar Ristorante Cascata del Toce";
	rName[7]="Bar Frua Souvenirs";
	rName[8]="Bar Ristorante delle Alpi";
	rName[9]="Bar Barulussa";
	
	var icn=new Array();
    icn[0]=BR//"Bar Alpenrose";
    icn[1]=BR//"Bar H";
	icn[2]=RR//"Ristorante Pizzeria Genzianella";
	icn[3]=BR//"Bar Pasticceria Il Camino";
	icn[4]=RR//"Ristorante Pizzeria La Baita";
	icn[5]=RR//"Ristorante Igli Risto Bar";
	icn[6]=RR//"Bar Ristorante Cascata del Toce";
	icn[7]=BR//"Bar Frua Souvenirs";
	icn[8]=RR//"Bar Ristorante delle Alpi";
	icn[9]=BR//"Bar Barulussa";


    var contentString=new Array();    
    contentString[0] =	'<div><strong>'+rName[0]+'</strong><br/><a href="#alpenrose">Visualizza informazioni</a></div>';
    contentString[1] =	'<div><strong>'+rName[1]+'</strong><br/><a href="#barh">Visualizza informazioni</a></div>';
    contentString[2] =	'<div><strong>'+rName[2]+'</strong><br/><a href="#genzianella">Visualizza informazioni</a></div></div>';
    contentString[3] =	'<div><strong>'+rName[3]+'</strong><br/><a href="#camino">Visualizza informazioni</a></div>';
    contentString[4] =	'<div><strong>'+rName[4]+'</strong><br/><a href="#baita">Visualizza informazioni</a></div>';
    contentString[5] =	'<div><strong>'+rName[5]+'</strong><br/><a href="#igli">Visualizza informazioni</a></div>';
    contentString[6] =	'<div><strong>'+rName[6]+'</strong><br/><a href="#cascata">Visualizza informazioni</a></div>';
    contentString[7] =	'<div><strong>'+rName[7]+'</strong><br/><a href="#frua">Visualizza informazioni</a></div>';
    contentString[8] =	'<div><strong>'+rName[8]+'</strong><br/><a href="#alpi">Visualizza informazioni</a></div>';
    contentString[9] =	'<div><strong>'+rName[9]+'</strong><br/><a href="#barulussa">Visualizza informazioni</a></div>';				    
        
	for(var i=0; i<llCoords.length; i++){
    	infowindow[i]=new google.maps.InfoWindow({content: contentString[i]});
	}
 
    for(var i=0; i<llCoords.length; i++){   
    	marker[i]=new google.maps.Marker({position: llCoords[i], map: map, title: rName[i], icon: icn[i]});
    }

	google.maps.event.addListener(marker[0], 'click', function() {infowindow[0].open(map,marker[0]);});
    google.maps.event.addListener(marker[1], 'click', function() {infowindow[1].open(map,marker[1]);});
    google.maps.event.addListener(marker[2], 'click', function() {infowindow[2].open(map,marker[2]);});
	google.maps.event.addListener(marker[3], 'click', function() {infowindow[3].open(map,marker[3]);});
	google.maps.event.addListener(marker[4], 'click', function() {infowindow[4].open(map,marker[4]);});
	google.maps.event.addListener(marker[5], 'click', function() {infowindow[5].open(map,marker[5]);});
	google.maps.event.addListener(marker[6], 'click', function() {infowindow[6].open(map,marker[6]);});
	google.maps.event.addListener(marker[7], 'click', function() {infowindow[7].open(map,marker[7]);});
	google.maps.event.addListener(marker[8], 'click', function() {infowindow[8].open(map,marker[8]);});
	google.maps.event.addListener(marker[9], 'click', function() {infowindow[9].open(map,marker[9]);});
  
}
