 var map;
 var geoCodeur;
 
 var markers = new Array();
 var markerClusterer;
 
  var circles = new Array();


 var lastIntervalleDate = new Array();
 
 var visibleInfoWindow;
 
 // For load
 var flag = false;
 var timeoutChargement;

 var MyMar;
 
 //Premier chargement
 var premierC = true;
 
 //For capitolWords
 var markerCW;
 var delimitationCW;
 
 //For menus right
 var isVisibleTw = true;
 var isVisibleCw = false;
 var isVisibleLastEQ = true;
 
 var loadedM1 = false;
 
 
 this.visibilityMarkesEnd = true;
 
  // GOOGLE MAP V2  
  function initialize() 
  {
	
	if(GBrowserIsCompatible()) 
	{
	  map = new GMap2(document.getElementById('myMap'));
	  map.setCenter(new GLatLng(41.41848463514069, -100.44202912499999), 5);
	  map.addControl(new GLargeMapControl());
	  map.addControl(new GMapTypeControl());
	  
	  geoCodeur = new GClientGeocoder();

	  this.debutChargement();
	  
	 GEvent.addListener(map, "zoomend", function() 
	 {
		if ( map.getZoom() >= intermediaireZoom )
		{
			if (  visibilityEarthQuakesM1 )
				updateVisibilityIn(markersEarthQuakesM1, getIntervalleDate());
			if (  visibilityEarthQuakesM2_5 )	
				updateVisibilityIn(markersEarthQuakesM2_5, getIntervalleDate());
			if (  visibilityEarthQuakesM5 )
				updateVisibilityIn(markersEarthQuakesM5, getIntervalleDate());
		}
		else 
		if ( map.getZoom() < intermediaireZoom )
		{
			if (  visibilityEarthQuakesM1 )
				updateVisibilityOut(markersEarthQuakesM1, getIntervalleDate());
			if (  visibilityEarthQuakesM2_5 )	
				updateVisibilityOut(markersEarthQuakesM2_5, getIntervalleDate());
			if (  visibilityEarthQuakesM5 )
				updateVisibilityOut(markersEarthQuakesM5, getIntervalleDate());
		}	
		
	 });
		
	}
	
	initializValuesMenus();
	
	
	
  }
	  
	  //initialize les valeurs visibility par rapport au checkBox ( Evite les erreurs 
function initializValuesMenus() 
{  
 
	document.getElementById("c1").checked = false;
	this.visibilityEarthQuakesM2_5 = document.getElementById("c2").checked;
	this.visibilityEarthQuakesM5 = document.getElementById("c3").checked;
	this.visibilityStorms = document.getElementById("c4").checked; 

}
  
 function refreshMap() 
 {
	if (markerClusterer != null) 
	{
	  markerClusterer.clearMarkers();
	}
	var zoom =  this.intermediaireZoom;
	var size = 40;
	var style = -1;
	zoom = zoom == -1 ? null : zoom;
	size = size == -1 ? null : size;
	style = style == "-1" ? null: parseInt(style, 10);
	markerClusterer = new MarkerClusterer(map, markers, {maxZoom: zoom, gridSize: size, styles: styles[style]});
}
	 

  
//Recupere la liste des dates de l'intervalle
function getIntervalleDate()
{
	var myListe = new Array();

	var posSliderLeft = document.getElementById('zoom-handle-1').offsetLeft;
	var posSliderRight = document.getElementById('zoom-handle-2').offsetLeft;
	
	for ( var i = 0; i<this.val.length; i++ )
	{
		var posDivLeft = document.getElementById("theDates").offsetLeft  + document.getElementById(this.val[i]).offsetLeft
		var posDivRight = document.getElementById("theDates").offsetLeft  + document.getElementById(this.val[i]).offsetLeft + parseFloat(document.getElementById(this.val[i]).style.width);
		
		if (  posDivLeft >= posSliderLeft &&  posDivLeft <= posSliderRight  )
			myListe[this.val[i]] = this.val[i];
		else if ( posDivRight >= posSliderLeft &&  posDivRight <= posSliderRight )
				myListe[this.val[i]] = this.val[i];
	}
		
	return myListe;
}  


