	
		<!-- Begin  //place these scripts within BODY tag if you are using IE 4.0 or below.
		//****************************************************************************
		// PopCalendar 4.1, Emailware(please mail&commend me if u like it)
		// Originally coded by Liming(Victor) Weng, email: victorwon@netease.com
		// Release date: 2000.5.9
		// Anyone may modify it to satify his needs, but please leave this comment ahead.
		//****************************************************************************
		
		var gdCtrl = new Object();
		var gdSentencia;
		var gcGray = "#F2C220";
		var gcToggle = "#F8D358";
		var fondoCalendario = "#FFFFFF";
		var fondoDias = "#CCCCCC";
		var gm = "#555555";
		
		var gdCurDate = new Date();
		var giYear = gdCurDate.getFullYear();
		var giMonth = gdCurDate.getMonth()+1;
		var iYear = giYear;
		var iMonth = giMonth;
		var giDay = gdCurDate.getDate();
		var VicPopCal = new Object();
		
		var nwDay = giDay;
		var nwYear = giYear;
		var nwMonth = giMonth
		
		var gMonths;
		

// Esta función cargará la info
function llamarasincrono(url, id_contenedor,N,offset){
	var pagina_requerida = false
	if (window.XMLHttpRequest) {// Si es Mozilla, Safari etc
		pagina_requerida = new XMLHttpRequest()
	} else if (window.ActiveXObject){ // pero si es IE
		try {
			pagina_requerida = new ActiveXObject("Msxml2.XMLHTTP")
		} 
		catch (e){ // en caso que sea una versión antigua
			try{
				pagina_requerida = new ActiveXObject("Microsoft.XMLHTTP")
			}
			catch (e){}
		}
	} else
		return false
	pagina_requerida.onreadystatechange=function(){ // función de respuesta
		cargarpagina(pagina_requerida, id_contenedor,N,offset)
	}
	pagina_requerida.open('GET', url, true) // asignamos los métodos open y send
	pagina_requerida.send(null)
}
// todo es correcto y ha llegado el momento de poner la información requerida
// en su sitio en la pagina xhtml
function cargarpagina(pagina_requerida, id_contenedor,N,offset){
	if (pagina_requerida.readyState == 4 && (pagina_requerida.status==200 || window.location.href.indexOf("http")==-1)){
		//usamos la propiedad responseXML: devuelve datos por el servidor en forma de documento XML

		var xml = pagina_requerida.responseXML;
		//encontramos el total de items en el RSS
		var limit = xml.getElementsByTagName('item').length;
		var l=0;
		
		
		  document.getElementById('actualfec').innerHTML=iMonth+"/"+iYear;
		  var myMonth = fBuildCal(iYear, iMonth);
		  var i = 0;
		  var cellText = document.getElementsByName("cellText");
		  for (w = 0; w < 6; w++)
			for (d = 0; d < 7; d++){
				cellText[(7*w)+d].Victor = i++;
				if ( (myMonth[w+1][d]<0) || ( (nwDay > myMonth[w+1][d]) & (iMonth==giMonth) & (iYear==giYear) ) ) {
					cellText[(7*w)+d].style.color = '#AAAAAA';
					if (myMonth[w+1][d]<0){
						cellText[(7*w)+d].innerHTML = -myMonth[w+1][d];
					}else{
						cellText[(7*w)+d].innerHTML = myMonth[w+1][d];
					}
					cellText[(7*w)+d].mes = "N";
					cellText[(7*w)+d].style.textDecoration = 'none';
					cellText[(7*w)+d].idExc = '';
					cellText[(7*w)+d].num = '';
					cellText[(7*w)+d].max = '';
					cellText[(7*w)+d].style.background='#FFFFFF';
					cellText[(7*w)+d].estado = 'OO';
					cellText[(7*w)+d].title = '';
					//cellText[(7*w)+d].id = "cellText";
					
				}else{
					cellText[(7*w)+d].style.textDecoration = 'none';
					cellText[(7*w)+d].style.color = ((d==6))?"red":"black";
					cellText[(7*w)+d].innerHTML = myMonth[w+1][d];
					cellText[(7*w)+d].style.background='#FFFFFF';
					cellText[(7*w)+d].mes = "S";
					cellText[(7*w)+d].estado = 'L';
					cellText[(7*w)+d].idExc = '';
					cellText[(7*w)+d].num = '';
					cellText[(7*w)+d].title = '';
					if (l<limit){
					   if ( xml.getElementsByTagName('title').item(l).firstChild.data == myMonth[w+1][d] ){
						cellText[(7*w)+d].estado = xml.getElementsByTagName('state').item(l).firstChild.data;
						cellText[(7*w)+d].maximo = xml.getElementsByTagName('maximo').item(l).firstChild.data;
						cellText[(7*w)+d].num = xml.getElementsByTagName('num').item(l).firstChild.data;
						cellText[(7*w)+d].idExc = xml.getElementsByTagName('link').item(l).firstChild.data;
						if (xml.getElementsByTagName('state').item(l).firstChild.data == 'C'){
							cellText[(7*w)+d].style.background='#FF0000';
							cellText[(7*w)+d].style.color='#FFFFFF';
							cellText[(7*w)+d].title=completo;
						} else if (xml.getElementsByTagName('state').item(l).firstChild.data == 'P'){
							cellText[(7*w)+d].style.background='#0000FF';
							cellText[(7*w)+d].style.color='#FFFFFF';
							cellText[(7*w)+d].title=xml.getElementsByTagName('description').item(l).firstChild.data+' / '+xml.getElementsByTagName('num').item(l).firstChild.data+disponible;
						}
						l++;
					   }
					}
					//alert(cellText[(7*w)+d].id);
					//cellText[(7*w)+d].id = "cellText";
					//alert(cellText[(7*w)+d].id);
					
					
					if ( (nwDay == myMonth[w+1][d]) & (iMonth==giMonth) & (iYear==giYear) ){
						cellText[(7*w)+d].style.background = gcToggle;
						cellText[(7*w)+d].estado = 'C';
						cellText[(7*w)+d].title = '';
						cellText[(7*w)+d].idExc = '';
						cellText[(7*w)+d].num = '';
					}					
				}
			}
			

//fUpdateCalAfter(offset);
document.getElementById('calendarioloading').style.display='none';
document.getElementById('calendario').style.display='';
/*		var xml = pagina_requerida.responseXML;
		//encontramos el total de items en el RSS
		var limit = xml.getElementsByTagName('item').length;
		//Boton Siguiente
		//i es la variable que irá incrementandose
		var next = "<next><a href=\"javascript:llamarasincrono(URI, 'rss',i);\">Siguiente</a></next>";
		//creamos el string donde irán las etiquetas y los valores
		var rss = "";
		//for de 2 ciclos, para mostrar 2 entradas a la vez
		for (var l=N;l<=N+1;l++){
			//cogemos el titulo del primer item, luego del segundo, y así...
			var title = xml.getElementsByTagName('title').item(l).firstChild.data;
			var url = xml.getElementsByTagName('link').item(l).firstChild.data;
			var pubDate = xml.getElementsByTagName('pubDate').item(l).firstChild.data;
			var description = xml.getElementsByTagName('description').item(l).firstChild.data;
			//si la longitud de la entrada es mayor a 200 caracteres la cortamos y le ponemos un enlace
			if(description.length>200) { description = description.substr(0,200)+ "...<br/><enlace><a href=\"" + url + "\">Leer más</a></enlace><br/><br/>"; }else description=description+"<br/><br/>";
			//esto es para cortar el +0000 de la fecha en WordPress
			var date = pubDate.split(" +");
			//sumamos las variables a nuestro string
			rss = rss+"<fecha>"+date[0]+"<fecha><br/><titulo>"+title+"</titulo><br/><descripcion>"+description+"</descripcion>";
			if (limit==l)
			//si nos pasamos del limite, la cortamos
				break;
		}
		//incrementamos la variable global
		i=i+2;
		//si nos pasamos del límite, volvemos a empezar
		if (i>limit)
			i=1;
		//metemos el string + el boton en el div-id que corresponde
		document.getElementById(id_contenedor).innerHTML=rss+next;
*/	//un pequeño mensaje para avisar que se está cargando la info
	}else if (pagina_requerida.readyState == 1){
//		document.getElementById(id_contenedor).innerHTML="<load>Cargando...</load>"
	}
} 





		function fChangeInitialDate(sDate){			
			if (sDate != null && sDate.length > 0){
				var splitDate = sDate.split("/");
				nwDay = parseInt(splitDate[0], 10);
				nwMonth = parseInt(splitDate[1], 10);
				nwYear = parseInt(splitDate[2], 10);		
						
			} else {
				nwDay = giDay;
				nwYear = giYear;
				nwMonth = giMonth			
			}			
		}
				
		//****************************************************************************
		// Param: popCtrl is the widget beyond which you want this calendar to appear;
		//        dateCtrl is the widget into which you want to put the selected date;
		//        popCal is the widget to display the calendar;  
		// i.e.: <input type="text" name="dc" style="text-align:center" readonly><INPUT type="button" value="V" onclick="fPopCalendar(dc,dc,popCal);return false">
		//****************************************************************************
		function fPopCalendar(popCtrl, dateCtrl, popCal, gdSent, ev, months){
		  if (!ev) ev = window.event;
		  ev.cancelBubble = true;
		  if (ev.stopPropagation) ev.stopPropagation();		  
		  VicPopCal = popCal;
		  gdSentencia = gdSent;
		  gdCtrl = dateCtrl;
  
		  fSetYearMon(nwYear, nwMonth);

			  var point = fGetXY(popCtrl);
	 	  	  VicPopCal.style.left = point.x + 'px';
			  VicPopCal.style.top  = point.y + popCtrl.offsetHeight + 1 + 'px';
			  

		  
		  gMonths = months;
		  VicPopCal.style.visibility = 'visible';
		}
		
		function fSetDate(iYear, iMonth, iDay){
		  // Formateamos para que el resultado sea DD/MM/AAAA
		  if (iDay < 10) iDay = '0' + iDay;
		  if (iMonth < 10) iMonth = '0' + iMonth;
		
 		  // Here, you could modify the locale as you need !!!!
		  gdCtrl.value = iDay+"/"+iMonth+"/"+iYear; 
		  VicPopCal.style.visibility = "hidden";
		  
		  //alert(gdCtrl.value);
		}
		
