	function ponerDatos(BackColor, Fecha, Title, Description, Address, City, Telephone, Time, Address_Google, Adjuntos, AdjuntosC){
		document.getElementById("CerrarDiv").style.backgroundColor = BackColor;
		document.getElementById("CalendarDate").innerHTML = Fecha
		document.getElementById("CalendarTitle").innerHTML = Title
		document.getElementById("CalendarAddress").innerHTML = Address
		document.getElementById("CalendarCity").innerHTML = City
		document.getElementById("CalendarTelephone").innerHTML = Telephone
		document.getElementById("CalendarTime").innerHTML = Time
		document.getElementById("CalendarDescription").innerHTML = Description
		
		if (GBrowserIsCompatible()) {
			var mapCompeticion = new GMap2(document.getElementById("CalendarDivGoogle"));
			mapCompeticion.setCenter(new GLatLng(37.4419, -122.1419), 15);
			mapCompeticion.addControl(new GLargeMapControl());
			mapCompeticion.setMapType(G_NORMAL_MAP); 
			var geocoder = new GClientGeocoder();
			
			if(Address_Google!=""){
				mypoints =Address_Google.split(",")
				var mypoint = new GLatLng(mypoints[0], mypoints[1])
				var mypointCenter = new GLatLng(parseFloat(mypoints[0])+0.003, parseFloat(mypoints[1])-0.005)
				
				mapCompeticion.setCenter(mypointCenter, 15);
				var markerCompeticion = new GMarker(mypoint);
				mapCompeticion.addOverlay(markerCompeticion);
			}
		}
		document.getElementById("frAdjuntos").src = Adjuntos
		document.getElementById("frAdjuntosC").src = AdjuntosC
		
		document.getElementById("CalendarDiv").style.border = "10px solid " + BackColor;
		document.getElementById("CalendarDiv").style.display = ""
	}

	function cerrar(obj){
		obj = document.getElementById(obj)
		if(obj!=null){ obj.style.display="none"; }
	}
	
	aMonths = Array("", "Gener","Febrer","Març","Abril","Maig","Juny","Juliol","Agost","Septembre","Octubre","Novembre","Decembre");
	
	function fill_table(imonth, month_length, divMonth, changeMonth){ 
		day=1
		
		month = aMonths[imonth];
		
		var TableTotalMes = document.createElement('TABLE');
		TableTotalMes.className="Agenda"
			var TableMes = document.createElement('TBODY');
				// TR TITULO
				var trTitulo = document.createElement('TR');
					trTitulo.className="Agenda_Titulo";
					trTitulo.setAttribute("height",30);
					var fechaInicio = new Date(year, (imonth-1), 1, 0, 0, 0, 0)
					
					if(changeMonth){
						var TdTitulo = document.createElement('TD');
							TdTitulo.innerHTML = "<B>&lt;&lt;</B>"
							TdTitulo.style.cursor="pointer";
							TdTitulo.align="center"
							TdTitulo.onclick=function(){
								DatePreviousMonth = DateAdd(fechaInicio, "M", -1)
								self.location="?fechaInicio=" + dateFormat(DatePreviousMonth, "isoDate")
							}
						trTitulo.appendChild(TdTitulo)

						var TdTitulo = document.createElement('TD');
							TdTitulo.colSpan ="5"
							TdTitulo.style.cursor="pointer";
							TdTitulo.align="center"
							TdTitulo.innerHTML = "<B>"+month+"   "+year+"</B>"
							TdTitulo.onclick=function(){
								self.location="calendar_Anual.asp?fechaInicio=" + dateFormat(fechaInicio, "isoDate")
							}
						trTitulo.appendChild(TdTitulo)

						var TdTitulo = document.createElement('TD');
							TdTitulo.style.cursor="pointer";
							TdTitulo.innerHTML = "<B>&gt;&gt;</B>"
							TdTitulo.align="center"
							TdTitulo.onclick=function(){
								DateNextMonth = DateAdd(fechaInicio, "M", 1)
								self.location="?fechaInicio=" + dateFormat(DateNextMonth, "isoDate")
							}
						trTitulo.appendChild(TdTitulo)
					}else{
						var TdTitulo = document.createElement('TD');
							TdTitulo.colSpan ="7"
							TdTitulo.innerHTML = "<B>"+month+"   "+year+"</B>"
						trTitulo.appendChild(TdTitulo)
					}
				TableMes.appendChild(trTitulo)
				
				// DIA DE LA SEMANA
				var trDiaSemana = document.createElement('TR');
					trDiaSemana.className="Agenda_DiasSemana";
					var ThDiaSemana = document.createElement('TH');
						ThDiaSemana.innerHTML = "L"
					trDiaSemana.appendChild(ThDiaSemana)
	
					var ThDiaSemana = document.createElement('TH');
						ThDiaSemana.innerHTML = "M"
					trDiaSemana.appendChild(ThDiaSemana)
	
					var ThDiaSemana = document.createElement('TH');
						ThDiaSemana.innerHTML = "X"
					trDiaSemana.appendChild(ThDiaSemana)
	
					var ThDiaSemana = document.createElement('TH');
						ThDiaSemana.innerHTML = "J"
					trDiaSemana.appendChild(ThDiaSemana)
	
					var ThDiaSemana = document.createElement('TH');
						ThDiaSemana.innerHTML = "V"
					trDiaSemana.appendChild(ThDiaSemana)
	
					var ThDiaSemana = document.createElement('TH');
						ThDiaSemana.innerHTML = "S"
					trDiaSemana.appendChild(ThDiaSemana)
	
					var ThDiaSemana = document.createElement('TH');
						ThDiaSemana.innerHTML = "D"
					trDiaSemana.appendChild(ThDiaSemana)
				TableMes.appendChild(trDiaSemana)
					
				if(start_day!=8){
					var trDia = document.createElement('TR');
						for (var i=1;i<start_day;i++){
							trDia.appendChild(document.createElement('TD'))
						}
					
						// fill the first week of days
						for (var i=start_day;i<8;i++){
							var tdDia = document.createElement('TD');
								tdDia.align="center"
								tdDia.id = "Day_" + divMonth + "_" + year + "_" + month + "_" + day
								tdDia.style.cursor = "pointer"
								tdDia.innerHTML = day
							trDia.appendChild(tdDia)
							day++
						}
					TableMes.appendChild(trDia)
				}
					
				// fill the remaining weeks
				while (day <= month_length) {
					var trDia = document.createElement('TR');
					for (var i=1;i<=7 && day<=month_length;i++){
							var tdDia = document.createElement('TD');
								tdDia.align="center"
								tdDia.id = "Day_" + divMonth + "_" + year + "_" + month + "_" + day
								tdDia.style.cursor = "pointer"
								tdDia.innerHTML = day
							trDia.appendChild(tdDia)
						day++
					}
					TableMes.appendChild(trDia)
					// the first day of the next month
					start_day=i
				}
			TableTotalMes.appendChild(TableMes)
		document.getElementById(divMonth).appendChild(TableTotalMes)
	}

