	var defaultInDivTime = "All day";
	var defaultInDivRate = "Rate not available";
	var defaultInDivValAll = "Must be select an event!";
	
	var defaultInValMSG01 = "Exceeds maximum of tickets allowed for the event";
	var defaultInValMSG02 = "Exceeds maximun of tickets allowed for that hour";
	var defaultInValMSG03 = "Exceeds maximum of available tickets allowed";
	var defaultInValMSG04 = "Must be selected at least a ticket";
	var defaultInValMSG05 = "Must be selected at least a ticket in";
	
	
	var maxTicketsConfiguration = 0;
	var RefPoint="";

	function hAvail(da,hv){
		this.day = da;
		this.hourAvail = hv;	
	}
	
	function price(ip,ir,pr,pe,np,mit,mat,cur){
			this.idPrice = ip;
			this.idRate = ir;
			this.price = pr;
			this.priceSpecial = pe;						
			this.namePrice = np;
			this.maxTPrice = mat;
			this.minTPrice = mit;
			this.Currency = cur;
	}

	function rate(ir,ie,db,de,tm,ds,ps,th,ta,hv){
		this.idRate = ir;
		this.idEvent = ie;
		this.dBegin = db;
		this.dEnd = de;
		this.time = tm;
		this.DaysSpecial = ds;
		this.prices = ps;
		this.availByEvent = ta;	
		this.ticketsByHour = th;		
		/* Arreglo de dias, hora, disponibilidadporhora */
		this.availByHour = hv;
	}
	
	function initialize(txtPriceCache,objTimesToRender,objPricesToRender,txtRateCache,txtAvailCache){
		document.getElementById(objTimesToRender).innerHTML =  "<B>" + defaultInDivTime + "</B>";
		document.getElementById(objPricesToRender).innerHTML = "<P class='Validators'>" + defaultInDivRate + "</P>";		
		
		var cRate = document.getElementById(txtRateCache);
		cRate.value = "";
		var txtPrice = document.getElementById(txtPriceCache);
		txtPrice.value = "";
		var txtAvail = document.getElementById(txtAvailCache);
		txtAvail.value = "";		
	}
	
	function setRates(ddlDay,txtPriceCache,aRates,objTimesToRender,objPricesToRender,txtRateCache,txtAvailCache,strdivMsg,strdivData,showIt,strchkRequired){
	
		var cmbddlDay = document.getElementById(ddlDay);
		var showIt = cmbddlDay.options[cmbddlDay.selectedIndex].value.split('$')[1];
		var divmsg = document.getElementById(strdivMsg); 
		var divdata = document.getElementById(strdivData);
		var chkRequired = document.getElementById(strchkRequired);
		
		//alert(strchkRequired);
		if (showIt=='true'){
			divmsg.style.display = 'none';
			divdata.style.display = 'block';
			if(chkRequired.style.display=='none')
			{
			}
			else
			{
			chkRequired.style.display='block';
			chkRequired.checked = false;
			chkRequired.disabled = false;			
			}
			
		}else{
			divmsg.style.display = 'block';
			divdata.style.display = 'none';	
			chkRequired.style.display='block';	
			chkRequired.checked = false;
			chkRequired.disabled = true;			
		}
		
		initialize(txtPriceCache,objTimesToRender,objPricesToRender,txtRateCache,txtAvailCache);
		var aTimes = new Array();		
		aTimes = getTimeRates(ddlDay,aRates)
		if (aRates.length > 0 && aTimes.length > 0){
			var ddlTimeName = 'ddlTimes_' + aRates[0].idEvent;
			renderTimes(ddlTimeName,txtPriceCache,aTimes,objTimesToRender,ddlDay,aRates,objPricesToRender,txtRateCache,txtAvailCache);
			var ddlTime = document.getElementById(ddlTimeName);			
			renderPrices(ddlDay,txtPriceCache,ddlTime.options[ddlTime.selectedIndex].value,aRates,objPricesToRender,txtRateCache,txtAvailCache,objTimesToRender);								
		}
		else{
			renderPrices(ddlDay,txtPriceCache,'*****',aRates,objPricesToRender,txtRateCache,txtAvailCache,objTimesToRender);			
		}
	}
	 
	function getTimeRates(ddlDay,aRates){
		var sDay = new Date(document.getElementById(ddlDay).value.split("$")[0]);
		//alert('ok');
		var aTimes = new Array();
		for(var i=0;i<aRates.length;i++){
			if(sDay>=aRates[i].dBegin && sDay<=aRates[i].dEnd){
				var rt = aRates[i];
				if(rt.time != '*****'){
					if (rt.ticketsByHour > 0){
					 /*Consideramos si existe el dia actual en la lista de disponibilidad */
						for(j=0; j < rt.availByHour.length;j++)
							if(rt.availByHour[j].day.toString() == sDay.toString()){
								aTimes.push(rt.time);		
								break;
							}										
					}else
						/*En este caso no consideramos la disponibilidad por hora*/								
						aTimes.push(rt.time);						
				}				
			}
		}
		return aTimes;
	}
			
	
	function renderTimes(ddlName,txtPriceCache,aTimes,objTimesToRender,ddlDay,aRates,objPricesToRender,txtRateCache,txtAvailCache){
		document.getElementById(objTimesToRender).innerHTML =  "<B>" + defaultInDivTime + "</B>";
		var cmbTimes = "<SELECT id='" + ddlName + "' onChange=" + "renderPrices('" + ddlDay + "','" + txtPriceCache + "',this.value,aRates_" + aRates[0].idEvent + ",'" + objPricesToRender + "','" + txtRateCache + "','" + txtAvailCache + "')" + " onmousewheel='return false;'>";
		for(var i=0;i<aTimes.length;i++){
			cmbTimes = cmbTimes + "<OPTION value='" + aTimes[i] + "'>" + aTimes[i] + "</OPTION>";
		}
		cmbTimes = cmbTimes + "</SELECT>";
		document.getElementById(objTimesToRender).innerHTML = cmbTimes;
		/* ocultamos los validadores por el caso de que esten visibles */
		hide_validators(aRfvSelPrices);
	}
	
	function renderPrices(ddlDay,txtPriceCache,sTime,aRates,objPricesToRender,txtRateCache,txtAvailCache,objTimesToRender){
		document.getElementById(objPricesToRender).innerHTML = "<P class='Validators'>" + defaultInDivRate + "</P>";
		
		var cRate = document.getElementById(txtRateCache);
		cRate.value = "";
		var txtPrice = document.getElementById(txtPriceCache);
		txtPrice.value = "";
		var txtAvail =  document.getElementById(txtAvailCache);
		txtAvail.value = "0,0"; //Event Avail, TicketsByHour
		
		
		var ddlDaySel = document.getElementById(ddlDay);
		var sDay = new Date(ddlDaySel.value.split("$")[0]);
		
		var tblPrices = "<TABLE cellSpacing='0' cellPadding='1'  border='0' width='90%' align='right'>";
		for(var i=0;i<aRates.length;i++){			
			if(sDay>=aRates[i].dBegin && sDay<=aRates[i].dEnd && sTime==aRates[i].time){
				var aPrices = aRates[i].prices;
				cRate.value = aRates[i].idRate;
				/*AKY CAMBIAMOS PARA QUE SE OBTENGA LA DISPONIBILIDAD SEGUN EL DIA SELECIONADO ticketsByHour DEL ARREGLO DE DIAS EN LAS TARIFAS */
				var ticketsxhour = aRates[i].ticketsByHour;
				for(var j=0; j < aRates[i].availByHour.length;j++)
					if(aRates[i].availByHour[j].day.toString() == sDay.toString()){
						ticketsxhour = aRates[i].availByHour[j].hourAvail;
						break;
					}		
					if(aRates[i].time!='*****')	
					{
						txtAvail.value = ticketsxhour+','+ticketsxhour;
					}
					else
					{
						txtAvail.value = aRates[i].availByEvent[ddlDaySel.selectedIndex] + ',' +  ticketsxhour;
					}
				
						
				for(var j=0;j<aPrices.length;j++){
					tblPrices = tblPrices + "<TR><TD width=50%>";
					tblPrices = tblPrices + aPrices[j].namePrice; 
					
					tblPrices = tblPrices + "</TD><TD align=right width=40%>";
					if (aRates[i].DaysSpecial.charAt(sDay.getDay()) == '1'){
						if(eval(aPrices[j].priceSpecial)>0) 						
							{tblPrices += " $" + aPrices[j].priceSpecial + "";}
					}
					else{
						if(eval(aPrices[j].price)>0) 
							{tblPrices += " $" + aPrices[j].price + "";}
					}
					tblPrices = tblPrices + ' ' + aPrices[j].Currency + "</TD><TD align=right width=10%>";					
					
					tblPrices = tblPrices + "<SELECT id='Quantity_" + aPrices[j].idPrice + "' name='Quantity_" + aPrices[j].idPrice + "' onchange=addPriceCache('" + txtPriceCache + "'," + aPrices[j].idPrice + ",this.value,true) onclick=addPriceCache('" + txtPriceCache + "'," + aPrices[j].idPrice + ",this.value,true) onmousewheel='return false;' style=''>";
					for(var k = aPrices[j].minTPrice; k <= aPrices[j].maxTPrice; k++)
						tblPrices = tblPrices + "<OPTION value=" + k + ">" + k +  "</OPTION>";
					tblPrices = tblPrices + "</SELECT>";
					tblPrices = tblPrices + "</TD></TR>";
				}				
			}			
		}	
		
		//Checa si el evento no tiene dispo
		if (txtAvail.value=='0,0'){
			document.getElementById(objTimesToRender).innerHTML =  "<div class='Validators' style='; text-aling:center; float:left'>" + defaultInDivRate + "</div>";
		}
				
		tblPrices = tblPrices + "</TABLE>";															
		document.getElementById(objPricesToRender).innerHTML=tblPrices;				
		setAllPriceCache(aTxtSelPrices);

		/* ocultamos los validadores por el caso de que esten visibles */
		hide_validators(aRfvSelPrices);
	}
	
	function setAllPriceCache(aText){
		for(i=1;i<aText.length;i++){
			var txtPrice = document.getElementById(aText[i]);
			var parentElem = ((txtPrice.parentElement)?txtPrice.parentElement:txtPrice.parentNode);					
			var cmbPrices = parentElem.getElementsByTagName("select");
						
			if(cmbPrices&&cmbPrices.length>0){
				for(var k=0;k<cmbPrices.length;k++){
					if(cmbPrices[k].name.indexOf('Quantity_') != -1 && cmbPrices[k].options.length>0 && cmbPrices[k].options[cmbPrices[k].selectedIndex].value>0){
						/*Ponemos en el price cache los datos de la cantidad y el id precio*/
						addPriceCache(txtPrice.id,cmbPrices[k].name.split('_')[1],cmbPrices[k].options[cmbPrices[k].selectedIndex].value, false);						
					}
				}
			}
		}
	}
	
	function addPriceCache(txtCache, idPrice, Quantity, preSelect){
		var status = 'Add';
		var txtPrice = document.getElementById(txtCache);
		var sPrices = new String(txtPrice.value);
		var aSelPrices = new Array();
		if(sPrices!=""){		
			aSelPrices = sPrices.split(",");
			for(var i=0;i<aSelPrices.length;i++){
				var aSelPrice = new Array();
				aSelPrice = aSelPrices[i].toString().split("/");
				if(aSelPrice[0] == idPrice){
					if(Quantity==0){
						aSelPrices.splice(i,1);
						status = 'Remove';
					}else{
						aSelPrice[1] = Quantity;
						aSelPrices[i] = aSelPrice.join("/");
						status = 'Modify';
						continue;					
					}
				}			
			}			
			validate_selectionFields_in(aTxtAvailables,aTxtSelPrices,aRfvSelPrices);
		}
		
		if(status == 'Add' && Quantity > 0){	
			aSelPrices.push(idPrice + "/" + Quantity);
		}		
		txtPrice.value = aSelPrices.join(",");		
		
		/* Auto-seleccion del evento */
		if(preSelect)
			for(var j=1;j<aTxtSelPrices.length;j++){
				if(txtPrice.id == aTxtSelPrices[j]){
					var chkRequired = document.getElementById(aChkRequired[j]);				
					if(!chkRequired.disabled)
						chkRequired.checked = true;
						if(txtPrice.value != "")
							chkRequired.checked = true;
						else
						{
							chkRequired.checked = false;
							chkRequired.style.display='block';
							}
					break;
				}					
			}		
	}
	
	function getPriceCache(aText){
		for(i=1;i<aText.length;i++){
			var txtPrice = document.getElementById(aText[i]);
			var sPrices = new String(txtPrice.value);			
			var parentElem = ((txtPrice.parentElement)?txtPrice.parentElement:txtPrice.parentNode);					
			var cmbPrices = parentElem.getElementsByTagName("select");
						
			if(cmbPrices&&cmbPrices.length>0){
				if(sPrices!=""){		
					var aSelPrices = new Array();
					aSelPrices = sPrices.split(",");
					for(var j=0;j<aSelPrices.length;j++){
						var aSelPrice = new Array();
						aSelPrice = aSelPrices[j].toString().split("/");
						for(var k=0;k<cmbPrices.length;k++)
							if(cmbPrices[k].name == 'Quantity_' + aSelPrice[0]){
								/* Seleccionamos el valor actual */
								for(var l=0;l<cmbPrices[k].length;l++){
									if(cmbPrices[k].options[l].value == aSelPrice[1])
										cmbPrices[k].selectedIndex = l;
								}
							}																					
					}
					
				}else{
					for(var k=0;k<cmbPrices.length;k++)
						cmbPrices[k].selectedIndex=0;
				}	
			}
			else{
				txtPrice.value="";
			}			
		}
	}

