// JavaScript Document

 google.load("maps", "2.x");
   
  // Call this function when the page has been loaded
  function initialize() {
    var map = new google.maps.Map2(document.getElementById("map"));
	map.setMapType(G_SATELLITE_MAP);
    map.setCenter(new google.maps.LatLng(43.481761,-1.544672), 14);
	
	//definition de l'icone defaut a affecter a chaque gpoint
	var btzIcon = new GIcon(G_DEFAULT_ICON);
	btzIcon.image="elements/PinDown2Sat.png";
	markerOptions = { icon:btzIcon };
	
	var btzIconEvent = new GIcon(G_DEFAULT_ICON);
	btzIconEvent.image="elements/PinDown2GreenSatBig.png";
	markerOptionsEvent = { icon:btzIconEvent };
	
	//crea des points ancrage
	var mediatek = new GLatLng(43.481356,-1.554447);
	var rocher = new GLatLng(43.48405,-1.570219);
	var carroussel = new GLatLng(43.48331,-1.559887);
	var golf = new GLatLng(43.491121,-1.544120);
	var roxy = new GLatLng(43.476899,-1.567129);
	var extra = new GLatLng(43.473539,-1.550015);
	
	
	var zerocher=new GMarker(rocher, markerOptions);
	var zemediatek=new GMarker(mediatek, markerOptions);
	var zecarroussel=new GMarker(carroussel, markerOptions);
	var zegolf=new GMarker(golf, markerOptions);
	var zeroxy=new GMarker(roxy, markerOptionsEvent);
	var zeextra=new GMarker(extra, markerOptions);
	
	//ajout au display list
	map.addOverlay(zemediatek);
	map.addOverlay(zerocher);
	map.addOverlay(zecarroussel);
	map.addOverlay(zegolf);
	map.addOverlay(zeroxy);
	map.addOverlay(zeextra);
	
	
	//les contents html attention au saut de lignes des id pour les iframes pour eviter doublons
	var rocherContent="<div id='zinfo1'>Rocher de la Vierge<br /><iframe marginheight='0' marginwidth='0' frameborder='0' src='panos/vierge/vierge.html' width='235' height='148'></iframe>Patienter un instant, puis cliquer sur<br>FULLSCREEN - PLEIN ÉCRAN</div>";
	
	var carrousselContent="<div id='zinfo2'>Carroussel Grande Plage<br /><iframe marginheight='0' marginwidth='0' frameborder='0' src='panos/carrousel/carrousel.html' width='235' height='148'></iframe>Patienter un instant, puis cliquer sur<br>FULLSCREEN - PLEIN ÉCRAN</div>";
	
	var mediatekContent="<div id='zinfo3'>Médiathèque<br /><iframe marginheight='0' marginwidth='0' frameborder='0' src='panos/mediatheque/mediatheque.html' width='235' height='148'></iframe>Patienter un instant, puis cliquer sur<br>FULLSCREEN - PLEIN ÉCRAN</div>";
	
	var golfContent="<div id='zinfo4'>Golf Biarritz - Le Phare<iframe marginheight='0' marginwidth='0' frameborder='0' src='panos/golf/golf.html' width='235' height='148'></iframe>Patienter un instant, puis cliquer sur<br>FULLSCREEN - PLEIN ÉCRAN</div>";
	
	var roxyContent="<div id='zinfo5'>Roxy Jam<iframe marginheight='0' marginwidth='0' frameborder='0' src='panos/roxy_jam/roxy_jam1.html' width='235' height='148'></iframe>Patienter un instant, puis cliquer sur<br>FULLSCREEN - PLEIN ÉCRAN</div>";
	
	var extraContent="<div id='zinfo6'>Square Saint Charles<iFrame marginheight='0' marginwidth='0' frameborder='0' src='panos/winona/winona.html'width='235' height='148'></iframe>Patienter un instant, puis cliquer sur<br>FULLSCREEN - PLEIN ÉCRAN</div>";
	
	//les listeners des markers attention id fonctions a lineariser
	function retourCentre() {map.setCenter(new GLatLng(43.481761,-1.544672), 14);}
	
	//fonction declencheur de tooltip
	function dGolf() {
 	map.openInfoWindowHtml(golf,golfContent,{onCloseFn:retourCentre});
  		};
	function dMediatek() {
 	map.openInfoWindowHtml(mediatek,mediatekContent,{onCloseFn:retourCentre});
  		};
	function dCote() {
 	map.openInfoWindowHtml(roxy,roxyContent,{onCloseFn:retourCentre});
  		};
	function dRocher() {
	map.openInfoWindowHtml(rocher,rocherContent,{onCloseFn:retourCentre});
  		};
	function dCarroussel() {
	map.openInfoWindowHtml(carroussel,carrousselContent,{onCloseFn:retourCentre});
  		};
	function dExtra() {
	map.openInfoWindowHtml(extra,extraContent,{onCloseFn:retourCentre});
  		};
		
	var matab1=GInfoWindowTab("info gene",rocherContent);
	var matab2=GInfoWindowTab("GPS",rocherContent);
	//var gps=GInfoWindow.getPoint();	
		
		
	//pour acceder au dom en général depuis les liens externes du menu ou de la liste interactive
	GEvent.addDomListener(document.getElementById("zesat"),"click",function(){map.setMapType(G_SATELLITE_MAP)});
	GEvent.addDomListener(document.getElementById("zeplan"),"click",function(){map.setMapType(G_NORMAL_MAP)});
	GEvent.addDomListener(document.getElementById("zeplus"),"click",function(){map.zoomIn()});
	GEvent.addDomListener(document.getElementById("zemoins"),"click",function(){map.zoomOut()});
	GEvent.addDomListener(document.getElementById("btgolf"),"click",function(){dGolf()});
	GEvent.addDomListener(document.getElementById("btmediatek"),"click",function(){dMediatek()});
	GEvent.addDomListener(document.getElementById("btcote"),"click",function(){dCote()});
	GEvent.addDomListener(document.getElementById("btrocher"),"click",function(){dRocher()});
	GEvent.addDomListener(document.getElementById("btcarroussel"),"click",function(){dCarroussel()});
	
	var infoWin=function(zePoint, zeContent, zeFonction) { 
	map.openInfoWindowHtml(zePoint,zeContent,{onCloseFn:zeFonction});
	};
	
	//pour ne pas avoir de autodeclenchement nester la fonction perso dans une autre
	GEvent.addListener(zerocher, "click", function(){infoWin(rocher,rocherContent,retourCentre)});
	
	GEvent.addListener(zeroxy, "click", function(){infoWin(roxy,roxyContent,retourCentre)});
	
	GEvent.addListener(zecarroussel, "click", function(){infoWin(carroussel,carrousselContent,retourCentre)});
	
	GEvent.addListener(zemediatek, "click", function(){infoWin(mediatek,mediatekContent,retourCentre)});
	
	GEvent.addListener(zegolf, "click", function(){infoWin(golf,golfContent,retourCentre)});
	
	GEvent.addListener(zeextra, "click", function(){infoWin(extra,extraContent,retourCentre)});
	
      
 
	//la promo se declenche automatiquement
	//GEvent.addListener(zeroxy, "click", infoWin(roxy,roxyContent,retourCentre));
 	
	
	}
	
  google.setOnLoadCallback(initialize);

