var DatePicker = function () {
var $ = function (i) {return (i)},
addEvent = function (o, e, f) { ? (e, f, false) : ('on'+e, function(){(o)})},
getPos = function (el) {
for (var pos = {x:0, y:0}; el; el = ) {
+= ;
+= ;
}
return pos;
}
var init = function (n, config) {
window[n] = this;
._fd = function () {var d = new Date(this); (1); return ()};
._fc = function () {var d1 = new Date(this), d2 = new Date(this); (1); (1); (()+1); return (d2-d1)/86400000;};
= n;
= config;
= new Date;
= $();
= +'DatePicker';
();
();
}
= {
update : function (y, m) {
var con = [], week = ['Su','Mo','Tu','We','Th','Fr','Sa'], D = , _this = this;
fn = function (a, b) {return '<td title="'+_this.n+'DatePicker" class="noborder hand" onclick="'+_this.n+'.update('+a+')">'+b+'</td>'},
_html = '<table cellpadding=0 cellspacing=2>';
y && (() + y);
m && (() + m);
var year = (), month = () + 1, date = ();
for (var i=0; i<; i++) ('<td title="'++'DatePicker" class="noborder">'+week[i]+'</td>');
for (var i=0; i<D._fd(); i++ ) ('<td title="'++'DatePicker" class="noborder"> </td>');
for (var i=0; i<D._fc(); i++ ) ('<td class="hand" onclick="'++'.fillInput('+year+', '+month+', '+(i+1)+')">'+(i+1)+'</td>');
var toend = %7;
if (toend != 0) for (var i=0; i<7-toend; i++) ('<td class="noborder"> </td>');
_html += '<tr>'+fn("-1, null", "<<")+fn("null, -1", "<")+'<td title="'++'DatePicker" colspan=3 class="strong">'+year+'/'+month+'/'+date+'</td>'+fn("null, 1", ">")+fn("1, null", ">>")+'</tr>';
for (var i=0; i<; i++) _html += (i==0 ? '<tr>' : i%7==0 ? '</tr><tr>' : '') + con[i] + (i == -1 ? '</tr>' : '');
!! ? = _html : (_html);
},
fillInput : function (y, m, d) {
var s = || '/';
= y + s + m + s + d;
= 'none';
},
show : function () {
var s = , is = ;
s['left'] = is['left'] = getPos().x + 'px';
s['top'] = is['top'] = getPos().y + + 'px';
s['display'] = is['display'] = 'block';
is['width'] = - 2 + 'px';
is['height'] = - 2 + 'px';
},
hide : function () {
= 'none';
= 'none';
},
bind : function () {
var _this = this;
addEvent(document, 'click', function (e) {
e = e || ;
var t = || ;
if ( != _this.n+'DatePicker') {_this.hide()} else {_this.show()}
})
},
createBox : function (html) {
var box = = ('div'), mask = = ('iframe');
= || 'datepicker';
= 'javascript:false';
= 0;
= 'position:absolute;display:none;z-index:9999';
= 'position:absolute;display:none;z-index:9998';
= +'DatePicker';
= html;
(box);
(mask);
return box;
}
}
return init;
}();