function visibilityFirstLoad()
{
		if (  isLoadedTwitter && isLoadedEarthQuakes && isLoadedStorms )
		{
			visibilityMarkers();
			
			
			
			if ( this.visibilityStorms )
			{
				updateVisibilityOut (this.markersStorms, this.getIntervalleDate() );
				updateVisibilityIn (this.markersStorms, this.getIntervalleDate() );
			}	
			
			// if ( this.visibilityEarthQuakesM1 )
			// {
				// updateVisibilityOut (this.markersEarthQuakesM1, this.getIntervalleDate() );
				// updateVisibilityIn (this.markersEarthQuakesM1, this.getIntervalleDate() );
			// }	
			
		
			if ( this.visibilityEarthQuakesM2_5 )
			{
				updateVisibilityOut (this.markersEarthQuakesM2_5, this.getIntervalleDate() );
				updateVisibilityIn (this.markersEarthQuakesM2_5, this.getIntervalleDate() );
			}	
			
			if ( this.visibilityEarthQuakesM5 )
			{
				updateVisibilityOut (this.markersEarthQuakesM5, this.getIntervalleDate() );
				updateVisibilityIn (this.markersEarthQuakesM5, this.getIntervalleDate() );
			}	
			
		
				updateVisibilityOut (this.markersTwitter, this.getIntervalleDate() );
				updateVisibilityIn (this.markersTwitter, this.getIntervalleDate() );

			if ( this.markers )
				this.refreshMap();
			
			clearTimeout(this.timeoutChargement);
			this.finChargement();
			
				
				twitterReload();
		}	

	
}

function visibilityM1Load()
{
		if (   isLoadedEarthQuakes  )
		{
			visibilityMarkers();
				
			updateVisibilityOut (this.markersEarthQuakesM1, this.getIntervalleDate() );
			updateVisibilityIn (this.markersEarthQuakesM1, this.getIntervalleDate() );

			if ( this.markers )
				this.refreshMap();
			
			this.loadedM1 = true;
			clearTimeout(this.timeoutChargement);
			this.finChargement();
		}
		else
			this.timeoutChargement = setTimeout( "visibilityM1Load ()", 1);
		
		
}
  
  
function visibilityMarkers ( )
{

	var intervalleDate = this.getIntervalleDate();
	
	var listeUploadIn = new Array();
	var listeUploadOut = new Array();
	
	var expression = new RegExp("^[0-9]{4}-[0-9]{2}-[0-9]{2}$");
		
	
	//Premier enregistrement de l'intervalle
	if ( this.premierC  )
	{
		this.lastIntervalleDate = intervalleDate;
		
		for ( var temp =0; temp< this.val.length; temp++ )
			listeUploadOut[this.val[temp]] = this.val[temp];
		
		 listeUploadIn = intervalleDate;
		 
		 this.premierC = false
	}
	else
	{	
	
		for ( i in this.lastIntervalleDate )
		{	
			//Si c'est de la forme AAAA-MM-JJ
			for ( j in intervalleDate )
			{
				if (expression.test(i) && expression.test(j))
				{	
					//On test si la nouvelle valeur n'existe pas dans l'ancien intervalle
					if ( !this.lastIntervalleDate[j] )
					{
						listeUploadIn[j]=j;
						
					}	
											
					//On test si l'ancienne valeur n'existe pas dans le nouvel intervalle				
					if ( !intervalleDate[i] )
					{
						listeUploadOut[i]=i;
					
					}	
						
				}
			}
		}	
	}	
	
	//TWITTER
	if ( visibilityTwitter )
	{
		
		updateVisibilityIn(this.markersTwitter, listeUploadIn);
		updateVisibilityOut(this.markersTwitter, listeUploadOut);
	}
	
	
	//EARTHQUAKES MAGNITUDE 1
	if (  visibilityEarthQuakesM1 )
	{	
		updateVisibilityIn(this.markersEarthQuakesM1, listeUploadIn);
		updateVisibilityOut(this.markersEarthQuakesM1, listeUploadOut);

	}
	
	//EARTHQUAKES MAGNITUDE 2.5
	if (  visibilityEarthQuakesM2_5 )
	{	
		updateVisibilityIn(this.markersEarthQuakesM2_5, listeUploadIn);
		updateVisibilityOut(this.markersEarthQuakesM2_5, listeUploadOut);
	}
	
	//EARTHQUAKES MAGNITUDE 5
	if (  visibilityEarthQuakesM5 )
	{
		updateVisibilityIn(this.markersEarthQuakesM5, listeUploadIn);
		updateVisibilityOut(this.markersEarthQuakesM5, listeUploadOut);
	}
	
	//STORMS
	if (  visibilityStorms )
	{
		updateVisibilityIn(this.markersStorms, listeUploadIn);
		updateVisibilityOut(this.markersStorms, listeUploadOut);
	}
	
	//On mes a jour la liste des anciens intervalles
	this.lastIntervalleDate = intervalleDate;
	
	if ( this.markers )
			this.refreshMap();

	this.visibilityMarkesEnd = true;		
}




