var calendar_counter = 0; var calendar_image_open = CTX + "/images/calendar/calendar.gif"; function setupCalendar(campo, rangeyears) { if(campo && !campo.getAttribute("disabled") && campo.getAttribute("type") != "hidden"){ var rangeyearsaux = rangeyears || [1900, 2999]; if (campo.id == "") campo.setAttribute("id", "calendar_input_" + calendar_counter++); var boton = document.createElement("IMG"); boton.src = calendar_image_open; boton.className = "calendario"; boton.setAttribute("id", "calendar_input_" + calendar_counter++); campo.parentNode.insertBefore(boton, campo.nextSibling); var cal = Calendar.setup({ inputField : campo.id, ifFormat : "%d/%m/%Y", button : boton.id, electric : false, cache : true, align : "Cb", range : rangeyearsaux, weekNumbers : false }); // Modificacion para que el popup del calendario no salga debajo de los popups de otros formularios var oldOnClick = boton.onclick; boton.onclick = function() { oldOnClick(); if (window.calendar && window.calendar.element) window.calendar.element.style.zIndex = 2000; } } }