var icon_ville1 = new GIcon();
icon_ville1.image = "http://www.cybevasion.fr/lib2/google/push_rouge.png";
icon_ville1.iconSize = new GSize(16, 28);
icon_ville1.iconAnchor = new GPoint(8, 28);
icon_ville1.infoWindowAnchor = new GPoint(8, 8);

var icon_ville2 = new GIcon();
icon_ville2.image = "http://www.cybevasion.fr/lib2/google/push_bleu.png";
icon_ville2.iconSize = new GSize(14, 24);
icon_ville2.iconAnchor = new GPoint(7, 24);
icon_ville2.infoWindowAnchor = new GPoint(7, 7);

var icon_photo = new GIcon();
icon_photo.image = "http://www.cybevasion.fr/lib2/google/photo.png";
icon_photo.iconSize = new GSize(18, 18);
icon_photo.iconAnchor = new GPoint(9, 18);
icon_photo.infoWindowAnchor = new GPoint(9, 9);

var icon_photo2 = new GIcon();
icon_photo2.image = "http://www.cybevasion.fr/lib2/google/photo2.png";
icon_photo2.iconSize = new GSize(25, 25);
icon_photo2.iconAnchor = new GPoint(12, 25);
icon_photo2.infoWindowAnchor = new GPoint(12, 12);

var icon_hotel = new GIcon();
icon_hotel.image = "http://www.cybevasion.fr/lib2/hotel_gg.gif";
icon_hotel.iconSize = new GSize(33, 33);
icon_hotel.iconAnchor = new GPoint(16, 16);
icon_hotel.infoWindowAnchor = new GPoint(16, 16);

var icon_hotel2 = new GIcon();
icon_hotel2.image = "http://www.cybevasion.fr/lib2/google/hotel.png";
icon_hotel2.iconSize = new GSize(21, 21);
icon_hotel2.iconAnchor = new GPoint(10, 10);
icon_hotel2.infoWindowAnchor = new GPoint(10, 10);

var icon_parking = new GIcon();
icon_parking.image = "http://www.cybevasion.fr/lib2/parking_gg.gif";
icon_parking.iconSize = new GSize(21, 21);
icon_parking.iconAnchor = new GPoint(10, 10);
icon_parking.infoWindowAnchor = new GPoint(10, 10);

var icon_gare = new GIcon();
icon_gare.image = "http://www.cybevasion.fr/lib2/gare_gg.gif";
icon_gare.iconSize = new GSize(21, 21);
icon_gare.iconAnchor = new GPoint(10, 10);
icon_gare.infoWindowAnchor = new GPoint(10, 10);

var icon_aero = new GIcon();
icon_aero.image = "http://www.cybevasion.fr/lib2/aero_gg.gif";
icon_aero.iconSize = new GSize(21, 21);
icon_aero.iconAnchor = new GPoint(10, 10);
icon_aero.infoWindowAnchor = new GPoint(10, 10);

var icon_porte = new GIcon();
icon_porte.image = "http://www.cybevasion.fr/lib2/porte_gg.gif";
icon_porte.iconSize = new GSize(21, 21);
icon_porte.iconAnchor = new GPoint(10, 10);
icon_porte.infoWindowAnchor = new GPoint(10, 10);

var icon_metro = new GIcon();
icon_metro.image = "http://www.cybevasion.fr/lib2/metro_gg.gif";
icon_metro.iconSize = new GSize(21, 21);
icon_metro.iconAnchor = new GPoint(10, 10);
icon_metro.infoWindowAnchor = new GPoint(10, 10);

var icon_visit360 = new GIcon();
icon_visit360.image = "http://www.cybevasion.fr/lib2/google/virtual360.png";
icon_visit360.iconSize = new GSize(21, 21);
icon_visit360.iconAnchor = new GPoint(10, 10);
icon_visit360.infoWindowAnchor = new GPoint(10, 10);

