function hideElement(e, a) { if (isIE && !isIE7) for (i = 0; i < document.all.tags(e).length; i++) if (obj = document.all.tags(e)[i], obj && obj.offsetParent) { for (objLeft = obj.offsetLeft, objTop = obj.offsetTop, objParent = obj.offsetParent; "BODY" != objParent.tagName.toUpperCase() ;) objLeft += objParent.offsetLeft, objTop += objParent.offsetTop, objParent = objParent.offsetParent; objHeight = obj.offsetHeight, objWidth = obj.offsetWidth, a.offsetLeft + a.offsetWidth <= objLeft || a.offsetTop + a.offsetHeight <= objTop || a.offsetTop >= objTop + objHeight || a.offsetLeft >= objLeft + objWidth || (obj.style.visibility = "hidden") } } function showElement(e) { if (isIE && !isIE7) for (i = 0; i < document.all.tags(e).length; i++) obj = document.all.tags(e)[i], obj && obj.offsetParent && (obj.style.visibility = "") } function setWidth(e, a, t) { e > 0 && (titleWidth = e), a > 0 && (dayWidth = a), t > 0 && (dayDigits = t) } function addCalendar(e, a, t, r, n, l, i, o) { cals[cals.length] = new calOBJ(e, a, t, r, n, i, o) } function calOBJ(e, a, t, r, n, l, i) { this.name = e, this.title = a, this.field = t, this.field_d = r, this.formName = n, this.form = null, this.TxtDate = $("#" + l), this.calWin = i } function findCalendar(e) { for (var a = 0; a < cals.length; a++) if (cals[a].name == e) return null == cals[a].form && ("" == cals[a].formName ? document.forms[0] && (cals[a].form = document.forms[0]) : document.forms[cals[a].formName] && (cals[a].form = document.forms[cals[a].formName])), cals[a]; return null } function getDayName(e, a, t) { var r = new Date(e, a, t); return yxDays[r.getDay()].substring(0, 3) } function getMonthFromName(e) { for (var a = 0; a < yxMonthsLarge.length; a++) if (yxMonthsLarge[a].toLowerCase().substring(0, 3) == e.toLowerCase()) return a; return 0 } function getFormat() { var e = calFormat; return e = e.replace(/\\/g, "\\\\"), e = e.replace(/\\/g, "\\/"), e = e.replace(/\[/g, "\\["), e = e.replace(/\]/g, "\\]"), e = e.replace(/\(/g, "\\("), e = e.replace(/\)/g, "\\)"), e = e.replace(/\{/g, "\\{"), e = e.replace(/\}/g, "\\}"), e = e.replace(/\/g, "\\>"), e = e.replace(/\|/g, "\\|"), e = e.replace(/\*/g, "\\*"), e = e.replace(/\?/g, "\\?"), e = e.replace(/\+/g, "\\+"), e = e.replace(/\^/g, "\\^"), e = e.replace(/\$/g, "\\$"), e = e.replace(/dd/i, "\\d\\d"), e = e.replace(/mm/i, "\\d\\d"), e = e.replace(/yyyy/i, "\\d\\d\\d\\d"), e = e.replace(/day/i, "\\w\\w\\w"), e = e.replace(/mon/i, "\\w\\w\\w"), new RegExp(e) } function getDateNumbers(e) { var a, t, r, n = calFormat.search(/yyyy/i), l = calFormat.search(/mm/i), i = calFormat.search(/mon/i), o = calFormat.search(/dd/i); if (a = e.substring(n, n + 4) - 0, -1 != l) t = e.substring(l, l + 2) - 1; else var t = getMonthFromName(e.substring(i, i + 3)); return r = e.substring(o, o + 2) - 0, new Array(a, t, r) } function hideCal() { for (var e = 0; e < cals.length; e++) cals[e].calWin.style.visibility = "hidden"; window.status = "", showElement("SELECT"), showElement("APPLET") } function lastDay(e) { for (var a = e.getFullYear(), t = e.getMonth(), r = 31; r >= 28; r--) { var n = new Date(a, t, r); if (t == n.getMonth()) return r } } function firstDay(e) { var a = e.getFullYear(), t = e.getMonth(), r = new Date(a, t, 0); return r.getDay() } function dayDisplay(e) { return 0 == dayDigits ? yxDays[e] : yxDays[e].substring(0, dayDigits) } function get2Digits(e) { return (10 > e ? "0" : "") + e } function clearDate() { currentCal.form[currentCal.field].value = "", hideCal() } function actualday() { var e = new Date, a = e.getDate(), t = e.getMonth(), r = e.getFullYear(), n = a + "-" + t + "-" + r; return n } function checkDate(e) { var a = findCalendar(e); if (null != a && null != a.form && a.form[a.field]) { var t = getFormat(); return t.test(a.form[a.field].value) ? 0 : 1 } return 2 } function getCurrentDate() { var e = calFormat, a = new Date; return e = e.replace(/yyyy/i, a.getFullYear()), e = e.replace(/mm/i, get2Digits(a.getMonth() + 1)), e = e.replace(/dd/i, get2Digits(a.getDate())) } function compareDates(e, a) { var t, r, n = getFormat(); t = getNumbers(n.test(e) ? e : getCurrentDate()), r = getNumbers(n.test(a) ? a : getCurrentDate()); var l = t[0] + "" + t[1] + t[2], i = r[0] + "" + r[1] + r[2]; return l == i ? 0 : l > i ? 1 : -1 } function getNumbers(e) { var a, t, r, n = getFormat(); if (n.test(e)) { var l = calFormat.search(/yyyy/i), i = calFormat.search(/mm/i), o = calFormat.search(/mon/i), s = calFormat.search(/dd/i); if (a = e.substring(l, l + 4), -1 != i) t = e.substring(i, i + 2); else { var c = getMonthFromName(e.substring(o, o + 3)) + 1; t = 10 > c ? "0" + c : "" + c } return r = e.substring(s, s + 2), new Array(a, t, r) } return new Array("", "", "") } function calBody(e, a, t) { var r = "\n"; r += " \n", r += " \n", r += " \n", r += " "; for (var c = weekDay; weekDay + 7 > c; c++) r += " \n"; r += " \n"; var d = 1, u = firstDay(e), f = lastDay(e); weekDay > 0 && 0 == u && (u = 7); for (var c = 0; 6 > c; c++) { r += " \n"; for (var m = weekDay; weekDay + 7 > m; m++) if (u > 7 * c + m || d > f) r += " \n"; else { var g = calFormat; g = g.replace(/yyyy/i, cY), g = g.replace(/mm/i, get2Digits(cM + 1)), g = g.replace(/MON/, yxMonths[cM].substring(0, 3).toUpperCase()), g = g.replace(/Mon/i, yxMonths[cM].substring(0, 3)), g = g.replace(/dd/i, get2Digits(d)), g = g.replace(/DAY/, getDayName(cY, cM, d).toUpperCase()), g = g.replace(/day/i, getDayName(cY, cM, d)), valueDate = compareDates(g, actualday()); var p = dayColor, y = "calendarday", v = "calendardaya"; d == a && (p = currentDayColor, y = "calendarcurrentDay", v = "calendarcurrenta"), r += -1 != valueDate ? " \n" : " \n" } r += " \n" } return r += " \n", r += " \n", r += " \n", r += "
\n", r += " \n"; var n = e.getFullYear(), l = yxMonthsLarge[e.getMonth()]; if (r += " \n", n == yearmore && 11 == e.getMonth()) r += " \n", r += " \n", r += " \n"; else { var i = new Date, o = i.getMonth(), s = i.getFullYear(); r += e.getMonth() == o && n == s ? " \n" : " \n", r += " \n", r += " \n" } r += " \n", r += "
‹‹" + l + " " + n + "  ‹‹" + l + " " + n + "››
\n", r += "
" + dayDisplay(c) + "
 " + d++ + "" + d++ + "
\n", r += " " + yxLinks[0] + " " + yxLinks[1] + "
\n" } function prepMonth(e, a) { cM = e - 1, cM < 0 && (cM = 11, cY--); var t = new Date(cY, cM, 1); changeCal(t, a) } function nextMonth(e, a) { cM = e + 1, cM > 11 && (cM = 0, cY++); var t = new Date(cY, cM, 1); changeCal(t, a) } function changeCal(e, a) { var t = 0; if (currentCal = findCalendar(a), null != currentCal) { var r = getFormat(); if ("" != currentCal.form[currentCal.field].value && r.test(currentCal.form[currentCal.field].value)) { var n = getDateNumbers(currentCal.form[currentCal.field].value); n[0] == e.getFullYear() && n[1] == e.getMonth() && (t = n[2]) } else { var n = new Date; n.getFullYear() == e.getFullYear() && n.getMonth() == e.getMonth() && (t = n.getDate()) } } var l = calBody(e, t, a); currentCal.calWin.innerHTML = l, currentCal.calWin.style.visibility = "visible" } function pickDate(d) { hideCal(); var myDate = calFormat; myDate = myDate.replace(/yyyy/i, cY), myDate = myDate.replace(/mm/i, get2Digits(cM + 1)), myDate = myDate.replace(/MON/, yxMonths[cM].substring(0, 3).toUpperCase()), myDate = myDate.replace(/Mon/i, yxMonths[cM].substring(0, 3)), myDate = myDate.replace(/dd/i, get2Digits(d)), myDate = myDate.replace(/DAY/, getDayName(cY, cM, d).toUpperCase()), myDate = myDate.replace(/day/i, getDayName(cY, cM, d)); var arr_fecha = myDate.split("-"); currentCal.form[currentCal.field_d].value = arr_fecha[0], currentCal.form[currentCal.field].value = arr_fecha[1] + "-" + arr_fecha[2], currentCal.TxtDate.val(myDate), eval(currentCal.form[currentCal.field].attributes.onfocus.value) } function markClick(e) { var a = null; isIE || isOpera6 ? (winX = event.screenX, winY = event.screenY, a = event.srcElement) : (isN4 || isN6) && (winX = e.screenX, winY = e.screenY, a = e.target); var t = 0, r = 0, n = a; if (n.offsetParent) for (t = n.offsetLeft, r = n.offsetTop; n = n.offsetParent;) t += n.offsetLeft, r += n.offsetTop; return winX = t, winY = r + a.offsetHeight + 4, !0 } function showCal(e, a, t, r, n) { showCal(e, n) } function showCal(e, a, t) { hideCal(), nameCalendar = e; var r = currentCal, n = new Date; if (currentCal = findCalendar(e), null != currentCal && null != currentCal.form && currentCal.form[currentCal.field]) { getFormat(); if ("" != currentCal.form[currentCal.field].value) { var l = getDateNumbers(currentCal.form[currentCal.field_d].value + "-" + currentCal.form[currentCal.field].value); n = new Date(l[0], l[1], l[2]), cY = l[0], cM = l[1], dd = l[2] } else cY = n.getFullYear(), cM = n.getMonth(), dd = n.getDate(); var i = calBody(n, dd, e); if (null != currentCal.calWin && "visible" == currentCal.calWin.style.visibility) return void hideCal(); currentCal.calWin.innerHTML = i, currentCal.calWin.style.visibility = "visible", currentCal.calWin.style.left = winX + "px", currentCal.calWin.style.top = winY + "px"; var o = $(currentCal.calWin), s = $(t).parent().parent().position(), c = 0, d = 0, u = !1; -1 != $(t).parent().parent().attr("id").indexOf("Horizontal") && (u = !0), u ? (c = 40, d = s.left) : -1 != $(t).attr("id").indexOf("Arrival") ? (c = 40, d = 0) : (c = 135, d = 0), o.css({ position: "absolute", top: c, left: d }), hideElement("SELECT", currentCal.calWin), hideElement("APPLET", currentCal.calWin) } else null == currentCal ? window.status = "Calendar [" + e + "] not found." : currentCal.form ? currentCal.form[currentCal.field] || (window.status = "Form Field [" + currentCal.formName + "." + currentCal.field + "] not found.") : window.status = "Form [" + currentCal.formName + "] not found.", null != r && (currentCal = r) } function printLayerWeekDay(layer, form, month, day) { var objMes = eval("document." + form + "." + month), objDia = eval("document." + form + "." + day); if ("" != objDia.value && "" != objMes.value) { var ent_mesano = objMes.value.split("-"), diasem2 = new Date(parseInt(ent_mesano[1]) + "/" + ent_mesano[0] + "/" + objDia.value), diasemana2 = diasem2.getDay(); 0 == diasemana2 ? diasemana2 = 6 : diasemana2--, document.getElementById(layer).innerHTML = yxDays[diasemana2] } else document.getElementById(layer).innerHTML = "" } function validate() { today = new Date, validateDate(today) && document.searchForm.submit() } function validateDate(today) { var arrivalday = eval("document.getElementById(cals[0].field_d)"), arrivalmnthyr = eval("document.getElementById(cals[0].field)"); if (!arrivalday || !arrivalmnthyr) return !1; var departureday = eval("document.getElementById(cals[1].field_d)"), departuremnthyr = eval("document.getElementById(cals[1].field)"); if (!departureday && !departuremnthyr) return !1; var txtArrival = arrivalday.value + "-" + arrivalmnthyr.value, txtDepature = departureday.value + "-" + departuremnthyr.value, spl_arrival = txtArrival.split("-"), spl_departure = txtDepature.split("-"); String.IsNullOrWhiteSpace(spl_arrival[0]) || String.IsNullOrWhiteSpace(spl_arrival[1]) || String.IsNullOrWhiteSpace(spl_arrival[2]) || String.IsNullOrWhiteSpace(spl_departure[0]) || String.IsNullOrWhiteSpace(spl_departure[1]) || String.IsNullOrWhiteSpace(spl_departure[2]); var dateArrival = new Date(new Number(spl_arrival[2]), new Number(spl_arrival[1]) - 1, new Number(spl_arrival[0]), 0, 0, 0), dateDeparture = new Date(new Number(spl_departure[2]), new Number(spl_departure[1]) - 1, new Number(spl_departure[0]), 0, 0, 0); if (dateArrival.getTime() < today.getTime()) return alert(Calendar_errors[1]), !1; if (dateDeparture.getTime() < today.getTime()) return alert(Calendar_errors[2]), !1; if (dateArrival.getTime() >= dateDeparture.getTime()) return alert(Calendar_errors[3]), !1; var dateArrival2 = dateArrival.getTime() + 54432e5; return dateDeparture.getTime() >= dateArrival2 ? (alert(Calendar_errors[5]), !1) : !0 } function DateAdd(e, a, t, r, n, l) { var i = "", o = new Date(t, a, e, 0, 0, 0), s = new Date(o.getTime()), c = l, a = s.getMonth() + n; return a > 11 && (c = Math.floor((a + 1) / 12), a -= 12 * c, c += l), s.setMonth(a), s.setFullYear(s.getFullYear() + c), s.setDate(s.getDate() + r), s.getDate() < 10 && (i += "0"), i += s.getDate() + "/", s.getMonth() + 1 < 10 && (i += "0"), i += s.getMonth() + 1 + "/" + s.getFullYear() } var nameCalendar = "", fontFace = "verdana", fontSize = 9, titleWidth = 90, dayWidth = 12, dayDigits = 1, titleColor = "#FFFFFF", daysColor = "#E9E1CA", bodyColor2 = "#D6F2F8", dayColor = "#D6F2F8", dayColorExp = "#E9E9E9", currentDayColor = "#8CDBEC", footColor = "#E9E1CA", borderColor = "#E9E1CA", titleFontColor = "#333333", daysFontColor = "#000000", dayFontColor = "#999999", currentDayFontColor = "#000000", footFontColor = "#333333", calFormat = "dd-mm-yyyy", weekDay = 0, calWidth = 170, calHeight = 190, calOffsetX = -10, calOffsetY = 0, calWin = null, winX = 0, winY = 0, cal = "cal", cals = new Array, currentCal = null, isOpera = -1 != navigator.userAgent.indexOf("Opera") ? !0 : !1, isOpera5 = -1 != navigator.appVersion.indexOf("MSIE 5") && -1 != navigator.userAgent.indexOf("Opera 5") ? !0 : !1, isOpera6 = -1 != navigator.appVersion.indexOf("MSIE 5") && -1 != navigator.userAgent.indexOf("Opera 6") ? !0 : !1, isN6 = -1 != navigator.userAgent.indexOf("Gecko"), isN4 = document.layers ? !0 : !1, isMac = -1 != navigator.userAgent.indexOf("Mac"), isIE = !document.all || isOpera || isMac && -1 != navigator.appVersion.indexOf("MSIE 4") ? !1 : !0, isIE7 = navigator.appVersion.indexOf("MSIE 7") > -1 ? !0 : !1; isN4 && (fontSize += 2), (isN4 || isN6) && document.captureEvents(Event.CLICK), document.onclick = markClick;