//Rend invisible les markers en dehors l'intervalle 
function updateVisibilityOut (listMarkers, intervalL)
{	
	for ( i in  intervalL )
	{
		//Si c'est de la forme AAAA-MM-JJ
		
		

		var expression = new RegExp("^[0-9]{4}-[0-9]{2}-[0-9]{2}$");
		if ( expression.test(i))
		{	
			//Si il y a des markers dans cet interval
			if ( listMarkers[i] )
			{	//On affiche les markers
			
				with ( listMarkers[i] )
				{			
					
						this.setChange ( listeMarker, false );
					
				}	
			
			}
				
		}	
	
	}
	
	this.flag = false;
	
	
	
	
}


//Rend visible les markers dans l'intervalle 
function updateVisibilityIn (listMarkers,  intervalL)
{
	for ( i in  intervalL )
	{
		//Si c'est de la forme AAAA-MM-JJ
		
		var expression = new RegExp("^[0-9]{4}-[0-9]{2}-[0-9]{2}$");
		if ( expression.test(i))
		{	
			//Si il y a des markers dans cet interval
			if ( listMarkers[i] )
			{	//On affiche les markers
				with ( listMarkers[i] )
				{			
					
						this.setChange ( listeMarker, true );
						
				}	
			
			}
				
		}	
	
	}
	
	this.flag = false;
	
	

}

function setChange ( listOfMarker, changeType )
{

	if ( changeType )
	{
		for ( var i=0; i<listOfMarker.length; i++ )
		{ 
			with (listOfMarker[i]) 
			{
				// mark.set_visible(true);
				mark.show();
				
				if ( circle && this.map.getZoom() >= this.intermediaireZoom )
					this.map.addOverlay ( circle );
				
				//On ajoute les markers du clustering 
				
				if ( mark.getTitle()  == "Disaster" )
					this.pushMarker ( mark );
			}
	
		}
	
	}
	else
	{
		for ( var i=0; i<listOfMarker.length; i++ )
		{	
			with (listOfMarker[i])
			{
				// mark.set_visible(false);
				mark.hide();
				if ( circle )
					this.map.removeOverlay ( circle );
				
				//On Supprime les markers du clustering
				clearMarker ( mark )
			}
			
		}
	}	


}

//Fonction qui verifie si un marker est dans une liste et qui l'ajoute à celle ci en suite
function pushMarker ( mark )
{
	if ( this.markers )
		for ( var i =0; i< this.markers.length; i++ )
		{
			if  ( this.markers[i] == mark )
				return;			
		
		}
	this.markers.push ( mark );	


}

