//<![CDATA[ 
//variables globales ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
var maplat = 50.750058; var maplon = 2.260721; var mapzoom = 8;
var mapmarkers = "++"; var mapsponsors = "";
var showOnceSelectedValues = 1;
var useOnceMapParams = 2;
var useOnceSearchText = 1;
var vecesRight = 1;
var mapZoomFromMenu = 0; var mapCoordenadesFromMenu = "";
var boolVilleSelected = false;

var boolSelectFirstEdition = true;
var boolSelectFirstArea = true;
var boolSelectFirstVille = true;
//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

/*
var mapmarkers = "50.750058+2.260721+<div align='center'>Auberge Beauséjour</div><div><object width='250' height='250'><param name='movie' value='http://www.youtube.com/v/Y4Z9ixm9akg&rel=1'></param><param name='wmode' value='transparent'></param><embed src='http://www.youtube.com/v/Y4Z9ixm9akg&rel=1' type='application/x-shockwave-flash' wmode='transparent' width='250' height='250'></embed></object></div><div align='center'>Amaqui - (418) 629.5531</div>";
mapmarkers += "*50.750058+2.291321+<div align='center'>Idcal Optique</div><div><object width='250' height='250'><param name='movie' value='http://www.youtube.com/v/D8Q-tS4gYmM'></param><param name='wmode' value='transparent'></param><embed src='http://www.youtube.com/v/D8Q-tS4gYmM' type='application/x-shockwave-flash' wmode='transparent' width='250' height='250'></embed></object></div><div align='center'>[Address] - [Telephone]</div>";
mapmarkers += "*50.780058+2.291321+<div align='center'>Bon Marche</div><div><object width='250' height='250'><param name='movie' value='http://www.youtube.com/v/huzOHxjMDxk&rel=1'></param><param name='wmode' value='transparent'></param><embed src='http://www.youtube.com/v/huzOHxjMDxk&rel=1' type='application/x-shockwave-flash' wmode='transparent' width='250' height='250'></embed></object></div><div align='center'>3500 Boul, St-Joseph Est - [Telephone]</div>";
mapmarkers += "*50.790058+2.351321+<div align='center'>Loews le Concorde</div><div><object width='250' height='250'><param name='movie' value='http://www.youtube.com/v/do1Gpuvf4n4&rel=1'></param><param name='wmode' value='transparent'></param><embed src='http://www.youtube.com/v/do1Gpuvf4n4&rel=1' type='application/x-shockwave-flash' wmode='transparent' width='250' height='250'></embed></object></div><div align='center'>[Address], Québec - 647.2222</div>";
mapmarkers += "*50.710058+2.351321+<div align='center'>Loews le Concorde</div><div><object width='250' height='250'><param name='movie' value='http://www.youtube.com/v/Eh3AQqzMRL0&rel=1'></param><param name='wmode' value='transparent'></param><embed src='http://www.youtube.com/v/Eh3AQqzMRL0&rel=1' type='application/x-shockwave-flash' wmode='transparent' width='250' height='250'></embed></object></div><div align='center'>[Address], Québec - 647.2222</div>";
*/

