
AjaxSender = function(){
	this.params = new Array();
	this._xmlhttp =  this._getTransport();

	var onreadystatechange =  function( obj ){
		var method = function(){
			if (this._xmlhttp.readyState == 4) {			
				if (this._xmlhttp.status == 200) {
					if( this.onComplete && typeof(this.onComplete) == 'function' ) this.onComplete( this._xmlhttp.responseText );
				} else {
					if( this.onFailure && typeof(this.onFailure) == 'function' ) this.onFailure( this._xmlhttp.responseText );
				}//if
			}//if
		};//function method		
		return function(){ return method.apply( obj, new Array() ) };
	}//function	onreadystatechange
	this._xmlhttp.onreadystatechange =  onreadystatechange( this );
};

AjaxSender.prototype._getTransport = function() {
	var xmlreq = false;
	if (window.XMLHttpRequest) {
		xmlreq = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		// Try ActiveX
		try { 
			xmlreq = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e1) { 
			// first method failed 
			try {
				xmlreq = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e2) {
				// both methods failed 
			}//try 
		}//try
	}//if
    return xmlreq;
} ;

AjaxSender.prototype.url = "";

AjaxSender.prototype.method = "get";

AjaxSender.prototype.synchronize = false;

AjaxSender.prototype.onComplete = null;

AjaxSender.prototype.onFailure = null;

AjaxSender.prototype.params = null;

AjaxSender.prototype._xmlhttp = null;

AjaxSender.prototype.clearParam = function(){ this.params = new Array(); }

AjaxSender.prototype.setParam = function( name, value ){
	this.params[ this.params.length ] = { name : name , value : value };
};

AjaxSender.prototype.getQueryString = function(){
	var query = "";
	for( var i = 0, len=this.params.length ; i < len ; i++ ){
		query += (i==0)?((this.method=="get"||this.method=="GET")?"?":""):"&";
		query += this.params[i].name + "=" + this.params[i].value;
	}//for i
	return query;
}

AjaxSender.prototype.send = function(){
	var url = "";
	var param = "";
	
	//this._xmlhttp =  this._getTransport();

	if( this.method == "get" || this.method == "GET" ) {
		url = this.url + this.getQueryString();
	} else {
		url = this.url;
		param = this.getQueryString();
	}//if
	
	this._xmlhttp.open( this.method, url, this.synchronize );
	
	this._xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
	this._xmlhttp.setRequestHeader("Accept", "text/javascript, text/html, application/xml, text/xml, */*");
	this._xmlhttp.setRequestHeader("Connection", "close");
	this._xmlhttp.send( param );
	this.clearParam();
}


/** 
 	var sender = new AjaxSender();
	sender.url = "/test/return.asp";
	sender.synchronize = true;
	sender.method = "get";
	sender.onComplete = RChangeEventSelect
	sender.onFailure = function( data ){	 alert( "ERROR : " + data );	}
	sender.setParam( "data" , "view1 Data" );
	sender.send();
	
	var sender2 = new AjaxSender();
	sender2.url = "/test/return.asp";
	sender2.synchronize = true;
	sender2.method = "get";
	sender2.onComplete = RChangeEventSelect
	sender2.onFailure = function( data ){	 alert( "ERROR : " + data );	}
	sender2.setParam( "data" , "view2 Data" );
	sender2.send();

	function RChangeEventSelect( response ){
		var json = eval( "(" + response + ")" );
		var win = document.getElementById("strWinCode");
		var selectInput = new SelectInput();
		selectInput.clearOption( win );
		selectInput.addOption( win, "전체", "" );			
		selectInput.addOptionByMapList( win, "strWinDescription", "strWinCode", json );
	}

*/