/****** CLASSE ObjGoogleMap ***********/

function OBJGoogleMap(nomId,x,y,centre,urlKMLInfo,mapType){
	this.div_gmap=nomId;
	this.xinit=x;
	this.yinit=y;
	this.zoominit=parseInt(centre);

        this.xchargement=0;
        this.ychargement=0;

	this.gmap=document.getElementById(nomId);
	
	this.google_map = new GMap2(this.gmap);
	this.google_map.setCenter(new GLatLng(x,y),centre);

	this.largMapCtrl=new GLargeMapControl();
	this.google_map.addControl(this.largMapCtrl);
	this.overviewMapCtrl=new GOverviewMapControl ();
	this.google_map.addControl(this.overviewMapCtrl);
	this.hierarchicalMapCtrl=new GHierarchicalMapTypeControl();
	this.google_map.addControl(this.hierarchicalMapCtrl);
	this.google_map.checkResize();
	this.google_map.addMapType(G_PHYSICAL_MAP);
	this.google_map.addMapType(G_HYBRID_MAP);

	this.markerCourant=null;
	this.defautIcon=new GIcon();
	this.nbMarker=0;
	this.tabMarker=new Array();
	this.tabInfos=new Array();
	this.urlKMLInfo=urlKMLInfo;
	this.geoXML=null;
	if (mapType)this.google_map.setMapType(mapType);
	
	this.paramAjxToAdd=null;

	//this.google_map.enableScrollWheelZoom();
	
	this.div_status=null;
	this.div_infos=null;
	this.div_sidebar=null;
	this.div_sidebar_gene=null;
	this.div_sidebar_contenu=null;
	this.posXInit=this.gmap.offsetLeft;
	this.largeurInit=this.gmap.offsetWidth;
	
	this.clustering=null;
	this.clusteringActif=false;
	this.optsClustering={};
	this.listeBulleActive=false;
	this.inseeActif=false;
	this.autoCentre=false;
	this.labellingActif=false;

	this.initOverlays=initOverlays;
	this.initKML=initKML;
	this.getPoint=getPoint;
	this.getIcon=getIcon;
	this.setIcon=setIcon;
	this.setCentre=setCentre;
	this.efface1sur2=efface1sur2;
	this.effaceMarkeurs=effaceMarkeurs;
	this.inverseAffichage=inverseAffichage;
	this.afficheRechInfo=afficheRechInfo;
	this.affRecherche=affRecherche;
	this.activeListeBulle=activeListeBulle;
	this.activeInsee=activeInsee;
	this.ajouteMarkerSimple=ajouteMarkerSimple;
	this.ajouteMarkerSimpleI=ajouteMarkerSimpleI;
	this.ajouteMarkerWithTabs=ajouteMarkerWithTabs;
	this.ajouteMarkerWithTabs2=ajouteMarkerWithTabs2;
	this.ajouteMarkerWithTabsI=ajouteMarkerWithTabsI;
	this.ajouteMarkerWithTabsEtSideBar=ajouteMarkerWithTabsEtSideBar;
	this.setPictoByIdentAndShowBulle=setPictoByIdentAndShowBulle;
	this.setWindowHtmlMarkerByTabInfos=setWindowHtmlMarkerByTabInfos;
	this.setTabsMarkerByTabInfos=setTabsMarkerByTabInfos;
	this.regenereHTMLEtTabs=regenereHTMLEtTabs;
	this.setIcon("");
	this.affMsgAttente=affMsgAttente;
	this.affMsgInfos=affMsgInfos;
	this.affSideBar=affSideBar;
	this.affSideBar_v2=affSideBar_v2;
	this.affSideBar_v2ByTabHtml=affSideBar_v2ByTabHtml;
	this.cacheMsgAttente=cacheMsgAttente;
	this.cacheMsgInfos=cacheMsgInfos;
	this.cacheSideBar=cacheSideBar;

	this.setDivStatus=setDivStatus;
	this.setDivInfos=setDivInfos;
	this.setDivSideBar=setDivSideBar;
	this.setDivSideBarGene=setDivSideBarGene;
	this.setDivSideBarContenu=setDivSideBarContenu;
	this.setDivGMap=setDivGMap;
	this.gereEvents=gereEvents;
	this.manageMarker=manageMarker;
	this.zoomOnClusterById=zoomOnClusterById;
	this.eclateClusterById=eclateClusterById;
	this.visualiserHebergOnClusterById=visualiserHebergOnClusterById;
	this.miniCarte=miniCarte;
	this.setParamAjxToAdd=setParamAjxToAdd;
	
	this.activeClustering=activeClustering;
	this.setOptsClustering=setOptsClustering;
	this.setClusterImage=setClusterImage;
	this.activeLabelling=activeLabelling;
	this.activeAutoCentre=activeAutoCentre;
	this.setTypeMap=setTypeMap;
	this.setEvents=setEvents;
	this.reload=reload;
	this.checkResize=checkResize;
	this.resetCentre=resetCentre;
}	


function reload(){
	this.google_map = new GMap2(document.getElementById(this.div_gmap));
	this.google_map.setCenter(new GLatLng(this.xinit,this.yinit),this.zoominit);
	this.largMapCtrl=new GLargeMapControl();
	this.google_map.addControl(this.largMapCtrl);
	this.google_map.checkResize();

	this.google_map.addMapType(G_PHYSICAL_MAP);
	this.google_map.addMapType(G_HYBRID_MAP);
	this.initKML();


	this.overviewMapCtrl=new GOverviewMapControl ();
	this.google_map.addControl(this.overviewMapCtrl);
	this.hierarchicalMapCtrl=new GHierarchicalMapTypeControl()
	this.google_map.addControl(this.hierarchicalMapCtrl);
}

function checkResize(){
	this.google_map.checkResize();
}

function setTypeMap(typeMap){
	if (typeMap)this.google_map.setMapType(typeMap);
}

function miniCarte(mapType){
	this.google_map.removeControl(this.largMapCtrl);
	this.google_map.removeControl(this.overviewMapCtrl);
	this.google_map.removeControl(this.hierarchicalMapCtrl);
	if (mapType)this.setTypeMap(mapType);
}

function setParamAjxToAdd(params){
	this.paramAjxToAdd=params;
}
	

function setEvents(){
	//GEvent.addListener(this.google_map, 'move', this.gereEvents);
}

function gereEvents(){
}

function setCentre(latitude,longitude,zoom){
	this.google_map.setCenter(new GLatLng(latitude,longitude),zoom);
}	
function resetCentre(){
	this.google_map.setCenter(new GLatLng(this.xinit,this.yinit),this.zoominit);
}	
	
