 /*****************************************************************************
  * Helper functions - Helper functions - Helper functions - Helper functions *
  *****************************************************************************
  * pre: -
  * post: Creates an ajax..
  * xmlHttp --> XMLHttpRequest object
  * @Param1: method  --> GET or POST
  * @Param2: url     --> the url of the server side script
  * @Param3: sync    --> true/false (asynchronous or synchronous)
  * @param4: func	 --> Response function to be called
  * @Param5: params  --> Parameters to be send to the server side script
  */

  function AjaxCall(method, url, sync, func, params, opt) {
	  var xmlHttp = CreateAjaxObject();
	  if(xmlHttp != null) {
	    xmlHttp.open(method,url,sync);
	    xmlHttp.onreadystatechange = function() {
			  					                   func(xmlHttp, opt);
	                                 }
	    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");
      xmlHttp.send(params);
	  }
  }

  function CreateAjaxObject() {
    var xmlHttp;
    try {
      xmlHttp = new XMLHttpRequest();
    } catch(e) {
      try {
        xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
      } catch(e) {
        try {
          xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        } catch(e) {
          return(null);
        }
      }
    }
	  return(xmlHttp);
  }
