/* 
 -- CallTask(): Calls server end returns result as a string 
 -- tested across broweser platforms and in keeping with current specs
 -- Written by Ed Sanford of ODI Consulting (c) 1996-2008 all rights reserved
 -- modifications: (c) 1998,2000,2004,2007,2008,2009  all rights reserved
 -- usage example: var serverTime=CallTask('/utiltiy/time.cfm');
 ... notes: 
 		created 1998 using document.write('script src=...')
 		replace document.write with innerHTML+= ...  (es 2000)
 		innerHTML+="&lt;script src=...&gt;&lt;/script&gt;" with XMLHttpRequest() (es 2004)
 		remove unneeded eval() option on result of XMLHttpRequest() (es 2007)
 		update comments (es 2008)
 		getHTTPObject added for better backward compatibility (es 2009)
*/

function getHTTPObject() { 

  var xmlhttp;


    try {

      xmlhttp = new XMLHttpRequest();

    } catch (e) {

      xmlhttp = false;

  /*@cc_on

  @if (@_jscript_version >= 5)

    try {

      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");

    } catch (e) {

      try {

        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

      } catch (E) {

        xmlhttp = false;

      }

    }

  @else

  xmlhttp = false;

  @end @*/
      }



  return xmlhttp;

}


/* 
 -- CallTask(): Calls server end returns result as a string 
 -- tested across broweser platforms and in keeping with current specs
 -- Written by Ed Sanford of ODI Consulting (c) 1996-2008 all rights reserved
 -- modifications: (c) 1998,2000,2004,2007,2008  all rights reserved
 -- note: most recent modification was to increase simplification by removing the exec/noexec option
 --		 not only returns litteral string from server
 --      those wishing to execute returned code may do so by passing result to exec()
 
 -- usage example: var serverTime=CallTask('/utiltiy/time.cfm');
*/
function CallTask(pcTask)
	{
	var loClient = getHTTPObject();
	loClient.open("GET", pcTask,false);
	loClient.send(null);
	return loClient.responseText;
	}
	
function Trim(pcString)
  {
  return pcString.replace(/^\s*/,'').replace(/\s*$/,'');
  }