function getIcon(url_image){
	var img=new Image();
	img.src=url_image;
	var w=img.width;
	var h=img.height;
	
	if (!w)w=20;
	if (!h)h=34;

	var icon = new GIcon();
	icon.image = url_image;
	icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
	icon.iconSize = new GSize(w, h);
	icon.shadowSize = new GSize(37, 34);
	icon.iconAnchor = new GPoint( parseInt(w/2) , parseInt(h));
	icon.infoWindowAnchor = new GPoint(10, 10);
	return icon;
} 				

function setIcon(url_img){
	if (url_img.length==0)url_img="http://www.itea.fr/itea/images/gdf.gif";
	this.defautIcon=this.getIcon(url_img);
}	

function getPoint(lat,lng){
	return new GlatLng(lat,lng);
}	

function setDivStatus(div){this.div_status=div;}
function setDivInfos(div){this.div_infos=div;}
function setDivSideBar(div){this.div_sidebar=div;}
function setDivSideBarGene(div){this.div_sidebar_gene=div;}
function setDivSideBarContenu(div){this.div_sidebar_contenu=div;}
function setDivGMap(div){this.div_gmap=div;}

function initOverlays(){
	this.google_map.clearOverlays();
	this.initKML();
}

function initKML(){
	if (this.urlKMLInfo){
		var uniqueId=((new Date()).getTime() + "" + Math.floor(Math.random() * 1000000)).substr(0, 18);
	
		this.geoKML=new GGeoXml(this.urlKMLInfo+"?"+uniqueId);
		this.google_map.addOverlay(this.geoKML);
		this.geoKML.show();
	}
	
}

function effaceMarkeurs(){
	this.initOverlays();
	this.tabMarker=new Array();
	this.tabInfos[this.nbMarker]=null;
	this.nbMarker=0;
	if (this.clustering)this.clustering.removeMarkers();
}

function ajouteMarkerSimple(lat,lng){
	this.nbMarker++;
	var point = new GLatLng(lat,lng);
	var marker=new GMarker(point);
	this.tabMarker[this.nbMarker]=marker;
	this.tabInfos[this.nbMarker]=null;
	
	this.google_map.addOverlay(marker);

	return this.nbMarker;
}    

function ajouteMarkerSimpleI(lat,lng,tabInfos){
	this.nbMarker++;
	var point = new GLatLng(lat,lng);
	var marker=new GMarker(point);
	this.tabMarker[this.nbMarker]=marker;
	this.tabInfos[this.nbMarker]=tabInfos;
	
	this.google_map.addOverlay(marker);

	return this.nbMarker;
}    


function ajouteMarkerWithTabs(point,icon,tabs,delais,html){
	this.nbMarker++;
	var marker=new GMarker(point,icon);
	this.tabMarker[this.nbMarker]=marker;
	this.tabInfos[this.nbMarker]=null;
	GEvent.addListener(marker,"click",function(){marker.openInfoWindowTabsHtml(tabs);});
	GEvent.addListener(marker,"mouseover",function(){marker.openInfoWindowHtml(html);});
	this.google_map.addOverlay(marker);

	return this.nbMarker;
}

function ajouteMarkerWithTabs2(lat,lng,path_icon,html_clic,tab_html_clic){
	this.nbMarker++;
	var icon=this.getIcon(path_icon);
	var point = new GLatLng(lat,lng);
	var marker=new GMarker(point,icon);
	this.tabMarker[this.nbMarker]=marker;
	this.tabInfos[this.nbMarker]=null;

	GEvent.addListener(marker,"click",function(){marker.openInfoWindowHtml(html_clic);});

	var tabs=new Array();
	
	for (i=0;i<tab_html_clic.length;i++){
		var giwt=new GInfoWindowTab((i+1),tab_html_clic[i]);
		giwt.maxWidth=20;
		tabs.push(giwt);
	}
	GEvent.addListener(marker,"dblclick",function(){marker.openInfoWindowTabsHtml(tabs);});


	this.google_map.addOverlay(marker);

	return this.nbMarker;
}

function activeClustering(clusteringActif){
	this.clusteringActif=clusteringActif;
	this.labellingActif=clusteringActif;
}
function activeLabelling(labellingActif){
	this.labellingActif=labellingActif;
}

function activeListeBulle(listeBulleActive){
	this.listeBulleActive = listeBulleActive;
}

function activeAutoCentre(autoCentre){
	this.autoCentre = autoCentre;
}

function activeInsee(inseeActif){
	this.inseeActif = inseeActif;
}

