"use strict";

String.prototype.replaceAll = function( current, future ) {
	return this.replace( new RegExp(current, "gi") , future);
}

String.prototype.contains = function(it) { return this.indexOf(it) != -1; };

Array.prototype.removeItem = function(obj) {
  for (var i = this.length; i--;) {
    if (this[i] === obj) {
    	this.splice(i,1);
    	return this;
    }
  }
  return this;
}

// From: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind
if ( !Function.prototype.bind ) {

	Function.prototype.bind = function( obj ) {
		var
			slice = [].slice,
			args = slice.call(arguments, 1), 
			self = this, 
			nop = function () {}, 
			bound = function () {
				return
					self.apply( this instanceof nop ? this : ( obj || {} ), 
					args.concat( slice.call(arguments) ) );    
			};

		nop.prototype = self.prototype;

		bound.prototype = new nop();

		return bound;
	};	
}

var rdfx = rdfx ? rdfx : {};

rdfx.load = function (file, defer, async) {
	var s;
	s = document.createElement('script');
	s.src  = file;
	s.defer = defer;
	s.async = async;
	document.getElementsByTagName('body')[0].appendChild(s);
}

rdfx.load( '/pinc/lib.js', true, false) ;
rdfx.load( '/pinc/h5pres.js', true, false) ;
rdfx.load( '/pinc/uop.js', true, false) ;
rdfx.load( '/pinc/scheduler.js', true, false) ;