/* No valida evento requerido */
	function validate_selectionFields_in(aObjAvail,aObjPrices,aObjVal){	
		var lblMessage;
		var IsValued = false;
		var exceed = false;
		/* recorremos todos los cache de precio */
		for(var i=1; i < aObjPrices.length; i++){				
			var txtValidate = document.getElementById(aObjPrices[i]);
			var txtAvail = document.getElementById(aObjAvail[i]);
			lblMessage = document.getElementById(aObjVal[i]);
			
			lblMessage.style.display='none';			
			if(txtValidate.value != ""){
				IsValued = true;
				var result = IsExceedMaxTickets(txtAvail.value,txtValidate.value);
				
				if(result == 1){							
					lblMessage.innerText = defaultInValMSG01;
					lblMessage.style.display='block';					
					exceed = true;					
				}
				if(result == 2){			
					if(document.all)				
					{
						lblMessage.innerText = defaultInValMSG02;
					}
					else
					{
						lblMessage.textContent  = defaultInValMSG02;
					}
					
					lblMessage.style.display='block';					
					exceed = true;					
				}
				if(result == 3){							
					lblMessage.innerText = defaultInValMSG03;
					lblMessage.style.display='block';					
					exceed = true;					
				}
			}
		}		
		if(!exceed && !IsValued){
			alert(defaultInDivValAll);
			return false;
		}		
		if(exceed)
			return false;			
		if(IsValued)
			return true;				
	}
	
	/* Validando evento requerido */
	function validate_selectionFields(e){
		if (true==e.disabled){
			//esto es por el caso de los de tipo rate. Como el boton esta desabiolitado
			//si se le da click entra aqui de todos modos. esta validacion es para que 
			//el boton este deshabilitado se salga...
			//alert('se salio');
			return false;
		}

		var aObjAvail = aTxtAvailables;
		var aObjPrices = aTxtSelPrices;
		var aObjVal = aRfvSelPrices;
		var aObjSelect = aChkRequired;
		
		var lblMessage;
		var hasSelected = false;
		var hasTicketsSelected = true;
		var IsValued = true;
		var exceed = false;
		
		/* recorremos todos los cache de precio */
		for(var i=1; i < aObjSelect.length; i++){
			var chkRequired = document.getElementById(aObjSelect[i]);
			var WithRateCal = false; 
			
			//saber si es de tipo ratecalendar
			if (chkRequired.getAttribute("ShowCalendar")=='true')
			    WithRateCal = true;
			else
				WithRateCal = false;
				
			var showingRateCalendar = false;
			if (WithRateCal){
				var div = document.getElementById("lnkHideCalendar_" + chkRequired.getAttribute("IdEvento"))
				if (div){
					if (div.style.display=='block')
						showingRateCalendar = true;
				}
			}
			
			if(chkRequired.checked){	
					if (showingRateCalendar==false){
						var txtValidate = document.getElementById(aObjPrices[i]);
						var txtAvail = document.getElementById(aObjAvail[i]);
					
						hasSelected = true; /* Establecemos que se ha seleccionado al menos un evento */
					
						lblMessage = document.getElementById(aObjVal[i]);
						lblMessage.style.display='none';			
						if(txtValidate.value != "")
						{
							IsValued = true;
							var result = IsExceedMaxTickets(txtAvail.value,txtValidate.value);
							if(result == 1){							
								lblMessage.innerText = defaultInValMSG01;
								lblMessage.style.display='block';					
								exceed = true;					
							}
							if(result == 2){							
								lblMessage.innerText = defaultInValMSG02;
								lblMessage.style.display='block';					
								exceed = true;					
							}
							if(result == 3){							
								lblMessage.innerText = defaultInValMSG03;
								lblMessage.style.display='block';					
								exceed = true;											
							}		
						}else{
							lblMessage.innerText = defaultInValMSG04;
							lblMessage.style.display='block';					
							hasTicketsSelected = false;												
						}										
					}else{
						hasSelected = true; /* Establecemos que se ha seleccionado al menos un evento */
						//alert("es de rate");
						//si esta el checked pero no ha sel viajeros!
						var lnkBtn = document.getElementById('btnBookitCalendar_' + chkRequired.getAttribute("IdEvento"))
						if (lnkBtn.disabled==true){
							var msg = defaultInValMSG05 + ' ' + chkRequired.getAttribute("evNam");
							alert(msg)
							hasTicketsSelected = false;
						}
					}		
			}
		}	/*End for*/

		if(!hasSelected){
			//ocultando todos los requiredfields
			var rfv = document.getElementsByTagName("DIV");
			if (rfv.length>0){
				var i=0;
				for (i=0; i<=rfv.length-1; i++)
				{
					if (rfv[i].id.indexOf('rfvSelPrices')>=0){
						rfv[i].style.display = 'none';
					}
				}
			}			
			alert(defaultInDivValAll);
			return false;
		}	


		if(!hasTicketsSelected){			
			return false;
		}	
						
		if(!exceed && !IsValued){
			alert(defaultInDivValAll);
			return false;
		}		
		if(exceed)
			return false;

	return SendData();
}