function clickSurUnMarkerCluster(args){
	var nb=0,nbMemeCommune=0;
	var id=getUniqueId();
	var html_clic_all="<div>";
	if(!window.gmap.listeBulleActive)var html_divEtLst="<div id=gbulle_divlist_deroul"+id+" class='gbulle_divlist_deroul'><ul id='gbulle_ullist_deroul"+id+"' class='gbulle_ullist_deroul'>";
	else var html_divEtLst="<div id=gbulle_divlist_deroul"+id+" class='gbulle_divlist_affiche'><ul id='gbulle_ullist_deroul"+id+"' class='gbulle_ullist_affiche'>";
	if(window.gmap.listeBulleActive)var listeBulleActive = window.gmap.listeBulleActive;
	args.clusteredMarkers=shuffle(args.clusteredMarkers);
	for (var i=0;i<args.clusteredMarkers.length;i++){
		nbMemeCommune=0;
		for (var j=0;j<args.clusteredMarkers[i].tabHtml.length;j++){
			if(!window.gmap.listeBulleActive)html_divEtLst+="<li class='gbulle_lilist_deroul'>";
			else html_divEtLst+="<li class='gbulle_lilist_affiche'>";
			html_divEtLst+=args.clusteredMarkers[i].tabHtml[j];		
			html_divEtLst+="</li>";
				affUrlInDivFromHtml(args.clusteredMarkers[i].tabHtml[j],function(reponse){
					if(!listeBulleActive)setScrollHorizontalOnDiv("gbulle_divlist_deroul"+id,"gbulle_ullist_deroul"+id,{"nextButton":$("gbulle_clust_suiv"+id),"prevButton":$("gbulle_clust_prec"+id),"scrollSansEffet":"true"});
					else setScrollVerticalOnDiv("gbulle_divlist_deroul"+id,"gbulle_ullist_deroul"+id,{"nextButton":$("gbulle_clust_bas"+id),"prevButton":$("gbulle_clust_haut"+id),"scrollSansEffet":"true", "listeBulle":"true", "nbLi":nb});
				});
			
			nb++;nbMemeCommune++;
		}		
	}
	html_divEtLst+="</ul></div>";
	if (nb>1){
		if (nb>nbMemeCommune){
			html_clic_all+="<p><span id='motcle1'>Cet icone est un regroupement de</span>&nbsp;<strong>"+nb+"</strong>&nbsp;<span id='motcle2'>hébergements</span>";
			if (args.id!="pasdeclustering")html_clic_all+="&nbsp;<a href=#zoom onclick='gmap.zoomOnClusterById("+args.id+");'><span id='motcle6'>Zoomer</span></a>";
			html_clic_all+="</p></div>";
		}
		if(!window.gmap.listeBulleActive){
			html_clic_all+="<div class='gbulle_spanlist_bloc'>";
			html_clic_all+="<span id=gbulle_clust_prec"+id+" class='gbulle_spanlist_prec'>&nbsp;</span>";
		}else{
			 html_clic_all+="<div class='gbulle_spanlist_bloc liste_bulle'>";
			if(nb>6)html_clic_all+="<span id='gbulle_clust_haut"+id+"' class='gbulle_spanlist_haut'>&nbsp;</span>";
		}
		
	}
	html_clic_all+=html_divEtLst;		
	if(nb>1){
		if(!window.gmap.listeBulleActive)html_clic_all+="<span id=gbulle_clust_suiv"+id+" class='gbulle_spanlist_suiv'>&nbsp;</span>";
		else{
			if(nb>6)html_clic_all+="<span id='gbulle_clust_bas"+id+"' class='gbulle_spanlist_bas'>&nbsp;</span>";
			html_clic_all+= "<div style='clear:both'></div>";
		}
	}
	html_clic_all+="</div>";
	//permet de ne pas lancer le listener sur le moveend
	//En effet quand on affiche une infoWindow, la carte va ce rechercher
	//pour que toute la bulle apparaisse.
	window.RefreshInfoWindow=false;
	args.clusterMarker.openInfoWindowHtml(html_clic_all);
	if(window.gmap.autoCentre){
		GEvent.addListener(args.clusterMarker, 'infowindowclose', function() {
			  
                        if(window.gmap.xchargement!=0 && window.gmap.ychargement!=0 ){
                            iteaGMAP_zoomSurCoordonnees({x:window.gmap.xchargement,y: window.gmap.ychargement}); 
                        }else{
                            window.gmap.resetCentre();
                        }

		});
		//GEvent.bindDom(this.google_map, 'infowindowclose', args.clusterMarker, window.gmap.resetCentre);
	}
	chargeMotCleDsDiv('motcle1','LBL_ICONE_REGROUP');
	chargeMotCleDsDiv('motcle2','LBL_ICONE');
	chargeMotCleDsDiv('motcle6','LBL_ZOOMER');


	if(!window.gmap.listeBulleActive)setScrollHorizontalOnDiv("gbulle_divlist_deroul"+id,"gbulle_ullist_deroul"+id,{"nextButton":$("gbulle_clust_suiv"+id),"prevButton":$("gbulle_clust_prec"+id),"scrollSansEffet":"true"});
	else setScrollVerticalOnDiv("gbulle_divlist_deroul"+id,"gbulle_ullist_deroul"+id,{"nextButton":$("gbulle_clust_bas"+id),"prevButton":$("gbulle_clust_haut"+id),"scrollSansEffet":"true", "listeBulle":"true", "nbLi":nb});

	if(getVersionIE()<9 && $("gbulle_ullist_deroul"+id)){
		$('gbulle_ullist_deroul'+id).style.left='0';
		$('gbulle_ullist_deroul'+id).style.paddingLeft='0px';
		$('gbulle_ullist_deroul'+id).style.marginLeft='0px';
	}

	if(!window.gmap.listeBulleActive || (window.gmap.listeBulleActive && !$("gbulle_ullist_deroul"+id))){
		setTimeout(function(){
			if(getVersionIE()<9){
				$('gbulle_ullist_deroul'+id).style.left='0';
				$('gbulle_ullist_deroul'+id).style.paddingLeft='0px';
				$('gbulle_ullist_deroul'+id).style.marginLeft='0px';
			}

		if(!window.gmap.listeBulleActive)setScrollHorizontalOnDiv("gbulle_divlist_deroul"+id,"gbulle_ullist_deroul"+id,{"nextButton":$("gbulle_clust_suiv"+id),"prevButton":$("gbulle_clust_prec"+id),"scrollSansEffet":"true"});
		else setScrollVerticalOnDiv("gbulle_divlist_deroul"+id,"gbulle_ullist_deroul"+id,{"nextButton":$("gbulle_clust_bas"+id),"prevButton":$("gbulle_clust_haut"+id),"scrollSansEffet":"true", "listeBulle":"true", "nbLi":nb});
		},1000);
	}


}


function setClusterImage(urlImage){
	opts={
		"clusterMarkerIcon":this.getIcon(urlImage),
		"clusterMarkerClick":clickSurUnMarkerCluster
		}
	this.setOptsClustering(opts);
}

function setOptsClustering(opts){
	this.optsClustering=opts;
}

function manageMarker(){
	if (this.clusteringActif){
		this.clustering=new ClusterMarker(this.google_map,this.optsClustering);
		this.clustering.addMarkers(this.tabMarker);
		this.clustering.setObjGmap(this);
		this.google_map.checkResize();
		this.clustering.refresh(true);

	}else{
		for (var i=0;i<this.tabMarker.length;i++){
			if (this.tabMarker[i])this.google_map.addOverlay(this.tabMarker[i]);
		}
	}
	
}

function eclateClusterById(id){
	this.cacheSideBar();
	this.clustering.unclusterCluster(id);
}
function zoomOnClusterById(id){
	this.cacheSideBar();
	this.clustering.zoomOnCluster(id);
}
function visualiserHebergOnClusterById(id){
	this.cacheSideBar();
	this.clustering.visuDetailsSideBar(id);
}

