if(typeof CodeThatCalendar === "undefined")
{
	var cabecera = document.getElementsByTagName("head").item(0);
	var script = document.createElement("script");
	script.setAttribute("type","text/javascript");
	script.setAttribute("src","/includes/js/cCalendario/CodeThatCalendar/codethatcalendarstd.js");
	cabecera.appendChild(script);
}

if(typeof cCalendario === "undefined")
{
	var cCalendario = function()
	{
		this.id;
		this.tipoCabecera = "buttons";
		this.mostrarHora = true;
			
		this.mostrar = function()
		{
			if(typeof this.id === "undefined")
			{
				alert("Error en cCalendario: Debe especificar el id del control que recibirá la fecha");
				return;
			}		
			
			var parametros = 
			{
				firstday:1,
				width:275,
				windoww:300,
				windowh:200,
				border_width:0,
				border_color:'White',
				headerstyle: 
				{
					type:this.tipoCabecera,
					css:'clsDayName',
					imgnextm:'img/next.gif',
					imgprevm:'img/prev.gif',
					imgnexty : 'img/next_year.gif',
					imgprevy : 'img/prev_year.gif'
				},
				monthnames:["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"],
				daynames:["D","L", "M", "X", "J", "V", "S"]
			};
			
			if(this.mostrarHora === true)
			{
				parametros.dtype = "dd/MM/yyyy HH:mm:ss";
				parametros.showtime = true;
			}
			else
			{
				parametros.dtype = "dd/MM/yyyy";	
				parametros.showtime = false;
			}
			
			if(this.tipoCabecera == "comboboxes")
			{
				parametros.headerstyle.yearrange = [1900,new Date().getFullYear()];
			}
			
			var objCalendario = new CodeThatCalendar(parametros);
			objCalendario.popup(this.id);
		}
	}
}