/**************************************************************************
 *
 * SCRIPT:       ajax.js
 * VERSION:      1.0.0
 * COPYRIGHT:    (c) 2006-2009 All Rights Reserved.
 * AUTHOR(S):    Michael Huffman (mhuffman@mindspring.com)
 *
 * DESCRIPTION:  This script marks a registrant as paid.
 *
 * HISTORY:
 * 2008.01.02  MWH  Created script.
 * 
 **************************************************************************/

/**************************************************************************
 *
 * FUNCTION:     xmlhttpPost
 *
 * DESCRIPTION:  This method...
 *
 **************************************************************************/

function xmlhttpPost(strURL, obj, qstr) {

    var self       = this;
    var xmlHttpReq = null;

    // FF, Opera, Mozilla/Safari, Chrome, IE7+
    try {
        self.xmlHttpReq = new XMLHttpRequest();
    } catch( e ) {

      // IE6+
      try {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
      } catch( e ) {

        // IE5+
       try {
         self.xmlHttpReq = new ActiveXObject("Msxml2.HXMLHTTP" );
       } catch( e ) {
         self.xmlHttpReq = null;
       }

      }

    }


    if ( self.xmlHttpReq ) {

      self.xmlHttpReq.open('POST', strURL, true);
      self.xmlHttpReq.setRequestHeader('Content-Type',
                                       'application/x-www-form-urlencoded');

      self.xmlHttpReq.onreadystatechange = function() {

          if (self.xmlHttpReq.readyState == 4) {
              if (obj) {
                updatepage(obj, self.xmlHttpReq.responseText);
              }
              else {
                // DEBUG:
                // alert('response: ['+self.xmlHttpReq.responseText+']' );
              }
          }

      }

      self.xmlHttpReq.send(qstr);

    } else {

      alert('Your browser does not seem to support XMLHttpRequest.');

    }

}

/**************************************************************************
 *
 * FUNCTION:     updatepage
 *
 * DESCRIPTION:  This method...
 *
 **************************************************************************/

function updatepage(obj, respStr) {

    var objDiv = document.getElementById(obj);

    if ( objDiv ) {
      objDiv.innerHTML = respStr;
    }

}


/**************************************************************************
 *
 * END: ajax.js
 *
 **************************************************************************/