function setPictoByIdentAndShowBulle(ident,params){
	var trouve=false;
	var markerTrouve;
	var tabIdent;
	var identCurr,identReel;
	for (var i=1;i<this.tabMarker.length && !trouve;i++){
		var marker=this.tabMarker[i];
		if (marker){
			tabIdent=new String(marker.ident).split("|");
			for (var j=0;j<tabIdent.length && !trouve;j++){
				var tabChps=tabIdent[j].split("/");
				var identCurr=tabChps[1];
				var indiceInLst=tabChps[0];
				if (!identCurr){
					identCurr=tabChps[0];
					indiceInLst=-1;
				}
				if (identCurr.split("_").length>1){
					var tabChps=identCurr.split(".");
					var instance=tabChps[0];
					var id_famille=tabChps[1];
					var numg=tabChps[2];
					var tabChps=instance.split("_");
					var nom_instance=tabChps[0];
					identReel=identCurr;
					identCurr=nom_instance+"."+id_famille+"."+numg;
				}
				if (identCurr==ident){
					markerTrouve=marker;
					trouve=true;
				}
			}
		}
	}
	if (trouve){
		
		var html="<div id='div_gbulle_revele' class='div_gbulle' style='width:300px;height:120px;'><IMG style='padding-top:30px;padding-left:125px' src=/config_v3/imgs_defaut/rouegrise_fond.gif></div>";
		var gll=markerTrouve.getLatLng();
		//markerTrouve.labelText_="9999";
		this.google_map.setCenter(gll,params.zoom);
		//markerTrouve.openInfoWindowHtml(html);
		this.google_map.openInfoWindowHtml(gll,html);
		if (indiceInLst>=0)affUrlInDiv("div_gbulle_revele","/lib/ajax/gMap.php","affProdGLIndex="+indiceInLst);
		else affUrlInDiv("div_gbulle_revele","/lib/ajax/contenuFenetre.php","element=elemObjProd&typeInfo=xhtmlBulleCarte-"+identReel);

		if (params && params.imgPicto){
			if (this.markerCourant)this.google_map.removeOverlay(this.markerCourant);
			var markerOpts = {
	 			"icon": getIcon(params.imgPicto),
	 			"clickable": false,
	 			"labelText": "",
	 			"labelClass": "divGmapLabelNumSimpleCourant",
	 			"labelOffset": new GSize(3, -40)
	 		};
	 		var newmarker = new LabeledMarker(gll, markerOpts);
	 		this.google_map.addOverlay(newmarker);
			this.markerCourant=newmarker;
		}
		this.checkResize();
	}//else jslog("Marker ["+ident+"] introuvable ");
}


function ajouteMarkerWithTabsEtSideBar(lat,lng,path_icon,html_clic,html_sidebar,ident){
	this.nbMarker++;
	path_icon=unescape(path_icon);
	var icon=this.getIcon(path_icon);
	var point = new GLatLng(lat,lng);
	var marker ;
	
	if (this.labellingActif){
		var markerOpts = {
	 		"icon": icon,
	 		"clickable": true,
	 		"labelText": "",
	 		"labelClass": "divGmapLabelNumSimple",
	 		"labelOffset": new GSize(3, -40)
	 	};
	 	marker = new LabeledMarker(point, markerOpts);
	 }else marker=new GMarker(point,icon);

	var tabs=new Array();

	if (!ident)ident=this.nbMarker;
	
	marker.ident=ident;	
	marker.html=html_clic;
	marker.tabHtml=new Array();
	if (html_sidebar.length>0)marker.tabHtml=html_sidebar;
	else marker.tabHtml.push(html_clic);
 	var obj_gmap=this;
	var nb=marker.tabHtml.length;
	marker.listeBulleActive =obj_gmap.listeBulleActive;
	marker.windowclose = 'infowindowclose';
		GEvent.addListener(marker,"click",function(){
			var params={'id':'pasdeclustering','clusteredMarkers':new Array(),'clusterMarker':marker};
			for (var i=0;i<marker.tabHtml.length;i++){
				params.clusteredMarkers[i]={'html':marker.tabHtml[i],'tabHtml':new Array(marker.tabHtml[i])};
			}
			clickSurUnMarkerCluster(params);

			/*	if (nb>1){
					gmap.affSideBar_v2ByTabHtml(html_sidebar,250);
					marker.openInfoWindowHtml(html_clic);
				}else{

					var data=html_clic;
					affUrlInDivFromHtml(data);
					marker.openInfoWindowHtml(data);
				}*/
			});

	if (nb>1 && this.labellingActif)marker.labelText_=nb;

	this.tabMarker[this.nbMarker]=marker;
	//this.google_map.addOverlay(marker);
	return this.nbMarker;
}


function ajouteMarkerWithTabsI(lat,lng,icon,tabInfos){
	this.nbMarker++;
	var point = new GLatLng(lat,lng);
	this.tabMarker[this.nbMarker]=new GMarker(point,icon);
	this.tabInfos[this.nbMarker]=tabInfos;

	this.setWindowHtmlMarkerByTabInfos(this.nbMarker,tabInfos);
	this.setTabsMarkerByTabInfos(this.nbMarker,tabInfos);
	
	this.google_map.addOverlay(this.tabMarker[this.nbMarker]);

	return this.nbMarker;
}
function setWindowHtmlMarkerByTabInfos(idMarker,tabInfos){
	var html=getHTML_byTabInfos(tabInfos);
	GEvent.clearListeners(this.tabMarker[idMarker],"click")
	GEvent.addListener(this.tabMarker[idMarker],"click",function(){this.openInfoWindowHtml(html);});			
}
function setTabsMarkerByTabInfos(idMarker,tabInfos){
	var tabs=getGtab_byTabInfos(tabInfos);
	GEvent.clearListeners(this.tabMarker[idMarker],"dblclick");
	GEvent.addListener(this.tabMarker[idMarker],"dblclick",function(){this.openInfoWindowTabsHtml(tabs);});
}
function regenereHTMLEtTabs(){
	for (x=1;x<this.nbMarker;x++){
		this.setWindowHtmlMarkerByTabInfos(x,this.tabInfos[x]);
		this.setTabsMarkerByTabInfos(x,this.tabInfos[x]);
	}
}
function affMsgAttente(msg){
	var gmap=document.getElementById(this.div_gmap);
	var obj=affMsgAttenteParDessusInDiv(gmap,"_gmap","<img src=/config_v3/imgs_defaut/loading/roue16x16.gif /><br/>Recherche en cours...");
	
	//affDefileRechercheCommune(obj,gmap.getAttribute("dpts"));
}
function cacheMsgAttente(){
	effaceMsgAttenteParDessus("_gmap");
}	

function affMsgInfos(html,w,h){
	var infos=document.getElementById(this.div_infos);
	if (!infos)return;
	var gmap=document.getElementById(this.div_gmap);
	var decal=0;


	infos.style.top=gmap.offsetTop+gmap.offsetHeight;
	infos.style.left=gmap.offsetLeft;
	infos.style.width=gmap.offsetWidth;
	infos.style.height=h;
	infos.style.backgroundColor="#FFFFFF";
	infos.style.opacity=0.89;
	infos.style.filter="alpha(opacity=89)";
	infos.style.KhtmlOpacity=0.89;
	//infos.style.border="1px";
	infos.innerHTML=html;					

	infos.style.visibility="visible";
}
function cacheMsgInfos(){
	var infos=document.getElementById(this.div_status);
	infos.style.visibility="hidden";
}	

