function executeAjaxStrutsAction(action, actionMethod, containerId,
		subContainerId, errorHandler) {
	var submit_param;
	if (actionMethod == null) {
		actionMethod = $("#defaultMethod").val();
	}
	if (actionMethod != null && actionMethod.length > 1) {
		submit_param = "rand=" + Math.random() + "&method:" + actionMethod
				+ "=" + actionMethod
				+ getAllPaprametersFromContainer(containerId);
	} else {
		submit_param = "rand=" + Math.random()
				+ getAllPaprametersFromContainer(containerId);
	}
	if (subContainerId != null) {
		submit_param += getAllPaprametersFromContainer(subContainerId);
	}
	var conId = "#" + containerId;
	$.ajax( {
		type : "POST",
		url : action,
		dataType : "html",
		data : submit_param,
		success : function(data) {
			$(conId).html(data);
			fixQaDiv();
		},
		error : errorHandler
	});
}

function fixQaDiv() {
	// resolve bug in IE.
	if ($.browser.msie) {
		$("#adminQuestionLi").hide();
		$("#adminQuestionLi").show();
	}
}

function getAllPaprametersFromContainer(containerId) {
	var submit_param = "";
	var conId = "#" + containerId;
	$(conId).find("input").each(
			function() {
				if ($(this).attr("name").length > 0
						&& $(this).attr("type") != "submit"
						&& $(this).attr("type") != "button"
						&& !$(this).attr("disabled")
						&& ($(this).attr("type") != "checkbox" || $(this).attr("checked"))) {
					submit_param += "&" + $(this).attr("name") + "="
							+ encodeURIComponent($(this).val());
				}
			});
	$(conId).find("select").each(
			function() {
				if ($(this).attr("name").length > 0
						&& !$(this).attr("disabled")) {
					submit_param += "&" + $(this).attr("name") + "="
							+ encodeURIComponent($(this).val());
				}
			});
	$(conId).find("textarea").each(
			function() {
				if ($(this).attr("name").length > 0
						&& !$(this).attr("disabled")) {
					submit_param += "&" + $(this).attr("name") + "="
							+ encodeURIComponent($(this).val());
				}
			});
	return submit_param;
}

function disableElement(submitElId) {
	$("#" + submitElId).attr("disabled", "disabled");
}

function enableElement(submitElId) {
	$("#" + submitElId).removeAttr("disabled");
}

function scrollToDiv(elementId, elemTopOffsert) {
	var element = $("#" + elementId)[0];
	var top = (elemTopOffsert && (elemTopOffsert != null))  ? elemTopOffsert : 0; 
	var left = 0;
	while(element != null) {
	    left += element.offsetLeft;
	    top += element.offsetTop;
	    element = element.offsetParent;
	}
	window.scrollTo(left,top);
}