
function jajax(url, args) {
	if (typeof url == 'undefined') {
		return;
	}
	if (typeof args == 'undefined') {
		var args = {};
	}
	if (typeof args.fun == 'undefined') {
		args.fun = null;
	}
	if (typeof args.datatype == 'undefined') {
		args.datatype = 'json';
	}
	if (typeof args.post == 'undefined') {
		args.post = '';
	}
	if (typeof args.async == 'undefined') {
		args.async = true;
	}
	if (typeof args.formid != 'undefined') {
		var p = $('#' + args.formid).serialize();
		if ((p != '') && (args.post != '')) {
			p += '&';
		}
		if ((typeof args.clearform == 'boolean') && (args.clearform)) {
			$('#' + args.formid).each(function() {
				this.reset();
			});
		}
		args.post = p + args.post;
	}
	$.ajax({
		type:'POST',
		url:url,
		data:args.post,
		cache:false,
		async:args.async,
		dataType:args.datatype,
		processData:false,
		scriptCharset:'UTF-8',
		beforeSend:function(xmlHttpRequest) {
			xmlHttpRequest.setRequestHeader('X-JAJAX-Version', '0.1');
		},
		success:function(response) {
			if (args.fun != null) {
				args.fun(response);
			}
		},
		error:function (response) {
		}
	});
}
function jajaxparse(result) {
	if (typeof result.innerhtml != 'undefined') {
		for (var index in result.innerhtml) {
			$('#' + result.innerhtml[index].id).html(result.innerhtml[index].html);
		}
	}
	if (typeof result.appendhtml != 'undefined') {
		for (var index in result.appendhtml) {
			$('#' + result.appendhtml[index].id).append(result.appendhtml[index].html);
		}
	}
	if (typeof result.prependhtml != 'undefined') {
		for (var index in result.prependhtml) {
			$('#' + result.prependhtml[index].id).prepend(result.prependhtml[index].html);
		}
	}
	if (typeof result.eval != 'undefined') {
		for (var index in result.eval) {
			eval(result.eval[index]);
		}
	}
	if (typeof result.addclass != 'undefined') {
		for (var index in result.addclass) {
			$('#' + result.addclass[index].id).addClass(result.addclass[index].classes);
		}
	}
	if (typeof result.removeclass != 'undefined') {
		for (var index in result.removeclass) {
			$('#' + result.removeclass[index].id).removeClass(result.removeclass[index].classes);
		}
	}
}