var mobj = null; var startx = 0; var starty = 0; function Calendar (m, y, calDspl, calFrm) { this.tabHeader = 'ef4510'; this.m = m; this.y = y; this.calDspl = calDspl; this.calFrm = calFrm; this.obj = ''; this.http_request = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); } Calendar.prototype.writeDate = function (val) { this.calFrm.value = (val < 10 ? '0' : '')+val+'.'+(this.m < 10 ? '0' : '')+this.m+'.'+this.y; this.hide(); } Calendar.prototype.update = function(m,y) { this.m = m; this.y = y; this.http_request.open('GET', '/js/calendar.php?state=update&m='+m+'&y='+y+'&obj='+this.obj+'&headCol='+this.tabHeader, false); this.http_request.send(null); var text = this.http_request.responseText; this.updateText(text); } Calendar.prototype.updateText = function(text) { document.getElementById('Cal').innerHTML = text; } Calendar.prototype.init = function (obj) { this.obj = obj; this.update(12, 2008); } Calendar.prototype.show = function() { with(document) { getElementById(this.calDspl).style.position='absolute'; getElementById(this.calDspl).style.display='block'; } } Calendar.prototype.hide = function() { with(document) { getElementById(this.calDspl).style.display='none'; } } Calendar.prototype.move = function(event) { startx = event.pageX ? event.pageX : event.clientX; starty = event.pageY ? event.pageY : event.clientY; mobj=document.getElementById(this.calDspl); mobj.onmousemove= moveTo; mobj.onmouseup = moveStop; } function moveTo (event) { if(!event) event=window.event; if (mobj!=null) { x = event.pageX ? mobj.offsetLeft + event.pageX - startx : mobj.offsetLeft + event.clientX - startx; y = event.pageY ? mobj.offsetLeft + event.pageY - starty : mobj.offsetLeft + event.clientY - starty; mobj.style.left = x+'px'; mobj.style.top = y+'px'; } } function moveStop (event) { mobj = null; }