function affSideBar(html,w,div_sb,div_gm){
	var sb=document.getElementById(div_sb);
	var gmap=document.getElementById(div_gm);
	
	sb.style.top=gmap.offsetTop;
	sb.style.left=gmap.offsetLeft+gmap.offsetWidth;
	sb.style.width=w;
	sb.style.height=gmap.offsetHeight;
	sb.style.backgroundColor="#FFFFFF";
	sb.style.opacity=0.99;
	//infos.style.border="1px";
	sb.innerHTML=html;					

	sb.style.visibility="visible";
}
function affSideBar_v2(html,w){
	var sb_gene=document.getElementById(this.div_sidebar_gene);
	var sb_contenu=document.getElementById(this.div_sidebar_contenu);
	
	sb_gene.style.top=this.gmap.offsetTop;
	sb_gene.style.left=(this.gmap.offsetLeft+this.gmap.offsetWidth)-w;
	this.gmap.style.width=(this.gmap.offsetWidth-w);
	this.gmap.style.left=0-(w/2);
	sb_gene.style.width=w;
	sb_gene.style.height=this.gmap.offsetHeight;
	sb_gene.style.backgroundColor="#FFFFFF";
	sb_gene.style.opacity=0.9;
	sb_contenu.style.opacity=0.80;
	sb_contenu.innerHTML=html;					
	this.google_map.checkResize();
	//nomDivCurr=div_sb_gene;
	//opcacite=0;
	//affDivWithFondu();
	sb_gene.style.visibility="visible";
}

function affSideBar_v2ByTabHtml(tabHtml,w){

	var sb_gene=document.getElementById(this.div_sidebar_gene);
	var sb_contenu=document.getElementById(this.div_sidebar_contenu);
		sb_gene.style.top=this.gmap.offsetTop;
		sb_gene.style.left=(this.gmap.offsetLeft+this.gmap.offsetWidth)-w;
		this.gmap.style.width=(this.gmap.offsetWidth-w);
		this.gmap.style.left=0-(w/2);
		sb_gene.style.width=w;
		sb_gene.style.height=this.gmap.offsetHeight;
		sb_gene.style.backgroundColor="#FFFFFF";
		sb_gene.style.opacity=0.9;
		sb_contenu.style.opacity=0.80;


		var html="";
		for (i=0;i<tabHtml.length;i++){

			html+=tabHtml[i];
			affUrlInDivFromHtml(tabHtml[i]);
		}

		sb_contenu.innerHTML=html;
		this.google_map.checkResize();
		sb_gene.style.visibility="visible";
}


function affDivWithFondu(){
	var div=document.getElementById(nomDivCurr);

	div.style.opacity=opacite;
	opacite=opacite+0,1;
	to=window.setTimeout("affDivWithFondu",10000);
	if (opacite>1)window.clearTimeout(to);
}	

function cacheSideBar(){
	var sidebar=document.getElementById(this.div_sidebar_gene);
	if (!sidebar)return;
	sidebar.style.visibility="hidden";
	this.google_map.checkResize();
	this.gmap.style.width=this.largeurInit;
	this.gmap.style.left=0;
}

function efface1sur2(){
	for (i=1;i<this.tabMarker.length;i+=2){
		this.tabMarker[i].hide();
	}
}
function inverseAffichage(){
	for (i=1;i<this.tabMarker.length;i++){
		if (this.tabMarker[i].isHidden())this.tabMarker[i].show();
		else this.tabMarker[i].hide();
	}
}



function afficheRechInfo(rech_info){

	for (i=1;i<this.tabMarker.length;i++){
		var infos_curr=this.tabInfos[i];
				
		var affiche=false;
		for (j=0;j<infos_curr.length;j++){

			var info_curr=infos_curr[j];

			if (
					info_curr.getNbPers()>=rech_info.getNbPersMin() && info_curr.getNbPers()<=rech_info.getNbPersMax()  
				&&	info_curr.getNbEpi()>=rech_info.getNbEpiMin() && info_curr.getNbEpi()<=rech_info.getNbEpiMax()
				&&	info_curr.getNbChmb()>=rech_info.getNbChmbMin() && info_curr.getNbChmb()<=rech_info.getNbChmbMax()
				&&  rech_info.estTypeOK(info_curr.getType())
				&&  rech_info.refExiste(info_curr.getRef())
				&&  (!rech_info.getAni() || (rech_info.getAni() && info_curr.getAni()=="O"))
				&&  (!rech_info.getHandi() || (rech_info.getHandi() && info_curr.getHandi()=="O"))
				){ 
				this.tabInfos[i][j].affichee(true);
				affiche=true;
			}else{
				this.tabInfos[i][j].affichee(false);
			}
		}
		if (affiche)this.tabMarker[i].show();
		else this.tabMarker[i].hide();
	}
	this.regenereHTMLEtTabs();					
}

function affRecherche(rech_info){

	//window.setTimeout("googlemap.affMsgAttente()",100);

}





function getHTML_byTabInfos(tabInfos){
	if (tabInfos.length<1)return "";

	var html="<TABLE width=100><TR><TD><BR><FONT face=verdana size=1>";
	html+="Commune de <B>"+tabInfos[0].getCommune();
	html+="</B><BR><HR>";
	
	var nbGite=0;
	var nbChambre=0;
	var nbGeGs=0;
	var nbEnfant=0;
	var nbCamping=0;
	for (i=0;i<tabInfos.length;i++){
		if (tabInfos[i].estAffichee()){
			if (tabInfos[i].getType()=="G")nbGite++;
			if (tabInfos[i].getType()=="H")nbChambre++;
			if (tabInfos[i].getType()=="GS")nbGeGs++;
			if (tabInfos[i].getType()=="E")nbEnfant++;
			if (tabInfos[i].getType()=="CA")nbCamping++;
		}
	}

	if (nbGite>0){
		if (nbGite>1)html+="<BR>"+nbGite+" Gites ruraux";
		else html+="<BR>"+nbGite+" Gite rural";
	}
	if (nbChambre>0){
		if (nbChambre>1)html+="<BR>"+nbChambre+" Chambres";
		else html+="<BR>"+nbChambre+" Chambre"; 
	}
	if (nbGeGs>0){
		if (nbGeGs>1)html+="<BR>"+nbGeGs+" Gites d\'étape sejour";
		else html+="<BR>"+nbGeGs+" Gite d\'étape sejour";
	}
	if (nbEnfant>0){
		if (nbEnfant>1)html+="<BR>"+nbEnfant+" Gites d\'enfant";
		else html+="<BR>"+nbEnfant+" Gite d\'enfant";
	}
	if (nbCamping>0){
		if (nbCamping>1)html+="<BR>"+nbCamping+" Campings";
		else html+="<BR>"+nbCamping+" Camping";
	}

	html+="</FONT></TD></TR></TABLE>";

	return html;
}