function clearMarker ( mark )
{
	if ( this.markers )
		for ( var i =0; i< this.markers.length; i++ )
		{
			if  ( this.markers[i] == mark )
			{//On inverse avec le dernier element et on supprime le dernier element
			
				var temp = this.markers[this.markers.length-1];
				this.markers[this.markers.length-1] = this.markers[i];
				this.markers[i] = temp;
				
				
				this.markers.pop();
			
				
			
				return;		
			}		
		
		}
}
  


//Place un marqueur par rapport à un point
function placerMarker ( lat, lng, info, type, date, myLocation )
{

var tweet = "an earthquake near "+myLocation;

	switch (  type )
	{
		case "EARTHQUAKESM1" :
		//On teste si la liste de nom date existe 
		
		
			if ( this.markersEarthQuakesM1[date] )
			{//On ajoute la valeur à la liste
				with ( this.markersEarthQuakesM1[date] )
				{
				
					listeMarker[listeMarker.length] = placer (lat, lng, info, date, "EARTHQUAKESM1", tweet );					
				}
			}
			else
			{//On crée la liste
			
				var mDArray = new markerDateArray ( date, new Array() );
				with ( mDArray )
				{
					listeMarker[0] = placer (lat, lng, info, date, "EARTHQUAKESM1", tweet);
					
					
				}
				
				this.markersEarthQuakesM1[date] = mDArray;
			
			}
			
	
		break;
		
		case "EARTHQUAKESM2_5" :
		
		//On teste si la liste de nom date existe 
			if ( this.markersEarthQuakesM2_5[date] )
			{//On ajoute la valeur à la liste
				with ( this.markersEarthQuakesM2_5[date] )
				{
				
					listeMarker[listeMarker.length] = placer (lat, lng, info, date, "EARTHQUAKESM2_5", tweet);					
					
				}
			}
			else
			{//On crée la liste
			
				var mDArray = new markerDateArray ( date, new Array() );
				with ( mDArray )
				{
					listeMarker[0] = placer (lat, lng, info, date, "EARTHQUAKESM2_5", tweet);
					
					
				}
				
				this.markersEarthQuakesM2_5[date] = mDArray;
			
			}
		
		break;
		
		case "EARTHQUAKESM5" :
			//On teste si la liste de nom date existe 
			
			
			if ( this.markersEarthQuakesM5[date] )
			{//On ajoute la valeur à la liste
			
				
				with ( this.markersEarthQuakesM5[date] )
				{
				
					listeMarker[listeMarker.length] = placer (lat, lng, info, date, "EARTHQUAKESM5", tweet);					
					
				}
			}
			else
			{//On crée la liste
			
				var mDArray = new markerDateArray ( date, new Array() );
				with ( mDArray )
				{
					listeMarker[0] = placer (lat, lng, info, date, "EARTHQUAKESM5", tweet);
					
					
				}
				
				this.markersEarthQuakesM5[date] = mDArray;
			
			}
			
			
		
		break;
		
		case "STORMS" :
				//On teste si la liste de nom date existe 
				
			tweet = "a storm near "+myLocation;
			if ( this.markersStorms[date] )
			{//On ajoute la valeur à la liste
				with ( this.markersStorms[date] )
				{
				
					listeMarker[listeMarker.length] = placer (lat, lng, info, date, "STORMS", tweet);					
					
				}
			}
			else
			{//On crée la liste
			
				var mDArray = new markerDateArray ( date, new Array() );
				with ( mDArray )
				{
					listeMarker[0] = placer (lat, lng, info, date, "STORMS", tweet);
					
					
				}
				
				this.markersStorms[date] = mDArray;
			
			
			}
			
			
			
		break;
	
	}
	
	if ( this.nbStorms == this.nbStormsDepart )
		this.isLoadedStorms = true;
		
	if ( this.nbEarthQuakes == this.nbEarthQuakesDepart && this.nbListe == this.nbListeMax )
		this.isLoadedEarthQuakes = true;	

		
	

}

