';
var oac = this.createbasic(w,h);
oac.html(s);
this.objtd = oac.find("td[temp='nr']");
oac.find("td[tdaddclick]").click(function(){
me.changedatec($(this));
});
this.objtd.click(function(){
me.tdclick(this);
});
this.setcontentinit();
$('#rockdatepicker_close'+rand+'').click(function(){
me.hidemenu();
});
$('#rockdatepicker_queding'+rand+'').click(function(){
me.queding();
});
$('#rockdatepicker_now'+rand+'').click(function(){
me.quenow();
});
$('#rockdatepicker_clear'+rand+'').click(function(){
me.queclear();
});
$('#rockdatepicker_table'+rand+'').dblclick(function(){
me.queding();
});
$('#rockdatepicker_table'+rand+'').mouseover(function(){
me.hidefudong();
});
if(can.view!='time'){
this.setcontentinit();
this.addcale(this.now.Y, this.now.m);
}else{
$('#rockdatepicker_span'+rand+'').hide();
}
this.shetispannvel(0);
};
this.shetispannvel = function(lx){
$('#rockdatepicker_span'+rand+'').html(''+this.now.Y+'-'+this.sa(this.now.m)+'-'+this.sa(this.now.d)+'');
var ho = $('#rockdatepicker_input_h'+rand+'');
var io = $('#rockdatepicker_input_i'+rand+'');
var so = $('#rockdatepicker_input_s'+rand+'');
ho.val(this.sa(this.now.H));
io.val(this.sa(this.now.i));
so.val(this.sa(this.now.s));
if(can.format.indexOf('H')<0){
get('rockdatepicker_input_h'+rand+'').disabled=true;
}else{
if(lx==0)this.shetispannvelbulr('h');
}
if(can.format.indexOf('i')<0){
get('rockdatepicker_input_i'+rand+'').disabled=true;
}else{
if(lx==0)this.shetispannvelbulr('i');
}
if(can.format.indexOf('s')<0){
get('rockdatepicker_input_s'+rand+'').disabled=true;
}else{
if(lx==0)this.shetispannvelbulr('s');
}
};
this.shetispannvelbulr = function(lx){
var o = $('#rockdatepicker_input_'+lx+''+rand+'');
o.blur(function(){
me.blurnum(this);
});
o.focus(function(){
me.foucsnum(this);
});
};
this.setcontentinit = function(){
$('#rockdatepicker_year'+rand+'').parent().click(function(){
me.changeyear(this);
});
$('#rockdatepicker_month'+rand+'').parent().click(function(){
me.changemonth(this);
});
};
//选择年的
this.changeyear=function(o1){
this.hidefudong();
var o = $(o1);
var off = o.offset();
var s='
';
var xuoi = 0,oi=0;
for(var i=this.max.Y; i>=this.min.Y; i--){
oi++;
var cls= '';
if(i==this.Y){
cls='div01';
xuoi = oi;
}
s+='
'+i+'
';
}
s+='
';
$('#rockdatepicker_'+rand+'').append(s);
$('#rockdatepicker_fudong'+rand+'').scrollTop(xuoi*20);
$('#rockdatepicker_fudong'+rand+'').find('div').click(function(){
me.changeyeara(this);
});
};
//选择年的
this.changemonth=function(o1){
this.hidefudong();
var o = $(o1);
var off = o.offset();
var s='
';
var xuoi = 0,oi=0;
for(var i=1; i<=12; i++){
oi++;
var cls= '';
if(i==this.m){
cls='div01';
xuoi = oi;
}
s+='
'+i+'
';
}
s+='
';
$('#rockdatepicker_'+rand+'').append(s);
$('#rockdatepicker_fudong'+rand+'').scrollTop(xuoi*20);
$('#rockdatepicker_fudong'+rand+'').find('div').click(function(){
me.changemontha(this);
});
};
this.hidefudong = function(){
$('#rockdatepicker_fudong'+rand+'').remove();
};
this.changeyeara = function(o1){
$('#rockdatepicker_year'+rand+'').html($(o1).html());
this.selchagnge();
};
this.changemontha = function(o1){
$('#rockdatepicker_month'+rand+'').html($(o1).html());
this.selchagnge();
};
this.selchagnge=function(){
var Y=parseFloat($('#rockdatepicker_year'+rand+'').html());
var m=parseFloat($('#rockdatepicker_month'+rand+'').html());
this.addcale(Y,m);
me.hidefudong();
};
this.setweizhi = function(){
var off = obj.offset();;
if(can.inputid != '')off = $('#'+can.inputid+'').offset();
var o = $('#rockdatepicker_'+rand+'');
var nh = get('rockdatepicker_'+rand+'').clientHeight,
nw = get('rockdatepicker_'+rand+'').clientWidth,
t = off.top+can.top,
dy = t+nh-winHb()-$(document).scrollTop(),
l = off.left+can.left,
jl = l+nw-winWb(),
jl1 = 5;
if($('body,html').height()>winHb())jl1=22;
jl=jl+jl1;
if(dy>0)t=t-dy-5;
if(jl>0)l=l-jl;
this.mleft = l;
this.mtop = t;
o.css({'left':''+l+'px','top':''+t+'px'});
};
//单元格单击
this.tdclick = function(o){
var o1 = $(o);
var d = o1.text();
if(isempt(d))return;
this.now.Y = parseFloat(this.Y);
this.now.m = parseFloat(this.m);
this.now.d = parseFloat(d);
this.objtd.removeClass();
this.objtd.addClass('td00');
o.className='td01';
this.shetispannvel(1);
};
//确定
this.queding = function(){
var jg = $('#rockdatepicker_span'+rand+'').html();
if(can.view=='time')jg=js.now('Y-m-d');
var ho = get('rockdatepicker_input_h'+rand+'');
var io = get('rockdatepicker_input_i'+rand+'');
var so = get('rockdatepicker_input_s'+rand+'');
if(ho)if(!ho.disabled)jg+=' '+ho.value+'';
if(io)if(!io.disabled)jg+=':'+io.value+'';
if(so)if(!so.disabled)jg+=':'+so.value+'';
var val = jg;
if(this.isdate(val)){
val=this.formdt(can.format, val);
}
this.setValue(val);
};
this.quenow = function(){
var val = this.formdt(can.format);
this.setValue(val);
};
this.setValue = function(v){
var nobj = false;
if(can.inputid!=''){
nobj = get(can.inputid);
$('#'+can.inputid+'').val(v).focus();;
}else{
nobj = elet;
obj.val(v).focus();;
}
if(nobj){
js.onchangedate(nobj.name, nobj, v, this);
}
can.itemsclick(v, this);
this.hidemenu();
};
this.getValue = function(){
var s = '';
if(can.inputid!=''){
s = $('#'+can.inputid+'').val();;
}else{
s = obj.val();
}
return s;
};
this.queclear = function(){
this.setValue('');
};
//单击
this.itemsclick = function(o,event){
};
this.hidemenu = function(){
$('#rockdatepicker_'+rand+'').remove();
};
this.changedatec= function(o){
var lx = o.attr('tdaddclick');
if(lx=='m'){
this.plftmonth(1);
}
if(lx=='-m'){
this.plftmonth(-1);
}
if(lx=='y'){
this.plftyear(1);
}
if(lx=='-y'){
this.plftyear(-1);
}
if(lx =='today'){
this.addcale(this.todate.Y,this.todate.m);
}
};
//上个月
this.plftmonth=function(lx)
{
var Y=parseFloat(this.Y),m=parseFloat(this.m);
m=m+lx;
if(m==0)m=12;
if(m==13)m=1;
if(m==12&&lx==-1)Y--;
if(m==1&&lx==1)Y++;
this.addcale(Y,m);
};
this.plftyear=function(lx){
var Y=parseFloat(this.Y)+lx;
this.addcale(Y,this.m);
};
this.formdt=function(type,sj){
return js.now(type, sj);
};
this.isdate = function(sj){
if(!sj)return false;
var bo = /^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}/.test(sj);
return bo;
};
this.addcale = function(Y,m){
this.objtd.removeClass();
this.objtd.html('');
me.Y=parseFloat(Y);
me.m=parseFloat(m);
var first = ''+Y+'-'+m+'-01';
var stuat = me.formdt('Y-m-w',first);
stuat=stuat.split('-');
var year = parseFloat(stuat[0]);
var month = parseFloat(stuat[1]);
var maxday = me.marr[month-1];//这个月最大天数
if(year%4==0&&month==2)maxday=29;//判断是不是轮年
if(month<10)month='0'+month;
var ic=parseFloat(stuat[2]);
var maic=1;
var xq = 0,nic=ic-1;
var xqarr=[0,0,0,0,0,0,0];
var cls = '';
for(var i=0;ima)val=ma;
o.value=this.sa(val);
this.setoutshow=setTimeout("$('#rockdatepicker_spanselfaei"+rand+"').remove();",200);
};
this.foucsnum=function(o){
clearTimeout(this.setoutshow);
this.focusval = o.value;
var o1 = $(o);
var mi = parseFloat(o1.attr('min'));
var ma = parseFloat(o1.attr('max'));
o.select();
$('#rockdatepicker_spanselfaei'+rand+'').remove();
var s='
';
this.inputhis=o;
for(var a=mi;a<=ma;a++){
var ai = this.sa(a);
if(ai==o.value)ai=''+ai+'';
s+=''+ai+'';
if((a+1)%10==0)s+=' ';
}
s+='
';
$('#rockdatepicker_'+rand+'').append(s);
$('#rockdatepicker_spanselfaei'+rand+'').find('font').click(function(){
var x = $(this).text();
o.value = x;
});
};
this.createmontview = function(lx){
var w = 220,w1=109;
if(lx==0){
w=130;
w1=w;
}
var oac = this.createbasic(w,270);
var s = '';
s+='