var icon_annonce = new GIcon();
icon_annonce.image = "http://www.cybevasion.fr/lib2/google/push_bleu.png";
icon_annonce.iconSize = new GSize(14, 24);
icon_annonce.iconAnchor = new GPoint(7, 24);
icon_annonce.infoWindowAnchor = new GPoint(7, 7);

var icon_annonce2 = new GIcon();
icon_annonce2.image = "http://www.cybevasion.fr/lib2/google/push_rouge2.png";
icon_annonce2.iconSize = new GSize(14, 24);
icon_annonce2.iconAnchor = new GPoint(7, 24);
icon_annonce2.infoWindowAnchor = new GPoint(7, 7);

var icon_poly = new GIcon();
//icon_poly.image = "http://maps.google.com/mapfiles/kml/pal2/icon10.png";
icon_poly.image = "http://maps.google.com/mapfiles/kml/pal2/icon2.png";
icon_poly.iconSize = new GSize(32, 32);
icon_poly.iconAnchor = new GPoint(16, 16);
icon_poly.infoWindowAnchor = new GPoint(16, 16);

var icon_rue = new GIcon();
icon_rue.image = "http://www.cybevasion.fr/lib2/icon_rue.gif";
icon_rue.iconSize = new GSize(21, 18);
icon_rue.iconAnchor = new GPoint(10, 9);
icon_rue.infoWindowAnchor = new GPoint(10, 9);

var icon_drapeau = new GIcon();
icon_drapeau.image = "http://www.cybevasion.fr/lib2/google/drapeau.png";
icon_drapeau.iconSize = new GSize(21, 32);
icon_drapeau.iconAnchor = new GPoint(1, 32);
icon_drapeau.infoWindowAnchor = new GPoint(10, 10);

var icon_tour_paris = [];
for(var h=1; h<=16; h++){
	icon_tour_paris[h] = new GIcon();
	icon_tour_paris[h].image = "http://www.cybevasion.fr/lib2/google/paris_c" + h + ".png";
	icon_tour_paris[h].iconSize = new GSize(18, 18);
	icon_tour_paris[h].iconAnchor = new GPoint(9, 18);
	icon_tour_paris[h].infoWindowAnchor = new GPoint(9, 9);
}

var map;
function myzoom(a) {
	a > 0 ? map.zoomIn('', false, true): map.zoomOut('', true);
}

function mymove(a,b) {
	map.panDirection(a,b);
}

function affiche_marker(i) {
	//map.panTo(aMarkers[i].getPoint());
	aMarkers[i].openInfoWindowHtml(aMarkersHtml[i]);
	aMarkers[i].setImage(icon_ville1.image);
}

function affiche_marker2(i) {
	//map.panTo(aMarkers[i].getPoint());
	aMarkers[i].openInfoWindowHtml(aMarkersHtml[i]);
	//aMarkers[i].setMarkerZIndex (600000);
}

function revert_marker(i) {
	aMarkers[i].setImage(icon_annonce.image);
	//aMarkers[i].setMarkerZIndex (1);
}

function wheelZoom(a) {
	if (!a) a = window.event; 
	if (a.preventDefault) a.preventDefault(); 
	a.returnValue = false; 

	//if(a.cancelable){
	//	a.preventDefault();
	//}
	//(a.detail || -a.wheelDelta) < 0 ? map.zoomIn('', false, true): map.zoomOut('', true);
	//return false;
}

function changeType(a){
	if(a=='satellite'){
		map.setMapType(G_SATELLITE_MAP);
	}

	if(a=='map'){
		map.setMapType(G_NORMAL_MAP);
	}

	if(a=='hybrid'){
		map.setMapType(G_HYBRID_MAP);
	}

	if(a=='relief'){
		map.setMapType(G_PHYSICAL_MAP);
	}
}