function placer (lat, lng, info, date, type, tweet)
{
	
		var icon = new GIcon(G_DEFAULT_ICON);
		var circle;
		var latlng = new GLatLng(lat, lng);
		
		
		switch ( type )
		{
			case "EARTHQUAKESM1" :
				icon.image = "./images/earthquake_1.png";
				icon.shadow = "./images/earthquake_3_shadow.png";
				icon.iconSize  = new GSize(24, 24);
				circle = drawCircle(latlng,  this.diametreM1, '', "#ffe160");
			break;
			
			case "EARTHQUAKESM2_5" :
				icon.image = "./images/earthquake_2.png";
				icon.shadow = "./images/earthquake_3_shadow.png";
				icon.iconSize  = new GSize(24, 24);
				circle = drawCircle(latlng,  this.diametreM2_5, '', "#ffac07");
			break;
			
			case "EARTHQUAKESM5" :
				icon.image = "./images/earthquake_3.png";
				icon.shadow = "./images/earthquake_3_shadow.png";
				icon.iconSize  = new GSize(24, 24);
	
				circle = drawCircle(latlng,  this.diametreM5, '', "#ff512c");
				
			break;
			
			case "STORMS" :
				icon.image = "./images/storm_1.png";
				icon.shadow = "./images/storm_2_shadow.png";
				icon.iconSize  = new GSize(24, 24);
			break;		
		}
		
		
		
	
		var marker = new GMarker(latlng, {icon: icon, title: "Disaster"});
	
		var info = info+"<BR /><center><a href=\"http://twitter.com/?status=Hey! There is "+tweet+" (via @mapize)\" target=\"_blank\"  style=\"text-decoration:none;\" ><img src=\"./images/tweetthis.gif\" style=\"border:0px;\"/></a><center>";

		
		GEvent.addListener(marker,"click", function() 
		{
			 marker.openInfoWindowHtml(info);
			 
									
		});
		

		
	var MyMar = new MyMarker( marker, date, circle ); 		
	
	
	
			
				
	return MyMar;									 
}

//FOR TWITTER 
function placerMarkerTY ( location, info, myDate, type, isNew  )
{
	var temp = true;

	switch (type)
	{
		case "TWITTER" :
			//On teste si la liste de nom date existe 
			if ( this.markersTwitter[myDate] )
			{//On ajoute la valeur à la liste
				
				//on fait un test pour savoir si le marker n'ai pas deja dans la liste
				with ( this.markersTwitter[myDate] )
				{
					for (var i = 0; i< listeMarker.length; i++ )
					{
						with ( listeMarker[i] )
						{
							if ( date == myDate && location == mark.getTitle() )
							{
								temp = false;
							}	
						}
						
					}
					
				}	
				
				if ( temp )
					placerTY (location, info, myDate, this.markersTwitter[myDate], isNew);		
					
			}
			else
			{//On crée la liste
			
				var mDArray = new markerDateArray ( myDate, new Array() );
				placerTY (location, info, myDate, mDArray, isNew);
				
				
				this.markersTwitter[myDate] = mDArray;
				
				
			}
		break;	
		
	}

	if ( this.nbTweets == this.nbTweetsDepart )
		this.isLoadedTwitter = true;	
	
	
}