/*		function fSetSelected(aCell){
		  var iOffset = 0;
		  var tbSelYear = document.getElementById("tbSelYear");
		  var tbSelMonth = document.getElementById("tbSelMonth");		  
		  
		  var iYear = parseInt(tbSelYear.value, 10);
		  var iMonth = parseInt(tbSelMonth.value, 10);
		
		  aCell.bgColor = fondoCalendario;
		  
	  	  var iDay = parseInt(aCell.childNodes[0].innerHTML, 10);
		  
		  if (aCell.childNodes[0].mes == "N"){
		  	iOffset = (aCell.childNodes[0].Victor<10)?-1:1;
		  }
		  
		  iMonth += iOffset;
		  
		  if (iMonth < 1) {
			iYear--;
			iMonth = 12;
			
		  }else if (iMonth > 12){
		 	iYear++;
		 	iMonth = 1;
		  }
		  
		  fSetDate(iYear, iMonth, iDay);		  
		}
*/
/*		function fSetSelected(aCell){
		
		  aCell.bgColor = coloringo;
		  
	  	  alert (aCell.childNodes[0].data);
		  alert (aCell.estado);
		  alert (aCell.idExc);
		  
		}

*/
		
		function Point(iX, iY){
			this.x = iX;
			this.y = iY;
		}
		
		function fBuildCal(iYear, iMonth) {
		  var aMonth = new Array();
		  
		  for(i=1;i<7;i++)
		  	aMonth[i] = new Array(i);
		
		  var dCalDate = new Date(iYear, iMonth-1, 1);
		  var iDayOfFirst = dCalDate.getDay()-1;
		  if (iDayOfFirst == -1){iDayOfFirst = 6;}
		  var iDaysInMonth = new Date(iYear, iMonth, 0).getDate();
		  var iOffsetLast = new Date(iYear, iMonth-1, 0).getDate()-iDayOfFirst+1;
		  var iDate = 1;
		  var iNext = 1;
		
		  for (d = 0; d < 7; d++)
			aMonth[1][d] = (d<iDayOfFirst)?-(iOffsetLast+d):iDate++;
		  for (w = 2; w < 7; w++)
		  	for (d = 0; d < 7; d++)
				aMonth[w][d] = (iDate<=iDaysInMonth)?iDate++:-(iNext++);
		  return aMonth;
		}
		
		function fDrawCal(iYear, iMonth, iCellWidth, iDateTextSize) {

			

		  var styleTD1 = " width='"+iCellWidth+"' valign='middle' align='center' style='background-color:"+fondoDias+"; border:1px solid #FDF4D9; font-size:10px;padding:0px;font-family:verdana, helvetica, sans serif;";
		  var styleTD2 = " width='"+iCellWidth+"' valign='middle' align='center' style='background-color:"+fondoCalendario+";border:1px solid "+fondoCalendario+";padding:0px;font-size:10px; font-family:verdana, helvetica, sans serif;";
		
		  with (document) {
			write("<tr>");
			for(i=0; i<7; i++)
				write("<td "+styleTD1+"color: #808080'>" + WeekDay[i] + "</td>");
				
			write("</tr>");
		
		  	for (w = 1; w < 7; w++) {
				write("<tr>");
				for (d = 0; d < 7; d++) {
					write("<td name='cellText' id='cellText' "+styleTD2+"cursor: pointer;' onMouseOver='coloringo=this.style.backgroundColor;this.style.backgroundColor=gcToggle;' onMouseOut='this.style.backgroundColor=coloringo' onclick='fSetSelected(this)' estado=''  num='' idExc='' title=''>");
					//write("<span id='cellText' name='cellText' Victor='Liming Weng' mes='' style='width: 100%; height: 100%'></span>");
					write("</td>")
				}
				write("</tr>");
			}
		  }
		}
		
		function fUpdateCal(offset) {
			if ((iMonth==giMonth) & (iYear==giYear) & (offset==-1) ){
					offset=0;
			}
			
			if ((iMonth==1) & (offset==-1)){
				iYear--;
					iMonth=12;
			} else {
				if ((iMonth==12) & (offset==1)){
						iYear++;
						iMonth=1;
				} else {
					iMonth=iMonth+offset;
				}
			}
			document.getElementById('calendarioloading').style.display='';
			document.getElementById('calendario').style.display='none';
			
			llamarasincrono('/reservaxml.php?mes='+iMonth+'&ano='+iYear,'calendario',1,offset);
		}


		function fUpdateCalAfter(offset) {
//		  var iYear = document.getElementById("tbSelYear").value;
//		  var iMonth = document.getElementById("tbSelMonth").value;
          
		  if ((iMonth==giMonth) & (iYear==giYear) & (offset==-1) ){
				  offset=0;
		  }
		  
		  if ((iMonth==1) & (offset==-1)){
			    iYear--;
				iMonth=12;
		  } else {
			  if ((iMonth==12) & (offset==1)){
					iYear++;
					iMonth=1;
			  } else {
			  	iMonth=iMonth+offset;
			  }
		  }

		
		  document.getElementById('actualfec').innerHTML=iMonth+"/"+iYear;
		  var myMonth = fBuildCal(iYear, iMonth);
		  var i = 0;
		  var cellText = document.getElementsByName("cellText");
		  for (w = 0; w < 6; w++)
			for (d = 0; d < 7; d++){
				cellText[(7*w)+d].Victor = i++;
				if (myMonth[w+1][d]<0) {
					cellText[(7*w)+d].style.color = '#AAAAAA';
					cellText[(7*w)+d].innerHTML = -myMonth[w+1][d];
					cellText[(7*w)+d].mes = "N";
					cellText[(7*w)+d].style.textDecoration = 'none';
					//cellText[(7*w)+d].id = "cellText";
					
				}else{
					cellText[(7*w)+d].style.textDecoration = 'none';
					cellText[(7*w)+d].style.color = ((d==6))?"red":"black";
					cellText[(7*w)+d].innerHTML = myMonth[w+1][d];
					cellText[(7*w)+d].style.background='';
					cellText[(7*w)+d].mes = "S";
					//alert(cellText[(7*w)+d].id);
					//cellText[(7*w)+d].id = "cellText";
					//alert(cellText[(7*w)+d].id);
					
					
					if ( (nwDay == myMonth[w+1][d]) & (iMonth==giMonth) & (iYear==giYear) ){
						cellText[(7*w)+d].style.textDecoration = 'underline';
					}					
				}
			}
			
			
		}
		
		function fSetYearMon(iYear, iMon){
		  var tbSelYear = document.getElementById("tbSelYear");
		  var tbSelMonth = document.getElementById("tbSelMonth");		  

		  tbSelMonth.options[iMon-1].selected = true;
		  for (i = 0; i < tbSelYear.length; i++)
			if (tbSelYear.options[i].value == iYear)
				tbSelYear.options[i].selected = true;
		  fUpdateCal(iYear, iMon);
		}
		
		function fPrevMonth(){
		  var tbSelYear = document.getElementById("tbSelYear");
		  var tbSelMonth = document.getElementById("tbSelMonth");		  
		
		  var iMon = tbSelMonth.value;
		  var iYear = tbSelYear.value;
		
		  if (--iMon<1) {
			  iMon = 12;
			  iYear--;
		  }
		
		  fSetYearMon(iYear, iMon);
		}
		
		function fNextMonth(){
		  var tbSelYear = document.getElementById("tbSelYear");
		  var tbSelMonth = document.getElementById("tbSelMonth");		  
		
		  var iMon = tbSelMonth.value;
		  var iYear = tbSelYear.value;
		
		  if (++iMon>12) {
			  iMon = 1;
			  iYear++;
		  }
		
		  fSetYearMon(iYear, iMon);
		}
		
		function fGetXY(aTag){
		  var oTmp = aTag;
		  var pt = new Point(0,0);
   	      while (oTmp) {
			pt.x += oTmp.offsetLeft;
			pt.y += oTmp.offsetTop;
			oTmp = oTmp.offsetParent;
		  }		  
		  return pt;
		}
		
		function fGetMiddle(){
			var pt = new Point(0,0);
			var winWidth;
			var winHeight;
			
			if (navigator.appName.indexOf("Microsoft") != -1) {
				winWidth = top.document.body.offsetWidth;
				winHeight = top.document.body.offsetHeight;
			} else {
				winWidth = top.innerWidth;
				winHeight = top.innerHeight;
			}			
			
			pt.x = (winWidth/2) - 100;
			pt.y = (winHeight/2) - 105;
			
			return pt;
		}

			var gMonths = new Array("Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic");

			var coloringo;

		document.write("<table id='popTable' border='0' bgcolor='#808080' style='margin: 0px'>");
		document.write("<tr>");
		document.write("<td valign='middle' align='center' bgcolor='"+fondoDias+"' style='font-family:verdana, helvetica, sans serif;font-size:10px;'>");		

		// Select de los MESES
