	var bProcessingJSON = false;

	function showModalContent(strObject, oParams) {
		if (bProcessingJSON) { return; }
		bProcessingJSON = true;
		setTimeout('bProcessingJSON = false;', 1000);
		oParams.SmartObject = strObject;
		$("#modalBoxContent").html("");
		$("#modalBoxContent").load("/register/includes/json/smartjson/content.php",
						oParams,
						function(){
							$("#screenLayer").show();
							$("#modalBox").slideDown("fast");
							$('#modalBoxContent > form:first').each(function(){
								$(this).ajaxForm({
									dataType: 'json',
									success: handleFormReturn
								});
							});
							$('#formCancelLink').click(function(){ hideModal(); return false; }).attr("href","#");
						});
	}

	function processForm(strObject, oParams) {
		if (bProcessingJSON) { return; }
		bProcessingJSON = true;
		setTimeout('bProcessingJSON = false;', 1000);
		oParams.SmartObject = strObject;
		$.postJSON("/register/includes/json/smartjson/index.php", oParams, handleFormReturn);
	}

	function handleFormReturn(oData, oCallback) {
		if (oData.success) {
			hideModal();
			onModalFormSuccess();
		}
		else {
			for (var i = 0; i < oData.messages.length; i++) {
				alert(oData.messages[i].value);
			}
			onModalFormFailure();
		}
	}

	function onModalFormSuccess() { }

	function onModalFormFailure() { } 

	function hideModal() {
		$("#modalBox").slideUp("fast");
		$("#screenLayer").hide();
	}


