﻿



function PageMethod(methodPath, fn, paramArray, successFn, errorFn) {
	var pagePath;
	if (methodPath == "") {
		pagePath = window.location.pathname;
	}
	else {
		pagePath = methodPath;
	}
	var urlMethod = pagePath + "/" + fn;
	var paramList = '';
	if (paramArray.length > 0) {
		for (var i = 0; i < paramArray.length; i += 2) {
			if (paramList.length > 0) paramList += ',';
			paramList += '"' + paramArray[i] + '":"' + paramArray[i + 1] + '"';
		}
	}
	paramList = '{' + paramList + '}';
	$.ajax({
		type: "POST",
		url: urlMethod,
		contentType: "application/json; charset=utf-8",
		data: paramList,
		dataType: "json",
		success: successFn,
		error: errorFn
	});
}
function AjaxSucceeded(result) {
	return true;
}
function AjaxFailed(result) {
	return false;
}
function CallPageMethod(h,m,u,c,e,t,p) {
	PageMethod(h,m, ["u", u, "c", c, "e", e, "t", t, "p", p], AjaxSucceeded, AjaxFailed);
}