function dateFeedRtn(c,e,a,d,f){var b=parseInt(d.match(/[+-]?\d+/g));if($.isNumeric(b))if(0==b)var g=a?a:_getSysDate(c);else(a=$("#"+e).val().replace(/\//g,""))&&("Y"==c&&4==a.length||"YM"==c&&6==a.length||"YMD"==c&&8==a.length)&&_isDate(c,a)&&(g=_addDate(c,a,d,b));else g=_getSysDate(c);g&&($("#"+e).val(g).change(),"true"==f&&$("#queryButtonSubmit").click())}
var _addDate=function(c,e,a,d){var f;switch(c){case "Y":var b=e;break;case "YM":b=e.replace(/(\d{4})(\d{2})/,"$1/$2")+"/01";break;default:b=e.replace(/(\d{4})(\d{2})(\d{2})/,"$1/$2/$3")}b=new Date(b);var g=b.getFullYear(),h=b.getMonth(),k=b.getDate();if(a.indexOf("SY"))if(a.indexOf("SD"))if(a.indexOf("SW"))if(a.indexOf("EY"))if(a.indexOf("ED"))if(a.indexOf("EW"))if(a.indexOf("Y"))if(a.indexOf("M"))a.indexOf("D")||b.setDate(k+d);else for(a=0<d?1:-1,f=0;f<Math.abs(d);f++)0<f&&(g=b.getFullYear(),h=b.getMonth(),
k=b.getDate()),_mNew=0<d?h+2:h,_dNew=(new Date(g,_mNew,0)).getDate(),k>_dNew?b=new Date(g,_mNew,0):b.setMonth(h+a);else b.setFullYear(g+d);else a=_reorgCnt(a,b,d,0),b.setDate(k-b.getDay()+7*a);else f=new Date(g,h+1,0),b=new Date(g,h,1),a=_reorgCnt(a,b,d,f.getDate()-k),b.setMonth(h+a),b=new Date(b.getFullYear(),b.getMonth()+1,0);else a=_reorgCnt(a,b,d,0),b.setFullYear(g+a),b=new Date(b.getFullYear(),12,0);else a=_reorgCnt(a,b,d,1),b.setDate(k-b.getDay()+(0==b.getDay()?-6:1)+7*a);else a=_reorgCnt(a,
b,d,k-1),b.setMonth(h+a),b=new Date(b.getFullYear(),b.getMonth(),1);else a=_reorgCnt(a,b,d,h),b.setFullYear(g+a),b=new Date(b.getFullYear(),0,1);return _fmtDate(c,b,e)},_getSysDate=function(c){return _fmtDate(c,new Date,null)},_fmtDate=function(c,e,a){var d=e.getFullYear();var f=("00"+(e.getMonth()+1)).slice(-2);e=("00"+e.getDate()).slice(-2);switch(c){case "Y":break;case "YM":d+=f;break;default:d=d+f+e}return _isDate(c,d)?d:a},_isDate=function(c,e){switch(c){case "Y":c=e+"/01/01";break;case "YM":c=
e.replace(/(\d{4})(\d{2})/,"$1/$2")+"/01";break;default:c=e.replace(/(\d{4})(\d{2})(\d{2})/,"$1/$2/$3")}e=new Date(c);return e.getFullYear()!=parseInt(c.split("/")[0])||e.getMonth()!=parseInt(c.split("/")[1])-1||e.getDate()!=parseInt(c.split("/")[2])?!1:!0},_reorgCnt=function(c,e,a,d){var f;~c.indexOf("W")?e.getDay()!=d&&1==Math.abs(a)&&(f=0<a?a:a+1):c.indexOf("S")?1==Math.abs(a)&&(f=0<a?0==d?a:0:-1):1==Math.abs(a)&&(f=0<a?a:0==d?-1:0);return null==f?a:f};
