
String.prototype.trim = function () {
  return this.replace(/^\s*/, "").replace(/\s*$/, "");
}

var browser = navigator.appName;

function theWindowHeight() {
  var scrolledX, scrolledY;
  if (self.pageYoffset) {
    //scrolledX = self.pageXoffset;
    scrolledY = self.pageYoffset;
  } else if (document.documentElement && document.documentElement.scrollTop) {
    //scrolledX = document.documentElement.scrollLeft;
    scrolledY = document.documentElement.scrollTop;
  } else if (document.body) {
    //scrolledX = document.body.scrollLeft;
    scrolledY = document.body.scrollTop;
  } 

  var centerX, centerY;
  if (self.innerHeight) {
    //centerX = self.innerWidth;
    centerY = self.innerHeight;
  } else if (document.documentElement && document.documentElement.clientHeight) {
    //centerX = document.documentElement.clientWidth;
    centerY = document.documentElement.clientHeight;
  } else if (document.body) {
    //centerX = document.body.clientWidth;
    centerY = document.body.clientHeight;
  }

  return scrolledY + (centerY - 100) / 2; 
}

function ourWindowWidth() {
  if (window.innerWidth) {
    // Mozilla
    return (window.innerWidth);
  }

  if (document.documentElement.clientWidth) {
    // IE6
    return document.documentElement.clientWidth;
  }

  if (document.body.clientWidth) {
    // IE DHTML-compliant any other
    return document.body.clientWidth;
  }
}

function gotoPage(thePage) {
  window.location = thePage;
}

function getMessagePayloadForTag(theResponse, theTag) {
  return theResponse.substring(theResponse.indexOf("<" + theTag + ">") + theTag.length + 2, theResponse.indexOf("</" + theTag + ">"));
}

function moveGraphicsThisPage() {
  var pageLabelVar = document.getElementById("pageLabel");

  if (pageLabelVar != null) {
    var offset = 0;
    var browser = navigator.appName;
    if (browser.substring(0, 9) == "Microsoft") offset = 8;
    pageLabelVar.style.top = (174 + offset);
    pageLabelVar.style.left = (ourWindowWidth()/2) - 488;
    pageLabelVar.style.visibility = "visible";
  }

}

$(window).resize(function () {moveGraphicsThisPage();});
$(window).load(function () {moveGraphicsThisPage();});

