var Validator = Class.eventClass();

Object.extend (Validator.prototype, {
	f_aS: false,
	f_bK: false,
	showAirport: true,
	language: "zh",
	callback: function() {},
	initialize: function(f_aW,id) {
		this.id = id;
		this.f_bK = f_aW;
	},
	validate: function(string) {
		this.f_fZ(string);    
		
	},
	f_fZ: function(string) {
		if (!this.f_bK) return this.f_hL(false);
		var f_l = "lang=" + this.language + "&input=" + encodeURI(typeof(string)=="string"?string:string.join("&input="));
		f_l += ("&sa=" + (this.showAirport?"true":"false"));
		if (this.f_aS && this.f_aS.transport.readyState!=4 ) {
			try {
				this.f_aS.transport.abort();
			} catch (e) {
			}
		}
		this.f_aS = new Ajax.Request(
			this.f_bK,
			{
				removeScriptElement: true,
				crossSite : true,
				method:	"get",
				parameters: f_l+"&callback=window.ObjectPool."+this.id+".f_bV",
				onException: showError
		 	});
	},
	f_bV : function(f_fz) {
		this.fireEvent("validatecomplete", f_fz);
	}
});