/*		document.write("<select class='list' id='tbSelMonth' onChange='fUpdateCal()' Victor='Won' style='width: 55px'>");
		for (i=0; i<12; i++){
			document.write("<option value='"+(i+1)+"'>"+gMonths[i]+"</option>");
		}
		document.write("</select>");		

		// Select de los A�OS
		document.write("<select class='list' id='tbSelYear' onChange='fUpdateCal()' Victor='Won' style='width: 55px'>");
		for(i = 2008; i < 2010; i++)
		{
			document.write("<option value='"+i+"'>"+i+"</option>");
		}
		document.write("</select>");*/
									
		document.write("<img src='./ico/previous.png' onclick=\"fUpdateCal(-1);\" />");
		document.write("<label id=\"actualfec\">"+iMonth+"/"+iYear+"</label>");
		document.write("<img src='./ico/next.png'  onclick=\"fUpdateCal(+1);\" />");
		document.write("</td>");
		document.write("</tr><tr>");
		document.write("<td align='center'>");
		document.write("<div style='background-color: #B4BDC0;'>");
		document.write("<table width='100%' border='0' cellpadding='2'>");
		fDrawCal(giYear, giMonth, 19, 8);
		
		document.write("</table></div>");
		document.write("</td>");
		document.write("</tr>");
//		document.write("<tr><td align='center' style='border: 1px solid #B4BDC0; background-color: #EEEEEE'>");
//		document.write("<font style='font-family:verdana, helvetica, sans serif;cursor:pointer ;font-size:10px;;' onclick='fSetDate(giYear,giMonth,giDay)' onMouseOver='this.style.color=gm' onMouseOut='this.style.color=\"#000000\"'>");

//			document.write("Hoy:&nbsp;&nbsp;"+giDay+"&nbsp;"+gMonths[giMonth-1]+"&nbsp;"+giYear+"</font>");

//		document.write("</td></tr>");
//		document.write("</td></tr>");
		document.write("</table>");

