    //<![CDATA[
	
	/* *°*°*°* Déclarations des Cookies *°*°*°* */
	if($.cookie('time')== null){
	
	$.cookie('time','Last 90 days',{path:'/'});
	$.cookie('contract','All transfers',{path:'/'});
	
	$.cookie('timebdd','90days',{path:'/'});
	$.cookie('contractbdd','all',{path:'/'});
	
	$.cookie('monthcal','january',{path:'/'});
	$.cookie('yearcal','2009',{path:'/'});
	}
	
	/* *°*°*°* Déclarations des Variables *°*°*°* */
	// "map" est la variable qui définie la carte et "mgr" définie le marker manager
	var map,mgr;
	var t = 0;
	// Variables utiles à la création des polylines
	var tabBulle = [];
	var tabStartpts = [];
	var tabEndpts = [];
	var tabJoueur = [];
	var tabDate = [];
	var tabType = [];
	var tabDeal = [];
	var tabSalary = [];
	var tabTransferFee = [];
	var tabCurrency = [];
	var tabTransferFeeCurrency = [];
	var tabStatus = [];
	var tabPicture = [];
	var tabLogod = [];
	var tabLogoa = [];
	var tabFrom = [];
	var tabTo = [];
	var tabPolyline =[];
	
	var cible = "null";
	
	var polyline;
	var contrat;
	var from;
	var to;
	
	var colour = "#000000";
	var width = "2";
	//Variables pour l'affichage des flèches et du texte dans les modes venues et teams
	var team1,team2,team3,team4,team5;
	var venue1,venue2,venue3,venue4,venue5;
	var html1,html2,html3,html4,html5;
	//Variable pour l'affichage de la liste dans le mode transferts
	var htmliste,transf1;
	var liste = "";
	
	/* Création des caractéristiques des marqueurs */
	var icon = new GIcon();
		//ombre des marqueurs 
		icon.shadow = "./img/YouFootMap/shadow_mark.png";
		//taille des marqueurs
    	icon.iconSize = new GSize(21, 34);
		//taille ombre des marqueurs
    	icon.shadowSize = new GSize(39, 34);
		//point d'ancrage du marqueur sur la map
    	icon.iconAnchor = new GPoint(6, 20);
		//point d'ancrage de l'infobulle sur le marqueur
    	icon.infoWindowAnchor = new GPoint(5, 1);
	
	var iconContrat = new GIcon();
		//ombre des marqueurs 
		iconContrat.shadow = "./img/YouFootMap/shadow_contrat.png";
		//taille des marqueurs
    	iconContrat.iconSize = new GSize(12, 20);
		//taille ombre des marqueurs
    	iconContrat.shadowSize = new GSize(28, 20);
		//point d'ancrage du marqueur sur la map
    	iconContrat.iconAnchor = new GPoint(6, 20);
		//point d'ancrage de l'infobulle sur le marqueur
    	iconContrat.infoWindowAnchor = new GPoint(5, 1);
		
	var iconfavorite = new GIcon();
		//ombre des marqueurs 
		iconfavorite.shadow = "./img/YouFootMap/shadow_mark.png";
		//taille des marqueurs
    	iconfavorite.iconSize = new GSize(21, 34);
		//taille ombre des marqueurs
    	iconfavorite.shadowSize = new GSize(28, 20);
		//point d'ancrage du marqueur sur la map
    	iconfavorite.iconAnchor = new GPoint(6, 20);
		//point d'ancrage de l'infobulle sur le marqueur
    	iconfavorite.infoWindowAnchor = new GPoint(5, 1);
		

/* *°*°*°* Fin de Déclarations des variables *°*°*°* */

