// == ajax_http() ==
function ajax_http() {
	var xmlhttp;
	/*@cc_on
	@if (@_jscript_version >= 5)
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {
			xmlhttp = false;
		}
	}
	@else
		xmlhttp = false;
	@end @*/
	if ( !xmlhttp && typeof XMLHttpRequest != 'undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			xmlhttp = false;
		}
	}
	return xmlhttp;
}

// == ajax_select_load() ==
function ajax_select_load( ev_obj, select_o, target_url, default_val, method, data ) {
    if ( method == undefined ) {
        method = 'get';
        data = null;
    }            
    if ( default_val == undefined )
        default_val = '';
    var http = ajax_http();
    http.open(method,target_url);
    http.onreadystatechange = function () {
        if ( http.readyState == 4 ) {
            var result_ary = http.responseText.split('|');
            select_o.length = 1;
            for ( var i = 0; i < result_ary.length; i++ ) {
                var item = result_ary[i];
                if ( trim(item.toString()) == '' )
                    continue;
                var item_ary = item.split(';'); 
                var val = item_ary[0];
                var opt = new Option(item_ary[1],val);
                opt.selected = (default_val == val);
                select_o.options[i] = opt;
            }
            ev_obj.success();
        }
        delete http;
    };
    http.send(data);
}


// == ajax_get() ============================
function ajax_get( ev_obj, script_url  ) {
    var http = ajax_http();
    http.open("get",script_url);
    http.onreadystatechange = function () {
        if ( http.readyState == 4 )
           	ev_obj.success(http.responseText);
        delete http;
    };
    http.send(null);
}