function getGtab_byTabInfos(tabInfos){
	if (tabInfos.length<1)return "";

	var tabs=new Array();
	
	for (i=0;i<tabInfos.length;i++){
		if (tabInfos[i].estAffichee())
			tabs.push(new GInfoWindowTab("Details",getHTML_byInfos(tabInfos[i])));
	}

	return tabs;
}
function getHTML_byInfos(infos){
	var html="<TABLE cellpadding=0 cellspacing=0 border=0><TR><TD>";

	html+=infos.getHtmlDesc();

	html+="</TD></TR></TABLE>";

	return html;
}

function setTabRefGiteByTrscWeb_Ajax(info_rech,googlemap,dpt,base,date_debut,duree){
	var addr="/lib/ajax/traiteRequete.php";
	var sending="requeteTRSCWEB_type=REQ1&date_deb="+date_debut+"&dpt="+dpt+"&duree="+duree+"&base="+base;
	var xhr_local=creeObjHttpRequest();		
	xhr_local.onreadystatechange = function(){
		if( (xhr_local.readyState == 4) && xhr_local.status == 200){
			reponse = clean(xhr_local.responseXML.documentElement);
							
			var itms=reponse.getElementsByTagName("REPONSES");
			if (itms[0].childNodes[0].childNodes[0]){
				var nb_rep=parseInt(itms[0].childNodes[1].childNodes[0].nodeValue);
				if (nb_rep>0){			
					var tabOut=new Array();
					for (k=2;k<(2+nb_rep);k++){
						tabOut.push(parseInt(itms[0].childNodes[k].childNodes[0].nodeValue));
					}
					info_rech.setTabRef(tabOut);
					googlemap.afficheRechInfo(info_rech);
					googlemap.cacheMsgAttente();
				}
			}
		
		}
	}
	googlemap.affMsgAttente();
	xhr_local.open("POST",addr,true);
	xhr_local.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
	xhr_local.send(sending);
}	
function getDateString(j,m,a){
	var date="";
	if (j<10)date+="0"+parseInt(j,10);
	else date+=j;
	if (m<10)date+="0"+parseInt(m,10);
	else date+=m;
	date+=a;
	return date;
}



function affichePointCurrGL(googlemap,form,form2,id_session,affichageSimpleListeCourante){
	if (!googlemap)return;
	var addr="/lib/ajax/gMap.php";
	if (!id_session){
		var sess = getQueryStringVal('PHPSESSID');
		tabSess = sess.split("#");
		id_session = tabSess[0];
	}
	var sending="session="+id_session;
	if (affichageSimpleListeCourante)sending+="&affichageSimpleListeCourante=O";
	if(googlemap.inseeActif)sending+="&inseeActive=O";
	if (form){
		if (window.desactiveForm)desactiveForm(form);
		
		if (form.jour && form.mois && form.annee && form.duree && (form.jour.value!="0") && (form.mois.value!="0") && (form.annee.value!="0") && (form.jour.value!="") && (form.mois.value!="") && (form.annee.value!=""))sending=sending+"&date_deb="+getDateString(form.jour.value,form.mois.value,form.annee.value)+"&duree="+form.duree.value;
		if (form.epis)sending=sending+"&epis="+escape(form.epis.value);
		if (form.EPI)sending=sending+"&epis="+escape(form.EPI.value);
		if (form.nb_pers)sending=sending+"&nb_pers="+escape(form.nb_pers.value);
		if (form.NBP)sending=sending+"&nb_pers="+escape(form.NBP.value);
		if (form.nb_chambres)sending=sending+"&nb_chambres="+escape(form.nb_chambres.value);
		if (form.NBCH)sending=sending+"&nb_chambres="+escape(form.NBCH.value);
		if (form.animal)sending=sending+"&animal="+form.animal[0].checked;
		if (form.ANI)sending=sending+"&animal="+form.ANI[0].checked;
		if (form.handi)sending=sending+"&handi="+form.handi[0].checked;
		if (form.label)sending=sending+"&label="+form.label.value;
        if (form.RUB)if(form.RUB.value!=-1){sending=sending+"&RUB="+form.RUB.value};
		if (form.acc)sending=sending+"&acc[0]="+form.acc.value;
		if (form.ACC){
			sending=sending+"&yaACC=O";
			if (form.ACC.length>0){
				for (var i=0;i<form.ACC.length;i++){
					var obj=form.ACC[i];
					if (obj.type=="checkbox" && obj.checked)sending=sending+"&acc["+i+"]="+form.ACC[i].value;
				}
			}
		}
		if (form.cla)sending=sending+"&cla[0]="+form.cla.value;
		if (form.chk_date)sending=sending+"&chk_date="+form.chk_date.checked;
		else sending=sending+"&chk_date=true";
		if (form.DEB)sending+="&date_deb="+form.DEB.value;
		if (form.NBJ)sending+="&duree="+form.NBJ.value;
		
	}
		
	if (!form2 && form)form2=form;	

	if (form2){
		if (window.desactiveForm)desactiveForm(form2);
		
		if (form2.chk_acc_LOCAT_cla_GITES && form2.chk_acc_LOCAT_cla_GITES.checked)sending=sending+"&acc[0]=LOCAT&cla[0]=GITES";
		if (form2.chk_acc_LOCAT_cla_RESID && form2.chk_acc_LOCAT_cla_RESID.checked)sending=sending+"&acc[1]=LOCAT&cla[1]=RESID";
		if (form2.chk_acc_LOCAT_cla_CAMPI && form2.chk_acc_LOCAT_cla_CAMPI.checked)sending=sending+"&acc[2]=LOCAT&cla[2]=CAMPI";
		if (form2.chk_acc_HOTEL_cla_HOTEL && form2.chk_acc_HOTEL_cla_HOTEL.checked)sending=sending+"&acc[3]=HOTEL&cla[3]=HOTEL";
		if (form2.chk_acc_HOTEL_cla_CHAMB && form2.chk_acc_HOTEL_cla_CHAMB.checked)sending=sending+"&acc[4]=HOTEL&cla[4]=CHAMB";
	}
	if (googlemap && googlemap.paramAjxToAdd)sending+="&"+googlemap.paramAjxToAdd;

	//Gildas : comprends pas pourquoi on fait ça?
	//si on fait une liste avec un moteur AJAX avec un lien comme liste-hebergement.html?ACC=G&CRITINIT=O
	//A chaque fois qu'on afficheras la carte, elle ne seras pas cohérente... J'enleve en attendant
	//CF fiche 149090
	/*var tabVarQs=getTabValInQueryString();
	for (var i=0;i<tabVarQs.length;i++){
        if(tabVarQs[i][0]=="RUB"){
           if(form){if (form.RUB){if(form.RUB.value==-1){sending+="&"+tabVarQs[i][0]+"="+tabVarQs[i][1];}}}
           else {sending+="&"+tabVarQs[i][0]+"="+tabVarQs[i][1];}//modif 27/04/11 pour prise en compte de RUB sans form (fiche 148361)
        }else{
             sending+="&"+tabVarQs[i][0]+"="+tabVarQs[i][1];
        }
        
	}*/


	var xhr_local=creeObjHttpRequest();		
	xhr_local.onreadystatechange = function(){
		if( (xhr_local.readyState == 4) && xhr_local.status == 200){
			googlemap.effaceMarkeurs();
            reponse = clean(xhr_local.responseXML.documentElement);

			var nbrep=reponse.childNodes.length;
			var nbheber=0;
			
			for (var i=0;i<nbrep;i++){
				if (reponse.childNodes[i].childNodes[0].childNodes[0]){
					var identUniq=reponse.childNodes[i].getAttribute("identUnique");
					var lat=reponse.childNodes[i].childNodes[0].childNodes[0].nodeValue;
					var lng=reponse.childNodes[i].childNodes[1].childNodes[0].nodeValue;
					if (reponse.childNodes[i].childNodes[2].childNodes[0])
						var ico=unescape(reponse.childNodes[i].childNodes[2].childNodes[0].nodeValue);
					else var ico="";
					var html_clic=(reponse.childNodes[i].childNodes[3].childNodes[0].nodeValue);
					var nbOnglet=reponse.childNodes[i].childNodes[4].childNodes.length;

					if (nbOnglet==0)nbheber++;
					else nbheber+=nbOnglet;

					var htmlOnglet=new Array();
					for (j=0;j<nbOnglet;j++){
						htmlOnglet.push((reponse.childNodes[i].childNodes[4].childNodes[j].childNodes[0].nodeValue));
					}
					
					//googlemap.ajouteMarkerWithTabs2(lat,lng,ico,html_clic,htmlOnglet);
					googlemap.ajouteMarkerWithTabsEtSideBar(lat,lng,ico,html_clic,htmlOnglet,identUniq);
					//googlemap.ajouteMarkerWithTabsEtSideBar(lat,lng,ico,html_clic,htmlOnglet);
				}
			}						
			googlemap.manageMarker();
			googlemap.affMsgInfos("<FONT face=Verdana size=1 color=black><B>"+nbheber+" Réponses</B></FONT>",200,15);
			googlemap.cacheMsgAttente();
			
			if (window.getVersionIE && getVersionIE()<7){
				googlemap.setTypeMap(G_PHYSICAL_MAP);
				googlemap.setTypeMap(G_NORMAL_MAP);
			}
			if (form && window.reactiveForm)reactiveForm(form);
			if (form2 && window.reactiveForm)reactiveForm(form2);
		}
	}
	googlemap.cacheSideBar();
	googlemap.affMsgAttente();

	googlemap.effaceMarkeurs();
	xhr_local.open("POST",addr,true);
	xhr_local.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
	xhr_local.send(sending);
}


