String.prototype.trim = function () {
  return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1");
};

if (!Array.prototype.forEach)
{
  Array.prototype.forEach = function(fun /*, thisp*/)
  {
    var len = this.length;
    if (typeof fun != "function")
      throw new TypeError();

    var thisp = arguments[1];
    for (var i = 0; i < len; i++)
    {
      if (i in this)
        fun.call(thisp, this[i], i, this);
    }
  };
}


Array.prototype.inArray = function(search_term) {
  var i = this.length;
  if (i > 0) {
	 do {	    	    
		if (this[i] === search_term) {
		   return true;
		}
	 } while (i--);
  }
  return false;
}


// 
var SDG_BASE_URL = location.protocol + "//" + location.hostname;
