﻿// JScript File
String.prototype.trim = function()
{
    return this.replace(/^\s*/, "").replace(/\s*$/, "");
}

function createRequestObject() {
  var reqObj;
  var browser = navigator.appName;
  if(browser == "Microsoft Internet Explorer"){
	reqObj = new ActiveXObject("Microsoft.XMLHTTP");
	isIE = true;
  }else{
	reqObj = new XMLHttpRequest();
  }
  return reqObj;
}

function doCall(whereTo, returnTo,async){
	if (async == null)
		async = false;
  inCall = true;
  http = createRequestObject();
  http.open('get', noCache(whereTo), async);
  
  
  // DO WE HAVE A FUNCTION TO CALL ONCE CALL IS COMPLETED?
  if(returnTo.length > 0){
	eval("http.onreadystatechange = "+returnTo);
  }
  // SEND CALL
  http.send(null);
}

function noCache(uri)
{
	return uri.concat(/\?/.test(uri)?"&":"?","noCache=",(new Date).getTime(),".",Math.random()*1234567);
}
