﻿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 BB = 'image/Struttura/geopointer/BB.gif';
    var AA = '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.37678068975942, 8.426191931793223); //ferrera
    llCoords[1] = new google.maps.LatLng(46.37287971590492, 8.42725408656312); //agricola
    llCoords[2] = new google.maps.LatLng(46.373027765540456, 8.428241139480601); //crosetti
    llCoords[3] = new google.maps.LatLng(46.371837805244056, 8.427491462060938); //sferrera
	llCoords[4] = new google.maps.LatLng(46.37639578632455, 8.426470881530772); //TABACCHERIA SOUVENIR ZARINI
	llCoords[5] = new google.maps.LatLng(46.37794648649447, 8.425644761154185); //BOTTEGA DELL’ARTIGIANO WIBALI,WABILI,WUP
	llCoords[6] = new google.maps.LatLng(46.37232082491352, 8.427232628891001); //valmaggia
	llCoords[7] = new google.maps.LatLng(46.3729130271079, 8.428477173873911); //clo


    //google.maps.event.addListener(map, 'dragend', function() { document.getElementById('caz').innerHTML=map.getCenter().lat()+"-"+map.getCenter().lng() });
    
    var rName=new Array();
    rName[0]="ALIMENTARI SOUVENIR FERRERA";
    rName[1]="FORMAZZA AGRICOLA";
	rName[2]="MACELLERIA CROSETTI";
	rName[3]="SOUVENIR FERRERA";
	rName[4]="TABACCHERIA SOUVENIR ZARINI";
	rName[5]="BOTTEGA DELL’ARTIGIANO WIBALI,WABILI,WUP";
	rName[6]="VALMAGGIA SPORT";
	rName[7]="ABBIGLIAMENTO CLO";
	
	var icn=new Array();
    icn[0]=AA//"Agriturismo Ross Wald";
    icn[1]=AA//"Albergo Bar Ristorante Rotenthal";
	icn[2]=AA//"Residence Meublè Monte Giove";
	icn[3]=AA//"Residence Meublè Monte Giove";
	icn[4]=AA//"Residence Meublè Monte Giove";
	icn[5]=AA//"Residence Meublè Monte Giove";
	icn[6]=AA//"Residence Meublè Monte Giove";
	icn[7]=AA//"Residence Meublè Monte Giove";


    var contentString=new Array();    
    contentString[0] =	'<div><strong>'+rName[0]+'</strong><br/><a href="#ferrera">Visualizza informazioni</a></div>';
    contentString[1] =	'<div><strong>'+rName[1]+'</strong><br/><a href="#agricola">Visualizza informazioni</a></div>';
	contentString[2] =	'<div><strong>'+rName[2]+'</strong><br/><a href="#crosetti">Visualizza informazioni</a></div>';
	contentString[3] =	'<div><strong>'+rName[3]+'</strong><br/><a href="#sferrera">Visualizza informazioni</a></div>';
	contentString[4] =	'<div><strong>'+rName[4]+'</strong><br/><a href="#zarini">Visualizza informazioni</a></div>';
	contentString[5] =	'<div><strong>'+rName[5]+'</strong><br/><a href="#wup">Visualizza informazioni</a></div>';
	contentString[6] =	'<div><strong>'+rName[6]+'</strong><br/><a href="#valmaggia">Visualizza informazioni</a></div>';
	contentString[7] =	'<div><strong>'+rName[7]+'</strong><br/><a href="#clo">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]);}); 
}