AE.namespace('AE.run.ajaxProxy');
AE.run.ajaxProxy = function(){
	this.config = {
		proxy:globalImgServer+"/static/ajax_proxy.html",
		domain : "alibaba.com"
	},
	
	this.temp = {
		ajaxForm : null
	},
	
	this.setForm = function(ajaxForm){
		this.temp.ajaxForm = ajaxForm;
	},
	
	this.asyncRequest = function(type,url,callBack,postBody,iConfig){
		
			var _self = this;
			_self.config = YL.merge(_self.config,iConfig||{});
			var config = _self.config;
			
			try{document.domain = config.domain;}catch(e){}
			var iframe = document.createElement("iframe");
			
			YUE.on(iframe,"load",function(){
				
				var tempCallBack = callBack.success;
				callBack.success = function(o){
						tempCallBack(o);
						//do other
						//document.body.removeChild(iframe);
				}

				if(_self.temp.ajaxForm){
					this.contentWindow.setForm(_self.temp.ajaxForm);
				}
				
				this.contentWindow.sendRequest(type,url,callBack,postBody);
			});
			
			iframe.src = config.proxy;
			iframe.style.display = "none";
			
			// for ie6 fixed
			setTimeout(function(){
				document.body.appendChild(iframe);
			},0);
			
	}

}