(function(A){A.text={format:function(C,B){return C.format(B)},whitespace:[" "," ","\t","\n","\r","\f"],types:{startIndex:0,trimStart:1,endIndex:2,trimEnd:3,trim:4},trim:function(G,D,F,H,C){if(!G||G.length==0){return G}D=D||A.text.whitespace;F=F||A.text.types.trim;H=H||0;C=C||G.length-1;var B,E;if(F<A.text.types.endIndex||F>A.text.types.trimEnd){for(H=0;H<C&&(B=function(){for(E=0;E<D.length;E++){if(D[E]==G.substr(H,D[E].length)){return D[E].length}}return 0}());H+=B){}if(F==A.text.types.startIndex){return H}if(F==A.text.types.trimStart){return G.slice(H,G.length)}}if(F>A.text.types.trimStart){for(C=G.length;C>=H&&(B=function(){for(E=0;E<D.length;E++){if(D[E]==G.substr(C-D[E].length,D[E].length)){return D[E].length}}return 0}());C-=B){}if(F==A.text.types.endIndex){return C}if(F==A.text.types.trimEnd){return G.slice(0,C)}}return G.slice(H,C)},trimStartIndex:function(D,C,B){return A.text.trim(D,C,A.text.types.startIndex,0,B)},trimStart:function(D,C,B){return A.text.trim(D,C,A.text.types.trimStart,0,B)},trimEndIndex:function(C,B,D){return A.text.trim(C,B,A.text.types.endIndex,D)},trimEnd:function(C,B,D){return A.text.trim(C,B,A.text.types.trimEnd,D)},isWhitespace:function(B){return A.inArray(B,A.text.whitespace)!=-1}};String.prototype.left=function(B){if(this==null){return null}else{return this.length<B?this:this.substring(0,B)}};String.prototype.right=function(B){if(this==null){return null}else{return this.length<B?this:this.substring(this.length-B)}};String.prototype.startsWith=function(B){if(this==null){return false}else{return this.length<B.length?false:this.substring(0,B.length)==B}};String.prototype.endsWith=function(B){if(this==null){return false}else{return this.length<B.length?false:this.substring(this.length-B.length)==B}};String.prototype.isDate=function(){return Date.parse(this)};String.prototype.isEMail=function(){return new RegExp(String.patternEMail,"gi").test(this)};String.prototype.format=function(B){var C=Date.parse(this);if(C){return C.toString(B)}else{return this}};String.prototype.indexOfAny=function(B,D){var F,E=-1;if(B){if(C==null){C=0}for(var C=0;C<B.length;C++){F=this.indexOf(B[C],D);if(F>-1&&(E==-1||F<E)){E=F}}}return E};String.patternEMail="^([a-z0-9_.-])+@([a-z0-9-]+.)+[a-z0-9]{2,4}$";Date.months=new Array("January","February","March","April","May","June","July","August","September","October","November","December");Date.monthsAbbr=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");Date.days=new Array("Sunday","Monday","Tuesday","Wednesday","Thusday","Friday","Saturday");Date.daysAbbr=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");Date.prototype.toString=function(B){if(!B){B="d mmm yyyy hh:nn:ss"}var C=this;return B.replace(/(yyyy|mmmm|mmm|mm|m|dddd|ddd|dd|d|hh|h|nn|n|ss|s)/ig,function(D){switch(D.toLowerCase()){case"yyyy":return C.getFullYear();case"mmmm":return Date.months[C.getMonth()];case"mmm":return Date.monthsAbbr[C.getMonth()];case"mm":return("0"+(C.getMonth()+1)).right(2);case"m":return C.getMonth()+1;case"dddd":return Date.days[C.getDay()];case"ddd":return Date.daysAbbr[C.getDay()];case"dd":return("0"+C.getDate()).right(2);case"d":return C.getDate();case"hh":return("0"+C.getHours()).right(2);case"h":return C.getHours();case"nn":return("0"+C.getMinutes()).right(2);case"n":return C.getMinutes();case"ss":return("0"+C.getSeconds()).right(2);case"s":return C.getSeconds()}})};Date.prototype.addSeconds=function(B){this.setTime(Date.addSeconds(this,B).getTime())};Date.prototype.addMinutes=function(B){this.setTime(Date.addMinutes(this,B).getTime())};Date.prototype.addHours=function(B){this.setTime(Date.addHours(this,B).getTime())};Date.prototype.addDays=function(B){this.setTime(Date.addDays(this,B).getTime())};Date.prototype.addMonths=function(B){this.setTime(Date.addMonths(this,B).getTime())};Date.prototype.addYears=function(B){this.setTime(Date.addYears(this,B).getTime())};Date.prototype.parse=function(C,B){d=Date.parse(C,B);if(!isNaN(d)){this.setTime(d.getTime())}};Date.addSeconds=function(C,B){return new Date(Date.parse(C).getTime()+B*1000)};Date.addMinutes=function(C,B){return new Date(Date.parse(C).getTime()+B*60000)};Date.addHours=function(C,B){return new Date(Date.parse(C).getTime()+B*3600000)};Date.addDays=function(C,B){return new Date(Date.parse(C).getTime()+B*86400000)};Date.addMonths=function(C,B){C=Date.parse(C);C.setMonth(C.getMonth()+B);return C};Date.addYears=function(C,B){C=Date.parse(C);C.setYear(C.getFullYear()+B);return C};Date.parse=function(D,C){var F;if(D){if(D.constructor==Date){F=new Date(D)}else{if(D.constructor==String){var E=new RegExp("^(([0-9]{4}|[0-2]?[0-9]|3[0-1])[\\.\\s\\-\\/])?".concat("((1[0-2]|0?[0-9])|(",Date.monthsAbbr.join("|"),"|",Date.months.join("|"),"))([\\.\\s\\-\\/]([0-9]{2,4}))?$"),"i");var B=E.exec(D);if(B){F=new Date(0,0,0,0,0,0);if(B[2]&&B[2].length==4){F.setYear(B[2]);F.setDate(B[7])}else{F.setYear(Date.year(B[7]?B[7]:new Date().getFullYear()));F.setDate(B[2]?B[2]:1)}B[4]?F.setMonth(B[4]-1):F.setMonth(Date.month(B[5]))}E=new RegExp("([0-1]{0,1}[0-9]|2[0-4]):([0-5]?[0-9]|6[0-9])(:([0-5]?[0-9]|6[0-9]))?");B=E.exec(D);if(B){if(!F){F=new Date(0,0,0,0,0,0)}F.setHours(B[1],B[2]);if(B[4]){F.setSeconds(B[4])}}}}}if(isNaN(F)){if(C){return Date.parse(C)}else{return null}}else{return F}};Date.prototype.getFirstDayOfMonth=function(){return new Date(this.getFullYear(),this.getMonth(),1)};Date.prototype.getDatePart=function(){return new Date(this.getFullYear(),this.getMonth(),this.getDate())};Date.month=function(B){i=Date.monthsAbbr.indexOf(B);if(i>-1){return i}return Date.months.indexOf(B)};Date.year=function(B){var C=parseInt(B);return C<1000?(C>50?C+1900:C+2000):C};Array.prototype.indexOf=function(C,B){if(C!=undefined){if(C.constructor==String){for(B=B?B:0;B<this.length;B++){if(this[B].toLowerCase()==C.toLowerCase()){return B}}}else{for(B=B?B:0;B<this.length;B++){if(this[B]==C){return B}}}}return -1};Array.prototype.contains=function(B){return this.indexOf(B)!=-1};Array.prototype.remove=function(D,C){var B=this.indexOf(D);if(B!=-1){this.splice(B,1,C)}}})(jQuery);