/* : 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,l=f.prototype,q=f.CultureInfo,e=function(a,c){c||(c=2);return("000"+a).slice(c*-1)};l.clearTime=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this};l.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,c){if(isNaN(a)||isNaN(c))throw Error(a+ " - "+c);else if(a instanceof Date&&c instanceof Date)return ac?1:0;else throw new TypeError(a+" - "+c);};f.equals=function(a,c){return a.compareTo(c)===0};f.getDayNumberFromName=function(a){var c=q.dayNames,b=q.abbreviatedDayNames,g=q.shortestDayNames;a=a.toLowerCase();for(var k=0;k=a.getTime()&&this.getTime()<=c.getTime()};l.isAfter=function(a){return this.compareTo(a||new Date)===1};l.isBefore=function(a){return this.compareTo(a||new Date)===-1};l.isToday=function(){return this.isSameDay(new Date)};l.isSameDay=function(a){return this.clone().clearTime().equals(a.clone().clearTime())}; l.addMilliseconds=function(a){this.setMilliseconds(this.getMilliseconds()+a);return this};l.addSeconds=function(a){return this.addMilliseconds(a*1E3)};l.addMinutes=function(a){return this.addMilliseconds(a*6E4)};l.addHours=function(a){return this.addMilliseconds(a*36E5)};l.addDays=function(a){this.setDate(this.getDate()+a);return this};l.addWeeks=function(a){return this.addDays(a*7)};l.addMonths=function(a){var c=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+a);this.setDate(Math.min(c, f.getDaysInMonth(this.getFullYear(),this.getMonth())));return this};l.addYears=function(a){return this.addMonths(a*12)};l.add=function(a){if(typeof a=="number"){this._orient=a;return 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 d,i,j;l.getWeek= function(){var a,c,b,g,k;d=!d?this.getFullYear():d;i=!i?this.getMonth()+1:i;j=!j?this.getDate():j;if(i<=2){a=d-1;c=(a/4|0)-(a/100|0)+(a/400|0);b=((a-1)/4|0)-((a-1)/100|0)+((a-1)/400|0);b=c-b;g=0;k=j-1+31*(i-1)}else{a=d;c=(a/4|0)-(a/100|0)+(a/400|0);b=((a-1)/4|0)-((a-1)/100|0)+((a-1)/400|0);b=c-b;g=b+1;k=j+(153*(i-3)+2)/5+58+b}a=(a+c)%7;c=k+3-(k+a-g)%7|0;b=c<0?53-((a-b)/5|0):c>364+b?1:(c/7|0)+1;d=i=j=null;return b};l.getISOWeek=function(){d=this.getUTCFullYear();i=this.getUTCMonth()+1;j=this.getUTCDate(); return e(this.getWeek())};l.setWeek=function(a){return this.moveToDayOfWeek(1).addWeeks(a-this.getWeek())};f._validate=function(a,c,b,g){if(typeof a=="undefined")return false;else if(typeof a!="number")throw new TypeError(a+" is not a Number.");else if(ab)throw new RangeError(a+" is not a valid value for "+g+".");return true};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,c,b){return f._validate(a,1,f.getDaysInMonth(c,b),"day")};f.validateMonth=function(a){return f._validate(a,0,11,"month")};f.validateYear=function(a){return f._validate(a,0,9999,"year")};l.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}; l.moveToFirstDayOfMonth=function(){return this.set({day:1})};l.moveToLastDayOfMonth=function(){return this.set({day:f.getDaysInMonth(this.getFullYear(),this.getMonth())})};l.moveToNthOccurrence=function(a,c){var b=0;if(c>0)b=c-1;else if(c===-1){this.moveToLastDayOfMonth();this.getDay()!==a&&this.moveToDayOfWeek(a,-1);return this}return this.moveToFirstDayOfMonth().addDays(-1).moveToDayOfWeek(a,+1).addWeeks(b)};l.moveToDayOfWeek=function(a,c){var b=(a-this.getDay()+7*(c||+1))%7;return this.addDays(b=== 0?b+=7*(c||+1):b)};l.moveToMonth=function(a,c){var b=(a-this.getMonth()+12*(c||+1))%12;return this.addMonths(b===0?b+=12*(c||+1):b)};l.getOrdinalNumber=function(){return Math.ceil((this.clone().clearTime()-new Date(this.getFullYear(),0,1))/864E5)+1};l.getTimezone=function(){return f.getTimezoneAbbreviation(this.getUTCOffset())};l.setTimezoneOffset=function(a){var c=this.getTimezoneOffset();return this.addMinutes(Number(a)*-6/10-c)};l.setTimezone=function(a){return this.setTimezoneOffset(f.getTimezoneOffset(a))}; l.hasDaylightSavingTime=function(){return Date.today().set({month:0,day:1}).getTimezoneOffset()!==Date.today().set({month:6,day:1}).getTimezoneOffset()};l.isDaylightSavingTime=function(){return this.hasDaylightSavingTime()&&(new Date).getTimezoneOffset()===Date.today().set({month:6,day:1}).getTimezoneOffset()};l.getUTCOffset=function(){var a=this.getTimezoneOffset()*-10/6;if(a<0){a=(a-1E4).toString();return a.charAt(0)+a.substr(2)}else{a=(a+1E4).toString();return"+"+a.substr(1)}};l.getElapsed=function(a){return(a|| new Date)-this};if(!l.toISOString)l.toISOString=function(){function a(c){return c<10?"0"+c:c}return'"'+this.getUTCFullYear()+"-"+a(this.getUTCMonth()+1)+"-"+a(this.getUTCDate())+"T"+a(this.getUTCHours())+":"+a(this.getUTCMinutes())+":"+a(this.getUTCSeconds())+'Z"'};l._toString=l.toString;l.toString=function(a){var c=this;if(a&&a.length==1){var b=q.formatPatterns;c.t=c.toString;switch(a){case "d":return c.t(b.shortDate);case "D":return c.t(b.longDate);case "F":return c.t(b.fullDateTime);case "m":return c.t(b.monthDay); case "r":return c.t(b.rfc1123);case "s":return c.t(b.sortableDateTime);case "t":return c.t(b.shortTime);case "T":return c.t(b.longTime);case "u":return c.t(b.universalSortableDateTime);case "y":return c.t(b.yearMonth)}}var g=function(k){switch(k*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(k){if(k.charAt(0)==="\\")return k.replace("\\","");c.h=c.getHours; switch(k){case "hh":return e(c.h()<13?c.h()===0?12:c.h():c.h()-12);case "h":return c.h()<13?c.h()===0?12:c.h():c.h()-12;case "HH":return e(c.h());case "H":return c.h();case "mm":return e(c.getMinutes());case "m":return c.getMinutes();case "ss":return e(c.getSeconds());case "s":return c.getSeconds();case "yyyy":return e(c.getFullYear(),4);case "yy":return e(c.getFullYear());case "dddd":return q.dayNames[c.getDay()];case "ddd":return q.abbreviatedDayNames[c.getDay()];case "dd":return e(c.getDate()); case "d":return c.getDate();case "MMMM":return q.monthNames[c.getMonth()];case "MMM":return q.abbreviatedMonthNames[c.getMonth()];case "MM":return e(c.getMonth()+1);case "M":return c.getMonth()+1;case "t":return c.h()<12?q.amDesignator.substring(0,1):q.pmDesignator.substring(0,1);case "tt":return c.h()<12?q.amDesignator:q.pmDesignator;case "S":return g(c.getDate());default:return k}}):this._toString()}})(); (function(){var f=Date,l=f.prototype,q=f.CultureInfo,e=Number.prototype;l._orient=+1;l._nth=null;l._is=false;l._same=false;l._isSecond=false;e._dateElement="day";l.next=function(){this._orient=+1;return this};f.next=function(){return f.today().next()};l.last=l.prev=l.previous=function(){this._orient=-1;return this};f.last=f.prev=f.previous=function(){return f.today().last()};l.is=function(){this._is=true;return this};l.same=function(){this._same=true;this._isSecond=false;return this};l.today=function(){return this.same().day()}; l.weekday=function(){if(this._is){this._is=false;return!this.is().sat()&&!this.is().sun()}return false};l.at=function(h){return typeof h==="string"?f.parse(this.toString("d")+" "+h):this.set(h)};e.fromNow=e.after=function(h){var m={};m[this._dateElement]=this;return(!h?new Date:h.clone()).add(m)};e.ago=e.before=function(h){var m={};m[this._dateElement]=this*-1;return(!h?new Date:h.clone()).add(m)};var d="sunday monday tuesday wednesday thursday friday saturday".split(/\s/),i="january february march april may june july august september october november december".split(/\s/), j="Millisecond Second Minute Hour Day Week Month Year".split(/\s/),a="Milliseconds Seconds Minutes Hours Date Week Month FullYear".split(/\s/),c="final first second third fourth fifth".split(/\s/);l.toObject=function(){for(var h={},m=0;mn)throw new RangeError(f.getDayName(h)+" does not occur "+m+" times in the month of "+f.getMonthName(n.getMonth())+" "+n.getFullYear()+".");return this}return this.moveToDayOfWeek(h,this._orient)}},g=function(h){return function(){var m=f.today(),n=h-m.getDay();if(h===0&&q.firstDayOfWeek===1&&m.getDay()!==0)n+=7;return m.addDays(n)}},k=0;k-1;t--){o=j[t].toLowerCase();if(n[o]!=m[o])return false;if(p==o)break}return true}if(h.substring(h.length-1)!="s")h+="s";return this["add"+h](this._orient)}};b=function(h){return function(){this._dateElement=h;return this}};for(g=0;g0&&!m)try{g=j.call(this,b[1])}catch(p){m=true}else m=true;if(!m&&g[1].length===0)m=true;if(!m){b=[];for(m=0;m0){k[0]=k[0].concat(b[0]);k[1]=b[1]}}if(k[1].length1)j=Array.prototype.slice.call(arguments);else if(arguments[0]instanceof Array)j=arguments[0];if(j)for(var c=j.shift();02?g:g+(g+2E3f.getDaysInMonth(this.year,this.month))throw new RangeError(this.day+" is not a valid value for days.");b=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second);if(this.timezone)b.set({timezone:this.timezone});else this.timezoneOffset&&b.set({timezoneOffset:this.timezoneOffset});return b},finish:function(b){b=b instanceof Array?q(b):[b];if(b.length===0)return null;for(var g=0;g",{"class":"ganttview"});(new e(h,b)).render();k.append(h);h=f("div.ganttview-vtheader",k).outerWidth()+f("div.ganttview-slide-container",k).outerWidth();k.css("width",h+2+"px");(new d(k,b)).apply()})}var c=this,b=f.extend(true,{showWeekends:true,cellWidth:21,cellHeight:31,slideWidth:400,vHeaderWidth:100,behavior:{clickable:true, draggable:true,resizable:true}},j);if(b.data)a();else b.dataUrl&&f.getJSON(b.dataUrl,function(g){b.data=g;a()})}function q(j,a){if(j=="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 j=Array.prototype.slice.call(arguments);j.length==1&&typeof j[0]=="object"&&l.call(this,j[0]);j.length==2&&typeof j[0]=="string"&&q.call(this,j[0],j[1])}; var e=function(j,a){var c=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return{render:function(){for(var b=a.data,g=a.cellHeight,k=f("
",{"class":"ganttview-vtheader"}),h=0;h",{"class":"ganttview-vtheader-item"});m.append(f("
",{"class":"ganttview-vtheader-item-name",css:{height:b[h].series.length*g+"px"}}).append(b[h].name));for(var n=f("
",{"class":"ganttview-vtheader-series"}),o=0;o",{"class":"ganttview-vtheader-series-name"}).append(b[h].series[o].name)); m.append(n);k.append(m)}j.append(k);b=f("
",{"class":"ganttview-slide-container",css:{width:a.slideWidth+"px"}});h=a.start;g=a.end;k=[];k[h.getFullYear()]=[];k[h.getFullYear()][h.getMonth()]=[h];for(h=h;h.compareTo(g)==-1;){h=h.clone().addDays(1);k[h.getFullYear()]||(k[h.getFullYear()]=[]);k[h.getFullYear()][h.getMonth()]||(k[h.getFullYear()][h.getMonth()]=[]);k[h.getFullYear()][h.getMonth()].push(h);h=h}g=dates=k;k=a.cellWidth;h=f("
",{"class":"ganttview-hzheader"});m=f("
",{"class":"ganttview-hzheader-months"}); n=f("
",{"class":"ganttview-hzheader-days"});o=0;for(var p in g)for(var t in g[p]){var x=g[p][t].length*k;o+=x;m.append(f("
",{"class":"ganttview-hzheader-month",css:{width:x-1+"px"}}).append(c[t]+"/"+p));for(var u in g[p][t])n.append(f("
",{"class":"ganttview-hzheader-day"}).append(g[p][t][u].getDate()))}m.css("width",o+"px");n.css("width",o+"px");h.append(m).append(n);b.append(h);p=a.data;g=dates;k=a.cellWidth;h=a.showWeekends;t=f("
",{"class":"ganttview-grid"});u=f("
",{"class":"ganttview-grid-row"}); for(var s in g)for(var v in g[s])for(var w in g[s][v]){m=f("
",{"class":"ganttview-grid-row-cell"});i.isWeekend(g[s][v][w])&&h&&m.addClass("ganttview-weekend");u.append(m)}s=f("div.ganttview-grid-row-cell",u).length*k;u.css("width",s+"px");t.css("width",s+"px");for(s=0;s",{"class":"ganttview-blocks"});for(w=0;w",{"class":"ganttview-block-container"})); b.append(v);s=a.data;v=a.cellWidth;w=a.start;p=f("div.ganttview-blocks div.ganttview-block-container",b);for(u=t=0;u",{"class":"ganttview-block",title:k.name+", "+h+" days",css:{width:h*v-9+"px","margin-left":m*v+3+"px"}});o=s[u];o={id:o.id,name:o.name};f.extend(o,k);n.data("block-data",o);s[u].series[g].color&&m.css("background-color",s[u].series[g].color);m.append(f("
", {"class":"ganttview-block-text"}).text(h));f(p[t]).append(m);t+=1}j.append(b);b=j.parent();f("div.ganttview-grid-row div.ganttview-grid-row-cell:last-child",b).addClass("last");f("div.ganttview-hzheader-days div.ganttview-hzheader-day:last-child",b).addClass("last");f("div.ganttview-hzheader-months div.ganttview-hzheader-month:last-child",b).addClass("last")}}},d=function(j,a){function c(h,m){f("div.ganttview-block",h).live("click",function(){m&&m(f(this).data("block-data"))})}function b(h,m,n,o){f("div.ganttview-block", h).resizable({grid:m,handles:"e,w",stop:function(){var p=f(this);k(h,p,m,n);o&&o(p.data("block-data"))}})}function g(h,m,n,o){f("div.ganttview-block",h).draggable({axis:"x",grid:[m,m],stop:function(){var p=f(this);k(h,p,m,n);o&&o(p.data("block-data"))}})}function k(h,m,n,o){h=f("div.ganttview-slide-container",h);var p=h.scrollLeft();h=m.offset().left-h.offset().left-1+p;p=Math.round(h/n);o=o.clone().addDays(p);m.data("block-data").start=o;p=m.outerWidth();n=Math.round(p/n)-1;m.data("block-data").end= o.clone().addDays(n);f("div.ganttview-block-text",m).text(n+1);m.css("top","").css("left","").css("position","relative").css("margin-left",h+"px")}return{apply:function(){a.behavior.clickable&&c(j,a.behavior.onClick);a.behavior.resizable&&b(j,a.cellWidth,a.start,a.behavior.onResize);a.behavior.draggable&&g(j,a.cellWidth,a.start,a.behavior.onDrag)}}},i={daysBetween:function(j,a){if(!j||!a)return 0;j=Date.parse(j);a=Date.parse(a);if(j.getYear()==1901||a.getYear()==8099)return 0;for(var c=0,b=j.clone();b.compareTo(a)== -1;){c+=1;b.addDays(1)}return c},isWeekend:function(j){return j.getDay()%6==0},getBoundaryDatesFromData:function(j,a){var c=new Date;maxEnd=new Date;for(var b=0;b