/* form functions */ var setSelect = SetSelect = function(frm, selectbox, waarde) { if (!frm[selectbox] || !frm[selectbox].options) return; for (var i = 0; i < frm[selectbox].options.length; i++) { if (frm[selectbox].options[i].value == waarde || frm[selectbox].options[i].value == '0' + waarde) { frm[selectbox].options[i].selected = true; break; }; }; }; /* country and city dropdown */ var SelectCountry = function(country, select_city, show_all_cities) { if (country == '') country = 'EMPTY'; var count = select_city.options.length; for (var i = 0; i < count; i++) { select_city.options[0] = null; }; select_city.options[0] = new Option('', ''); select_city.options[0].innerHTML = translate_select_city; select_city.options[0].selected = true; var index = 1; if (show_all_cities == null || show_all_cities != false) { select_city.options[1] = new Option('', 'ALL'); select_city.options[1].innerHTML = translate_all_cities; index = 2; } for(var i = 0; i < cities.length; i++) { if (cities[i][0] == country) { select_city.options[index] = new Option('', cities[i][1]); select_city.options[index].innerHTML = cities[i][2]; index++; }; }; }; // end selectCountry var SelectCity = function(city, select_country, select_city) { if (city == 'ALL') { var count = select_city.options.length; for(i = 0; i < count; i++) { select_city.options[0] = null; }; var index = 0; for(var i = 0; i < cities.length; i++) { if (cities[i][1] != '') { select_city.options[index] = new Option('', cities[i][1]); select_city.options[index].innerHTML = cities[i][2]; index++; }; }; select_country.options[0].selected = true; }; }; // end selectCity var Mod = function(a, b) { return a - Math.floor(a / b) * b; }; var IsLeapYear = function(year) { return (year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0)); }; var setDaysInMonth = SetDaysInMonth = function(yyyyMM, ddlDay) { var month = yyyyMM.substring(5, 7); var year = yyyyMM.substring(0, 4); var oldday = ddlDay.selectedIndex; switch (month) { case '02': if (IsLeapYear(year)) { /* 29 */ ddlDay.options[30] = null; ddlDay.options[29] = null; } else { /* 28 */ ddlDay.options[30] = null; ddlDay.options[29] = null; ddlDay.options[28] = null; } break; case '04': /* 30 */ if (!ddlDay.options[28]) { ddlDay.options[28] = new Option('29', '29'); } if (!ddlDay.options[29]) { ddlDay.options[29] = new Option('30', '30'); } ddlDay.options[30] = null; break; case '06': /* 30 */ if (!ddlDay.options[28]) { ddlDay.options[28] = new Option('29', '29'); } if (!ddlDay.options[29]) { ddlDay.options[29] = new Option('30', '30'); } ddlDay.options[30] = null; break; case '09': /* 30 */ if (!ddlDay.options[28]) { ddlDay.options[28] = new Option('29', '29'); } if (!ddlDay.options[29]) { ddlDay.options[29] = new Option('30', '30'); } ddlDay.options[30] = null; break; case '11': /* 30 */ if (!ddlDay.options[28]) { ddlDay.options[28] = new Option('29', '29'); } if (!ddlDay.options[29]) { ddlDay.options[29] = new Option('30', '30'); } ddlDay.options[30] = null; break; default: /* 31 */ if (!ddlDay.options[28]) { ddlDay.options[28] = new Option('29', '29'); } if (!ddlDay.options[29]) { ddlDay.options[29] = new Option('30', '30'); } if (!ddlDay.options[30]) { ddlDay.options[30] = new Option('31', '31'); } } /* end switch */ var newday = ddlDay.selectedIndex; if (oldday != newday) { ddlDay.options[ddlDay.options.length - 1].selected = true; }; }; var maxLength = function(o, e, len, spn) { var span; if (spn && (span = document.getElementById(spn))) { span.innerHTML = Math.max(len - o.value.length, 0); }; o.value = o.value.substring(0, len); return true; };