// augment.js JavaScript 1.8.5 methods for all, version: 0.2.1
// using snippets from Mozilla - https://developer.mozilla.org/en/JavaScript
// (c) 2011 Oliver Nightingale
//
//  Released under MIT license.
//
if(!Array.prototype.every)Array.prototype.every=function(d,c){if(this===void 0||this===null)throw new TypeError;var a=Object(this),b=a.length>>>0;if(typeof d!=="function")throw new TypeError;for(var e=0;e<b;e++)if(e in a&&!d.call(c,a[e],e,a))return false;return true};
if(!Array.prototype.filter)Array.prototype.filter=function(d,c){if(this===void 0||this===null)throw new TypeError;var a=Object(this),b=a.length>>>0;if(typeof d!=="function")throw new TypeError;for(var e=[],f=0;f<b;f++)if(f in a){var g=a[f];d.call(c,g,f,a)&&e.push(g)}return e};
if(!Array.prototype.forEach)Array.prototype.forEach=function(d,c){if(this===void 0||this===null)throw new TypeError;var a=Object(this),b=a.length>>>0;if(typeof d!=="function")throw new TypeError;for(var e=0;e<b;e++)e in a&&d.call(c,a[e],e,a)};
if(!Array.prototype.indexOf)Array.prototype.indexOf=function(d){if(this===void 0||this===null)throw new TypeError;var c=Object(this),a=c.length>>>0;if(a===0)return-1;var b=0;if(arguments.length>0){b=Number(arguments[1]);if(b!==b)b=0;else if(b!==0&&b!==Infinity&&b!==-Infinity)b=(b>0||-1)*Math.floor(Math.abs(b))}if(b>=a)return-1;for(b=b>=0?b:Math.max(a-Math.abs(b),0);b<a;b++)if(b in c&&c[b]===d)return b;return-1};Array.isArray=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"};
if(!Array.prototype.lastIndexOf)Array.prototype.lastIndexOf=function(d){if(this===void 0||this===null)throw new TypeError;var c=Object(this),a=c.length>>>0;if(a===0)return-1;var b=a;if(arguments.length>1){b=Number(arguments[1]);if(b!==b)b=0;else if(b!==0&&b!==Infinity&&b!==-Infinity)b=(b>0||-1)*Math.floor(Math.abs(b))}for(a=b>=0?Math.min(b,a-1):a-Math.abs(b);a>=0;a--)if(a in c&&c[a]===d)return a;return-1};
if(!Array.prototype.map)Array.prototype.map=function(d,c){if(this===void 0||this===null)throw new TypeError;var a=Object(this),b=a.length>>>0;if(typeof d!=="function")throw new TypeError;for(var e=Array(b),f=0;f<b;f++)if(f in a)e[f]=d.call(c,a[f],f,a);return e};
if(!Array.prototype.reduce)Array.prototype.reduce=function(d){if(this===void 0||this===null)throw new TypeError;var c=Object(this),a=c.length>>>0;if(typeof d!=="function")throw new TypeError;if(a==0&&arguments.length==1)throw new TypeError;var b=0,e;if(arguments.length>=2)e=arguments[1];else{do{if(b in c){e=c[b++];break}if(++b>=a)throw new TypeError;}while(1)}for(;b<a;){if(b in c)e=d.call(undefined,e,c[b],b,c);b++}return e};
if(!Array.prototype.reduceRight)Array.prototype.reduceRight=function(d){if(this===void 0||this===null)throw new TypeError;var c=Object(this),a=c.length>>>0;if(typeof d!=="function")throw new TypeError;if(a===0&&arguments.length===1)throw new TypeError;a-=1;var b;if(arguments.length>=2)b=arguments[1];else{do{if(a in this){b=this[a--];break}if(--a<0)throw new TypeError;}while(1)}for(;a>=0;){if(a in c)b=d.call(undefined,b,c[a],a,c);a--}return b};
if(!Array.prototype.some)Array.prototype.some=function(d,c){if(this===void 0||this===null)throw new TypeError;var a=Object(this),b=a.length>>>0;if(typeof d!=="function")throw new TypeError;for(var e=0;e<b;e++)if(e in a&&d.call(c,a[e],e,a))return true;return false};if(!Date.now)Date.now=function(){return+new Date};if(!Date.prototype.toJSON)Date.prototype.toJSON=Date.prototype.toJSON;
if(!Date.prototype.toUTCString)Date.prototype.toUTCString=function(){var d=function(c){return(c+="",c.length==2)?c:"0"+c};return function(){var c=[this.getUTCFullYear(),d(this.getUTCMonth()+1),d(this.getUTCDate())].join("-"),a=[d(this.getUTCHours()),d(this.getUTCMinutes()),d(this.getUTCSeconds())].join(":")+"."+this.getMilliseconds();return[c,a].join("T")+"Z"}}();
if(!Function.prototype.bind)Function.prototype.bind=function(d){var c=[].slice,a=c.call(arguments,1),b=this,e=function(){},f=function(){return b.apply(this instanceof e?this:d||{},a.concat(c.call(arguments)))};e.prototype=b.prototype;f.prototype=new e;return f};if(!Object.keys)Object.keys=function(d){if(d!==Object(d))throw new TypeError("Object.keys called on non-object");var c=[],a;for(a in d)Object.prototype.hasOwnProperty.call(d,a)&&c.push(a);return c};
if(!String.prototype.trim)String.prototype.trim=function(){var d=/^\s+/,c=/\s+$/;return function(){return this.replace(d,"").replace(c,"")}}();

