﻿// STREETVIEW MOZART //


   // Map & Pano delcarations
	google.load("maps", "2");
    var map5;
    var myPano5;   
    var panoClient5;
    var currentLatLng5 = new GLatLng(45.842465,1.232420);
	var imoLatLng5 = new GLatLng(45.842004,1.23370);
	var corgnLatLng5 = new GLatLng(45.841000,1.233302);
    var currentYaw5 = 80;
	var imgSrc5 = "http://www.limoges-locations.fr/wp-content/themes/limoges-locations/images/residence.png";
   
   // Field of view marker and icon declarations
    var fovMarker5; 
    //var fovIcon5 = new GIcon(G_DEFAULT_ICON);
    var iconSize5 = 150; 
    
    var imoMarker5; //marker pour icone imobilier
    var imoIcon5 = new GIcon(G_DEFAULT_ICON);

	var corgnMarker; //marker pour icone corgnac
	var corgnIcon = new GIcon(G_DEFAULT_ICON);	
	
	function initialized5(chosen) {
	panoClient5 = new GStreetviewClient();	     
	map5 = new GMap2(document.getElementById("street5"));
	map5.addControl(new GLargeMapControl3D);
	map5.addControl (new GScaleControl);
	map5.setCenter(currentLatLng5, 16);
	myPano5 = new GStreetviewPanorama(document.getElementById("view5"));
	myPano5.setLocationAndPOV(currentLatLng5, {yaw:currentYaw5, pitch:0});
			
	//fovIcon5.image = "http://www.limoges-locations.fr/wp-content/themes/limoges-locations/demoicon.php?yaw=180";		
	//fovIcon5.iconSize = new GSize(iconSize5, iconSize5);
	//fovIcon5.iconAnchor = new GPoint(iconSize5/2, iconSize5/2); //anchor in the middle
	//fovIcon5.shadow = null;
	//fovMarker5 = new GMarker(currentLatLng5, {icon: fovIcon5, clickable: false})		
	GEvent.addListener(myPano5, "initialized", handleInitialized5); 
	//GEvent.addListener(myPano5, "yawchanged", handleYawChange5);
	
	/*icone immo*/
	imoIcon5.image = imgSrc5;
	imoIcon5.shadow = null;
	imoIcon5.iconSize = new google.maps.Size(20,20);
	imoMarker5 = new GMarker(imoLatLng5, {icon: imoIcon5, clickable: false})
	
	/**icone monoprix **/
	corgnIcon.image = "http://www.limoges-locations.fr/wp-content/themes/limoges-locations/images/commerces.png";
	corgnIcon.shadow = null;
	corgnIcon.iconSize = new google.maps.Size(20,20);
	corgnMarker = new GMarker(corgnLatLng5, {icon: corgnIcon, clickable: false})
	
	return;
}
function handleInitialized5(location) {
	currentLatLng5 = location.latlng;	
	placeFovMarker5();
	return;	
}
/*function handleYawChange5(yaw){
	currentYaw5 = Math.round(yaw);
	placeFovMarker5();
	return;
} */
function placeFovMarker5(){
	map5.removeOverlay(fovMarker5);
	/* The following line really only needs to be in handleYawChange(), but doing so creates a flicker of the marker 
	* when using Firefox.  It may have something to do with the lag between when the initialized event is triggered
	* and when the Street View image is actually finished loading. Although less than optimal, I've found that 
	* reloading the image for each placement avoids the problem.
	*/
	//fovIcon5.image = "http://www.limoges-locations.fr/wp-content/themes/limoges-locations/demoicon.php?yaw="+currentYaw5+"&rand="+Math.random();	
	//fovMarker5 = new GMarker(currentLatLng5, {icon: fovIcon5, clickable: false});
	//map5.addOverlay(fovMarker5);
	map5.addOverlay(imoMarker5);	
	map5.addOverlay(corgnMarker);
	map5.setCenter(currentLatLng5);
	return;
}
google.setOnLoadCallback(initialized5);