function SendData(){
		//Ok, todos son validos si llega hasta aqui...
		if(true){
			var str = "";
			var arrtxt = document.getElementsByTagName("input");
			if (arrtxt.length>0){
				var qsDetails = new String("{0}${1}${2}${3}${4}${5}${6}${7}${8}${9}${10}*");
				var fullDetails = "";
				for (var w=0; w<=arrtxt.length-1; w++){
					if (arrtxt[w].id.indexOf("txtSelPrices")>=0){
						var chkRequired = document.getElementById(arrtxt[w].getAttribute('chkRequired'));
						if (chkRequired){
							if (chkRequired.checked){
								var WithRateCal = false; 
								//saber si es de tipo ratecalendar
								if (chkRequired.getAttribute("ShowCalendar")=='true')
									WithRateCal = true;
								else
									WithRateCal = false;
									
								var showingRateCalendar = false;
								if (WithRateCal){
									var div = document.getElementById("lnkShowCalendar_" + chkRequired.getAttribute("IdEvento"))
									if (div){
										if (div.style.display=='none')
											showingRateCalendar = true;
									}
								}
								if (showingRateCalendar==false){
									//es del tipo antiguo
									if (arrtxt[w].value != "" && arrtxt[w].value.length > 1){
										var PropertySelected = arrtxt[w].getAttribute('PropertySelected');
										var IDddlDaysEvent = arrtxt[w].getAttribute('ddlDaysEvent');
										var ActivityID = arrtxt[w].getAttribute('ActivityID');
										var ddlDaysEvent = document.getElementById(IDddlDaysEvent);
										var IdEvento = arrtxt[w].getAttribute('IdEvento');
										var idRate = document.getElementById(arrtxt[w].getAttribute('txtSelRate')).value;
			
										var qtemp = qsDetails;
										qtemp = qtemp.replace("{0}",PropertySelected)
										qtemp = qtemp.replace("{1}",ActivityID)
										qtemp = qtemp.replace("{2}",IdEvento)
										qtemp = qtemp.replace("{3}",idRate)
										qtemp = qtemp.replace("{4}",ddlDaysEvent.options[ddlDaysEvent.selectedIndex].value.split('$')[0]);
										qtemp = qtemp.replace("{5}",arrtxt[w].value);
										
										qtemp = qtemp.replace("{6}",SessionID);
										qtemp = qtemp.replace("{7}",RefPoint);
										qtemp = qtemp.replace("{8}",sourceIdPortal);
										qtemp = qtemp.replace("{9}",currentCurrency);
										qtemp = qtemp.replace("{10}",VarPromotionCode);
										//Inicializar combos
										/*
										var tart=arrtxt[w].value.split(",");
										
										for(var ww=0; ww<=tart.length-1; ww++)
										{	
											var idprecio=tart[ww].split("/")[0];
											var combo=document.getElementById('Quantity_'+idprecio);
											combo.selectedIndex=0;
										}
										arrtxt[w].value="";*/
										fullDetails += qtemp;								
									}								
								}else{
									//es de tipo rate calendar
									var txtData;
									txtData = document.getElementById("txtHCache_" + chkRequired.getAttribute('IdEvento'))
									if (txtData){
										fullDetails += txtData.value + "*";								
									}
								}
							}//end checked
						}
					}
				}
				
				
				if (fullDetails != ""){
					if (fullDetails.substring(fullDetails.length-1, fullDetails.length) =="*"){
						fullDetails = fullDetails.substring(0, fullDetails.length-1);
					}
  										
					qs = qs.replace("{0}",ActivityID)
					qs = qs.replace("{1}",ActivityFrom)
					qs = qs.replace("{2}",ActivityTo)
					qs = qs.replace("{3}",IDCulture)
					qs = qs.replace("{4}",'RACK')
					qs = qs.replace("[DETAILS]",fullDetails)
					qs = qs.replace("{6}",SessionID)
					qs = qs.replace("{7}",RefPoint)
					qs = qs.replace("{8}",sourceIdPortal)
					qs = qs.replace("{9}",currentCurrency);
					qs = qs.replace("{10}",VarPromotionCode);
					//'VarPromotionCode
					//if(RefPoint=='DEMO'){alert(qs);}
					//window.location = actUrl + escape(qs);
					var frm = document.getElementById("frmSendData");
					if (frm){
						frm.action = actUrl;
						var frmData = document.getElementById("frmdata");
						frmData.value = qs+"&PromotionCode="+VarPromotionCode;
						frm.submit();
					}
				}else{
					alert(defaultInValMSG04);
				}
			}
			return false;				
		}
	}

	
	function IsExceedMaxTickets(sAvail,sPrices){		
		var aSelPrices = new Array();
		var aSelAvail = new Array();
		var tickets = 0;		
		var result = 0;
		if(sPrices!=""){		
			aSelPrices = sPrices.split(",");
			aSelAvail = sAvail.split(",");
			for(var i=0;i<aSelPrices.length;i++){
				var aSelPrice = new Array();
				aSelPrice = aSelPrices[i].toString().split("/");
				tickets += parseInt(aSelPrice[1]);				
			}
			if(tickets > maxTicketsConfiguration)
				result = 1; /* Config */
			else
				if(aSelAvail[1]>0 && aSelAvail[1] < tickets)
					result = 2; /* Por hora */		
				else
					if(aSelAvail[0] < tickets)
						result = 3; /* No hay dispo */
		}
		return result;
	}
	
	function hide_validators(aObjVal){
		for(var i=1;i<aObjVal.length;i++){
			lblMessage = document.getElementById(aObjVal[i]);
			lblMessage.style.display='none';
		}
	}

	var curDivCalendarShowed=null;
	function hideYCalendar(EventId,chkReq){
		var curDivToShow=document.getElementById('lnkShowCalendar_' + EventId);
		var curDivToHide=document.getElementById('lnkHideCalendar_' + EventId);		
		var curAvailHide = document.getElementById('AvailBlock_' + EventId);
		if (curDivToShow){
			curDivToShow.style.display='block';
			curAvailHide.style.display='block';
			curDivToHide.style.display='none';
		}
		document.getElementById(chkReq).disabled=false;
		if(document.getElementById(chkReq).style.display!='none')
		{
		document.getElementById(chkReq).checked=false;
		}
		return false;
	}
	function showYCalendar(StartDate,RateType,language,PropertyId,ActivityId,EventId,maxCalendarDate,r1,r2,returnValue,chkRequiredID){
		//if (curDivCalendarShowed!=null) hideYCalendar(curDivCalendarShowed);		
		//curDivCalendarShowed=EventId;	
		
		var curDivToShow = document.getElementById('lnkShowCalendar_' + EventId);
		var curDivToHide = document.getElementById('lnkHideCalendar_' + EventId);		
		var curAvailHide = document.getElementById('AvailBlock_' + EventId);

		curDivToShow.style.display='none';
		curDivToHide.style.display='block';
		curAvailHide.style.display='none';
		
		if (curDivToShow){
			var Obj=eval('cComm_' + EventId);
			new initCalendar(PropertyId,ActivityId,EventId,language,RateType,'gCalContainer_' + EventId,StartDate,Obj,maxCalendarDate,r1,r2,chkRequiredID);
		}
		return returnValue;
	}
	

