/* : Licensed under The MIT License. See license.txt and http://www.datejs.com/license/. @website: http://www.datejs.com/ */ Date.CultureInfo={name:"en-US",englishName:"English (United States)",nativeName:"English (United States)",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shortestDayNames:["Su","Mo","Tu","We","Th","Fr","Sa"],firstLetterDayNames:["S","M","T","W","T","F","S"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbreviatedMonthNames:["Jan", "Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],amDesignator:"AM",pmDesignator:"PM",firstDayOfWeek:0,twoDigitYearMax:2029,dateElementOrder:"mdy",formatPatterns:{shortDate:"M/d/yyyy",longDate:"dddd, MMMM dd, yyyy",shortTime:"h:mm tt",longTime:"h:mm:ss tt",fullDateTime:"dddd, MMMM dd, yyyy h:mm:ss tt",sortableDateTime:"yyyy-MM-ddTHH:mm:ss",universalSortableDateTime:"yyyy-MM-dd HH:mm:ssZ",rfc1123:"ddd, dd MMM yyyy HH:mm:ss GMT",monthDay:"MMMM dd",yearMonth:"MMMM, yyyy"},regexPatterns:{jan:/^jan(uary)?/i, feb:/^feb(ruary)?/i,mar:/^mar(ch)?/i,apr:/^apr(il)?/i,may:/^may/i,jun:/^jun(e)?/i,jul:/^jul(y)?/i,aug:/^aug(ust)?/i,sep:/^sep(t(ember)?)?/i,oct:/^oct(ober)?/i,nov:/^nov(ember)?/i,dec:/^dec(ember)?/i,sun:/^su(n(day)?)?/i,mon:/^mo(n(day)?)?/i,tue:/^tu(e(s(day)?)?)?/i,wed:/^we(d(nesday)?)?/i,thu:/^th(u(r(s(day)?)?)?)?/i,fri:/^fr(i(day)?)?/i,sat:/^sa(t(urday)?)?/i,future:/^next/i,past:/^last|past|prev(ious)?/i,add:/^(\+|aft(er)?|from|hence)/i,subtract:/^(\-|bef(ore)?|ago)/i,yesterday:/^yes(terday)?/i, today:/^t(od(ay)?)?/i,tomorrow:/^tom(orrow)?/i,now:/^n(ow)?/i,millisecond:/^ms|milli(second)?s?/i,second:/^sec(ond)?s?/i,minute:/^mn|min(ute)?s?/i,hour:/^h(our)?s?/i,week:/^w(eek)?s?/i,month:/^m(onth)?s?/i,day:/^d(ay)?s?/i,year:/^y(ear)?s?/i,shortMeridian:/^(a|p)/i,longMeridian:/^(a\.?m?\.?|p\.?m?\.?)/i,timezone:/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?)|gmt|utc)/i,ordinalSuffix:/^\s*(st|nd|rd|th)/i,timeContext:/^\s*(\:|a(?!u|p)|p)/i},timezones:[{name:"UTC",offset:"-000"}, {name:"GMT",offset:"-000"},{name:"EST",offset:"-0500"},{name:"EDT",offset:"-0400"},{name:"CST",offset:"-0600"},{name:"CDT",offset:"-0500"},{name:"MST",offset:"-0700"},{name:"MDT",offset:"-0600"},{name:"PST",offset:"-0800"},{name:"PDT",offset:"-0700"}]}; (function(){var f=Date,g=f.prototype,j=f.CultureInfo,b=function(a,d){d||(d=2);return("000"+a).slice(d*-1)};g.clearTime=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this};g.setTimeToNow=function(){var a=new Date;this.setHours(a.getHours());this.setMinutes(a.getMinutes());this.setSeconds(a.getSeconds());this.setMilliseconds(a.getMilliseconds());return this};f.today=function(){return(new Date).clearTime()};f.compare=function(a,d){if(isNaN(a)||isNaN(d))throw Error(a+ " - "+d);else if(a instanceof Date&&d instanceof Date)return ad?1:0;else throw new TypeError(a+" - "+d);};f.equals=function(a,d){return a.compareTo(d)===0};f.getDayNumberFromName=function(a){for(var d=j.dayNames,e=j.abbreviatedDayNames,c=j.shortestDayNames,a=a.toLowerCase(),b=0;b=a.getTime()&&this.getTime()<=d.getTime()};g.isAfter=function(a){return this.compareTo(a||new Date)===1};g.isBefore=function(a){return this.compareTo(a||new Date)===-1};g.isToday=function(){return this.isSameDay(new Date)};g.isSameDay=function(a){return this.clone().clearTime().equals(a.clone().clearTime())}; g.addMilliseconds=function(a){this.setMilliseconds(this.getMilliseconds()+a);return this};g.addSeconds=function(a){return this.addMilliseconds(a*1E3)};g.addMinutes=function(a){return this.addMilliseconds(a*6E4)};g.addHours=function(a){return this.addMilliseconds(a*36E5)};g.addDays=function(a){this.setDate(this.getDate()+a);return this};g.addWeeks=function(a){return this.addDays(a*7)};g.addMonths=function(a){var d=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+a);this.setDate(Math.min(d, f.getDaysInMonth(this.getFullYear(),this.getMonth())));return this};g.addYears=function(a){return this.addMonths(a*12)};g.add=function(a){if(typeof a=="number")return this._orient=a,this;a.milliseconds&&this.addMilliseconds(a.milliseconds);a.seconds&&this.addSeconds(a.seconds);a.minutes&&this.addMinutes(a.minutes);a.hours&&this.addHours(a.hours);a.weeks&&this.addWeeks(a.weeks);a.months&&this.addMonths(a.months);a.years&&this.addYears(a.years);a.days&&this.addDays(a.days);return this};var c,h,n;g.getWeek= function(){var a,d,e,b,f;c=!c?this.getFullYear():c;h=!h?this.getMonth()+1:h;n=!n?this.getDate():n;h<=2?(a=c-1,d=(a/4|0)-(a/100|0)+(a/400|0),e=d-(((a-1)/4|0)-((a-1)/100|0)+((a-1)/400|0)),b=0,f=n-1+31*(h-1)):(a=c,d=(a/4|0)-(a/100|0)+(a/400|0),e=d-(((a-1)/4|0)-((a-1)/100|0)+((a-1)/400|0)),b=e+1,f=n+(153*(h-3)+2)/5+58+e);a=(a+d)%7;b=f+3-(f+a-b)%7|0;c=h=n=null;return b<0?53-((a-e)/5|0):b>364+e?1:(b/7|0)+1};g.getISOWeek=function(){c=this.getUTCFullYear();h=this.getUTCMonth()+1;n=this.getUTCDate();return b(this.getWeek())}; g.setWeek=function(a){return this.moveToDayOfWeek(1).addWeeks(a-this.getWeek())};f._validate=function(a,d,e,b){if(typeof a=="undefined")return!1;else if(typeof a!="number")throw new TypeError(a+" is not a Number.");else if(ae)throw new RangeError(a+" is not a valid value for "+b+".");return!0};f.validateMillisecond=function(a){return f._validate(a,0,999,"millisecond")};f.validateSecond=function(a){return f._validate(a,0,59,"second")};f.validateMinute=function(a){return f._validate(a,0,59,"minute")}; f.validateHour=function(a){return f._validate(a,0,23,"hour")};f.validateDay=function(a,d,e){return f._validate(a,1,f.getDaysInMonth(d,e),"day")};f.validateMonth=function(a){return f._validate(a,0,11,"month")};f.validateYear=function(a){return f._validate(a,0,9999,"year")};g.set=function(a){f.validateMillisecond(a.millisecond)&&this.addMilliseconds(a.millisecond-this.getMilliseconds());f.validateSecond(a.second)&&this.addSeconds(a.second-this.getSeconds());f.validateMinute(a.minute)&&this.addMinutes(a.minute- this.getMinutes());f.validateHour(a.hour)&&this.addHours(a.hour-this.getHours());f.validateMonth(a.month)&&this.addMonths(a.month-this.getMonth());f.validateYear(a.year)&&this.addYears(a.year-this.getFullYear());f.validateDay(a.day,this.getFullYear(),this.getMonth())&&this.addDays(a.day-this.getDate());a.timezone&&this.setTimezone(a.timezone);a.timezoneOffset&&this.setTimezoneOffset(a.timezoneOffset);a.week&&f._validate(a.week,0,53,"week")&&this.setWeek(a.week);return this};g.moveToFirstDayOfMonth= function(){return this.set({day:1})};g.moveToLastDayOfMonth=function(){return this.set({day:f.getDaysInMonth(this.getFullYear(),this.getMonth())})};g.moveToNthOccurrence=function(a,d){var e=0;if(d>0)e=d-1;else if(d===-1)return this.moveToLastDayOfMonth(),this.getDay()!==a&&this.moveToDayOfWeek(a,-1),this;return this.moveToFirstDayOfMonth().addDays(-1).moveToDayOfWeek(a,1).addWeeks(e)};g.moveToDayOfWeek=function(a,d){var e=(a-this.getDay()+7*(d||1))%7;return this.addDays(e===0?e+7*(d||1):e)};g.moveToMonth= function(a,d){var e=(a-this.getMonth()+12*(d||1))%12;return this.addMonths(e===0?e+12*(d||1):e)};g.getOrdinalNumber=function(){return Math.ceil((this.clone().clearTime()-new Date(this.getFullYear(),0,1))/864E5)+1};g.getTimezone=function(){return f.getTimezoneAbbreviation(this.getUTCOffset())};g.setTimezoneOffset=function(a){var d=this.getTimezoneOffset();return this.addMinutes(Number(a)*-6/10-d)};g.setTimezone=function(a){return this.setTimezoneOffset(f.getTimezoneOffset(a))};g.hasDaylightSavingTime= function(){return Date.today().set({month:0,day:1}).getTimezoneOffset()!==Date.today().set({month:6,day:1}).getTimezoneOffset()};g.isDaylightSavingTime=function(){return this.hasDaylightSavingTime()&&(new Date).getTimezoneOffset()===Date.today().set({month:6,day:1}).getTimezoneOffset()};g.getUTCOffset=function(){var a=this.getTimezoneOffset()*-10/6;return a<0?(a=(a-1E4).toString(),a.charAt(0)+a.substr(2)):(a=(a+1E4).toString(),"+"+a.substr(1))};g.getElapsed=function(a){return(a||new Date)-this};if(!g.toISOString)g.toISOString= function(){function a(a){return a<10?"0"+a:a}return'"'+this.getUTCFullYear()+"-"+a(this.getUTCMonth()+1)+"-"+a(this.getUTCDate())+"T"+a(this.getUTCHours())+":"+a(this.getUTCMinutes())+":"+a(this.getUTCSeconds())+'Z"'};g._toString=g.toString;g.toString=function(a){var d=this;if(a&&a.length==1){var e=j.formatPatterns;d.t=d.toString;switch(a){case "d":return d.t(e.shortDate);case "D":return d.t(e.longDate);case "F":return d.t(e.fullDateTime);case "m":return d.t(e.monthDay);case "r":return d.t(e.rfc1123); case "s":return d.t(e.sortableDateTime);case "t":return d.t(e.shortTime);case "T":return d.t(e.longTime);case "u":return d.t(e.universalSortableDateTime);case "y":return d.t(e.yearMonth)}}var c=function(a){switch(a*1){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th"}};return a?a.replace(/(\\)?(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|S)/g,function(a){if(a.charAt(0)==="\\")return a.replace("\\","");d.h=d.getHours;switch(a){case "hh":return b(d.h()< 13?d.h()===0?12:d.h():d.h()-12);case "h":return d.h()<13?d.h()===0?12:d.h():d.h()-12;case "HH":return b(d.h());case "H":return d.h();case "mm":return b(d.getMinutes());case "m":return d.getMinutes();case "ss":return b(d.getSeconds());case "s":return d.getSeconds();case "yyyy":return b(d.getFullYear(),4);case "yy":return b(d.getFullYear());case "dddd":return j.dayNames[d.getDay()];case "ddd":return j.abbreviatedDayNames[d.getDay()];case "dd":return b(d.getDate());case "d":return d.getDate();case "MMMM":return j.monthNames[d.getMonth()]; case "MMM":return j.abbreviatedMonthNames[d.getMonth()];case "MM":return b(d.getMonth()+1);case "M":return d.getMonth()+1;case "t":return d.h()<12?j.amDesignator.substring(0,1):j.pmDesignator.substring(0,1);case "tt":return d.h()<12?j.amDesignator:j.pmDesignator;case "S":return c(d.getDate());default:return a}}):this._toString()}})(); (function(){var f=Date,g=f.prototype,j=f.CultureInfo,b=Number.prototype;g._orient=1;g._nth=null;g._is=!1;g._same=!1;g._isSecond=!1;b._dateElement="day";g.next=function(){this._orient=1;return this};f.next=function(){return f.today().next()};g.last=g.prev=g.previous=function(){this._orient=-1;return this};f.last=f.prev=f.previous=function(){return f.today().last()};g.is=function(){this._is=!0;return this};g.same=function(){this._same=!0;this._isSecond=!1;return this};g.today=function(){return this.same().day()}; g.weekday=function(){return this._is?(this._is=!1,!this.is().sat()&&!this.is().sun()):!1};g.at=function(a){return typeof a==="string"?f.parse(this.toString("d")+" "+a):this.set(a)};b.fromNow=b.after=function(a){var e={};e[this._dateElement]=this;return(!a?new Date:a.clone()).add(e)};b.ago=b.before=function(a){var e={};e[this._dateElement]=this*-1;return(!a?new Date:a.clone()).add(e)};var c="sunday monday tuesday wednesday thursday friday saturday".split(/\s/),h="january february march april may june july august september october november december".split(/\s/), n="Millisecond Second Minute Hour Day Week Month Year".split(/\s/),a="Milliseconds Seconds Minutes Hours Date Week Month FullYear".split(/\s/),d="final first second third fourth fifth".split(/\s/);g.toObject=function(){for(var e={},d=0;dd)throw new RangeError(f.getDayName(a)+" does not occur "+e+" times in the month of "+f.getMonthName(d.getMonth())+" "+d.getFullYear()+".");return this}return this.moveToDayOfWeek(a,this._orient)}},l=function(a){return function(){var e=f.today(),d=a-e.getDay();a===0&&j.firstDayOfWeek===1&&e.getDay()!==0&&(d+=7);return e.addDays(d)}},k=0;k-1;f--){b=n[f].toLowerCase();if(d[b]!=e[b])return!1;if(c==b)break}return!0}a.substring(a.length-1)!="s"&&(a+="s");return this["add"+a](this._orient)}};e=function(a){return function(){this._dateElement=a;return this}};for(l=0;l0&&!m)try{l=c.call(this,e[1])}catch(q){m=!0}else m=!0;!m&&l[1].length===0&&(m=!0);if(!m){e=[];for(m=0;m0&&(k[0]=k[0].concat(e[0]),k[1]=e[1])}k[1].length1?c=Array.prototype.slice.call(arguments):arguments[0]instanceof Array&& (c=arguments[0]);if(c)for(var d=c.shift();02?b:b+(b+2E3f.getDaysInMonth(this.year,this.month))throw new RangeError(this.day+" is not a valid value for days.");a=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second);this.timezone?a.set({timezone:this.timezone}):this.timezoneOffset&&a.set({timezoneOffset:this.timezoneOffset});return a},finish:function(a){a=a instanceof Array?j(a):[a];if(a.length===0)return null;for(var b=0;b",{"class":"ganttview"});(new b(d,e)).render();a.append(d);d=f("div.ganttview-vtheader",a).outerWidth()+f("div.ganttview-slide-container",a).outerWidth();a.css("width",d+2+"px");(new c(a,e)).apply()})}var d=this,e=f.extend(!0,{showWeekends:!0,cellWidth:21,cellHeight:31,slideWidth:400,vHeaderWidth:100,behavior:{clickable:!0, draggable:!0,resizable:!0}},g);e.data?a():e.dataUrl&&f.getJSON(e.dataUrl,function(b){e.data=b;a()})}function j(b,a){if(b=="setSlideWidth"){var c=$("div.ganttview",this);c.each(function(){var b=$("div.ganttview-vtheader",c).outerWidth();$(c).width(b+a+1);$("div.ganttview-slide-container",this).width(a)})}}f.fn.ganttView=function(){var b=Array.prototype.slice.call(arguments);b.length==1&&typeof b[0]=="object"&&g.call(this,b[0]);b.length==2&&typeof b[0]=="string"&&j.call(this,b[0],b[1])};var b=function(b, a){var c=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return{render:function(){for(var e=a.data,g=a.cellHeight,k=f("
",{"class":"ganttview-vtheader"}),i=0;i",{"class":"ganttview-vtheader-item"});m.append(f("
",{"class":"ganttview-vtheader-item-name",css:{height:e[i].series.length*g+"px"}}).append(e[i].name));for(var j=f("
",{"class":"ganttview-vtheader-series"}),p=0;p",{"class":"ganttview-vtheader-series-name"}).append(e[i].series[p].name)); m.append(j);k.append(m)}b.append(k);e=f("
",{"class":"ganttview-slide-container",css:{width:a.slideWidth+"px"}});i=a.start;g=a.end;k=[];k[i.getFullYear()]=[];for(k[i.getFullYear()][i.getMonth()]=[i];i.compareTo(g)==-1;)i=i.clone().addDays(1),k[i.getFullYear()]||(k[i.getFullYear()]=[]),k[i.getFullYear()][i.getMonth()]||(k[i.getFullYear()][i.getMonth()]=[]),k[i.getFullYear()][i.getMonth()].push(i);var g=dates=k,k=a.cellWidth,i=f("
",{"class":"ganttview-hzheader"}),m=f("
",{"class":"ganttview-hzheader-months"}), j=f("
",{"class":"ganttview-hzheader-days"}),p=0,q;for(q in g)for(var t in g[q]){var w=g[q][t].length*k;p+=w;m.append(f("
",{"class":"ganttview-hzheader-month",css:{width:w-1+"px"}}).append(c[t]+"/"+q));for(var s in g[q][t])j.append(f("
",{"class":"ganttview-hzheader-day"}).append(g[q][t][s].getDate()))}m.css("width",p+"px");j.css("width",p+"px");i.append(m).append(j);e.append(i);q=a.data;g=dates;k=a.cellWidth;i=a.showWeekends;t=f("
",{"class":"ganttview-grid"});s=f("
",{"class":"ganttview-grid-row"}); for(var o in g)for(var u in g[o])for(var v in g[o][u])m=f("
",{"class":"ganttview-grid-row-cell"}),h.isWeekend(g[o][u][v])&&i&&m.addClass("ganttview-weekend"),s.append(m);o=f("div.ganttview-grid-row-cell",s).length*k;s.css("width",o+"px");t.css("width",o+"px");for(o=0;o",{"class":"ganttview-blocks"});for(v=0;v",{"class":"ganttview-block-container"})); e.append(u);o=a.data;u=a.cellWidth;v=a.start;q=f("div.ganttview-blocks div.ganttview-block-container",e);for(s=t=0;s",{"class":"ganttview-block",title:k.name+", "+i+" days",css:{width:i*u-9+"px","margin-left":m*u+3+"px"}}),p=o[s],p={id:p.id,name:p.name},f.extend(p,k),j.data("block-data",p),o[s].series[g].color&&m.css("background-color",o[s].series[g].color),m.append(f("
", {"class":"ganttview-block-text"}).text(i)),f(q[t]).append(m),t+=1;b.append(e);e=b.parent();f("div.ganttview-grid-row div.ganttview-grid-row-cell:last-child",e).addClass("last");f("div.ganttview-hzheader-days div.ganttview-hzheader-day:last-child",e).addClass("last");f("div.ganttview-hzheader-months div.ganttview-hzheader-month:last-child",e).addClass("last")}}},c=function(b,a){function c(a,b){f("div.ganttview-block",a).live("click",function(){b&&b(f(this).data("block-data"))})}function e(a,b,c,d){f("div.ganttview-block", a).resizable({grid:b,handles:"e,w",stop:function(){var e=f(this);h(a,e,b,c);d&&d(e.data("block-data"))}})}function g(a,b,c,d){f("div.ganttview-block",a).draggable({axis:"x",grid:[b,b],stop:function(){var e=f(this);h(a,e,b,c);d&&d(e.data("block-data"))}})}function h(a,b,c,d){var a=f("div.ganttview-slide-container",a),e=a.scrollLeft(),a=b.offset().left-a.offset().left-1+e,e=Math.round(a/c),d=d.clone().addDays(e);b.data("block-data").start=d;e=b.outerWidth();c=Math.round(e/c)-1;b.data("block-data").end= d.clone().addDays(c);f("div.ganttview-block-text",b).text(c+1);b.css("top","").css("left","").css("position","relative").css("margin-left",a+"px")}return{apply:function(){a.behavior.clickable&&c(b,a.behavior.onClick);a.behavior.resizable&&e(b,a.cellWidth,a.start,a.behavior.onResize);a.behavior.draggable&&g(b,a.cellWidth,a.start,a.behavior.onDrag)}}},h={daysBetween:function(b,a){if(!b||!a)return 0;b=Date.parse(b);a=Date.parse(a);if(b.getYear()==1901||a.getYear()==8099)return 0;for(var c=0,e=b.clone();e.compareTo(a)== -1;)c+=1,e.addDays(1);return c},isWeekend:function(b){return b.getDay()%6==0},getBoundaryDatesFromData:function(b,a){var c=new Date;maxEnd=new Date;for(var e=0;e