//FOR TWITTER 
function placerTY (location, info, date, liste, isNew)
{

		if (geoCodeur)
		{
			
			
			geoCodeur.getLocations(location, function(response)
			{
	
					 if (response.Status.code == 200) 
					{ 
						
						var icon = new GIcon(G_DEFAULT_ICON);
						// icon.image = "http://chart.apis.google.com/chart?cht=mm&chs=24x32&chco=FFFFFF,90EDF6,000000&ext=.png";
						
						
						if ( isNew )
						{
							icon.image = "./images/twitter_new.png";
							icon.shadow  = "./images/twitter_shadow.png";
							icon.iconSize  = new GSize(24, 24);
						}
						else
						{
							icon.image = "./images/twitterMark.png";
							icon.shadow  = "./images/twitter_shadow.png";
							icon.iconSize  = new GSize(24, 24);
						}	
						// icon.shadowSize   = new GSize(32, 32);
						
						var place = response.Placemark[0];
						var point = new GLatLng(place.Point.coordinates[1],  place.Point.coordinates[0]);

						var marker = new GMarker(point, {icon: icon, title: location });
						
						// marker.hide();
					
							
						GEvent.addListener(marker,"click", function() 
						{
							 marker.openInfoWindowHtml(info);
							 
													
						});
		
						map.addOverlay (marker);	
							
						with ( liste )
						{
							listeMarker[listeMarker.length] = new MyMarker( marker, date );
						}	
						
					}
				});

			
					 
									 
										 
		 
		
		}

		
}


function MyMarker( mark, date, circle ) 
{
	this.mark=mark;
	this.date=date;
	this.circle=circle;
}



function changeVisibility ( type )
{
	
	this.flag = true;
	if ( type == "EARTHQUAKESM1" && !this.loadedM1 )
	{
		this.debutChargement();
		// this.timeoutChargement = setTimeout( "chargement ()", 1);
	}	
	else
	{
	
		this.debutChargement();
		this.timeoutChargement = setTimeout( "chargement ()", 1);
	}
		
	switch (type)
	{
		case "EARTHQUAKESM1" :
			if ( this.visibilityEarthQuakesM1 )
			{
				
				this.visibilityEarthQuakesM1 = false;
				updateVisibilityOut (this.markersEarthQuakesM1, this.getIntervalleDate() );

				
			}	
			else
			{
				
				if ( !this.loadedM1 )
				{
									
					this.nbEarthQuakesDepart=-1;		
					this.nbEarthQuakes=0;
					this.isLoadedEarthQuakes = false;
					
					this.nbListeMax = 1;
					this.nbListe = 0;
					
					this.timeoutChargement = setTimeout( "visibilityM1Load ()", 1);
					hearthQuakesLoad();
					visibilityM1Load();

				}
				this.visibilityEarthQuakesM1 = true;
				updateVisibilityIn (this.markersEarthQuakesM1, this.getIntervalleDate() );
		
			}
					
	
		break;
		
		case "EARTHQUAKESM2_5" :
			if ( this.visibilityEarthQuakesM2_5 )
			{
				this.visibilityEarthQuakesM2_5 = false;
				updateVisibilityOut (this.markersEarthQuakesM2_5, this.getIntervalleDate() );

			}	
			else
			{
				this.visibilityEarthQuakesM2_5 = true;	
				updateVisibilityIn (this.markersEarthQuakesM2_5, this.getIntervalleDate() );
			}
		break;
		
		case "EARTHQUAKESM5" :
			if ( this.visibilityEarthQuakesM5 )
			{
				this.visibilityEarthQuakesM5 = false;
				updateVisibilityOut (this.markersEarthQuakesM5, this.getIntervalleDate() );

			}		
			else
			{
				this.visibilityEarthQuakesM5 = true;	
				updateVisibilityIn (this.markersEarthQuakesM5, this.getIntervalleDate() );
			}
		break;
		
		case "STORMS" :
			if ( this.visibilityStorms )
			{
				this.visibilityStorms = false;
				updateVisibilityOut (this.markersStorms, this.getIntervalleDate() );
				
			}	
			else
			{
				this.visibilityStorms = true;	
				updateVisibilityIn (this.markersStorms, this.getIntervalleDate() );
			}
		break;
	
	
	}

		if ( this.markers )
			this.refreshMap();
}



function displayOption ( visible )
{
	
	if ( visible )
		document.getElementById("listCheckBoxExtra").style.display="block"; 
	else
		document.getElementById("listCheckBoxExtra").style.display="none"; 

}