function iteaGMAP_loadByXml(googlemap,xml){
    googlemap.effaceMarkeurs();//test bug affichage carte
	var nbrep=xml.childNodes.length;
	for (var i=0;i<nbrep;i++){
		var identUniq=xml.childNodes[i].getAttribute("ident");
		var lat=xml.childNodes[i].childNodes[0].childNodes[0].nodeValue;
		var lng=xml.childNodes[i].childNodes[1].childNodes[0].nodeValue;
		if (xml.childNodes[i].childNodes[2].childNodes[0])
			var ico=unescape(xml.childNodes[i].childNodes[2].childNodes[0].nodeValue);
		else var ico="";
		var html=unescape(xml.childNodes[i].childNodes[3].childNodes[0].nodeValue);
		googlemap.ajouteMarkerWithTabsEtSideBar(lat,lng,ico,html,"",identUniq);
	}
	googlemap.manageMarker();
	googlemap.cacheMsgAttente();
}

function iteaGMAP_load_listeCourante(googlemap,objMap){
	if (!googlemap)return;
	var addr="/lib/ajax/map.php";
	googlemap.effaceMarkeurs();
	googlemap.affMsgAttente();
	var sending="session="+getQueryStringVal('PHPSESSID');
	sending+="&affichageSimpleListeCourante=O";
    var classe = objMap.className;
    if(classe.indexOf('carto_favoris')>0 ){
        sending+='&listeFavoris=1';
    }
	if(googlemap.inseeActif)sending+="&inseeActive=O";
	affMsgAttenteParDessusInDiv(objMap,"carto_v2");
	appelAjaxXMLToFunc(addr,sending,function(reponse){
		iteaGMAP_loadByXml(googlemap,reponse);
		effaceMsgAttenteParDessus("carto_v2");
	});
}

function revelePointParmisLesAutres(objGmap,ident,params){
	objGmap.setPictoByIdentAndShowBulle(ident,params);
}

function iteaGMAP_zoomSurCoordonnees(params){
	if(!params.x && !params.y)
		gmap.resetCentre();
	else{
		if(!params.z)params.z = 9;
		gmap.setCentre(params.x,params.y, params.z);
                gmap.xchargement=params.x;
                gmap.ychargement=params.y;
	}
}


function iteaGMAP_withForm(form){
	affichePointCurrGL(gmap,form);
}
function iteaGMAP_withLstCurr(){
    if($('liLst_elem_1LstFavori')){
        iteaGMap_reload();
    }
    else{
        affichePointCurrGL(gmap,'','','',true);
    }
	
}
function iteaGMAP_revelePicto(ident,params){
	revelePointParmisLesAutres(gmap,ident,params);
}
function iteaGMAP_setElemDeListeClickToVisuCarte(params){
	if (!params.classeATraiter)params.classeATraiter="span_lst_visuOnCartoCurr";
	$$("."+params.classeATraiter).each(function (obj){
		obj.observe("click",function (evt){
			if (params.callback)params.callback(this);
			var ident=this.getAttribute("identUnique"); 
			iteaGMAP_revelePicto(ident,params);
			if (params.update)params.update(this);
			var classSelect=params.classeATraiter+"_select";
			$$("."+classSelect).each(function(obj){obj.removeClassName(classSelect);});
			$(obj).addClassName(classSelect);
		});
	}
	);
}

function iteaGMAP_initForFiche(){
	$$(".div_itea_GMAP").each(function (obj){
		var lat=obj.getAttribute("latitude");
		var lng=obj.getAttribute("longitude");
		var picto=obj.getAttribute("picto");
		var map= new GMap2(obj);
		map.addControl(new GSmallMapControl());
		var gll=new GLatLng(lat,lng);
		map.setCenter(gll,8);
		var ico=getIcon("/config_v3/imgs_defaut/google_map/punaise.png");
		var opts={
			icon:ico
		}
		var marker=new GMarker(gll,opts);
		map.addOverlay(marker);

	});
}

