// =====================================================================//
// Author: Mark Qian <markqian@hotmail.com>                             //
// WWW: http://www.coolshare.com/                                       //
// All rights reserved (2006)                                           //
//                                                                      //
// You must contact Mark Qian to get a permission of use                //
// in case you want to make any use of the codes besides viewing it     //
// on Mark's site.                                                      //
//======================================================================//

/////////////////////////// Closure 2 //////////////////////////////
//
// Communicator is contained in a closure since we
// need to preserved the reference of Communicator
// so that we can refer it in method wrapper, "process", that 
// will be assigned to onreadystatechange.
// When the call return, we need the "handler", the real callback 
// processor wrapped by "process", to carry out the real tasks on 
// the return text. The callback will be executed in the "process"'s
// execution context where we can't refer to the Communicator that 
// appears as a local var of doKeyUp and may be garbage collected
// if we don't wrap it with a closure.
//
///////////////////////////////////////////////////////////////
var Communicator = (function(){
	function construct() {	    
	  this.state = 0;

	  this.init = function (w, url, params, handler) {
		    this.state = 1;
		    this.w = w;
		    this.url = url;
		    this.params = params;
		    this.handler = handler;
	  }
	  
	  var pp = this;
	
	  
	  
	  ////////////////////////////////////////////////////////////
	  // Process nothing in case the sub class does not
	  // implement "send" instead of throwing an "undefine" error
	  //////////////////////////////////////////////////////////
	  this.send = function() {
	    
	  }
	}
	return construct;
})();