function changeContinent ()
{
	switch ($F("continent"))
	{
		case "America" :
			this.map.setCenter(new GLatLng(37.09024,-95.712891));
		break;
		
		case "Europa" :
			this.map.setCenter(new GLatLng(54.5259614,15.2551187));
		break;
		
		case "Africa" :
			this.map.setCenter(new GLatLng( -8.783195, 34.508523));
		break;
		
		case "Asia" :
			this.map.setCenter(new GLatLng( 34.047863, 100.6196553));
		break;
		
		case "Oceania" :
			this.map.setCenter(new GLatLng( -13.8848005, 173.050575));
		break;

	}


}


//Possede un nom de type AAAA-MM-JJ et la liste de tous les markers à cette date
function markerDateArray( nom, listeMarker ) 
{
	this.nom=nom;
	this.listeMarker=listeMarker;
}


function chargement ( )
{
	if ( !this.flag  )	
	{
		clearTimeout(this.timeoutChargement);
		//document.getElementById("loadingMap").style.display="none"; 
		
	}
	else
		setTimeout( "chargement ()", 1);
		
}



function debutChargement ()
{
	// document.getElementById("loadingMap").style.display="block"; 
}

function finChargement ()
{
	// document.getElementById("loadingMap").style.display="none"; 
}



 
 function placerLawmaker ( st, id )
 {
	var state = st+", united states";
	if (geoCodeur)
	{
		
		
		geoCodeur.getLocations(state, function(response)
		{
				if ( markerCW )
					map.removeOverlay (markerCW);
				if ( delimitationCW )
					map.removeOverlay (delimitationCW);	
					
				 if (response.Status.code == 200) 
				{ 
					
					var icon = new GIcon(G_DEFAULT_ICON);
					icon.image = "http://assets.capitolwords.org/v2/images/legislators/"+id+".jpg";
					icon.iconSize  = new GSize(40/1.5, 50/1.5);
					icon.shadow   = "";
					
					var place = response.Placemark[0];
					var point = new GLatLng(place.Point.coordinates[1],  place.Point.coordinates[0]);

					markerCW = new GMarker(point, {icon: icon, title: state });

					map.addOverlay (markerCW);
					
					delimitationCW = new GPolygon(stateBorders[st], false, "#99B3CC", 50, true);
					map.addOverlay(delimitationCW);

				}
			});
	}
	
 }
 
 function deployerMenu ( m )
 {
	switch ( m )
	{
		case "cp_tw" :
			if ( isVisibleTw )
			{
				 Effect.SlideUp('cp_tw');
				 isVisibleTw = false;
			
			}
			else
			{
				 Effect.SlideDown('cp_tw');
				 isVisibleTw = true;
				 
			}
		break;	
		
		case "cp_tw2" :
			if ( isVisibleCw )
			{
				 Effect.SlideUp('cp_tw2');
				 isVisibleCw = false;
			
			}
			else
			{
				 Effect.SlideDown('cp_tw2');
				 isVisibleCw = true;
				 
			}
		break;
		
		case "last_eq" :
			if ( isVisibleLastEQ )
			{
				 Effect.SlideUp('last_eq');
				 isVisibleLastEQ = false;
			
			}
			else
			{
				 Effect.SlideDown('last_eq');
				 isVisibleLastEQ = true;
				 
			}
		break;
	
	}
	
 }
 
 function changeReaction ()
{

		if ( visibilityTwitter )
		{
			this.visibilityTwitter = false;
			updateVisibilityOut (this.markersTwitter, this.getIntervalleDate() );
			if ( visibleInfoWindow )
				visibleInfoWindow.close();
				
		}
		else
		{
			this.visibilityTwitter = true;
			updateVisibilityIn (this.markersTwitter, this.getIntervalleDate() );
		
		}



}


function selectM5( lng, lat)
{
	 map.setCenter(new GLatLng(lat, lng), 7);
}
 


	document.write("<script type=\"text/javascript\">initialize();</script>");





 
 