function iteaGMAP_initForListe(ident){
	var carto = document.getElementById(ident);
		var lat=carto.getAttribute("latitude");
		var lng=carto.getAttribute("longitude");
		var picto=carto.getAttribute("picto");
		var map= new GMap2(carto);
		map.addControl(new GSmallMapControl());
		var gll=new GLatLng(lat,lng);
		map.setCenter(gll,8);
		var ico=getIcon("/config_v3/imgs_defaut/google_map/punaise.png");
		var opts={
			icon:ico
		}
		var marker=new GMarker(gll,opts);
		map.addOverlay(marker);

}


function iteaGMap_init(params){
	var objMap=$$(".iteaGMAP_liste_v2").first();
	var mode='iteaGMAP_load_listeCourante';
	if (!objMap){
		objMap=$("google_map");
		mode='iteaGMAP_withForm';
	}
	if (objMap){
		window.gmap=new OBJGoogleMap(objMap.id,params.x,params.y,params.z,params.kml);
		window.gmap.setCentre(params.x,params.y,params.z);
		window.gmap.activeLabelling(params.lbl.on);
		if(params.insee)window.gmap.activeClustering(eval(params.clust.on));
		else window.gmap.activeClustering(params.clust.on);
		if(params.listeBulle)window.gmap.activeListeBulle(eval(params.listeBulle.on));
		if(params.insee)window.gmap.activeInsee(eval(params.insee.on));
		window.gmap.checkResize();
		if (params.clust.img)window.gmap.setClusterImage(params.clust.img);
		else window.gmap.setClusterImage("http://www.itea.fr/itea/images/GDF/punaise_G.gif");
		if(params.autoCentre)window.gmap.activeAutoCentre(eval(params.autoCentre.on));
		if (mode=='iteaGMAP_load_listeCourante')iteaGMAP_load_listeCourante(window.gmap,objMap);
		if (mode=='iteaGMAP_withForm')iteaGMAP_withForm();
	}
}
function iteaGMap_reload(){
	var objMap=$$(".iteaGMAP_liste_v2").first();
	if (objMap && window.gmap){
		iteaGMAP_load_listeCourante(window.gmap,objMap);	
	}
}
 

function iteaGMAPStreetView_initForFiche(paramsCarte, paramsStreetView){

    var mapManager = {// objet pour gérer l'affichage de la street view
            sv : new google.maps.StreetViewService(),
            map : null,
            divMap : null,
            divView : null,
            panorama :null,
            setMap : function(divMap,mapOptions){
                this.map = new google.maps.Map(divMap,mapOptions);
                },
            processSVData : function (data, status){
                    if (status != google.maps.StreetViewStatus.OK){  
                        $("div_itea_streetView").hide();
                    }   
                } ,
            gll : null,
            setGll : function(lat,lng){
                this.gll = new google.maps.LatLng(lat,lng);
                },
            mapOptions : {  
                },
            setPanoramaForMap: function (){
                var panoOptions = {
                    position: this.gll,
                    pov:({
                        heading: 270,
                        pitch: 0,
                        zoom: 1
                  })
                };
                var panorama = new  google.maps.StreetViewPanorama($("div_itea_streetView"),panoOptions);
                this.map.setStreetView(panorama);
                this.sv.getPanoramaByLocation(this.gll, 50, this.processSVData);
            },
            setPanorama:function (){
                var panoOptions = {
                    position: this.gll,
                    pov:({
                        heading: 270,
                        pitch: 0,
                        zoom: 1
                  })
                };
                this.panorama = new  google.maps.StreetViewPanorama($("div_itea_streetView"),panoOptions);
                this.sv.getPanoramaByLocation(this.gll, 50, this.processSVData);
            }
            
        }
        mapManager.divMap = $("div_itea_GMAP");
        mapManager.divView = $("div_itea_streetView");
        mapManager.StreetViewType = paramsStreetView.embed;
		var lat=mapManager.divMap.getAttribute("latitude");
		var lng=mapManager.divMap.getAttribute("longitude");
        var zoom = $('div_itea_streetView').getAttribute('zoom');
        var streetWidth = $('div_itea_streetView').offsetWidth;
        var streetHeight = $('div_itea_streetView').offsetHeight;
        var mapWidth = $('div_itea_GMAP').offsetWidth;
        var mapHeight = $('div_itea_GMAP').offsetHeight;
        if(typeof(zoom) =='undefined' || zoom == null){
            zoom = parseInt(paramsCarte.z);
            if(!zoom){
                zoom = 11;
            }
        }
        else{
            zoom= parseInt(zoom);
        }
        if(paramsCarte.img){
            var ico=paramsCarte.img;
        }
        else{
            var ico="/config_v3/imgs_defaut/google_map/punaise.png";
        }
        if(paramsStreetView.img){
            var ico=paramsStreetView.img;
        }
        else{
            var ico="/config_v3/imgs_defaut/google_map/punaise.png";
        }
        
        var srcStreet = "http://maps.googleapis.com/maps/api/streetview?size="+streetWidth+"x"+streetHeight+"&location="+lat+","+lng+"&heading="+paramsStreetView.heading+"&fov="+paramsStreetView.fov+"&pitch="+paramsStreetView.pitch+"&sensor=false";

        /****** au cas où la carte est statique (image) *****/
        if(paramsCarte.embed){
           var src = "http://maps.googleapis.com/maps/api/staticmap?center="+lat+","+lng+"&zoom="+zoom+"&size="+mapWidth+"x"+mapHeight+"&maptype=roadmap&markers=color:green%7Clabel:G%7C"+lat+","+lng+"&sensor=false";
           $("div_itea_GMAP").innerHTML = '<img src="'+src+'" width="100%" height="100%" />';
           // pour la street view on regarde si il faut générer une image statique ou pas
           if(paramsStreetView.embed){
                $('div_itea_streetView').innerHTML = '<img src="'+srcStreet+'" width="100%" height="100%" />';  
           }
           else{
               mapManager.setGll(lat,lng);
                mapManager.setPanorama();
                var marker = new google.maps.Marker({
                    position: mapManager.gll,
                    map: mapManager.panorama,
                    icon: ico
                });
           }
        }
        /****** au cas où la carte est dynamique *****/
        else{
            mapManager.setGll(lat,lng);
            mapManager.mapOptions = {
                center: mapManager.gll,
                zoom: zoom,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            mapManager.setMap(mapManager.divMap,mapManager.mapOptions);
            var marker = new google.maps.Marker({
                position: mapManager.gll,
                map: mapManager.map,
                icon: ico
             });
             if(paramsStreetView.embed){
                 $('div_itea_streetView').innerHTML = '<img src="'+srcStreet+'" width="100%" height="100%" />';  
             }
             else{
                mapManager.setPanoramaForMap();
             }
        }
}

