
function doLoginForm(inID) {
	var myAjax = new Ajax("login_form.php",{
		data: {record_id:inID},
		update: $("form"),
		evalScripts: false,
		onComplete: function() {
			modal_show_centered("form",400);
		},
		onFailure: function() {
			alert("failed");
		}
	}).request();
}


function doLogin() {
	gOK = false;
	var myAjax = new Ajax("login.php", {
		data: $("login_data"),
		update: $("form"),
		evalScripts: true,
		onComplete: function() {
			if(gOK) {
				modal_hide();
				document.location.href = 'https://cornerstoneorphanproject.com/html/my_account.php';
				parent.document.location.href = 'https://cornerstoneorphanproject.com/html/my_account.php';
				alert('Access granted. You are now securly logged in.');
			}
		}
	}).request();
}


function doLogout() {
 	gOK = false;
	var myAjax = new Ajax("logout_form.php", {
		data: $("logout_data"),
		update: $("form"),
		evalScripts: true,
		onComplete: function() {
			if(gOK) {

			}
		}
	}).request();
	document.location.href = 'http://cornerstoneorphanproject.com/html/index.php?aid=logout';
	alert('You have been logged out.');
}


function doCreateAccountForm(inID) {
	var myAjax = new Ajax("account_create_form.php",{
		data: {record_id:inID},
		update: $("form"),
		evalScripts: false,
		onComplete: function() {
			modal_show_centered("form",400);
		},
		onFailure: function() {
			alert("failed");
		}
	}).request();
}

function doCreateAccount() {
	gOK = false;
	var myAjax = new Ajax("account_create_save.php", {
		data: $("account_data"),
		update: $("form"),
		evalScripts: true,
		onComplete: function() {
			if(gOK) {
				modal_hide();
				document.location.href = 'https://cornerstoneorphanproject.com/html/my_account.php';
				parent.document.location.href = 'https://cornerstoneorphanproject.com/html/my_account.php';
				alert('Account created successfully. You are now securly logged in.');
			}
		}
	}).request();
}