var strIDS = "";
//datos temporales para sponsors
var gmarkers = []; var i = 0;
function createMarker(point, title, content) {  
	var marker = new GMarker(point);  
	GEvent.addListener(marker, "click",	function() { marker.openInfoWindowHtml("<strong>" + title + "</strong><br/>" + content); });
	return marker;
}
function stringToNumber(n1){ if(n1){ return parseFloat(n1.split(",").join(".")); }else{ return 0; }}
function redirectDetails(params){
	params += 	"&mapZoom="+document.getElementById("map_zoom").value+
			"&mapCenter="+document.getElementById("map_coordenades").value+
			"&txtSearch="+document.getElementById("textSearch").value;
	document.location = params;
}
function checkAll(field){
for (i = 0; i < field.length; i++)
	field[i].checked = true ;
}
function uncheckAll(field){
for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}
function Left(str, n){
	if (n <= 0)
		return "";
	else if (n > String(str).length)
		return str;
	else
		return String(str).substring(0,n);
}
function Right(str, n){
	if (n <= 0)
	   return "";
	else if (n > String(str).length)
	   return str;
	else {
	   var iLen = String(str).length;
	   return String(str).substring(iLen, iLen - n);
	}
}
function trim(cadena){
	for(i=0; i<cadena.length; ){
		if(cadena.charAt(i)==" ")
			cadena=cadena.substring(i+1, cadena.length);
		else
			break;
	}
	for(i=cadena.length-1; i>=0; i=cadena.length-1){
		if(cadena.charAt(i)==" ")
			cadena=cadena.substring(0,i);
		else
			break;
	}
	return cadena;
}
function KeyPress(){

		$("#btnSubmit").trigger('click');
		return false;
	
}
function ajaxCallForSelectIssue(hiddenID,visibleID,valueToSelect){
	$.ajax({
	   type: "POST",
	   url: "process.asp",
	   async: false,
	   data: "action=filleLittleThingForIEIssue",
	   success: function(txt){
			//alert(txt);
			options1 = "<option value='"+ txt +"'>"+ txt +"</option>";
			$("#"+hiddenID).prepend(options1);
				//document.getElementById("area").options[0].selected = true;
				setDropDownSelectedValue(visibleID,valueToSelect);

		}
	});
}
function setDropDownSelectedValue(elemID,valueToSet){
	var dropDown = document.getElementById(elemID);
	for (var i = 0; i < dropDown.length; i++){
		if (parseInt(dropDown.options[i].value) == parseInt(valueToSet)){
			dropDown.selectedIndex = i;
			//dropDown.options[i].selected = true;
			return;
		}
	}
	dropDown.selectedIndex = 0;
	//dropDown.options[0].selected = true;
	return;
}
function getDropDownSelectedValue(elemID){
	var dropDown = document.getElementById(elemID);
	if (dropDown.selectedIndex==-1){ 
		return 0;	
	}else{
		return dropDown.options[dropDown.selectedIndex].value;
	}
}
function goNearestLocation(strType) {
	boolVilleSelected = true;
	document.getElementById("contMenu").style.display="none";
	//obtengo coordenadas del mapa
	document.getElementById("map_coordenades_rightClick").value = document.getElementById("hiddenCursorPoint").value;
	
	//obtengo coordenadas por separado
	var arrayCoordenades = document.getElementById("map_coordenades_rightClick").value.split(",");
	var paramLat = (  Right(  trim(arrayCoordenades[0]), (arrayCoordenades[0].length - 1)  ) );
	var paramLon = (  Left(  trim(arrayCoordenades[1]), (arrayCoordenades[1].length - 2)  )  );
	
	$.ajax({
	   type: "POST",
	   url: "process.asp",
	   data: "action=getNearestLocation&type="+ strType +"&latCoord="+paramLat+"&lonCoord="+paramLon,
	   success: function(txt){
			// arrayDataCoordenades: INDEX:   0: latcoord,  1: loncoord,  2: zoom,  3: idVille,  4: idZone,  5: idEdition,  6: idRegion
			document.getElementById("contMenu").style.display="none";	
			if (txt!="noresult"){
					var arrayDataCoordenades = txt.split("|");
					//alert(txt);
					//document.getElementById("showTestCoord").innerHTML = txt;
					// seteo las 2 variables globales
					mapZoomFromMenu = parseFloat(arrayDataCoordenades[2]);
					mapCoordenadesFromMenu = document.getElementById("map_coordenades_rightClick").value;
					mapzoom = parseFloat(arrayDataCoordenades[2]);
					map.setCenter(new GLatLng(parseFloat(arrayDataCoordenades[0]), parseFloat(arrayDataCoordenades[1])), mapZoomFromMenu);
					
					// SE SELECCIONAN LOS COMBOS ===============================================================================================================================================
					if (  parseInt(arrayDataCoordenades[6]) != 0  ){ //EXISTE REGION
						//LLAMADA AJAX PARA ERROR AL SELECCIONAR
						$.ajax({ type: "POST", url: "process.asp", data: "action=filleLittleThingForIEIssue", 
							success: function(txt){
								options1 = "<option value='"+ txt +"'>"+ txt +"</option>";
								$("#hiddenRegionSelect").prepend(options1);
								
								setDropDownSelectedValue("regionSelect",parseInt(arrayDataCoordenades[6]));
								boolSelectFirstEdition = false;
								$("#regionSelect").trigger('change');
								
								if (  parseInt(arrayDataCoordenades[5]) != 0  ){ //EXISTE EDICION
									$.ajax({ type: "POST", url: "process.asp", data: "action=filleLittleThingForIEIssue", 
										success: function(txt){
											options1 = "<option value='"+ txt +"'>"+ txt +"</option>";
											$("#hiddenEditionSelect").prepend(options1);
											setDropDownSelectedValue("editionSelect",parseInt(arrayDataCoordenades[5]));
											
											boolSelectFirstArea = false;
											$("#editionSelect").trigger('change');
											
											$.ajax({ type: "POST", url: "process.asp", data: "action=filleLittleThingForIEIssue", 
												success: function(txt){
													options1 = "<option value='"+ txt +"'>"+ txt +"</option>";
													$("#hiddenAreaSelect").prepend(options1);
													setDropDownSelectedValue("area",parseInt(arrayDataCoordenades[4]));
													
													boolSelectFirstVille = false;
													var valEdition = getDropDownSelectedValue("editionSelect");
													var valArea = getDropDownSelectedValue("area");
													$.ajax({
													   type: "POST",
													   url: "process.asp",
													   data: "action=fillcombovilles&edition="+valEdition+"&area="+valArea,
													   success: function(txt){
															//alert(txt);
															var arrayVilles = new Array(); 
															boolResult = false;
															if (txt != ""){
																boolResult = true; arrayVilles = txt.split(",");
																$("#ville").empty(); options1="";
																for (var index in arrayVilles){
																	var arrayDataVilles = arrayVilles[index].split("*");
																	options1 += "<option value='"+ arrayDataVilles[0] +"'>"+arrayDataVilles[1]+"</option>";
																}
															}else{
																$("#ville").empty();
															}
															$("#ville").prepend(options1);
															setDropDownSelectedValue("ville",parseInt(arrayDataCoordenades[3]));
														}
													});
													
													
													
												}
											});
										}
									});
									
								}
							
							}
						});

						
					}
					
					//==============================================================================================================================================================================
			}else{ 
				
				alert("Aucun résultat trouvé."); 
				var comboToSelectNullValue = "";
				switch(strType){
					case "edition":
						document.getElementById("editionSelect").options[0].selected = true;
						document.getElementById("area").options[0].selected = true;
						document.getElementById("ville").options[0].selected = true;
						break;
					case "zone":
						document.getElementById("area").options[0].selected = true;
						document.getElementById("ville").options[0].selected = true;
						break;
					case "ville":
						document.getElementById("ville").options[0].selected = true;
						break;
				}
				
				
			
			}
		}
			
	});
	
	
	

}
function load(lat,lon,size,mmakers,boolerase,paramZoom,paramCenter,boolFirstMap,catSelected) { 
	if (GBrowserIsCompatible()){
		var arrayMarkers = new Array(); var strMarkers = mmakers;
		
		if (size=="" || size==0){ size=7; } //default ZOOM
		/*
		var mapopt = {size: new GSize(512,460)}; 
		var map = new GMap2(document.getElementById("divmap"), mapopt);
		
		*/
		if(paramCenter=="" || paramCenter==null || paramCenter==undefined){ paramCenter=lat+","+lon; }
		map.setCenter(new GLatLng(lat, lon), size);
		map.enableScrollWheelZoom();
		map.setMapType(G_NORMAL_MAP);
		//map.setUIToDefault();

		if (strMarkers!="++"){ var bounds = new GLatLngBounds(); }
		
		if (boolerase == 1) { map.clearOverlays(); }
		var Icon = new GIcon();
		Icon.iconSize=new GSize(32,32);
		Icon.shadowSize=new GSize(56,32);
		Icon.iconAnchor=new GPoint(16,32);
		Icon.infoWindowAnchor=new GPoint(16,0);

		function createMarker(point,html,icon,typeOfMarker) {
			var marker = new GMarker(point,icon);
			GEvent.addListener(marker, "click", function() {
					marker.openInfoWindowHtml(html);
					document.getElementById("map_zoom").value = map.getZoom();
					//document.getElementById("contMenu").style.display = "";
					document.getElementById("map_coordenades").value = map.getCenter();
			}); 
	        GEvent.addListener(map, "infowindowclose", function() {
					var zoomOnClick = document.getElementById("map_zoom").value;
					var coordenadeOnClick = document.getElementById("map_coordenades").value;
					//document.getElementById("contMenu").style.display = "";
					var arrayCoordenades = coordenadeOnClick.split(",");
					var paramLat = parseFloat(  Right(  trim(arrayCoordenades[0]), (arrayCoordenades[0].length - 1)  ) );
					var paramLon = parseFloat(  Left(  trim(arrayCoordenades[1]), (arrayCoordenades[1].length - 1)  )  );
					map.setCenter(new GLatLng(paramLat, paramLon), parseInt(zoomOnClick));
			});
			return marker;
		}
		arrayMarkers = strMarkers.split("*");
		i = 0;
		for (var index in arrayMarkers){
			var arrayEachMarker = arrayMarkers[index].split("+");
			var markerLat = stringToNumber(arrayEachMarker[0]); var markerLon = stringToNumber(arrayEachMarker[1]);
			var markerData = arrayEachMarker[2]; 
					
			if (arrayEachMarker[3]=="C" || arrayEachMarker[3]=="A" || arrayEachMarker[3]=="S"){
				var pushpin = new GIcon(Icon, arrayEachMarker[4], null, arrayEachMarker[5]);			
			}else{
				var pushpin = new GIcon(Icon, "http://maps.google.com/mapfiles/kml/pal3/icon55.png", null, "http://maps.google.com/mapfiles/kml/pal3/icon55s.png");			
			}
			//alert(arrayEachMarker[4]);
			var location = new GLatLng(markerLat,markerLon);

			var marker = createMarker(location, markerData, pushpin,arrayEachMarker[3])				    
			gmarkers[i] = marker;
			i++;
			if (markerLat!=0 || markerLon!=0){ 
				map.addOverlay(marker);
				
				if (boolFirstMap){ bounds.extend(location); }

			}
			
		}
		
		/*contextmenu = document.getElementById("contMenu");
		map.getContainer().appendChild( contextmenu );
		var x=428;
		var y=7;

		var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(x,y));  
		pos.apply(contextmenu);*/
		// AGREGAR EL OVERVIEW DEL MAPA ----------------------------------------------------------------------------------------
		/*
		var overviewmap = new GOverviewMapControl(new GSize(200,200)) 
		map.addControl(overviewmap);
		overviewmap.hide(true); 
		//  ======== funcion para ajustar la posicion del overview ========
		function positionOverview(x,y) {
				var omap=document.getElementById("map_overview");
				omap.style.left = x+"px";
				omap.style.top = y+"px";
				// == cambio el estilo del overview ==
				omap.firstChild.style.border = "1px solid gray";
				omap.firstChild.firstChild.style.left="4px";
				omap.firstChild.firstChild.style.top="4px";
				omap.firstChild.firstChild.style.width="190px";
				omap.firstChild.firstChild.style.height="190px";
		}
		//----------------------------------------------------------------------------------------------------------------------------------------
		*/
		map.addControl(new GLargeMapControl()); 
		map.addControl(new GMapTypeControl());
		map.enableContinuousZoom(); 
		GEvent.addListener(map, "click", function() {
			//contextmenu.style.visibility = "hidden";
			//document.getElementById("contMenu").style.display="none";
		});
		GEvent.addListener(map,'mousemove',function(p) { document.getElementById("hiddenCursorPoint").value = p; }); 
		// CREA EL MENU CONTEXTAL----------------------------------------------------------------------------------------------------

		/*
		var contextmenu = document.createElement("div");
		contextmenu.id = "contMenu";
		contextmenu.style.display="none";
		contextmenu.style.background="#ffffff";
		contextmenu.style.border="1px solid #8888FF";

		contextmenu.innerHTML = '<a href="javascript:goNearestLocation(\'region\'); "><div class="context">&nbsp;&nbsp;Go nearest region&nbsp;&nbsp;</div></a>'
					+'<a href="javascript:goNearestLocation(\'edition\'); "><div class="context">&nbsp;&nbsp;Go nearest département&nbsp;&nbsp;</div></a>'
					+'<a href="javascript:goNearestLocation(\'zone\')"><div class="context">&nbsp;&nbsp;Go nearest zone&nbsp;&nbsp;</div></a>'
					+ '<a id="goNearestA" href="javascript:goNearestLocation(\'ville\'); "><div class="context">&nbsp;&nbsp;Go nearest ville&nbsp;&nbsp;</div></a>';
		map.getContainer().appendChild(contextmenu);
		*/
		// AGREGA EL EVENTO singlerightclick ---------------------------------------------------------------------------------------------
		/*
		GEvent.addListener(map,"singlerightclick",function(pixel,tile) {
		// store the "pixel" info in case we need it later
		// adjust the context menu location if near an egde
		// create a GControlPosition
		// apply it to the context menu, and make the context menu visible
		clickedPixel = pixel;
		var x=pixel.x;
		var y=pixel.y;
		if (x > map.getSize().width - 120) { x = map.getSize().width - 120 }
		if (y > map.getSize().height - 100) { y = map.getSize().height - 100 }
		var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(x,y));  
		pos.apply(contextmenu);
		//contextmenu.style.visibility = "visible";
		document.getElementById("contMenu").style.display="";
		});
		*/
		
		// SET MAP CENTER---------------------------------------------------------------------------------------------------------------------
			if (useOnceMapParams>0 && paramZoom != "" && paramZoom!=undefined ){			
					//alert("paramZoom: "+paramZoom+"|paramCenter: "+paramCenter)
					document.getElementById("map_zoom").value = paramZoom;
					var paramLat; var paramLon;
					var arrayCoordenades = paramCenter.split(",");
					paramLat = parseFloat(  Right(  trim(arrayCoordenades[0]), (arrayCoordenades[0].length - 1)  ) );
					paramLon = parseFloat(  Left(  trim(arrayCoordenades[1]), (arrayCoordenades[1].length - 1)  )  );
					//alert("paramLat: |"+paramLat+"| -- paramLon: |"+paramLon+"|");
					map.setCenter(new GLatLng(paramLat, paramLon), parseInt(paramZoom));
					if (  Left(catSelected,1) != "-"  ){
						useOnceMapParams--;
					}else{
						useOnceMapParams = useOnceMapParams - 2;
					}
			}else{
				if (!boolFirstMap){
						//alert("size:"+size+"|lat:"+lat+"|lon:"+lon);
						//alert("mapCoordenadesFromMenu: "+mapCoordenadesFromMenu); alert("mapZoomFromMenu: "+mapZoomFromMenu);
						var coordToSetNotFirstMap; var zoomToSetNotFirstMap;
						if (mapZoomFromMenu!=0){ zoomToSetNotFirstMap = mapZoomFromMenu; }else{ zoomToSetNotFirstMap =  map.getZoom(); }
						if (mapCoordenadesFromMenu!=""){ 
							coordToSetNotFirstMap = mapCoordenadesFromMenu;
							var arrayCoordenades = mapCoordenadesFromMenu.split(",");
							lat = parseFloat(  Right(  trim(arrayCoordenades[0]), (arrayCoordenades[0].length - 1)  ) );
							lon = parseFloat(  Left(  trim(arrayCoordenades[1]), (arrayCoordenades[1].length - 1)  )  );
						}else{ 
							coordToSetNotFirstMap = map.getCenter(); 
						}
						//alert("lat: "+lat+"-lon: "+lon); alert("zoom: "+zoomToSetNotFirstMap);
						map.setCenter(new GLatLng(lat, lon), zoomToSetNotFirstMap);
						document.getElementById("map_zoom").value = zoomToSetNotFirstMap;
						document.getElementById("map_coordenades").value = map.getCenter();
				}else{
						map.setZoom(map.getBoundsZoomLevel(bounds));
						map.setCenter(bounds.getCenter());
				}
			}
		//----------------------------------------------------------------------------------------------------------------------------------------
		
	}else{
		document.getElementById("divmap").innerHTML = "Browser is not compatible";
	}
}  
// This function picks up the click and opens the corresponding info window
function myclick(i) {
	GEvent.trigger(gmarkers[i], "click");
}
//]]> 
function LoadjQueryFunctions(idcatselected,idselectedarea,idselectedville,idsubcattoselect,idregiontoselect,ideditiontoselect,mapzoomtoset,mapcenter,txtsearched){
			var idSubCatToSelect2 = idsubcattoselect;
			$('#CatTable').hide();
			var options1; var boolResult;
			//load sponsors
			var valRegionForFirstMap = $("#regionSelect").val();
			$.ajax({
			   type: "POST",
			   url: "process.asp",
			   data: "action=loadFirstMap&edition="+document.getElementById("hiddenEdition").value+"&gRegion="+valRegionForFirstMap,
			   success: function(txt){
					//alert(txt);
					mapmarkers ="";
					if (txt!=""){ 
						arrayMapaData = txt.split("%");
						var MapCoordenades = arrayMapaData[1];
						if (MapCoordenades!=""){ 
							
							arrayMapCoordenades = MapCoordenades.split("|");
							//alert(maplat+","+maplon);
							maplat = stringToNumber(arrayMapCoordenades[0]);
							maplon = stringToNumber(arrayMapCoordenades[1]);
							arraySponsors = arrayMapaData[0].split("*");
							if (arraySponsors!=""){
								for (var index in arraySponsors){
									var arrayDataEd = arraySponsors[index].split("|");
									if (mapsponsors != ""){ mapsponsors += "*" }
									var detailsLink = "<input type='button' style='cursor:pointer;' onClick=redirectDetails('details.asp?cat=-&area="+ getDropDownSelectedValue("area") +"&cat=&markerU="+ arrayDataEd[6] +"&markerUSh="+ arrayDataEd[7] +"&type=sponsor&lat="+ arrayDataEd[0] +"&lon="+ arrayDataEd[1] +"&idSponsor="+ arrayDataEd[8] +"&ville="+ getDropDownSelectedValue("ville") +"&idedition="+ document.getElementById("hiddenEdition").value  +"&idRegion="+ arrayDataEd[10] +"') value='details' />";
									mapsponsors += arrayDataEd[0] + "+" + arrayDataEd[1] + "+"+ arrayDataEd[9] +"<div align='left'><i>Annonceur</i></div><div align='center'><B>"+ arrayDataEd[2] +"</B></div><div><object width='250' height='250'><param name='movie' value='"+ arrayDataEd[5] +"'></param><param name='wmode' value='transparent'></param><embed src='"+ arrayDataEd[5] +"' type='application/x-shockwave-flash' wmode='transparent' width='250' height='250'></embed></object></div><div align='center'>"+ arrayDataEd[3] +" <br> "+ arrayDataEd[4] +"</div><div align='right'>"+ detailsLink +"</div>+S+" + arrayDataEd[6] + "+" + arrayDataEd[7];
								}
							}else{
								mapsponsors = "++";
							}
							load(maplat, maplon, mapzoom, mapsponsors,0,mapzoomtoset,mapcenter,true,idcatselected);	
						}
					}
			   }
			});
			//fin load sponsors
			

			$("#regionSelect").change(function(){
					
					var valRegion = $(this).val(); $("#CatTable").fadeOut(500);
					//alert(valRegion);
					$("#editionSelect").html("<option>loading...</option>");
					$.ajax({
					   type: "POST",
					   url: "process.asp",
					   data: "action=ceditions&region="+valRegion,
					   success: function(txt){					      
							var arrayEditions = new Array(); 
							options1 = "";
							boolResult = false;
							//alert("txt:"+txt);
							if (txt != ""){
								boolResult = true; arrayEditions = txt.split(",");
								$("#editionSelect").empty(); options1="";
								for (var index in arrayEditions){
									var arrayDataEd = arrayEditions[index].split("*");
									//alert(arrayDataEd[0]);
									if(arrayDataEd[0]==2){
										options1 += "<option value='"+ arrayDataEd[0] +"' SELECTED >"+arrayDataEd[1]+"</option>";
									}else{
										options1 += "<option value='"+ arrayDataEd[0] +"'>"+arrayDataEd[1]+"</option>";	
									}
								}
							}else{
								$("#editionSelect").empty();
								//alert("empty edition");
							}
							options1 = "<option value='-----------'>-----------</option>" + options1;
							//alert("options: "+options2);
							$("#editionSelect").prepend(options1);
							
							//cargo hidden area combo para cargar los datos de este
							
							
							$.ajax({
							   type: "POST",
							   url: "process.asp",
							   data: "action=filleLittleThingForIEIssue",
							   success: function(txt){
									//alert(txt);
									options1 = "<option value='"+ txt +"'>"+ txt +"</option>";
									$("#hiddenEditionSelect").prepend(options1);
									
									if (ideditiontoselect==""){
										if (boolSelectFirstEdition){
											document.getElementById("editionSelect").options[0].selected = true;
										}else{ boolSelectFirstEdition=true; }
									}else{
										//alert("2:"+ideditiontoselect);
										setDropDownSelectedValue("editionSelect",ideditiontoselect);
										$("#editionSelect").trigger('change');
									}

								}
							});
							
							
							if (boolResult){ 
								if (boolSelectFirstEdition){
									$("#editionSelect").trigger('change');
								}
								document.getElementById("btnSubmit").disabled = false;
								
							}else{
								document.getElementById("btnSubmit").disabled = false;
							}
						}
					});
			 });
			
			
			$("#editionSelect").change(function(){
					var valEdition = $(this).val(); $("#CatTable").fadeOut(500);
					$("#area").html("<option>loading...</option>");
					document.getElementById("btnSubmit").disabled = false;
					//alert(valEdition);
					$.ajax({
					   type: "POST",
					   url: "process.asp",
					   data: "action=fillcomboareas&edition="+valEdition,
					   success: function(txt){					      
						  var arrayEditions = new Array(); options1="";
							boolResult = false;
							if (txt != ""){
								boolResult = true; arrayEditions = txt.split(",");
								$("#area").empty(); options1="";
								for (var index in arrayEditions){
									var arrayDataEd = arrayEditions[index].split("*");
									options1 += "<option value='"+ arrayDataEd[0] +"'>"+arrayDataEd[1]+"</option>";
								}
							}else{
								$("#area").empty();
							}
							options1 = "<option value='-----------'>-----------</option>" + options1;
							$("#area").prepend(options1);
							//cargo hidden area combo para cargar los datos de este
							
							
							$.ajax({
							   type: "POST",
							   url: "process.asp",
							   data: "action=filleLittleThingForIEIssue",
							   success: function(txt){
									//alert(txt);
									options1 = "<option value='"+ txt +"'>"+ txt +"</option>";
									$("#hiddenAreaSelect").prepend(options1);
									
									if (idselectedarea==""){
										//alert(boolSelectFirstArea);
										if (boolSelectFirstArea){
											document.getElementById("area").options[0].selected = true;
										}
									}else{
										setDropDownSelectedValue("area",idselectedarea);
										if (idselectedville=="-----------"){
											if (Left(idcatselected,1) != "-" && showOnceSelectedValues == 1){
												
											}
										}
									
									}
									//alert(boolSelectFirstArea+" .Next line trigger");
									if (boolSelectFirstArea){ $("#area").trigger('change'); }else{ boolSelectFirstArea = true; }
								}
							});
							/*
							if (boolResult){ 
								$("#area").trigger('change');
								document.getElementById("btnSubmit").disabled = false;
								//$("#area").trigger('change');
							}else{
								document.getElementById("btnSubmit").disabled = false;
								
							}
							*/
							
						}
					});
			 });

			$("#area").change(function(){
					var valArea = $(this).val(); 
					//var valEdition = document.getElementById("hiddenEdition").value; 
					var valEdition = getDropDownSelectedValue("editionSelect");
					$("#CatTable").fadeOut(500);
					//document.getElementById("btnSubmit").disabled = true;
					document.getElementById("btnSubmit").disabled = false;
					$("#ville").html("<option>loading...</option>");
					
					//alert(valEdition+"|"+valArea);
					
					$.ajax({
					   type: "POST",
					   url: "process.asp",
					   data: "action=fillcombovilles&edition="+valEdition+"&area="+valArea,
					   success: function(txt){
							//alert(txt);
							var arrayVilles = new Array(); 
							boolResult = false;
							if (txt != ""){
								boolResult = true; arrayVilles = txt.split(",");
								$("#ville").empty(); options1="";
								for (var index in arrayVilles){
									var arrayDataVilles = arrayVilles[index].split("*");
									options1 += "<option value='"+ arrayDataVilles[0] +"'>"+arrayDataVilles[1]+"</option>";
								}
							}else{
								$("#ville").empty();
							}
							$("#ville").prepend(options1);
							//cargo hidden ville para que se cargue el selected value de details.
							$.ajax({
							   type: "POST",
							   url: "process.asp",
							   data: "action=filleLittleThingForIEIssue",
							   success: function(txt){
									//alert(txt);
									options1 = "<option value='"+ txt +"'>"+ txt +"</option>";
									$("#hiddenVilleSelect").prepend(options1);
									
									if (idselectedville==""){
										if (boolSelectFirstVille){
											document.getElementById("ville").options[0].selected = true;
										}else{ boolSelectFirstVille = true; }
									}else{
										
										setDropDownSelectedValue("ville",idselectedville);
										
										if (Left(idcatselected,1) != "-" && showOnceSelectedValues == 1){
											if (txtsearched!="" && useOnceSearchText==1){
												document.getElementById("textSearch").value = txtsearched;
												useOnceSearchText = 0;
											}
											$("#btnSubmit").trigger('click');
											showOnceSelectedValues = 0;
										}
										
									}

								}
							});
							
							if (boolResult){ 
								if (boolSelectFirstVille){
									
									$("#ville").trigger('change');
								}
								document.getElementById("btnSubmit").disabled = false;
							}
					   }
					});
			 });
			 $("#ville").change(function(){
				$("#CatTable").fadeOut(500);
				if($("#category").val()=="39"){
					$("#btnSubmit").trigger('click');
				}
				mapmarkers = "";
			 });
			$("#category").change(function(){
				$("#CatTable").fadeOut(500);
				strIDS = "";
				//alert($(this).val());
				if ($(this).val()=="39"){
					//$(".weeksTD").show();
					//document.getElementById("wTD1").style.display = "";
					document.getElementById("wTD2").style.display = "";
					$(".TRSearch").show();
					document.getElementById("textSearch").select();
//					document.getElementById("contMenu").style.display="";
				}else{
					//$(".weeksTD").hide();
					document.getElementById("wTD1").style.display = "none";
					document.getElementById("wTD2").style.display = "none";
					$(".TRSearch").hide();
//					document.getElementById("contMenu").style.display="none";
				}
			 });
			 $("#btnSubmit").click(function(){
					var valCategory = $("#category").val(); var valEdition = $("#editionSelect").val();
					var valArea = $("#area").val(); var valVille = $("#ville").val();
					var valWeeks = $("#gMapsWeeks").val();
					var valTextToSearch = $("#textSearch").val();
					valTextToSearch = valTextToSearch.replace(/\'/g, '\"')
					document.getElementById("textSearch").value = valTextToSearch;
					var valRegion = $("#regionSelect").val();
					
					//alert(window.chAll);
					
					//alert(valTextToSearch);
					//vacio marcadores
					mapmarkers = "";
					var strCategory = valCategory;
					//alert("reg:"+valRegion+"|ed:"+valEdition+"|area:"+valArea+"|ville:"+valVille+"|cat:"+strCategory+"|week: "+valWeeks+"|search:"+valTextToSearch);
					if (valArea!="loading..." && valEdition!="loading..." && valVille!="loading..."){
						$("#loadingMsg").show();
						$('#loadingMsg').modal({ overlayId: 'modalOverlay'  });
						//alert(valRegion);
						$.ajax({
						   type: "POST",
						   url: "process.asp",
						   data: "action=getData&edition="+valEdition+"&area="+valArea+"&ville="+valVille+"&category="+strCategory+"&gWeeks="+valWeeks+"&gRegion="+valRegion+"&gTextToSearch="+ParseTextToAjaxSend(valTextToSearch),
						   success: function(txt){
								var arrayToParse = new Array();
								arrayToParse = txt.split("|");
								if (arrayToParse[0]=="nodata"){
									var tabletoAdd = arrayToParse[1]; var idtoAdd = arrayToParse[2];
									var infoAdd = arrayToParse[3];
									var forShow = tabletoAdd;
									//alert(forShow);
									if (forShow=="utilisateurs"){
										//alert("No coordenades found for " + infoAdd);
										alert("La recherche n'a renvoyé aucun records.");
									}else{
										alert("Coordenates pas trouvé. S’il vous plaît contacter l'administrateur.");
									}

								}else{
									maplat = stringToNumber(arrayToParse[0]);
									maplon = stringToNumber(arrayToParse[1]);
									mapzoom = parseInt(arrayToParse[2]);
									strSubCats = arrayToParse[3];
									//if (mapmarkers!=""){ mapmarkers+="*"; }
									
									mapmarkers = arrayToParse[4];
									//alert("mm: "+mapmarkers);
									//if (mapmarkers==""){ alert("No markers for ville/zone"); }
									//cargo el mapa
									var markersToShow;
									if (mapsponsors!=""){ 
										markersToShow = mapsponsors+"*"+mapmarkers;
									}else{
										markersToShow = mapmarkers;
									}
									load(maplat,maplon,mapzoom,markersToShow,1,mapzoomtoset,mapcenter,false,idcatselected);
									var count2 = 0;
									if (arrayToParse[5]=="scats"){
										if (strSubCats){
											//remuevo elementos
											$(".SubCatClass").remove();
											//alert("strSubCats: " + strSubCats);
											arraySubCats = strSubCats.split(",");							
											var count = 1; var countRows = 0;
											arrayObjects = Array(arraySubCats.lenght);
											$("#divCat").empty();
											//$("#divCat").prepend("<table id='tSubCats' border='0' width='680px' align='center'>");
											//alert(strSubCats);
											 var count2 = 5;
											 
											var tableSubCats = document.createElement("Table"); 
											tableSubCats.cellSpacing = "0"; tableSubCats.cellPadding = "0"; tableSubCats.width = "790px"; tableSubCats.border = 0;
											tableSubCats.align = "center";
											 
												
												index = 0;
												//rows = 3; 
												rows = (arraySubCats.length/4)
												rowCounter = arraySubCats.length;
												cols = 7;
												//alert("subs: "+rowCounter);
												for(i=0;i<rows;i++){
													
													var  TRtable = tableSubCats.insertRow(i);
													rowCounter = 0;

													for(j=0;j<cols;j++){  
														if (arraySubCats[index]){
															newID = "subCatChk" + count;
															
															var  TDtable = TRtable.insertCell(j);
															TDtable.align="left";
															var arraySubCatInfo = arraySubCats[index].split("%");
															TDtable.innerHTML = "<input type='checkbox' name='chkboxes' id='subCatChk"+arraySubCatInfo[0] +"' value='"+ arraySubCatInfo[0] +"' onClick='fromSubCat(this);' /> "+ arraySubCatInfo[1];
															TDtable.className = 'SubCatClass';
															
															count++; 
															
															if (index < arraySubCats.length){ index++; }
															if (strIDS!=""){
																strIDS += "*";
															}
															strIDS += "subCatChk"+arraySubCatInfo[0];
															rowCounter--;
															if (rowCounter==0){ break; }
														}
													}
													if (rowCounter==0){ break; }
												}

											document.getElementById("divCat").appendChild(tableSubCats);
											$("#CatTable").fadeIn(1000);
											// selecciono la sub-categoria
											if (idSubCatToSelect2!=""){
												if (document.getElementById("subCatChk"+idSubCatToSelect2) !== null){
													document.getElementById("subCatChk"+idSubCatToSelect2).checked = true;
													fromSubCat(document.getElementById("subCatChk"+idSubCatToSelect2));
												}
												
											}
											
										}//else{ alert("no sub-cat"); }
									}
									if (arrayToParse[5]=="articles"){
										//alert("articles");
									}
								}
								
								
								document.getElementById("listBOX").style.display = "none";
								document.getElementById("divmap").style.display = "";
								document.body.style.cursor = 'default';
								$.modal.close(); document.getElementById("loadingMsg").style.display = "none";
						   }
						});
					}else{  }
			 });
			
			$("#category").html("<option>loading...</option>");
			//alert("user type_"+document.getElementById("hiddenUserType").value);
			$.ajax({
			   type: "POST",
			   url: "process.asp",
			   data: "action=fillcombocategory&userType="+document.getElementById("hiddenUserType").value,
			   success: function(txt){
					var arrayAreas = new Array(); 
					options1 = "<option>-----------</option>"; boolResult = false;
					if (txt != ""){
						boolResult = true; arrayAreas = txt.split("*");
						$("#category").empty(); options1="";
						for (var index in arrayAreas){
							var arrayCategoryData = arrayAreas[index].split("|");
							options1 += "<option value='"+ arrayCategoryData[0] +"'>"+arrayCategoryData[1]+"</option>";
						}
					}else{
						$("#category").empty();
					}
					$("#category").prepend(options1);
					//cargo HiddenCategory para que funcione la seleccion
					$.ajax({
					   type: "POST",
					   url: "process.asp",
					   data: "action=filleLittleThingForIEIssue",
					   success: function(txt){
							//alert(txt);
							options1 = "<option value='"+ txt +"'>"+ txt +"</option>";
							$("#hiddenCategorySelect").prepend(options1);
							if (idcatselected==""){
								document.getElementById("category").options[1].selected = true;
							}else{
								setDropDownSelectedValue("category",idcatselected);
							}					
							if (boolResult){ 
								$("#category").trigger('change');
								document.getElementById("btnSubmit").disabled = false;
								//$("#category").trigger('change');
							}else{
								document.getElementById("btnSubmit").disabled = false;
							}
						}
					});

			   }
			});
			//$("#editionSelect").trigger('change');
			if (idregiontoselect==""){
				setDropDownSelectedValue("regionSelect",91);
			}else{
				setDropDownSelectedValue("regionSelect",parseInt(idregiontoselect));
			}
			
			$("#regionSelect").trigger('change');

}	
function ParseTextToAjaxSend(val){
		var arrayValToParse = new Array(); var parsedText = "";
		arrayValToParse = val.split(" "); 
		for (var index in arrayValToParse){
			if (parsedText!=""){ parsedText+="|"; }
			parsedText+=arrayValToParse[index];
		}
		return parsedText;
}
function fromSubCat(obj){
	$(document).ready(function(){
		if (obj.checked==true){
			var strSubCategory = ParseTextToAjaxSend(obj.value);
			var categoryId = document.getElementById("category").value;
			var regionId = $("#regionSelect").val();
			var areaSubCat = document.getElementById("area").value;
			//var villeSubCat = document.getElementById("ville").value;
			var villeSubCat = $("#ville").val();
			//var editionSubCat = document.getElementById("hiddenEdition").value;
			var editionSubCat = getDropDownSelectedValue("editionSelect");
			
			//alert("obj.regionId: " + regionId + "|strSubCategory: "+strSubCategory+"|categoryId:"+categoryId+"|areaSubCat:"+areaSubCat+"|villeSubCat:"+villeSubCat+"|editionSubCat:"+editionSubCat);
			//alert(regionId);
			allCh = 0;
			
			if (window.chAll == 1){
				window.chAll = 0;
				strSubCategory="t";
			}
			if (strSubCategory=="t"){ checkAll(document.subcatForm.chkboxes); allCh = 1; }
			$("#loadingMsg").show();
			$('#loadingMsg').modal({ overlayId: 'modalOverlay'  }); 
			$.ajax({
			   type: "POST",
			   url: "process.asp",
			   data: "action=subcat&allChecked="+allCh+"&edition="+editionSubCat+"&area="+areaSubCat+"&ville="+villeSubCat+"&scat="+ strSubCategory+"&categoryId="+categoryId+"&gRegion="+regionId,
			   success: function(txt){
				//alert(txt);
				var arrayResult = txt.split("|");
				if (arrayResult[1]=="nook"){ alert("Some sorties have no coordenades for localization and where not displayed"); }
				mapmarkers += "*" + arrayResult[0];
				//alert(mapmarkers);
				load(maplat,maplon,mapzoom,mapsponsors+mapmarkers,0);
				$.modal.close(); document.getElementById("loadingMsg").style.display = "none";
			   }
			});
		}else{ 

			var strKeep= "";
			//window.chAll = 0;
			arrayIDS = strIDS.split("*");
			for (var a1 in arrayIDS){
				 //alert(arrayIDS[a1]);
				 if (document.getElementById(arrayIDS[a1]).checked ==true){
					 //alert(arrayIDS[a1]);
					 if (strKeep!=""){ strKeep += "*"; }
					 strKeep += document.getElementById(arrayIDS[a1]).value;
				 }
			}
			var categoryId = document.getElementById("category").value;
			//alert("obj.value: " + obj.value);
			if (obj.value=="t"){ uncheckAll(document.subcatForm.chkboxes); strKeep =""; }
			$("#loadingMsg").show();
			$('#loadingMsg').modal({ overlayId: 'modalOverlay'  }); 

			$.ajax({
			   type: "POST",
			   url: "process.asp",
			   data: "action=subcat&allChecked=0&scat="+strKeep+"&edition="+document.getElementById("editionSelect").value+"&area="+document.getElementById("area").value+"&ville="+$("#ville").val()+"&categoryId="+categoryId+"&gRegion="+$("#regionSelect").val(),
			   success: function(txt){
				var arrayResult = txt.split("|");
				if (arrayResult[1]=="nook"){ alert("Some sorties have no coordenades for localization and where not displayed"); }
				//if (mapmarkers!=""){ mapmarkers+=mapmarkers+"*" }
				mapmarkers = arrayResult[0];
				var markersToShow;
				if (mapsponsors!=""){ 
					markersToShow = mapsponsors+"*"+mapmarkers;
				}else{
					markersToShow = mapmarkers;
				}
				load(maplat,maplon,mapzoom,markersToShow,1);
				$.modal.close(); document.getElementById("loadingMsg").style.display = "none";
			   }
			});
		}
	});
}
function on_change_type(){
	window.chAll = 1;
	window.FORCE_CHECK_ALL = true;
	$("#btnSubmit").trigger("click");
}
function change_pagination(showID, max){
	document.body.style.cursor = 'hand';
	document.body.style.cursor = 'pointer';
	for (var ppag = 1; ppag<=max; ppag++){
		if (ppag != showID){
			$(".PAG_"+ppag).hide();
			var o_PAGNUMBER = document.getElementById("PAGNUMBER_"+ppag);
			o_PAGNUMBER.style.cursor = "pointer";
			o_PAGNUMBER.style.cursor = "hand";
			o_PAGNUMBER.style.color = "blue";
			o_PAGNUMBER.style.textDecoration = "underline";
		}
	}
	$(".PAG_"+showID).show(200);
	var o_PAGNUMBER_S = document.getElementById("PAGNUMBER_"+showID);
	o_PAGNUMBER_S.style.cursor = "default";
	o_PAGNUMBER_S.style.color = "black";
	o_PAGNUMBER_S.style.textDecoration = "none";
	document.body.style.cursor = 'default';
}
function list_view(){
	
	$("#loadingMsg").show();
	$('#loadingMsg').modal({ overlayId: 'modalOverlay'  }); 
					var valCategory = $("#category").val(); var valEdition = $("#editionSelect").val();
					var valArea = $("#area").val(); var valVille = $("#ville").val();
					var valWeeks = $("#gMapsWeeks").val();
					var valTextToSearch = $("#textSearch").val();
					valTextToSearch = valTextToSearch.replace(/\'/g, '\"')
					document.getElementById("textSearch").value = valTextToSearch;
					var valRegion = $("#regionSelect").val();
					
					//alert(valTextToSearch);
					//vacio marcadores
					mapmarkers = "";
					var strCategory = valCategory;
					//alert("reg:"+valRegion+"|ed:"+valEdition+"|area:"+valArea+"|ville:"+valVille+"|cat:"+strCategory+"|week: "+valWeeks+"|search:"+valTextToSearch);
					if (valArea!="loading..." && valEdition!="loading..." && valVille!="loading..."){
						$("#loadingMsg").show();
						$('#loadingMsg').modal({ overlayId: 'modalOverlay'  }); 
						$.ajax({
						   type: "POST",
						   url: "process_list.asp",
						   data: "action=getData&edition="+valEdition+"&area="+valArea+"&ville="+valVille+"&category="+strCategory+"&gWeeks="+valWeeks+"&gRegion="+valRegion+"&gTextToSearch="+ParseTextToAjaxSend(valTextToSearch),
						   success: function(txt){

								if (txt==""){
										alert("La recherche n'a renvoyé aucun records.");
								}else{
									var arrayToParse = new Array();
									arrayToParse = txt.split("|");
									var tableSubCats = document.createElement("Table"); 
									tableSubCats.cellSpacing = "0"; 
									tableSubCats.cellPadding = "0"; 
									tableSubCats.width = "790px"; 
									tableSubCats.border = 0;
									tableSubCats.align = "center";
									
	
									$("#listBOX").empty();
									var returnBOX  = document.createElement("DIV"); 
									returnBOX.style.textAlign="left";
									returnBOX.style.fontSize="14px";
									returnBOX.innerHTML = "<a href='#' style='font-size:14px;' onClick=\"document.getElementById('listBOX').style.display = 'none';document.getElementById('divmap').style.display = '';\">Retour &agrave; la carte</a>";
									returnBOX.innerHTML += "<br/><br/>";
									document.getElementById("listBOX").appendChild(returnBOX);
									
									// pagination
									var pages_num = 1;
									if (arrayToParse.length>30){
										pages_num = arrayToParse.length / 30;
										pages_num = Math.round(pages_num);
									}
									
									var pagBOX  = document.createElement("DIV"); 
									pagBOX.style.fontSize="14px";
									
									
									var str_pages_num = "";
									for (var pn = 1; pn<=pages_num; pn++){
										
										var numberSPAN  = document.createElement("SPAN");
										if (pn != 1){
											numberSPAN.style.cursor = "pointer";
											numberSPAN.style.cursor = "hand";
											numberSPAN.style.color = "blue";
											numberSPAN.style.textDecoration = "underline";
										}
										numberSPAN.title = pn.toString();
										numberSPAN.id = "PAGNUMBER_"+pn;
										//alert(pn+" - "+pages_num);
										numberSPAN.onclick = function(){
											
											change_pagination(this.title, pages_num);
											
										}
										var spanTEXT = document.createTextNode(pn.toString());
										numberSPAN.appendChild(spanTEXT);
										
										
										var numberSPAN_sep  = document.createElement("SPAN");
										var spanTEXT_sep = document.createTextNode(" - ");
										numberSPAN_sep.appendChild(spanTEXT_sep);
										
										pagBOX.appendChild(numberSPAN);
										//alert(pn+" - "+pages_num);
										if (pn != pages_num) pagBOX.appendChild(numberSPAN_sep);
									}
					
									document.getElementById("listBOX").appendChild(pagBOX);
									
									
									
									
									// loop articles
									var tr_back = "#CCCCCC";
									var countArticles  = 1;
									var idForPagination = 1;
									
									// get all ids
									var all_idss = "";
									for (var z=0; z<arrayToParse.length;z++){
										var a_article_s 	= arrayToParse[z].split("*");
										if (!isNaN(a_article_s[4])){
											var A_IDs			= a_article_s[4];
											if (all_idss!="") all_idss += "|";
											all_idss += A_IDs
										}
									}
									//document.getElementById("t_ids").innerHTML = all_idss;
									for (var a=0; a<arrayToParse.length;a++){
										var a_article = arrayToParse[a].split("*");
										var A_TITRE 	= a_article[0];
										var A_SURTITRE 	= a_article[1].toString();
										var A_TEXT 		= a_article[2];
										var A_IMG 		= a_article[3];
										var A_ID		= a_article[4];
										var A_VILLENAME	=  a_article[5];
										var A_ZONENAME	=  a_article[6];
										
										if (countArticles==30){
											countArticles = 1;
											idForPagination++;
										}
										
										
										
										
										var  TRtable = tableSubCats.insertRow(a);
										TRtable.className = "PAG_"+idForPagination;
										//alert("PAG_"+idForPagination);
										TRtable.style.display = "none";
										if (tr_back == "#E6E6E6"){
											tr_back = "#CCCCCC";
										}else{
											tr_back = "#E6E6E6";
										}
										TRtable.bgColor = tr_back;
										for(j=0;j<3;j++){  
												var  TDtable = TRtable.insertCell(j);
												var DIV_INNER = "";
												if (j==0){
													DIV_INNER += "<img src='"+A_IMG+"' width='50px' height='50px'/>";
													TDtable.style.padding = "8px"; 
													TDtable.style.verticalAlign = "middle"; 
													TDtable.vAlign = "middle";
												}else if(j==1){
													// http://www.infoalacarte.fr/articledetails.asp?idArticle=165293&idArticles=165293&sem=24&id=2406&idedition=5&lat=43,41698&lon=1,628665&markerU=http://maps.google.com/mapfiles/kml/pal4/icon0.png&markerUSh=http://maps.google.com/mapfiles/kml/pal4/icon0s.png&area=-----------&cat=39&type=articles&ville=-----------&txtSearch=&mapCenter=(47.07012182383309,-1.07666015625)&mapZoom=6
													var anchor_article = "<span style='cursor:pointer;cursor:hand;color:blue;text-decoration:underline;' onClick='wArticle = window.open(\"articledetails_list.asp?idArticle="+A_ID+"&all="+all_idss+"&retour=list\");wArticle.focus();'>";
													//if (a==0) alert(all_idss);
													DIV_INNER = anchor_article;
													
													//if (a==10) alert("-"+A_SURTITRE+"-"+ typeof(A_SURTITRE) );
													if (A_SURTITRE!="" && A_SURTITRE!=" " && A_SURTITRE!=undefined) DIV_INNER += "<B>"+A_SURTITRE+"</B>, ";
													DIV_INNER += "<i>"+A_TITRE+"</i></span>, Ville&nbsp;:&nbsp;"+ A_VILLENAME+", Zone&nbsp;:&nbsp;"+A_ZONENAME +"<hr size='1px' color='#CCCCCC' />";
													DIV_INNER += "<span style='font-size:10px;'>"+A_TEXT+"</span>";
													TDtable.style.paddingBottom = "25px"; 
													TDtable.style.paddingRight = "10px"; 
												}
												//TDtable.innerHTML = '<div><b class="spiffy"><b class="spiffy1"><b></b></b><b class="spiffy2"><b></b></b><b class="spiffy3"></b><b class="spiffy4"></b><b class="spiffy5"></b></b><div class="spiffyfg">';
												TDtable.style.paddingTop = "15px"; 
												TDtable.innerHTML = DIV_INNER;
												//TDtable.innerHTML += '</div><b class="spiffy"><b class="spiffy5"></b><b class="spiffy4"></b><b class="spiffy3"></b><b class="spiffy2"><b></b></b><b class="spiffy1"><b></b></b></b></div>';
										}
										countArticles++;
									}
									
									document.getElementById("listBOX").appendChild(tableSubCats);
									document.getElementById("listBOX").style.display = "";
									document.getElementById("divmap").style.display = "none";
									

								}
								$(".PAG_1").show();
								document.body.style.cursor = 'default';
								$.modal.close(); document.getElementById("loadingMsg").style.display = "none";
						   }
						});
					}
	
	
	
}