/* *°*°*°* Les Fonctions *°*°*°* */	
	/** I **/
	/*°* La fonction setupMap sert à initialiser la map selon les paramètres fournis *°*/
    function setupMap(){
		if (GBrowserIsCompatible()) {
			//1*Création de notre map à l'intérieur de la div avec id="map"
			map = new GMap2(document.getElementById("map"));
			//2*La carte est centrée sur la Latitude et la Longitude d'origine de l'utilisateur, avec un niveau de zoom de 6
			//var loc = new google.maps.LatLng(ClientLocation.latitude, ClientLocation.longitude);
			loc = new google.maps.LatLng(48.8372, 2.33);
			map.setCenter(loc, 6);
			
			//3*Affichage des éléments standards de l'interface utilisateur qu'on peux voir sur Google Maps maps.google.fr
			map.setUIToDefault();
			//4*Met la map satellite par defaut
			map.setMapType(G_PHYSICAL_MAP);
			//5*Création du markerManager
			mgr = new MarkerManager(map, {
				trackMarkers: true
			});
			//event lors du changement de type de map 
			GEvent.addListener(map, "maptypechanged", function(){
				removeFleche();
				//fleche();	
		 	}); 
			//6*Mise en place des limites de zoom
			G_PHYSICAL_MAP.getMinimumResolution = function () { return 2 };
            G_NORMAL_MAP.getMinimumResolution = function () { return 2 };
            G_SATELLITE_MAP.getMinimumResolution = function () { return 2 };
            G_HYBRID_MAP.getMinimumResolution = function () { return 2 };

            G_PHYSICAL_MAP.getMaximumResolution = function () { return 15 };
            G_NORMAL_MAP.getMaximumResolution = function () { return 18 };
            G_SATELLITE_MAP.getMaximumResolution = function () { return 18 };
            G_HYBRID_MAP.getMaximumResolution = function () { return 18 }; 
			//7*Définir la fonction lancée au démarrage de la map
			//window.setTimeout(setupFavorite, 0);
			//charge l'onglet deja selectionné dans la map en normal screen :
			loadonglet();
		}
		else {
			//7*affichage du message "Désolé, mais votre navigateur n'est pas compatible avec Google Maps".
			alert('Désolé, mais votre navigateur n\'est pas compatible avec Google Maps');
		}
	}
	
	/** II **/
	/*°* Fonction de création des marqueurs *°*/
	function createMarker(point, contenue, icon){
		var marker = new GMarker(point, {icon: icon});
			/* Mise en place d'un évènement qui lorsqu'on click sur le marqueur 
			 * ouvre l'infobulle avec le nombre de favoris écrit*/
			GEvent.addListener(marker, "click", function(){
				//marker.openExtInfoWindow(map,"customWindow",contenue,{beakOffset: 3});
				marker.openInfoWindowHtml("<b>" + contenue + "</b>");
			});
			return marker;
		}
	/*°* Fonction de suppression des marqueurs *°*/
	function clearMarkers(){
		mgr.clearMarkers();
	}

	/** III **/
	/*°* *°*/
	function setupFavorite(){
		//Appel des fonctions en charges de vider la carte de tous ces éléments
		clearMarkers();
		clearPolyline();
		removeFleche();
		removeListe();
		// Fin	
		$.cookie('onglet','o_1',{path:'/'});
		GDownloadUrl("/files/googlemap/favorite.php?_="+Math.random()+'&userid='+$.cookie('userId'), function(doc){
			var xmlDoc = GXml.parse(doc);
			var markers = xmlDoc.documentElement.getElementsByTagName("marker");
			for (var i = 0; i < markers.length; i++) {
				var lat = parseFloat(markers[i].getAttribute("lat"));
				var lng = parseFloat(markers[i].getAttribute("lng"));
				var point = new GLatLng(lat, lng);
				
				//regarde le type du marqueur		
				var type = markers[i].getAttribute("type");
				var slug = markers[i].getAttribute("slug");
				
				//complete les infobulles pour chaque type différents	
				if (type == 'Team') {
					var id =  markers[i].getAttribute("id");
					var nom = markers[i].getAttribute("nom");
					//var image = "<img style=\"width:75px; height:75px; float:left; margin-right:3px;\" src=\"/media/image/"+markers[i].getAttribute("img")+"\" alt="+ nom +"\" />";
					var image = "<img style=\"width:75px; height:75px; float:left; margin-right:3px;\" src="+markers[i].getAttribute("img")+" alt="+ nom +"\" />";
					var adresse = "<div style=\"width:250px;\">"+ markers[i].getAttribute("adresse") +"</div><div>" + markers[i].getAttribute("codepostal") +" "+markers[i].getAttribute("ville") + "</div>" +markers[i].getAttribute("pays");
				
					var content = "<a href=\"/teams/news/"+ slug +" \"> "+image +"</a><div style=\"width:300px;\"><a href=\"/teams/news/"+ slug +" \"> "+  nom +"</a><br><br>" + adresse+"</div>";

					map.addOverlay(createMarker(point, content, new GIcon(iconfavorite, "./img/YouFootMap/mark-team2.png")));
				}
				else if (type == 'Venue'){
					var id =  markers[i].getAttribute("id");
					var nom = markers[i].getAttribute("nom");
					//var image = "<img style=\"width:75px; height:75px; float:left; margin-right:3px;\" src=\"/media/image/"+markers[i].getAttribute("img")+"\" alt="+ nom +"\" />";
					var image = "<img style=\"width:75px; height:75px; float:left; margin-right:3px;\" src="+markers[i].getAttribute("img")+" alt="+ nom +"\" />";

					var adresse = "<div style=\"width:250px;\">"+ markers[i].getAttribute("adresse") +"</div><div>" + markers[i].getAttribute("codepostal") +" "+markers[i].getAttribute("ville") + "</div>" +markers[i].getAttribute("pays");
					var content = "<a href=\"/venues/view/"+ slug +" \"> "+image +"</a><div style=\"float:left;\"><a href=\"/venues/view/"+ slug +" \"> "+  nom +"</a><br><br>" + adresse+"</div>";
			
					map.addOverlay(createMarker(point, content, new GIcon(iconfavorite, "./img/YouFootMap/mark-venue2.png")))
				}
				else if (type == 'Match'){
					var startdate = markers[i].getAttribute("start_date");
					var venueName = markers[i].getAttribute("venue_name");
					var venueId = markers[i].getAttribute("venue_id");
					var venueSlug = markers[i].getAttribute("venueSlug");
					var id = markers[i].getAttribute("idmatch");
					
					var homeMediaId = markers[i].getAttribute("homeTeamMediaId");
					var homeId = markers[i].getAttribute("homeTeamId");
					var homeSlug = markers[i].getAttribute("homeSlug");
					var homeName = markers[i].getAttribute("homeTeamName");
					
					var awayMediaId = markers[i].getAttribute("awayTeamMediaId");
					var awayId = markers[i].getAttribute("awayTeamId");
					var awaySlug = markers[i].getAttribute("awaySlug");
					var awayName = markers[i].getAttribute("awayTeamName");
					
					//contenu de l'infobulle	
					var content = "<div style=\width:410px;\"><div style=\float:left;\"><div style=\"float:left; font-size:14px; margin-bottom:3px; width:200px;\"><a href=\"/teams/news/"+homeSlug+"\">"+homeName+"</a></div><div style=\"float:right; font-size:14px; text-align:right; margin-right:10px; margin-bottom:3px; width:200px;\"><a href=\"/teams/news/"+awaySlug+"\">"+awayName+"</a></div></div><div style=\"float:left; width:400px;\"><a href=\"/teams/news/"+homeSlug+"\"><img style=\"width:75px; height:75px; float:left; margin-right:3px;\" src=\"/media/image/"+homeMediaId+"\" alt="+ homeName +"\" /></a><a href=\"/teams/news/"+awaySlug+"\"><img style=\"width:75px; height:75px; float:right; margin-right:3px;\" src=\"/media/image/"+awayMediaId+"\" alt="+ awayName +"\" /></a></div><br><div style=\"margin-top:5px; width:400px; float:left;\">Place: <a href=\"/venues/view/"+venueSlug+"\">"+ venueName +"</a><br>Start time:"+ startdate +"<br>-><a href=\"/matches/view/"+slug+"\">See this match page</a></div></div>";

					map.addOverlay(createMarker(point, content, new GIcon(iconfavorite, "./img/YouFootMap/mark-match2.png")))
				}
			}
			
		});
		//change les classe des différents onglets
		$('#o_1').attr("class", "selected");
		$('#o_2').attr("class", "normal");
		$('#o_3').attr("class", "normal");
		$('#o_4').attr("class", "normal");
		$('#o_5').attr("class", "normal");
		
	}

	/*°* *°*/
	function setupTeam(){
		//Appel des fonctions en charges de vider la carte de tous ces éléments
		clearMarkers();
		clearPolyline();
		removeFleche();
		removeListe();
		//Fin
		$.cookie('onglet','o_2',{path:'/'});
		//fleche();
		GDownloadUrl("files/googlemap/team.php?_="+Math.random(), function(doc){
			var gmarkersA = [];
			var gmarkersB = [];
			var gmarkersC = [];
			var gmarkersD = [];
			var xmlDoc = GXml.parse(doc);
			var markers = xmlDoc.documentElement.getElementsByTagName("marker");
			for (var i = 0; i < markers.length; i++) {
				var lat = parseFloat(markers[i].getAttribute("lat"));
				var lng = parseFloat(markers[i].getAttribute("lng"));
				var point = new GLatLng(lat, lng);
				var favoris = markers[i].getAttribute("favoris");
				var slug = markers[i].getAttribute("slug");
				if(favoris == '') {
					favoris = 0;
				}
				
				//recupere données pour la bulle lors du click marker
				var id =  markers[i].getAttribute("id");
				var nom = markers[i].getAttribute("nom");
				var idimg = id.replace(/-/g,'');
				
				//var image = "<img style=\"width:75px; height:75px; float:left; margin-right:3px;\" src=\"/media/image/"+markers[i].getAttribute("img")+"\" alt="+ nom +"\" />";
				var image = "<img style=\"width:75px; height:75px; float:left; margin-right:3px;\" src="+markers[i].getAttribute("img")+" alt="+ nom +"\" />";
				
				var adresse = "<div style=\"width:250px;\">"+ markers[i].getAttribute("adresse") +"</div><div>" + markers[i].getAttribute("codepostal") +" "+markers[i].getAttribute("ville") + "</div>" +markers[i].getAttribute("pays");
				var content = "<a href=\"/teams/news/"+ slug +" \"> "+image +"</a><div style=\"width:300px;\"><a href=\"/teams/news/"+ slug +" \"> "+  nom +"</a><br><br>" + adresse+"<br>Number of fans : "+favoris+"</div>";
				
				switch(true)
				{
					case (favoris < 100) :
						var marker = createMarker(point, content, new GIcon(icon, "./img/YouFootMap/mark-team2.png"));
						gmarkersA.push(marker);
						break;
					case (favoris > 100 && favoris < 1000) :
						 var marker = createMarker(point, content, new GIcon(icon, "./img/YouFootMap/mark-team2.png"));
						 gmarkersB.push(marker);
						 break;
					case (favoris > 1000 && favoris < 5000) :
						var marker = createMarker(point, content, new GIcon(icon, "./img/YouFootMap/mark-team2.png"));
						gmarkersC.push(marker);
						break;
					case (favoris > 5000) :
						var marker = createMarker(point, content, new GIcon(icon, "./img/YouFootMap/mark-team2.png"));
						gmarkersD.push(marker);
						break;
				}
				
			}
			/*mgr.addMarkers(gmarkersA, 12);
			mgr.addMarkers(gmarkersB, 9);
			mgr.addMarkers(gmarkersC, 6);
			mgr.addMarkers(gmarkersD, 2);*/
			mgr.addMarkers(gmarkersA, 2);
			mgr.addMarkers(gmarkersB, 2);
			mgr.addMarkers(gmarkersC, 2);
			mgr.addMarkers(gmarkersD, 2);
			mgr.refresh();
		});
		
		//change les classe des différents onglets
		$('#o_1').attr("class", "normal");
		$('#o_2').attr("class", "selected");
		$('#o_3').attr("class", "normal");
		$('#o_4').attr("class", "normal");
		$('#o_5').attr("class", "normal");
	}

	/*°* *°*/
	function setupVenue(){
		//Appel des fonctions en charges de vider la carte de tous ces éléments
		clearMarkers();
		clearPolyline();
		removeFleche();
		removeListe();
		//Fin
		$.cookie('onglet','o_3',{path:'/'});
		//fleche();
		GDownloadUrl("/files/googlemap/venue.php?_="+Math.random(), function(doc){
			var gmarkersE = [];
			var gmarkersF = [];
			var gmarkersG = [];
			var gmarkersH = [];
			var xmlDoc = GXml.parse(doc);
			var markers = xmlDoc.documentElement.getElementsByTagName("marker");
			
			for (var i = 0; i < markers.length; i++) {
				var lat = parseFloat(markers[i].getAttribute("lat"));
				var lng = parseFloat(markers[i].getAttribute("lng"));
				var point = new GLatLng(lat, lng);
				
				//recupere attributs pour pouvoir afficher des la bulle lors du click du markeur
				var favoris = markers[i].getAttribute("favoris");
				var id =  markers[i].getAttribute("id");
				var slug =  markers[i].getAttribute("slug");
				var nom = markers[i].getAttribute("nom");
				var image = "<img style=\"width:75px; height:75px; float:left; margin-right:3px;\" src="+markers[i].getAttribute("img")+" alt="+ nom +"\" />";
				var adresse = "<div style=\"width:250px;\">"+ markers[i].getAttribute("adresse") +"</div><div>" + markers[i].getAttribute("codepostal") +" "+markers[i].getAttribute("ville") + "</div>" +markers[i].getAttribute("pays");
				var content = "<a href=\"/venues/view/"+ slug +" \"> "+image +"</a><div style=\"float:left;\"><a href=\"/venues/view/"+ slug +" \"> "+  nom +"</a><br><br>" + adresse+"<br>Number of fans : "+favoris+"</div>";
				
				switch(true)
				{
					case (favoris < 100) :
						var marker = createMarker(point, content , new GIcon(icon, "./img/YouFootMap/mark-venue2.png"));
						gmarkersE.push(marker);
						break;
					case (favoris > 100 && favoris < 1000) :
						 var marker = createMarker(point, content, new GIcon(icon, "./img/YouFootMap/mark-venue2.png"));
						 gmarkersF.push(marker);
						 break;
					case (favoris > 1000 && favoris < 5000) :
						var marker = createMarker(point, content, new GIcon(icon, "./img/YouFootMap/mark-venue2.png"));
						gmarkersG.push(marker);
						break;
					case (favoris > 5000) :
						var marker = createMarker(point, content, new GIcon(icon, "./img/YouFootMap/mark-venue2.png"));
						gmarkersH.push(marker);
						break;
				}
				
			}
			mgr.addMarkers(gmarkersE, 2);
			mgr.addMarkers(gmarkersF, 2);
			mgr.addMarkers(gmarkersG, 2);
			mgr.addMarkers(gmarkersH, 2);
			mgr.refresh();
		});
		
		//change les classe des différents onglets
		$('#o_1').attr("class", "normal");
		$('#o_2').attr("class", "normal");
		$('#o_3').attr("class", "selected");
		$('#o_4').attr("class", "normal");
		$('#o_5').attr("class", "normal");
	}
		
		/*°* *°*/
	function setupTodaymatches(){
		//Appel des fonctions en charges de vider la carte de tous ces éléments
		clearMarkers();
		clearPolyline();
		removeFleche();
		removeListe();
		//Fin
		$.cookie('onglet','o_4',{path:'/'});
		//fleche();
		GDownloadUrl("/files/googlemap/match.php?_="+Math.random(), function(doc){
			var gmarkersE = [];
			var gmarkersF = [];
			var gmarkersG = [];
			var gmarkersH = [];
			var xmlDoc = GXml.parse(doc);
			var markers = xmlDoc.documentElement.getElementsByTagName("marker");
			for (var i = 0; i < markers.length; i++) {
				var lat = parseFloat(markers[i].getAttribute("lat"));
				var lng = parseFloat(markers[i].getAttribute("lng"));
				var point = new GLatLng(lat, lng);
				
				var favoris = markers[i].getAttribute("favoris");
				var startdate = markers[i].getAttribute("start_date");
				var venueName = markers[i].getAttribute("venue_name");
				var venueId = markers[i].getAttribute("venue_id");
				var venueSlug =  markers[i].getAttribute("venueSlug");
				var id = markers[i].getAttribute("idmatch");
				var slug =  markers[i].getAttribute("slug");
				
				var homeMediaId = markers[i].getAttribute("homeTeamMediaId");
				var homeId = markers[i].getAttribute("homeTeamId");
				var homeSlug = markers[i].getAttribute("homeSlug");
				var homeName = markers[i].getAttribute("homeTeamName");
				
				var awayMediaId = markers[i].getAttribute("awayTeamMediaId");
				var awayId = markers[i].getAttribute("awayTeamId");
				var awaySlug = markers[i].getAttribute("awaySlug");
				var awayName = markers[i].getAttribute("awayTeamName");
				
				//contenu de l'infobulle	
				var content = "<div style=\width:410px;\"><div style=\float:left;\"><div style=\"float:left; font-size:14px; margin-bottom:3px; width:200px;\"><a href=\"/teams/news/"+homeSlug+"\">"+homeName+"</a></div><div style=\"float:right; font-size:14px; text-align:right; margin-right:10px; margin-bottom:3px; width:200px;\"><a href=\"/teams/news/"+awaySlug+"\">"+awayName+"</a></div></div><div style=\"float:left; width:400px;\"><a href=\"/teams/news/"+homeSlug+"\"><img style=\"width:75px; height:75px; float:left; margin-right:3px;\" src=\"/media/image/"+homeMediaId+"\" alt="+ homeName +"\" /></a><a href=\"/teams/news/"+awaySlug+"\"><img style=\"width:75px; height:75px; float:right; margin-right:3px;\" src=\"/media/image/"+awayMediaId+"\" alt="+ awayName +"\" /></a></div><br><div style=\"margin-top:5px; width:400px; float:left;\">Place: <a href=\"/venues/view/"+venueSlug+"\">"+ venueName +"</a><br>Start time:"+ startdate +"<br>Number of fans :"+favoris+"<br>-><a href=\"/matches/view/"+slug+"\">See this match page</a></div></div>";

				switch(true)
				{
					case (favoris < 100) :
						var marker = createMarker(point, content, new GIcon(icon, "./img/YouFootMap/mark-match2.png"));
						gmarkersE.push(marker);
						break;
					case (favoris > 100 && favoris < 1000) :
						var marker = createMarker(point, content, new GIcon(icon, "./img/YouFootMap/mark-match2.png"));
						gmarkersF.push(marker);
						 break;
					case (favoris > 1000 && favoris < 5000) :
						var marker = createMarker(point, content, new GIcon(icon, "./img/YouFootMap/mark-match2.png"));
						gmarkersG.push(marker);
						break;
					case (favoris > 5000) :
						var marker = createMarker(point, content, new GIcon(icon, "./img/YouFootMap/mark-match2.png"));
						gmarkersH.push(marker);
						break;
				}
		
			}
			mgr.addMarkers(gmarkersE, 2);
			mgr.addMarkers(gmarkersF, 2);
			mgr.addMarkers(gmarkersG, 2);
			mgr.addMarkers(gmarkersH, 2);
			mgr.refresh();
		});
		
		//change les classe des différents onglets
		$('#o_1').attr("class", "normal");
		$('#o_2').attr("class", "normal");
		$('#o_3').attr("class", "normal");
		$('#o_4').attr("class", "selected");
		$('#o_5').attr("class", "normal");
	}
	
	
	/*°* *°*/
	function setupTransfert(period, type){
		//Appel des fonctions en charges de vider la carte de tous ces éléments
		clearMarkers();
		clearPolyline();
		removeFleche();
		removeListe();
		//Fin
		//Appel de la fonction d'affichage de la liste
		listeTransfert();
		//Fin
		$.cookie('onglet','o_5',{path:'/'});
		cible = "null";
		var request = GXmlHttp.create();
		//request.open("GET", "/files/googlemap/polyline.php?date="+period+"&type="+type+"&_="+Math.random(), true);
		request.open("GET", "/googlemap/getTransfers/"+period+"/"+type+"/"+Math.random(), true);
		request.onreadystatechange = function(){
			if (request.readyState == 4) {
				var xmlDoc = GXml.parse(request.responseText);
				var lines = xmlDoc.documentElement.getElementsByTagName("line");
				liste='';
				liste += '<ul>';
				for (var i = 0; i < lines.length; i++) {
					var points = lines[i].getElementsByTagName("point");
					var joueur = lines[i].getAttribute("joueur");
					var from = points[0].getAttribute("clubd");
					var to = points[1].getAttribute("cluba");
					var logoa = lines[i].getAttribute("logoa");
					var logod = lines[i].getAttribute("logod");
					var picture = lines[i].getAttribute("picture");
					var date = lines[i].getAttribute("date");
					var type = lines[i].getAttribute("type");
					var deal = lines[i].getAttribute("deal");
					var transfer_fee = lines[i].getAttribute("transfer_fee");
					var salary = lines[i].getAttribute("salary");
					var transfer_fee_currency = lines[i].getAttribute("transfer_fee_currency");
					var currency = lines[i].getAttribute("currency");
					var status = lines[i].getAttribute("status");
					var pts = new Array();
					var ptsbulle = new GLatLng((parseFloat(points[0].getAttribute("lat")) + parseFloat(points[1].getAttribute("lat"))) / 2, (parseFloat(points[0].getAttribute("lng")) + parseFloat(points[1].getAttribute("lng"))) / 2);
					for (var j = 0; j < points.length; j++) {
						pts[j] = new GLatLng(parseFloat(points[j].getAttribute("lat")), parseFloat(points[j].getAttribute("lng")));
					}
					
					var startlat = parseFloat(points[0].getAttribute("lat"));
					var startlng = parseFloat(points[0].getAttribute("lng"));
					var startpts = new GLatLng(startlat, startlng);
					
					var endlat = parseFloat(points[1].getAttribute("lat"));
					var endlng = parseFloat(points[1].getAttribute("lng"));
					var endpts = new GLatLng(endlat, endlng);
					
					map.addOverlay(createPolyline(pts, joueur, ptsbulle, startpts, endpts, from, to, logoa, logod, picture, date, type, deal, salary, transfer_fee ,currency, transfer_fee_currency, status));
				}
				

				liste += '</ul>';
				document.getElementById("zoneListe").innerHTML = liste;
				/*var content = document.getElementById("zoneListe").innerHTML;
				$('#mydiv').html(content);*/
			}
		}
		
		$('#o_1').attr("class", "normal");
		$('#o_2').attr("class", "normal");
		$('#o_3').attr("class", "normal");
		$('#o_4').attr("class", "normal");
		$('#o_5').attr("class", "selected");
		request.send(null);
	}
	
	/** IV **/
	/*°* *°*/
	function createPolyline(pts, joueur, ptsbulle, startpts, endpts, from, to, logoa, logod, picture, date, type, deal, salary, transfer_fee,currency, transfer_fee_currency, status){
	
		var polyOptions = {geodesic:false, clickable:true};
		polyline = new GPolyline(pts, "#7D8886", 2, 1, polyOptions);
		
		tabStartpts[t] = startpts;
		tabEndpts[t] = endpts;
		tabBulle[t] = ptsbulle;
		tabJoueur[t] = joueur;
		tabDate[t] = date;
		tabType[t] = type;
		tabDeal[t] = deal;
		tabTransferFee[t] = transfer_fee;
		tabSalary[t] = salary;
		tabTransferFeeCurrency[t] = transfer_fee_currency;
		tabCurrency[t] = currency;
		tabStatus[t] = status;
		tabPicture[t] = picture;
		tabLogod[t] = logod;
		tabLogoa[t] = logoa;
		tabFrom[t] = from;
		tabTo[t] = to;
		tabPolyline[t] = polyline;
		var thisPolyline = tabPolyline[t];
		var j = t;
		liste += '<li>'
					+'<div class="lien' + t + '" style="display:inline-block; width:170px; padding:1px;">'
						+'<div id="closeplayer'+t+'" style=" display:inline-block; vertical-align:top; cursor:pointer; background-image:url(./img/YouFootMap/fleche.gif); background-position:-0px -0px; width:12px; height:14px; float:left;" onclick="clickLien(' + t + ')"></div>'
						+'<div onclick="clickLien(' + t + ')" id="openplayer'+t+'" style="display:inline-block; vertical-align:top; cursor:pointer; background-image:url(./img/YouFootMap/fleche.gif); background-position:-0px -17px; width:12px; height:12px; display:none; float:left; "></div>'
						+'<a style="color:#000000; margin-left:3px; text-decoration:none; font-size: 10px;" id="' + t + '" href="javascript:clickLien(' + t + ')" onmouseover="surligneOn(' + t + ')" onmouseout="surligneOut(' + t + ')">' + joueur + '</a>'
					+'</div>'
					+'<div id="transfert' + t + '" style="margin-top:0; display:none; padding-left: 15px; width:170px;">To: ' + to + '<br>From: ' + from + '</div>'
				+'</li>';
		
		GEvent.addListener(polyline, "mouseover", function(){surligneOn(j);});
		GEvent.addListener(polyline, "mouseout", function(){surligneOut(j);});
		GEvent.addListener(polyline, "click", function() {clickLien(j);});
		
		t++;
		
		return polyline;
	}
	
	
	/*°* *°*/	
	function clickLien(i){
		
		clearMarkers();
		map.closeExtInfoWindow();
		
		var gmarkersT = [];
		var favoris;
		
		contenu = '<div style=" width:200px; padding: 5px; "><div style="display:inline-block; padding:0; margin0; width:210px;"><img src="./img/YouFootMap/icon_contrat.gif" style="display:inline-block; vertical-align:text-top; " /> <div style="font-weight:bold; display:inline-block; width:120px; margin:3px; vertical-align:text-top;">Transfer info</div><div class="closewindow" onclick="map.closeExtInfoWindow()" onmouseover="overclose();" onmouseout="unoverclose();"  style="background-image:url(./img/YouFootMap/close.png); background-position:0,0; width:13px; height:13px; cursor:pointer; float:right; display:inline-block; vertical-align:text-top;"/></div><br>'
		+'<center><div style="width:45px; height:45px; padding:0; margin:0;"><img style="width:45px; height:45px" src="/media/image/'+ tabPicture[i] +'"/></div></center>'
		+'<center><div style="width:200px">'+ tabJoueur[i] +'<br><br></div></center>'
		+'<div><center><img style="width:35px; height:35px; padding10px" src="/media/image/'+ tabLogod[i] +'"/><img style="width:35px; height:35px; padding:10px;" src="./img/YouFootMap/fl.jpg"/><img style="width:35px; height:35px; padding10px" src="/media/image/'+ tabLogoa[i] +'"/></center></div>'
		+'<div style="margin-bottom:2px; height:30px;"><div style="text-align:right; width:90px; float:left;">'+ tabFrom[i] +'</div><div style="width:90px; float:right">'+ tabTo[i] +'</div></div><br>'
		+'<div style="width:200px; height:100px"><div id="kind" style="font-weight:bold;">Type : '+tabType[i]+'</div><div id="statut" style="font-weight:bold;">Status : '+tabStatus[i]+'</div><div id="startdate" style="font-weight:bold;">Starting date : '+tabDate[i]+'</div><div id="typeofdeal" style="font-weight:bold;">Nature of transfer : '+tabDeal[i]+'</div><div id="salary" style="font-weight:bold;">Salary : '+tabSalary[i]+' '+tabCurrency[i]+'</div><div id="transferfee" style="font-weight:bold;">Transfer fee : '+tabTransferFee[i]+' '+tabTransferFeeCurrency[i]+'</div><br></div>'
		+'</div>';
		
		if ( cible == "null"){
			
		}else{
			tabPolyline[cible].setStrokeStyle({color: "#7D8886"});
			$('.lien'+cible).css("background",'#FFFFFF');
			$('#'+cible).css("background",'#FFFFFF');
			document.getElementById(cible).style.fontWeight='normal';
			$('#transfert'+cible).slideUp('1000');
			$('#closeplayer'+cible).show();
			$('#openplayer'+cible).hide();
		}
		
		if (i != cible) {
			
			cible = i;
			tabPolyline[i].setStrokeStyle({
				color: "#000000"
			});
			document.getElementById(i).style.color = '#000000';
			$('.lien' + i).css("background", '#A5D6FF');
			$('#' + i).css("background", '#A5D6FF');
			$('#closeplayer' + i).hide();
			$('#openplayer' + i).show();
			document.getElementById(i).style.fontWeight = 'bolder';
			$('#transfert' + i).slideDown('1000');
			$('#transfert' + i).css("background", '#A5D6FF');
			
			contrat = new GMarker(tabBulle[i], new GIcon(iconContrat, "./img/YouFootMap/icon_contrat.gif"));
			fromMarker = new GMarker(tabStartpts[i], new GIcon(icon, "./img/YouFootMap/mark-transfer2.png"));
			toMarker = new GMarker(tabEndpts[i], new GIcon(icon, "./img/YouFootMap/mark-transfer2.png"));

			
			gmarkersT.push(fromMarker);
			gmarkersT.push(toMarker);
			gmarkersT.push(contrat);
			mgr.addMarkers(gmarkersT, 0)
			mgr.refresh();
			
			GEvent.addListener(contrat, "click", function(){
				contrat.openExtInfoWindow(map, "transfertWindow", contenu);
			});
			//GEvent.addListener(fromMarker, "click", function(){fromMarker.openExtInfoWindow(map,"fromWindow","Depart");});
			//GEvent.addListener(toMarker, "click", function(){toMarker.openExtInfoWindow(map,"ToWindow","Arrive");});
			
			map.setCenter(tabBulle[i], 4);
			$("svg").css("z-index", "100");
		}else{
			cible = 'null';
		}
	}
	
	/*°*
	 *  Fonction qui change la couleur de la polyline lors du passage de la souris sur le joueur correspondant
	 *°*/
	function surligneOn(i){
		tabPolyline[i].setStrokeStyle({color: "#3440EF"});
		document.getElementById(i).style.color='#3440EF';
		$("svg").css("z-index","100");
	}
	
	/*°* Fonction qui change la couleur de la polyline lors de la fin du passage sur le joueur *°*/
	function surligneOut(i){
		if (i == cible ){
			tabPolyline[i].setStrokeStyle({color: "#000000"});
			document.getElementById(i).style.fontWeight='bolder';
		}else{
			tabPolyline[i].setStrokeStyle({color: "#7D8886"});
			document.getElementById(i).style.background='#FFFFFF';
			document.getElementById(i).style.fontWeight='normal';
		}
		document.getElementById(i).style.color='#000000';
		$("svg").css("z-index","100");
	}
	
	/*°* Fonction de suppression des polylines *°*/
	function clearPolyline(){
		map.clearOverlays();
	}
	
	/** V **/
	/*°* Fonction d'ajout de notre flèche à côté de la barre de zoom *°*/
	function fleche(){
		var onglet = $.cookie('onglet');
		if (this.map.getCurrentMapType() == G_PHYSICAL_MAP ){
			switch(onglet) {
				case 'o_2':
				html1 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="15">All Teams</div>');
				html2 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="12">Teams with over 100 fans</div>');
				html3 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="9">Teams with over 1000 fans</div>');
				html4 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="6">Teams with over 5000 fans</div>');
				html5 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="2">National Teams</div>');
				map.addControl(html1, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 88)));
				map.addControl(html2, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 112)));
				map.addControl(html3, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 136)));
				map.addControl(html4, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 160)));
				map.addControl(html5, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 192)));
					break;
				case 'o_3':
				html1 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="15">All Venues</div>');
				html2 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="12">Venues with over 100 fans</div>');
				html3 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="9">Venues with over 1000 fans</div>');
				html4 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="6">Venues with over 5000 fans</div>');
				html5 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="2">Best Venues</div>');
				map.addControl(html1, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 88)));
				map.addControl(html2, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 112)));
				map.addControl(html3, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 136)));
				map.addControl(html4, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 160)));
				map.addControl(html5, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 192)));
					break;
				case 'o_4':
				html1 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="15">All matches</div>');
				html2 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="12">Matches with over 100 fans</div>');
				html3 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="9">Matches with over 1000 fans</div>');
				html4 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="6">Matches with over 5000 fans</div>');
				html5 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="2">Best matches</div>');
				map.addControl(html1, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 88)));
				map.addControl(html2, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 112)));
				map.addControl(html3, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 136)));
				map.addControl(html4, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 160)));
				map.addControl(html5, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 192)));
					break;
			}
		}
		else{
			switch(onglet) {
				case 'o_2':
				html1 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="15">All Teams</div>');
				html2 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="12">Teams with over 100 fans</div>');
				html3 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="9">Teams with over 1000 fans</div>');
				html4 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="6">Teams with over 5000 fans</div>');
				html5 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="2">National Teams</div>');
				map.addControl(html1, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 112)));
				map.addControl(html2, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 136)));
				map.addControl(html3, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 160)));
				map.addControl(html4, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 185)));
				map.addControl(html5, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 216)));
					break;
				case 'o_3':
				html1 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="15">All Venues</div>');
				html2 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="12">Venues with over 100 fans</div>');
				html3 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="9">Venues with over 1000 fans</div>');
				html4 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="6">Venues with over 5000 fans</div>');
				html5 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="2">Best Venues</div>');
				map.addControl(html1, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 112)));
				map.addControl(html2, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 136)));
				map.addControl(html3, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 160)));
				map.addControl(html4, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 185)));
				map.addControl(html5, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 216)));
					break;
				case 'o_4':
				html1 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="15">All matches</div>');
				html2 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="12">Matches with over 100 fans</div>');
				html3 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="9">Matches with over 1000 fans</div>');
				html4 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="6">Matches with over 5000 fans</div>');
				html5 = new HtmlControl('<div onclick="clickfleche(this);" class="'+ onglet +'" value="2">Best matches</div>');
				map.addControl(html1, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 112)));
				map.addControl(html2, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 136)));
				map.addControl(html3, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 160)));
				map.addControl(html4, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 185)));
				map.addControl(html5, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 216)));
					break;
				}
		}
	}

	
	function removeFleche(){
		map.removeControl(html1);
		map.removeControl(html2);
		map.removeControl(html3);
		map.removeControl(html4);
		map.removeControl(html5);
	}
	
	function clickfleche(elem){
		var zoomval = $(elem).attr('value');
		zoomval = parseInt(zoomval);
		map.setZoom(zoomval);
		
	}
	
	
	/*°*
	 * Fonction affichant une liste des joueurs lors du clic sur les transferts 
	 */ 
	
	function listeTransfert(){
		//div panel
		htmliste = '<script src="js/panel.js" type="text/javascript" ></script><div id="test" onclick="fullMap()" style="cursor:pointer; float: right; display: none; background-image:url(./img/YouFootMap/plus-moins.png); background-position:-1px -1px; width:14px; height:14px;"></div><div id="panel" style="border: 1px solid black; z-index:1; height:430px; width:190px; background-color:#FFFFFF; float: right; opacity:0.90;  filter : alpha(opacity=90);">'
		+'<div id="list player" style="position:relative; background:url(./img/YouFootMap/ltfont.png) repeat-x; font-size: 12px; font-weight: bold; height: 22px; padding-top: 5px; padding-left: 3px;  "><div onmouseover="hideall()" id="pt" style="float:left; display:inline-block">Players transfered</div><div onclick="fullMap()" style="cursor:pointer; float: right;  display:inline-block; background-image:url(./img/YouFootMap/plus-moins.png); background-position:-1px -19px; width:14px; height:14px; margin-right:5px;"></div></div>'
		+'<div id="choixTransfers" style="padding-top: 5px; padding-left: 3px; padding-right: 3px"><div><div onmouseover="hideall()" style="width:70px; display:inline-block; vertical-align:top; float:left; padding:1px; font-weight:bold;">Period:</div><div id="timechoice" onclick="showtime()" style="padding:3px; background-color: #F0F0F0; display:inline-block; vertical-align:top; width:105px; cursor:pointer;"><div id="cooktim" style="float:left;">'+ $.cookie('time') +'</div><div id="closetime" style="display:inline-block; vertical-align:top; cursor:pointer; background-image:url(./img/YouFootMap/fleche.gif); background-position:-0px -0px; width:12px; height:14px; float:right; "></div><div id="opentime" style="display:inline-block; vertical-align:top; cursor:pointer; background-image:url(./img/YouFootMap/fleche.gif); background-position:-0px -17px; width:12px; height:12px; display:none; float:right; "></div></div></div>'
		+'<div id="time" style="display:none; z-index:2; width:105px; margin-left:72px; padding:3px; background-color: #F0F0F0; position:absolute;">'
		+'<p onmouseover="this.style.background=\'#FFFFFF\'" onmouseout="this.style.background=\'#F0F0F0\'" onclick="timechoice(\'today\', this)" id="today" style="text-decoration:none; color:black; cursor:pointer;">Today</p>'
		+'<p onmouseover="this.style.background=\'#FFFFFF\'" onmouseout="this.style.background=\'#F0F0F0\'" onclick="timechoice(\'week\', this)" id="week" style="text-decoration:none; color:black; cursor:pointer;">This week</p>'
		+'<p onmouseover="this.style.background=\'#FFFFFF\'" onmouseout="this.style.background=\'#F0F0F0\'" onclick="timechoice(\'month\', this)" id="month"  style="text-decoration:none; color:black; cursor:pointer;">This month</p>'
		+'<p onmouseover="this.style.background=\'#FFFFFF\'" onmouseout="this.style.background=\'#F0F0F0\'" onclick="timechoice(\'90days\', this)" id="90days" style="text-decoration:none; color:black; cursor:pointer;">Last 90 days</p>'
		+'<p onmouseover="this.style.background=\'#FFFFFF\'" onmouseout="this.style.background=\'#F0F0F0\'" onclick="timechoice(\'custom\', this)" id="custom" style="text-decoration:none; color:black; cursor:pointer;">Custom period</p>'
		+'</div><br><div>'
		/*<div onmouseover="hideall()" style="display:inline-block; vertical-align:top; float:left; padding:1px; width: 70px; font-weight:bold;">Contracts:</div>'
		+'<div id="contractchoice" onclick="showcontract(); " style="padding:3px; background-color: #F0F0F0; display:inline-block; vertical-align:top; width:105px; cursor:pointer;"><div id="cookcon" style="float:left;"> '+ $.cookie("contract") +' </div><div id="closecontract" style=" display:inline-block; vertical-align:top; cursor:pointer; background-image:url(./img/YouFootMap/fleche.gif); background-position:-0px -0px; width:12px; height:14px; float:right; "></div><div id="opencontract" style="display:inline-block; vertical-align:top; cursor:pointer; background-image:url(./img/YouFootMap/fleche.gif); background-position:-0px -17px; width:12px; height:12px; display:none; float:right; "></div></div></div>'
		+'<div id="contract"  style="display:none; z-index:2; width:105px; margin-left:72px; padding:3px; background-color: #F0F0F0; position:absolute;">'
		+'<p onmouseover="this.style.background=\'#FFFFFF\'" onmouseout="this.style.background=\'#F0F0F0\'" onclick="contractchoice(\'all\', this);" id="all"  style="text-decoration:none; color:black; cursor:pointer;">All transfers</p>'
		+'<p onmouseover="this.style.background=\'#FFFFFF\'" onmouseout="this.style.background=\'#F0F0F0\'" onclick="contractchoice(\'new\', this); " id="new"  style="text-decoration:none; color:black; cursor:pointer;">New contracts</p>'
		+'<p onmouseover="this.style.background=\'#FFFFFF\'" onmouseout="this.style.background=\'#F0F0F0\'" onclick="contractchoice(\'pro\', this); " id="pro"  style="text-decoration:none; color:black; cursor:pointer;">Pro. transfers</p>'
		+'<p onmouseover="this.style.background=\'#FFFFFF\'" onmouseout="this.style.background=\'#F0F0F0\'" onclick="contractchoice(\'national\', this); " id="national"  style="text-decoration:none; color:black; cursor:pointer;">National sel.</p>'
		+'<p onmouseover="this.style.background=\'#FFFFFF\'" onmouseout="this.style.background=\'#F0F0F0\'" onclick="contractchoice(\'amateur\', this); " id="amateur"  style="text-decoration:none; color:black; cursor:pointer;">Amateur tr.</p></div></div><br><hr><div>'*/
		+'<h4 style="padding:3px;" onmouseover="hideall()" >Results :</h4></div><br><div onmouseover="hideall()" id="zoneListe" style="padding:3px; height:270px; overflow-y:scroll; overflow-x:hidden"></div></div>'
		
		//div calendar
		+'<div id="calendar" style="border: 1px solid black; display:none; height:160px; width:170px; float:left; z-index:1; margin-top:30px; margin-right:-20px; background-color:#FFFFFF; opacity:0.95;  filter : alpha(opacity=95);"><div style="position:relative; background:url(./img/YouFootMap/ltfont.png) repeat-x; font-size: 12px; font-weight: bold; height: 22px; padding-top: 5px; padding-left: 3px;">Custom period<div class="closewindow" onclick="unshowcalendar();" onmouseover="overclose();" onmouseout="unoverclose();"  style="background-image:url(./img/YouFootMap/close.png); background-position:0px 0px; width:13px; height:13px; cursor:pointer; float:right; margin-right:3px; display:inline-block; vertical-align:text-top;"></div></div>'
		+'<form name="custom_yearmonth" method="post" action="javascript:validate();"><div onmouseover="hideall();" style=" vertical-align:top; float:left; padding:3px; width:180px; font-weight:bold;">Year:</div>'
		+'<div style="width:120px; margin:auto;"><div style="background-image:url(./img/YouFootMap/datepicker-arrows.png); background-position:0px -16px;  height:15px; width:16px; float:left;  display:inline-block; float:left; cursor:pointer; " onmouseover="hideall();$(this).css(\'background-position\',\'0px -32px\');" onclick="beforeyear(); " onmouseout="$(this).css(\'background-position\',\'0px -16px\')" id="beforeyear"></div><div id="yearchoice" onclick="showyear()" style="margin-left:2px; margin-right:2px; width:84px; display:inline-block; vertical-align:top; cursor:pointer;"><div id="cookyear" style="width:80px;  float:left;"><input id="yearname" onfocus="this.style.border=\'1px inset #4ED7F7\';" onblur="this.style.border=\'1px inset #D9D9D8\';" style="width:82px; border:1px inset #D9D9D8; background-color: #F0F0F0;" type="text" name="yearcal" value="'+ $.cookie("yearcal") + '" /></div></div><div onclick="nextyear(); " onmouseover="hideall();$(this).css(\'background-position\',\'0px -48px\')" onmouseout="$(this).css(\'background-position\',\'0px 0px\')" style="background-image:url(./img/YouFootMap/datepicker-arrows.png); background-position:0px 0px; width:16px; height:15px; display:inline-block;  cursor:pointer" id="nextyear"></div></div>'
		+'<div id="yearcalendar" style="display:none; overflow:auto; height:140px; z-index:2; width:77px; margin-left:44px; margin-top:-2px; padding:3px; background-color: #F0F0F0; position:absolute;">';
			for(var i=2009; i>=1980;i--){
				htmliste+='<p onmouseover="this.style.background=\'#FFFFFF\'" onmouseout="this.style.background=\'#F0F0F0\'" onclick="yearchoice(\''+ i +'\', this);" id="'+ i +'"  style="text-decoration:none; color:black; cursor:pointer;">'+ i +'</p>';
			}
		htmliste+= '</div><br>'
		+'<div onmouseover="hideall();" style="display:inline-block; vertical-align:top; float:left; padding:3px; width: 180px; font-weight:bold;">Month:</div>'
		+'<div style="width:120px; margin:auto;" ><div style="background-image:url(./img/YouFootMap/datepicker-arrows.png); background-position:0px -16px; width:16px; height:15px; cursor:pointer; display:inline-block; float:left;" onmouseover="hideall();$(this).css(\'background-position\',\'0px -32px\')" onmouseout="$(this).css(\'background-position\',\'0px -16px\')" onclick="beforemonth(); " id="beforemonth" ></div><div id="monthchoice" onclick="showmonth()" style="margin-left:2px; margin-right:2px; width:84px; display:inline-block; vertical-align:top; cursor:pointer;"><div id="cookmonth" style=" float:left;"><input id="monthname" onfocus="this.style.border=\'1px inset #4ED7F7\';" onblur="this.style.border=\'1px inset #D9D9D8\';" style="width:82px; border:1px inset #D9D9D8; background-color:#F0F0F0;" type="text" name="monthcal" value="'+ $.cookie("monthcal") +'" /></div></div><div id="nextmonth" onmouseover="hideall();$(this).css(\'background-position\',\'0px -48px\')" onmouseout="$(this).css(\'background-position\',\'0px 0px\')" onclick="nextmonth();" style="background-image:url(./img/YouFootMap/datepicker-arrows.png); background-position:0px 0px; width:16px; height:15px; cursor:pointer; display:inline-block; "></div></div>'
		+'<div id="monthcalendar" style="display:none;  z-index:2; width:77px; margin-left:44px; margin-top:-2px;padding:3px; background-color: #F0F0F0; position:absolute;">'
			+'<p onmouseover="this.style.background=\'#FFFFFF\'" onmouseout="this.style.background=\'#F0F0F0\'" onclick="monthchoice(\'january\', this); " id="january"  value="0" style="text-decoration:none; color:black; cursor:pointer;">january</p>'
			+'<p onmouseover="this.style.background=\'#FFFFFF\'" onmouseout="this.style.background=\'#F0F0F0\'" onclick="monthchoice(\'february\', this);  " id="february"  value="1 "style="text-decoration:none; color:black; cursor:pointer;">february</p>'
			+'<p onmouseover="this.style.background=\'#FFFFFF\'" onmouseout="this.style.background=\'#F0F0F0\'" onclick="monthchoice(\'march\', this); " id="march"  value="2" style="text-decoration:none; color:black; cursor:pointer;">march</p>'
			+'<p onmouseover="this.style.background=\'#FFFFFF\'" onmouseout="this.style.background=\'#F0F0F0\'" onclick="monthchoice(\'april\', this); " id="april"  value="3" style="text-decoration:none; color:black; cursor:pointer;">april</p>'
			+'<p onmouseover="this.style.background=\'#FFFFFF\'" onmouseout="this.style.background=\'#F0F0F0\'" onclick="monthchoice(\'may\', this); " id="may"  value="4" style="text-decoration:none; color:black; cursor:pointer;">may</p>'
			+'<p onmouseover="this.style.background=\'#FFFFFF\'" onmouseout="this.style.background=\'#F0F0F0\'" onclick="monthchoice(\'june\', this); " id="june"  value="5" style="text-decoration:none; color:black; cursor:pointer;">june</p>'
			+'<p onmouseover="this.style.background=\'#FFFFFF\'" onmouseout="this.style.background=\'#F0F0F0\'" onclick="monthchoice(\'july\', this); " id="july"  value="6" style="text-decoration:none; color:black; cursor:pointer;">july</p>'
			+'<p onmouseover="this.style.background=\'#FFFFFF\'" onmouseout="this.style.background=\'#F0F0F0\'" onclick="monthchoice(\'august\', this); " id="august"  value="7" style="text-decoration:none; color:black; cursor:pointer;">august</p>'
			+'<p onmouseover="this.style.background=\'#FFFFFF\'" onmouseout="this.style.background=\'#F0F0F0\'" onclick="monthchoice(\'september\', this); " id="september" value="8" style="text-decoration:none; color:black; cursor:pointer;">september</p>'
			+'<p onmouseover="this.style.background=\'#FFFFFF\'" onmouseout="this.style.background=\'#F0F0F0\'" onclick="monthchoice(\'october\', this); " id="october" value="9" style="text-decoration:none; color:black; cursor:pointer;">october</p>'
			+'<p onmouseover="this.style.background=\'#FFFFFF\'" onmouseout="this.style.background=\'#F0F0F0\'" onclick="monthchoice(\'november\', this); " id="november"  value="10" style="text-decoration:none; color:black; cursor:pointer;">november</p>'
			+'<p onmouseover="this.style.background=\'#FFFFFF\'" onmouseout="this.style.background=\'#F0F0F0\'" onclick="monthchoice(\'december\', this); " id="december"  value="11" style="text-decoration:none; color:black; cursor:pointer;">december</p>'
		+'</div><div onmouseover="hideall();" style="margin:auto;" /><br><div style="width:60px; margin:auto;"><input type="submit" name="validate" value="Validate" /></div></form></div>'
			transf1 = new HtmlControl(htmliste);
		map.addControl(transf1, new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(0,40)));
	}
	function removeListe(){
		map.removeControl(transf1);
	}
	
	/*°*
	 *  Fonction qui permet de show et hide le div time et div contract 
	 */
	
	function showtime(){
		if($('#time').is(":hidden")){
			$('#time').slideDown("fast");
			$('#closetime').hide();
			$('#opentime').show();
			$('#contract').slideUp("fast");
			$('#closecontract').show();
			$('#opencontract').hide();
			
		}
		else{
			$('#time').slideUp("fast");
			$('#closetime').show();
			$('#opentime').hide();
		}
	}

	function showcontract(){
		if($('#contract').is(":hidden")){
			$('#contract').slideDown("fast");
			$('#closecontract').hide();
			$('#opencontract').show();
			$('#time').slideUp("fast");
			$('#closetime').show();
			$('#opentime').hide();
		}
		else{
			$('#contract').slideUp("fast");
			$('#closecontract').show();
			$('#opencontract').hide();
		}
	}
	
	//Fonction qui permet de show et hide le div month et div year
	function showmonth(){
		if($('#monthcalendar').is(":hidden")){
			$('#monthcalendar').slideDown("fast");
			$('#yearcalendar').slideUp("fast");
			$('#openmonth').show();
			$('#closemonth').hide();
			$('#closeyear').show();
			$('#openyear').hide()
		}
		else{
			$('#monthcalendar').slideUp("fast");
			$('#closemonth').show();
			$('#openmonth').hide();
		}
	}
	
	function showyear(){
		if($('#yearcalendar').is(":hidden")){
			$('#yearcalendar').slideDown("fast");
			$('#monthcalendar').slideUp("fast");
			$('#openyear').show();
			$('#closeyear').hide();
			$('#openmonth').hide();
			$('#closemonth').show();
		}
		else{
			$('#yearcalendar').slideUp("fast");
			$('#closeyear').show();
			$('#openyear').hide();
		}
	}
	
	
	//cache le calendar lors du click cancel, remet par defaut la periode 90 days
	function unshowcalendar(){
		$('#calendar').hide();
	}
	
	/*°*
	 * Fonction qui permet de remonter les menus lors d'un mouseover sur une des div situé autour du menu
	 */
	
	function hideall(){
		$('#contract').slideUp("fast");
		$('#time').slideUp("fast");
		$('#closecontract').show();
		$('#closetime').show();
		$('#opentime').hide();
		$('#opencontract').hide();
		$('#yearcalendar').slideUp("fast");
		$('#closeyear').show();
		$('#openyear').hide();
		$('#monthcalendar').slideUp("fast");
		$('#closemonth').show();
		$('#openmonth').hide();
	}
	
	
	/*°* 
	 * fonctions qui permet de garder le choix d'une periode ou du type de contrat en vue
	 */
	
	function timechoice(tchoice, elem){
		$('#time').slideUp();
		
		var title = ($('#'+elem.id).text());
		var cookietimebdd = $.cookie("timebdd");
		var cookiecontractbdd = $.cookie("contractbdd");
		if (tchoice == 'custom') {
			$('#calendar').show();
		}
		else {
			$.cookie('time', title, {path: "/"});
			$.cookie('timebdd', tchoice, {path: "/"});
			
			setupTransfert(tchoice, cookiecontractbdd);
		}
		
	}

	function contractchoice(cchoice, elem){
		$('#contract').slideUp();
		
		var title = ($('#' + elem.id).text());
		var cookiecontractbdd = $.cookie("contractbdd");
		var cookietimebdd = $.cookie("timebdd");
		
		$.cookie('contractbdd', elem.id, {path:"/"});
		$.cookie('contract', title, {path:"/"});
		
		setupTransfert(cookietimebdd, cchoice);
	}
	
	//fonctions qui permettent d'avoir en vue l'année et le mois selectionné
	function monthchoice(mchoice, elem){
		$('#monthcalendar').slideUp();
		
		var title = ($('#'+elem.id).text());
		$("#monthname").val(title);
		$.cookie("monthcal", title, {path:"/"});
		
	}
	
	function yearchoice(ychoice, elem){
		$('#yearcalendar').slideUp();
		
		var title = ($('#'+elem.id).text());
		$("#yearname").val(title);
		$.cookie("yearcal", title, {path:"/"});
		
	}
	
	//fonction permettant de choisir l'année précédent et l'année suivante
	function beforeyear(){
			
		var oldyear = $.cookie("yearcal");
		var newyear = parseInt(oldyear) - 1;
		
		$.cookie("yearcal", newyear, {path:"/"});
		$("#yearname").val(newyear);
		
	
	}
	
	function nextyear(){
		
		var oldyear = $.cookie("yearcal");
		var newyear = parseInt(oldyear) + 1;
		
		$.cookie("yearcal", newyear, {path:"/"});
		$("#yearname").val(newyear);
	}
	
	//fonction permettant de choisir le mois précédent et le mois suivante
	function beforemonth(){
		var month = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];			 
		var oldmonth = $.cookie("monthcal");
		for (var i=0; i<12; i++) {
			if(month[i] == oldmonth){
				var newmonth = month[i-1];
				break;
			}
		};
		$.cookie("monthcal", newmonth, {path:"/"});
		$("#monthname").val(newmonth);

		
	}
	
	function nextmonth(){
			var month = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];		 
		var oldmonth = $.cookie("monthcal");
		for (var i=0; i<12; i++) {
			if(month[i] == oldmonth){
				var newmonth = month[i+1];
				break;
			}
		};
		$.cookie("monthcal", newmonth, {path:"/"});
		$("#monthname").val(newmonth);
		
	}
	
	//fonction qui valide les choix du mois et de l'année dans le customise period
	function validate(){
		var newyear = $('#yearname').val();
		var newmonth = $('#monthname').val(); 
		newmonth = newmonth.toLowerCase();	 
		
		if(newmonth == 'january' || newmonth == 'february' || newmonth == 'march' || newmonth == 'april' || newmonth == 'may' || newmonth == 'june' || newmonth == 'july' || newmonth == 'august' || newmonth == 'september' || newmonth == 'october' || newmonth == 'november' || newmonth == 'december' ) {
		
			$.cookie("monthcal", newmonth, {path: "/"});
			$.cookie("yearcal", newyear, {path: "/"});
			$.cookie("time", newmonth + ' ' + newyear, {path: "/"});
			$.cookie("timebdd", 'custom', {path: "/"});
			
			var contractbdd = $.cookie("contractbdd");
			var timebdd = $.cookie("timebdd");
			
			setupTransfert(timebdd, contractbdd);
		}
		else{
			alert('wrong month !!!');
		}
	}
	
	
	/** VI **/

	/*°*
	 * Function qui cache ou montre le panneau des transferts
	 */
	
	function fullMap(){
		if ($("#panel").css("display") == 'none'){
			$("#panel").show();
			if($.cookie('timebdd') == 'custom'){
				$("#calendar").show();
			}
			$("#test").hide();
		}else{
			$("#panel").hide();
			$("#test").show();
			$("#calendar").hide();
		}
	}
	
	//hover sur la croix qui permet de fermer la fenetre (transfer window et custom period)
	function overclose(){
		$(".closewindow").css("background-position","0px -15px");
	}
	function unoverclose(){
		$(".closewindow").css("background-position","0px 0px");
	}
	
	/*°*
	 *Fonction chargé au setupmap, il permet de garder les onglets selectionnés apres un changement de screen 
	 */
	
		function loadonglet(){
		if ($.cookie('onglet') != null) {
			
			var onglet = $.cookie('onglet');
			
			switch(onglet){
				case 'o_1' :
					setupFavorite();
					$('#o_1').attr("class", "selected");
					$('#o_2').attr("class", "normal");
					$('#o_3').attr("class", "normal");
					$('#o_4').attr("class", "normal");
					$('#o_5').attr("class", "normal");
					break;
					
				case 'o_2':
					setupTeam();
					$('#o_1').attr("class", "normal");
					$('#o_2').attr("class", "selected");
					$('#o_3').attr("class", "normal");
					$('#o_4').attr("class", "normal");
					$('#o_5').attr("class", "normal");
					break;
					
				case 'o_3':
					setupVenue();
					$('#o_1').attr("class", "normal");
					$('#o_2').attr("class", "normal");
					$('#o_3').attr("class", "selected");
					$('#o_4').attr("class", "normal");
					$('#o_5').attr("class", "normal");
					break;
					
				case 'o_4':
					setupTodaymatches();
					$('#o_1').attr("class", "normal");
					$('#o_2').attr("class", "normal");
					$('#o_3').attr("class", "normal");
					$('#o_4').attr("class", "selected");
					$('#o_5').attr("class", "normal");
					break;
					
				case 'o_5':
					var cookietime = $.cookie('timebdd');
					var cookietype = $.cookie('contractbdd');
					setupTransfert(cookietime,cookietype);
					$('#o_1').attr("class", "normal");
					$('#o_2').attr("class", "normal");
					$('#o_3').attr("class", "normal");
					$('#o_4').attr("class", "normal");
					$('#o_5').attr("class", "selected");
					break;
					
				default : return null;
			}
		}
		else {		
			setupTeam();
		}
	}
	
	/*°*
	 * Fonction appelé lors d'un mouseover ou d'un mouseout sur l'icone fullscreen
	 */
	
	function overFS(){
		$('#gofs').css("text-decoration",'underline');
		$('#full').css("margin-right","0px");
		$('#gofsimg').hide();
		$('#gofsimg2').show();	
	}

	function unoverFS(){
		$('#gofs').css("text-decoration",'none');
		$('#gofs').css("margin-bottom",'1px');
		$('#gofsimg').show();
		$('#gofsimg2').hide();
	}
	
	/*°*
	 * Fonction qui change la classe de l'onglet lors d'un mouseover ou mouseout 
	 */
	
	
	function overonglet(elem){
		var id = elem.id;
		var cl = $('#'+id).attr('class');
		
		if (cl != 'selected'){
			$('#'+id).attr('class', 'selected');
		}
	}
	
	function outonglet(elem){
		var id = elem.id;
		
		if (id != $.cookie('onglet')){
			$('#'+id).attr('class', 'normal');
		}
	}