function createMarker(point, contenu_html, vide, index_gg, type_icon) {
	var marker = new GMarker(point, type_icon);
	
	if(contenu_html!=""){
		GEvent.addListener(marker, "click", function() {
			marker.openInfoWindowHtml(contenu_html);
		});
	}
	return marker;
}

function createMarker2(point, contenu_html, vide, index_gg, type_icon) {
	var marker = new GMarker(point, type_icon);
	
	if(contenu_html!=""){
		GEvent.addListener(marker, "click", function() {
			marker.openInfoWindowHtml(contenu_html);
		});
	}
	aMarkers[index_gg] = marker;
	aMarkersHtml[index_gg] = contenu_html;
	return marker;
}
var aMarkers = new Array();
var aMarkersHtml = new Array();
var panorama;

function createSvMarker(point, contenu_html, type_icon, my_yaw, my_pitch, my_zoom, my_width, my_height) {
	var marker = new GMarker(point, type_icon);
	var contentNode = document.createElement('div');
	contentNode.style.textAlign = 'center';
	contentNode.style.width = '600px';
	contentNode.style.height = '400px';
	contentNode.innerHTML = 'Street View en cours de chargement...';
	var smallNode = document.createElement('div');
	smallNode.style.width = my_width + 'px';
	smallNode.style.height = my_height + 'px';
	smallNode.id = 'pano';

	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindow(smallNode);
	});
	GEvent.addListener(marker, "infowindowopen", function() {
		panorama = new GStreetviewPanorama(smallNode);
		myPOV = {yaw:my_yaw,pitch:my_pitch,zoom:my_zoom};
		panorama.setLocationAndPOV(point, myPOV);
		panorama.checkResize();
	});
	return marker;
}

function createSvPano(latp, lonp, my_yaw, my_pitch, my_zoom) {
	panorama = new GStreetviewPanorama(document.getElementById("panoSV"));
	panorama.setLocationAndPOV(new GLatLng(latp, lonp), {yaw: my_yaw, pitch: my_pitch, zoom: my_zoom});
}

function createDragMarker(point, contenu_html, vide, index_gg, type_icon) {
	var marker = new GMarker(point, {draggable: true});
	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml(contenu_html);
	});
	return marker;
}

var icon_arrdt = new Array();
for(var i=1; i<=20; i++){
	icon_arrdt[i] = new GIcon();
	icon_arrdt[i].image = "http://www.cybevasion.fr/lib2/google/label_arrdt_" + i + ".png";
	icon_arrdt[i].iconSize = new GSize(32, 32);
	icon_arrdt[i].iconAnchor = new GPoint(16, 16);
	icon_arrdt[i].infoWindowAnchor = new GPoint(16, 16);
}

var icon_prov = new Array();
for(var i=0; i<=34; i++){
	icon_prov[i] = new GIcon();
	icon_prov[i].image = "http://www.cybevasion.fr/lib/icones/tourisme/google/" + i + ".png";
	icon_prov[i].iconSize = new GSize(18, 18);
	icon_prov[i].iconAnchor = new GPoint(9, 9);
	icon_prov[i].infoWindowAnchor = new GPoint(9, 9);
}

var icon_num = new Array();
for(var i=1; i<=50; i++){
	icon_num[i] = new GIcon();
	icon_num[i].image = "http://www.cybevasion.fr/lib2/google/push_" + i + ".png";
	icon_num[i].iconSize = new GSize(22, 37);
	icon_num[i].iconAnchor = new GPoint(11, 37);
	icon_num[i].infoWindowAnchor = new GPoint(11, 11);
}

var icon_labelnum = new Array();
for(var i=1; i<=25; i++){
	icon_labelnum[i] = new GIcon();
	icon_labelnum[i].image = "http://www.cybevasion.fr/lib2/google/labels/label_" + i + ".gif";
	icon_labelnum[i].iconSize = new GSize(17, 17);
	icon_labelnum[i].iconAnchor = new GPoint(8, 8);
	icon_labelnum[i].infoWindowAnchor = new GPoint(8, 8);
}
