	var imgLayerInProgress;
	var imgObj;
	var blur;
	var idTimerLayer;
	var idTimerLayer2;
	
	var tGoogleMapTemplate =('<iframe width="658" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="#{url1}"></iframe><br /><br /><small><a href="javascript:void(0);" onclick="Effect.BlindUp(\'googleMapAgence\');"><img border="0" src="/Include/EBIncludes/Images/common_css/arrow_up.gif" alt="up" style="cursor:pointer" width="12" width="12" /></a><a href="#{url2}" location="_blank"><img border="0" src="/Include/EBIncludes/Images/common_css/add.gif" alt="max" style="cursor:pointer" width="12" width="12" /></a></small>');
	var hGoogleMapLiens = {"EXCIDEUIL" : {url1: "http://maps.google.fr/maps?f=q&amp;hl=fr&amp;geocode=&amp;q=Excideuil,+zc+le+maine&amp;ie=UTF8&amp;t=h&amp;cid=45330668,1043529,8011068903309689464&amp;s=AARTsJqArYIN75yIs47rpdY-q9QOasw3tQ&amp;ll=45.646688,1.178284&amp;spn=0.672029,1.167297&amp;z=9&amp;iwloc=A&amp;output=embed",
										 url2: "http://maps.google.fr/maps?f=q&amp;hl=fr&amp;geocode=&amp;q=Excideuil,+zc+le+maine&amp;ie=UTF8&amp;t=h&amp;cid=45330668,1043529,8011068903309689464&amp;ll=45.646688,1.178284&amp;spn=0.672029,1.167297&amp;z=9&amp;iwloc=A&amp;source=embed"},
						  "THENON"	  : {url1: "http://maps.google.fr/maps?f=q&amp;hl=fr&amp;geocode=&amp;q=THENON+GRANDCHAMP&amp;sll=47.15984,2.988281&amp;sspn=15.545168,39.550781&amp;ie=UTF8&amp;ll=45.3087,1.138458&amp;spn=0.502739,1.235962&amp;z=10&amp;iwloc=A&amp;cid=45139093,1071266,1030574793342776425&amp;output=embed&amp;s=AARTsJoitqAKRCQGCSla9Qw2aoCz2UUYBA",
						                 url2: "http://maps.google.fr/maps?f=q&amp;hl=fr&amp;geocode=&amp;q=THENON+GRANDCHAMP&amp;sll=47.15984,2.988281&amp;sspn=15.545168,39.550781&amp;ie=UTF8&amp;ll=45.3087,1.138458&amp;spn=0.502739,1.235962&amp;z=10&amp;iwloc=A&amp;cid=45139093,1071266,1030574793342776425&amp;source=embed"},
						  "LA_COQUILLE": {url1: "http://maps.google.fr/maps?f=q&amp;hl=fr&amp;geocode=&amp;q=LA+COQUILLE+GRANDCHAMP&amp;ie=UTF8&amp;ll=45.550482,0.980959&amp;spn=0.007815,0.019312&amp;z=14&amp;iwloc=A&amp;cid=45541098,976730,12647108603016907675&amp;output=embed&amp;s=AARTsJq2ohw5RTKZEYQtALiHosE7TFv4kQ",
						                  url2: "http://maps.google.fr/maps?f=q&amp;hl=fr&amp;geocode=&amp;q=LA+COQUILLE+GRANDCHAMP&amp;ie=UTF8&amp;ll=45.550482,0.980959&amp;spn=0.007815,0.019312&amp;z=14&amp;iwloc=A&amp;cid=45541098,976730,12647108603016907675&amp;source=embed"},
						  "ST_YRIEIX_LA_PERCHE" : {url1:"http://maps.google.fr/maps?f=q&amp;hl=fr&amp;geocode=&amp;q=ST+YRIEIX+LA+PERCHE+grandchamp&amp;sll=45.516409,1.206155&amp;sspn=0.25019,0.617981&amp;ie=UTF8&amp;ll=45.590017,1.238708&amp;spn=0.249992,0.617981&amp;z=11&amp;iwloc=A&amp;cid=45515124,1204997,2795945887233653241&amp;output=embed&amp;s=AARTsJqAu5RHT5gYHV9gcpHRY7QqJksHYg",
												   url2:"http://maps.google.fr/maps?f=q&amp;hl=fr&amp;geocode=&amp;q=Grandchamp+la+coquille,+9+rue+de+la+r%C3%A9publique&amp;ie=UTF8&amp;t=h&amp;cid=45515124,1204997,2795945887233653241&amp;ll=45.664926,1.271667&amp;spn=0.335905,0.583649&amp;z=10&amp;iwloc=A&amp;source=embed"},
						  "HAUTEFORT" :{url1:"http://maps.google.fr/maps?f=q&amp;hl=fr&amp;geocode=&amp;q=HAUTEFORT+GRANDCHAMP&amp;ie=UTF8&amp;ll=45.283704,1.137772&amp;spn=0.06281,0.154495&amp;z=13&amp;iwloc=A&amp;cid=45264859,1129360,8215941846323316341&amp;output=embed&amp;s=AARTsJrEMtA2d_-7exU2fNDAApHHYDSkKw",
										url2:"http://maps.google.fr/maps?f=q&amp;hl=fr&amp;geocode=&amp;q=Grandchamp+la+coquille,+9+rue+de+la+r%C3%A9publique&amp;ie=UTF8&amp;t=h&amp;cid=45264859,1129360,8215941846323316341&amp;ll=45.415804,1.196136&amp;spn=0.337397,0.583649&amp;z=10&amp;iwloc=A&amp;source=embed"}
						}

	function imgLayerAction(e){
		imgObj	  =	$(Event.element(e));
		var oImg;
		var offsetPos = imgObj.cumulativeOffset();
		
		
		oImg = $('imgLayer');
		
		 
		
		idTimerLayer = window.setTimeout(function(){ 
			if (oImg.visible()) oImg.hide();			
			oImg.src = imgObj.src;
			oImg.setStyle(imgObj.getDimensions());
			oImg.setStyle({'top': offsetPos[1] + 'px', 'left': offsetPos[0] +'px'});
			oImg.show();
			
			$(oImg).morph({'width':'300px', 'height':'225px','queue': 'end'}); 
		}, 1000);

	}
	
	function init(){
		resizeAction();
		var oImg = new Element('img', { 'id': 'imgLayer' }).setStyle({'position':'absolute', 'top':'0', 'left':'0', 'display':'none'});
		$(document.body).insert(oImg);
		
		imgLayerInProgress = false;
		$$('img.AcceuilImgAgence').each(function(e){Event.observe(e,'mouseover',imgLayerAction.bindAsEventListener(e));})
		Event.observe('imgLayer','mouseout' ,function(){window.setTimeout(imgLayerHide,500);});
		
		tGoogleMapTemplate = new Template(tGoogleMapTemplate);
		
		$$('table.AccueilListeAgences td').each(function(e){Event.observe(e,'click',ActiveGoogleMap )});
	}

	
	function imgLayerHide(){	
		var dimension = imgObj.getDimensions();
		var param = {'width': dimension.width + 'px',
					'height': dimension.height + 'px',
					'queue': 'end'};		
		window.clearTimeout(idTimerLayer);
		
		$('imgLayer').morph(param);	
	}
	
	function resizeAction(){
		if ($(document.body).getWidth() < 940){
			$$('div.Publication').invoke('hide'); 
		}
		else{
			$$('div.Publication').invoke('show'); 	
		}	
	}
	
	function ActiveGoogleMap(e){
		var obj = $(Event.element(e));
		var objGoogleMap;
		var objTd;
		var sAgence;
		
		objGoogleMap = $('googleMapAgence');
		
		if (obj.tagName == "TD"){
			objTd = obj;
		}
		else{
			objTd = $(obj.ancestors().find(function(e){return e.tagName == "TD";}));		
		}
		
		if (objTd){
			new Effect.Highlight(obj);
		
			//on récupére le nom de l'agence
			sAgence = $F(objTd.childElements().find(function(e){return e.match('.NomAgence')}));
		
			//on insert dans le div la valeur du template fusionner avec les valeurs correspondante à l'agence
			objGoogleMap.update(tGoogleMapTemplate.evaluate(hGoogleMapLiens[sAgence]));
		
			//si le div n'est pas afficher on l'affiche
			if (! objGoogleMap.visible()){
				new Effect.BlindDown(objGoogleMap);
			}
		}
	}
	
	Event.observe(window, 'load', init, false);
	Event.observe(window, 'resize', resizeAction);