var oldlink = null; // code to change the active stylesheet function setactivestylesheet(link, title) { var i, a, main; for(i=0; (a = document.getelementsbytagname("link")[i]); i++) { if(a.getattribute("rel").indexof("style") != -1 && a.getattribute("title")) { a.disabled = true; if(a.getattribute("title") == title) a.disabled = false; } } if (oldlink) oldlink.style.fontweight = 'normal'; oldlink = link; link.style.fontweight = 'bold'; return false; } function selected(cal, date) { cal.sel.value = date; // just update the date in the input field. if (cal.dateclicked && (cal.sel.id == "sel1" || cal.sel.id == "sel3")) cal.callclosehandler(); } function closehandler(cal) { cal.hide(); // hide the calendar } function showcalendar(id, format) { var el = document.getelementbyid(id); if (calendar != null) { calendar.hide(); // so we hide it first. } else { var cal = new calendar(false, null, selected, closehandler); calendar = cal; // remember it in the global var cal.setrange(1900, 2070); // min/max year allowed. cal.create(); } calendar.setdateformat(format); // set the specified date format calendar.parsedate(el.value); // try to parse the text in field calendar.sel = el; // inform it what input field we use calendar.showatelement(el.nextsibling, "br"); // show the calendar return false; } var minute = 60 * 1000; var hour = 60 * minute; var day = 24 * hour; var week = 7 * day; function isdisabled(date) { var today = new date(); return (math.abs(date.gettime() - today.gettime()) / day) > 10; } function flatselected(cal, date) { var el = document.getelementbyid("preview"); el.innerhtml = date; } function showflatcalendar() { var parent = document.getelementbyid("display"); var cal = new calendar(false, null, flatselected); cal.weeknumbers = false; cal.setdisabledhandler(isdisabled); cal.setdateformat("dd, m d"); cal.create(parent); cal.show(); }