JalaliDate={g_days_in_month:[31,28,31,30,31,30,31,31,30,31,30,31],j_days_in_month:[31,31,31,31,31,31,30,30,30,30,30,29]};JalaliDate.jalaliToGregorian=function(j,b,g){j=parseInt(j);b=parseInt(b);g=parseInt(g);var m=j-979;var d=b-1;var k=g-1;var h=365*m+parseInt(m/33)*8+parseInt((m%33+3)/4);for(var f=0;f<d;++f){h+=JalaliDate.j_days_in_month[f]}h+=k;var c=h+79;var n=1600+400*parseInt(c/146097);c=c%146097;var a=true;if(c>=36525){c--;n+=100*parseInt(c/36524);c=c%36524;if(c>=365){c++}else{a=false}}n+=4*parseInt(c/1461);c%=1461;if(c>=366){a=false;c--;n+=parseInt(c/365);c=c%365}for(var f=0;c>=JalaliDate.g_days_in_month[f]+(f==1&&a);f++){c-=JalaliDate.g_days_in_month[f]+(f==1&&a)}var e=f+1;var l=c+1;return[n,e,l]};JalaliDate.checkDate=function(b,c,a){return !(b<0||b>32767||c<1||c>12||a<1||a>(JalaliDate.j_days_in_month[c-1]+(c==12&&!((b-979)%33%4))))};JalaliDate.gregorianToJalali=function(a,f,n){a=parseInt(a);f=parseInt(f);n=parseInt(n);var m=a-1600;var d=f-1;var j=n-1;var b=365*m+parseInt((m+3)/4)-parseInt((m+99)/100)+parseInt((m+399)/400);for(var e=0;e<d;++e){b+=JalaliDate.g_days_in_month[e]}if(d>1&&((m%4==0&&m%100!=0)||(m%400==0))){++b}b+=j;var g=b-79;var l=parseInt(g/12053);g%=12053;var k=979+33*l+4*parseInt(g/1461);g%=1461;if(g>=366){k+=parseInt((g-1)/365);g=(g-1)%365}for(var e=0;e<11&&g>=JalaliDate.j_days_in_month[e];++e){g-=JalaliDate.j_days_in_month[e]}var c=e+1;var h=g+1;return[k,c,h]};Date.prototype.setJalaliFullYear=function(k,a,i){var e=this.getDate();var h=this.getMonth();var f=this.getFullYear();var b=JalaliDate.gregorianToJalali(f,h+1,e);if(k<100){k+=1300}b[0]=k;if(a!=undefined){if(a>11){b[0]+=Math.floor(a/12);a=a%12}b[1]=a+1}if(i!=undefined){b[2]=i}var c=JalaliDate.jalaliToGregorian(b[0],b[1],b[2]);return this.setFullYear(c[0],c[1]-1,c[2])};Date.prototype.setJalaliMonth=function(a,i){var e=this.getDate();var h=this.getMonth();var f=this.getFullYear();var b=JalaliDate.gregorianToJalali(f,h+1,e);if(a>11){b[0]+=math.floor(a/12);a=a%12}b[1]=a+1;if(i!=undefined){b[2]=i}var c=JalaliDate.jalaliToGregorian(b[0],b[1],b[2]);return this.setFullYear(c[0],c[1]-1,c[2])};Date.prototype.setJalaliDate=function(h){var c=this.getDate();var f=this.getMonth();var e=this.getFullYear();var a=JalaliDate.gregorianToJalali(e,f+1,c);a[2]=h;var b=JalaliDate.jalaliToGregorian(a[0],a[1],a[2]);return this.setFullYear(b[0],b[1]-1,b[2])};Date.prototype.getJalaliFullYear=function(){var b=this.getDate();var d=this.getMonth();var c=this.getFullYear();var a=JalaliDate.gregorianToJalali(c,d+1,b);return a[0]};Date.prototype.getJalaliMonth=function(){var b=this.getDate();var d=this.getMonth();var c=this.getFullYear();var a=JalaliDate.gregorianToJalali(c,d+1,b);return a[1]-1};Date.prototype.getJalaliDate=function(){var b=this.getDate();var d=this.getMonth();var c=this.getFullYear();var a=JalaliDate.gregorianToJalali(c,d+1,b);return a[2]};Date.prototype.getJalaliDay=function(){var a=this.getDay();a=(a+1)%7;return a};Date.prototype.setJalaliUTCFullYear=function(k,a,i){var e=this.getUTCDate();var h=this.getUTCMonth();var f=this.getUTCFullYear();var b=JalaliDate.gregorianToJalali(f,h+1,e);if(k<100){k+=1300}b[0]=k;if(a!=undefined){if(a>11){b[0]+=Math.floor(a/12);a=a%12}b[1]=a+1}if(i!=undefined){b[2]=i}var c=JalaliDate.jalaliToGregorian(b[0],b[1],b[2]);return this.setUTCFullYear(c[0],c[1]-1,c[2])};Date.prototype.setJalaliUTCMonth=function(a,i){var e=this.getUTCDate();var h=this.getUTCMonth();var f=this.getUTCFullYear();var b=JalaliDate.gregorianToJalali(f,h+1,e);if(a>11){b[0]+=math.floor(a/12);a=a%12}b[1]=a+1;if(i!=undefined){b[2]=i}var c=JalaliDate.jalaliToGregorian(b[0],b[1],b[2]);return this.setUTCFullYear(c[0],c[1]-1,c[2])};Date.prototype.setJalaliUTCDate=function(h){var c=this.getUTCDate();var f=this.getUTCMonth();var e=this.getUTCFullYear();var a=JalaliDate.gregorianToJalali(e,f+1,c);a[2]=h;var b=JalaliDate.jalaliToGregorian(a[0],a[1],a[2]);return this.setUTCFullYear(b[0],b[1]-1,b[2])};Date.prototype.getJalaliUTCFullYear=function(){var b=this.getUTCDate();var d=this.getUTCMonth();var c=this.getUTCFullYear();var a=JalaliDate.gregorianToJalali(c,d+1,b);return a[0]};Date.prototype.getJalaliUTCMonth=function(){var b=this.getUTCDate();var d=this.getUTCMonth();var c=this.getUTCFullYear();var a=JalaliDate.gregorianToJalali(c,d+1,b);return a[1]-1};Date.prototype.getJalaliUTCDate=function(){var b=this.getUTCDate();var d=this.getUTCMonth();var c=this.getUTCFullYear();var a=JalaliDate.gregorianToJalali(c,d+1,b);return a[2]};Date.prototype.getJalaliUTCDay=function(){var a=this.getUTCDay();a=(a+1)%7;return a};