﻿Type.registerNamespace("RLSoft.SharePoint.Ajax.Toolkit");RLSoft.SharePoint.Ajax.Toolkit.TimeSpan = function() {
if (arguments.length == 0) this._ctor$0.apply(this, arguments);else if (arguments.length == 1) this._ctor$1.apply(this, arguments);else if (arguments.length == 3) this._ctor$2.apply(this, arguments);else if (arguments.length == 4) this._ctor$3.apply(this, arguments);else if (arguments.length == 5) this._ctor$4.apply(this, arguments);else throw Error.parameterCount();}
RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.prototype = {
_ctor$0 : function() {
this._ticks = 0;}, 
_ctor$1 : function(ticks) {
this._ctor$0();this._ticks = ticks;},
_ctor$2 : function(hours, minutes, seconds) {
this._ctor$0();this._ticks = 
(hours * RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerHour) +
(minutes * RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerMinute) +
(seconds * RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerSecond);},
_ctor$3 : function(days, hours, minutes, seconds) {
this._ctor$0();this._ticks = 
(days * RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerDay) +
(hours * RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerHour) +
(minutes * RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerMinute) +
(seconds * RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerSecond);},
_ctor$4 : function(days, hours, minutes, seconds, milliseconds) {
this._ctor$0();this._ticks = 
(days * RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerDay) +
(hours * RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerHour) +
(minutes * RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerMinute) +
(seconds * RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerSecond) +
(milliseconds * RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerMillisecond);},
getDays : function() { 
return Math.floor(this._ticks / RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerDay);},
getHours : function() { 
return Math.floor(this._ticks / RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerHour) % 24;},
getMinutes : function() { 
return Math.floor(this._ticks / RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerMinute) % 60;},
getSeconds : function() { 
return Math.floor(this._ticks / RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerSecond) % 60;},
getMilliseconds : function() { 
return Math.floor(this._ticks / RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerMillisecond) % 1000;},
getDuration : function() { 
return new RLSoft.SharePoint.Ajax.Toolkit.TimeSpan(Math.abs(this._ticks));},
getTicks : function() { 
return this._ticks;},
getTotalDays : function() { 
Math.floor(this._ticks / RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerDay);},
getTotalHours : function() { 
return Math.floor(this._ticks / RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerHour);},
getTotalMinutes : function() { 
return Math.floor(this._ticks / RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerMinute);},
getTotalSeconds : function() { 
return Math.floor(this._ticks / RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerSecond);},
getTotalMilliseconds : function() { 
return Math.floor(this._ticks / RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerMillisecond);},
add : function(value) { 
return new RLSoft.SharePoint.Ajax.Toolkit.TimeSpan(this._ticks + value.getTicks());},
subtract : function(value) { 
return new RLSoft.SharePoint.Ajax.Toolkit.TimeSpan(this._ticks - value.getTicks());},
negate : function() { 
return new RLSoft.SharePoint.Ajax.Toolkit.TimeSpan(-this._ticks);},
equals : function(value) { 
return this._ticks == value.getTicks();},
compareTo : function(value) { 
if(this._ticks > value.getTicks()) 
return 1;else if(this._ticks < value.getTicks()) 
return -1;else 
return 0;},
toString : function() { 
return this.format("F");},
format : function(format) { 
if (!format) {
format = "F";}
if (format.length == 1) {
switch (format) {
case "t": format = RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.ShortTimeSpanPattern;break;case "T": format = RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.LongTimeSpanPattern;break;case "F": format = RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.FullTimeSpanPattern;break;default: throw Error.createError(String.format(RLSoft.SharePoint.Ajax.Toolkit.Resources.Common_DateTime_InvalidTimeSpan, format));}
}
var regex = /dd|d|hh|h|mm|m|ss|s|nnnn|nnn|nn|n/g;var builder = new Sys.StringBuilder();var ticks = this._ticks;if (ticks < 0) {
builder.append("-");ticks = -ticks;}
for (;;) {
var index = regex.lastIndex;var ar = regex.exec(format);builder.append(format.slice(index, ar ? ar.index : format.length));if (!ar) break;switch (ar[0]) {
case "dd":
case "d":
builder.append(RLSoft.SharePoint.Ajax.Toolkit.CommonToolkitScripts.padLeft(Math.floor(ticks / RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerDay, ar[0].length, '0')));break;case "hh":
case "h":
builder.append(RLSoft.SharePoint.Ajax.Toolkit.CommonToolkitScripts.padLeft(Math.floor(ticks / RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerHour) % 24, ar[0].length, '0'));break;case "mm":
case "m":
builder.append(RLSoft.SharePoint.Ajax.Toolkit.CommonToolkitScripts.padLeft(Math.floor(ticks / RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerMinute) % 60, ar[0].length, '0'));break;case "ss":
case "s":
builder.append(RLSoft.SharePoint.Ajax.Toolkit.CommonToolkitScripts.padLeft(Math.floor(ticks / RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerSecond) % 60, ar[0].length, '0'));break;case "nnnn":
case "nnn":
case "nn":
case "n":
builder.append(RLSoft.SharePoint.Ajax.Toolkit.CommonToolkitScripts.padRight(Math.floor(ticks / RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerMillisecond) % 1000, ar[0].length, '0', true));break;default:
Sys.Debug.assert(false);}
}
return builder.toString();}
}
RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.parse = function(text) {
var parts = text.split(":");var d = 0;var h = 0;var m = 0;var s = 0;var n = 0;var ticks = 0;switch(parts.length) {
case 1:
if (parts[0].indexOf(".") != -1) {
var parts2 = parts[0].split(".");s = parseInt(parts2[0]);n = parseInt(parts2[1]);} else {
ticks = parseInt(parts[0]);}
break;case 2:
h = parseInt(parts[0]);m = parseInt(parts[1]);break;case 3:
h = parseInt(parts[0]);m = parseInt(parts[1]);if (parts[2].indexOf(".") != -1) {
var parts2 = parts[2].split(".");s = parseInt(parts2[0]);n = parseInt(parts2[1]);} else {
s = parseInt(parts[2]);}
break;case 4:
d = parseInt(parts[0]);h = parseInt(parts[1]);m = parseInt(parts[2]);if (parts[3].indexOf(".") != -1) {
var parts2 = parts[3].split(".");s = parseInt(parts2[0]);n = parseInt(parts2[1]);} else {
s = parseInt(parts[3]);}
break;}
ticks += (d * RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerDay) +
(h * RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerHour) +
(m * RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerMinute) +
(s * RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerSecond) +
(n * RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerMillisecond);if(!isNaN(ticks)) {
return new RLSoft.SharePoint.Ajax.Toolkit.TimeSpan(ticks);} 
throw Error.create(RLSoft.SharePoint.Ajax.Toolkit.Resources.Common_DateTime_InvalidFormat);}
RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.fromTicks = function(ticks) { 
return new RLSoft.SharePoint.Ajax.Toolkit.TimeSpan(ticks);}
RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.fromDays = function(days) { 
return new RLSoft.SharePoint.Ajax.Toolkit.TimeSpan(days * RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerDay);}
RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.fromHours = function(hours) { 
return new RLSoft.SharePoint.Ajax.Toolkit.TimeSpan(hours * RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerHour);}
RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.fromMinutes = function(minutes) { 
return new RLSoft.SharePoint.Ajax.Toolkit.TimeSpan(minutes * RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerMinute);}
RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.fromSeconds = function(seconds) { 
return new RLSoft.SharePoint.Ajax.Toolkit.TimeSpan(minutes * RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerSecond);}
RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.fromMilliseconds = function(milliseconds) { 
return new RLSoft.SharePoint.Ajax.Toolkit.TimeSpan(minutes * RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerMillisecond);}
RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerDay = 864000000000;RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerHour = 36000000000;RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerMinute = 600000000;RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerSecond = 10000000;RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerMillisecond = 10000;RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.FullTimeSpanPattern = "dd:hh:mm:ss.nnnn";RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.ShortTimeSpanPattern = "hh:mm";RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.LongTimeSpanPattern = "hh:mm:ss";Date.prototype.getTimeOfDay = function Date$getTimeOfDay() {
return new RLSoft.SharePoint.Ajax.Toolkit.TimeSpan(
0, 
this.getHours(), 
this.getMinutes(), 
this.getSeconds(), 
this.getMilliseconds());}
Date.prototype.getDateOnly = function Date$getDateOnly() {
return new Date(this.getFullYear(), this.getMonth(), this.getDate());}
Date.prototype.add = function Date$add(span) {
return new Date(this.getTime() + span.getTotalMilliseconds());}
Date.prototype.subtract = function Date$subtract(span) {
return this.add(span.negate());}
Date.prototype.getTicks = function Date$getTicks() {
return this.getTime() * RLSoft.SharePoint.Ajax.Toolkit.TimeSpan.TicksPerMillisecond;}
RLSoft.SharePoint.Ajax.Toolkit.FirstDayOfWeek = function() {
}
RLSoft.SharePoint.Ajax.Toolkit.FirstDayOfWeek.prototype = {
Sunday : 0,
Monday : 1,
Tuesday : 2,
Wednesday : 3,
Thursday : 4,
Friday : 5,
Saturday : 6,
Default : 7
}
RLSoft.SharePoint.Ajax.Toolkit.FirstDayOfWeek.registerEnum("RLSoft.SharePoint.Ajax.Toolkit.FirstDayOfWeek");
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();