dragging = false; function dateNode(name) { this.name = name; this.obj = function() { return document.getElementById(this.name); } this.updateInput = "", this.date = new Date(); this.date.setMonth(this.date.getMonth()); this.day = 0; this.month = function() { return this.date.getMonth() }; this.year = function() { return (this.date.getFullYear().toString()).substring(2,4) }; this.months = new Array("January","February","March","April","May","June","July","August","Septemtber","October","November","December"); this.sMonth = function() { return this.months[this.month()] }; this.retDate = function() { cMonth = parseInt(this.month(),10) +1; cMonth = (cMonth < 10)?"0"+cMonth:cMonth; cDay = (this.day < 10)?"0"+this.day:this.day; return cDay+"/"+cMonth+"/"+this.year(); } this.sD = new Date(); this.eD = new Date(); this.aM = function(dir) { dir=(dir=="prev")?-1:1; this.date.setMonth(this.date.getMonth() + dir); this.reset(); } this.reset = function() { this.obj().getElementsByTagName("li")[1].innerHTML = this.sMonth()+"   "+this.year(); nDateMod = (this.date.getYear().toString().length == 4)?0:1900; this.sD.setMonth(this.date.getMonth()); this.sD.setDate(this.date.getDate() - (this.date.getDate()-1)); this.sD.setYear(this.date.getYear()+nDateMod); this.eD.setYear(this.sD.getYear()+nDateMod); this.eD.setMonth(this.sD.getMonth() + 1); this.eD.setDate(this.sD.getDate()); this.eD.setDate(this.eD.getDate() - 1); this.rebuild(); } this.rebuild = function() { obj = document.getElementById("calDays"); if (obj.childNodes.length > 0) clearList(obj); var cDay = 0; for(i=0; i 0) oList.removeChild(oList.childNodes[0]); } function createLi(sContent,sClass) { var newLi = document.createElement("li"); var textNode = document.createTextNode(""); newLi.appendChild(textNode); newLi.innerHTML = sContent; newLi.className = sClass; newLi.onmouseover = function () { if (this.className.indexOf("_ov") == -1) this.className = this.className+"_ov"; }; newLi.onmouseout = function () { if (this.className.indexOf("_ov") != -1) this.className = this.className.replace("_ov",""); }; newLi.onclick = function () { if (this.innerHTML != "") { oDate.day = this.innerHTML; updateInput(); } }; return newLi; } function toggleOver(obj) { if (obj.className.indexOf("_ov") == -1) obj.className = obj.className+"_ov"; else obj.className = obj.className.replace("_ov",""); } oDate = new dateNode("calendar"); function drag(mX,mY) { if (dragging) { oDate.obj().style.left = mX-50; oDate.obj().style.top = mY-10; } } function buildDate() { sDate = '
' + '' + '' +'
'; document.write(sDate); } function displayDate(e,fInput) { e=(e==null)?event:e; oDate.obj().style.left = e.x; oDate.obj().style.top = e.y; oDate.reset(); oDate.obj().style.display = "block"; oDate.updateField = fInput; } function updateInput() { document.form1[oDate.updateField].value = oDate.retDate(); oDate.obj().style.display = "none"; }