function userAC(takeAction, http_request) {
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			switch(takeAction) {
			case "loginUser":
				var resparr=http_request.responseText.split("^~");
				if(resparr[0]==1){
					document.getElementById("customer_info").innerHTML=resparr[1];
					if(seatsReserved==0) document.getElementById("purchase").disabled=true;
					document.getElementById("status_text").innerHTML="You have been logged in";
					document.getElementById("cu_text").innerHTML="Logged In as " + resparr[4];
					cmpHeader("cu_", "cucimg");
					if(resparr[2]==1){
						nt="Your password has recently been reset.  Please enter a new password now.<br>";
						nt+="New password: <input type='password' id='rspass'><br>";
						nt+="Verify password: <input type='password' id='rspassv'><br>";
						nt+="<input type='button' class='btn' value='Set New Password' onclick='startSetNewPassword();'>";
						document.getElementById("confirmation").innerHTML="";
						document.getElementById('customer_message').innerHTML=nt;
					} else {
						if(resparr[5]=="ShowShippingAddr") startShowShippingInfo();
					}
				} else {
					if(resparr[2]){
						document.getElementById("confirmation").innerHTML="";
						document.getElementById('customer_message').innerHTML=resparr[2];
					}
					document.getElementById("status_text").innerHTML=resparr[1];
				}
				flashStatus();
				break;
			case "updateAccountInfo":
			case "saveShippingAddress":
			case "newAccount":
			case "listPurchases":
			case "viewPurchaseDetails":
			case "forgotPassword":
			case "setNewPassword":
			case "editAccountInfo":
			case "showShippingInfo":
			case "setShippingToBilling":
				document.getElementById("confirmation").innerHTML="";
				document.getElementById("customer_message").innerHTML=http_request.responseText;
				document.getElementById("status_text").innerHTML="";
				break;
			case "registerAccount":
				var resparr=http_request.responseText.split("^~");
				document.getElementById("customer_message").innerHTML=resparr[1];
				startGetState();
				break;
			case "createUserAccount":
				var resparr=http_request.responseText.split("^~");
				document.getElementById("customer_message").innerHTML=resparr[1];
				if(resparr[0]==2){
					registering=true;
					startGetState();
				} else if(resparr[0]==0) {
					document.getElementById("confirmation").innerHTML="";
					document.getElementById('customer_message').innerHTML=resparr[1];
					document.getElementById("status_text").innerHTML=resparr[1];
				} else {
					document.getElementById("confirmation").innerHTML="";
					document.getElementById('customer_message').innerHTML="<h2>An e-mail has been sent to the address entered from no-reply@retrievertickets.com.  You must follow the link provided within to activate your account.</h2>";
					document.getElementById("status_text").innerHTML=resparr[1];
					flashStatus();
				}
				break;
			case "logOutUser":
				location.href="https://" + location.host + location.pathname
				/*seatsReserved=0;
				clearMovieHeader();
				clearPurchaseHeader();
				clearCustomerHeader();
				loginDisplay();
				document.getElementById("confirmation").innerHTML="";
				document.getElementById("customer_message").innerHTML="";
				seatsReserved=0;
				startGetState();
				document.getElementById("status_text").innerHTML="You have been logged out by your request.";
				flashStatus();
				break;*/
			case "reSendActivationMail":
				document.getElementById("status_text").innerHTML=http_request.responseText;
				flashStatus();
				break;
			case "sendFeedback":
				document.getElementById("confirmation").innerHTML="";
				document.getElementById("customer_message").innerHTML="Your Feedback has been sent, thank you!";
				break;
			}

		} else {
			alert('There was a problem with the request. '+http_request.status);
		}
	}
}

function startEditAccountInfo(){
	toDo="editAccountInfo";
	posstr="toDo=" + toDo;
	makePOSTRequest("https://" + webSite + "/backend/user_be.php",posstr,toDo, userAC);
}

function startSetNewPassword(){
	if(document.getElementById('rspass').value!=document.getElementById('rspassv').value){
		alert('The values you entered do not match!');
	} else {
		toDo='setNewPassword';
		posstr="toDo=" + toDo;
		posstr+="&rspass=" + document.getElementById('rspass').value;
		makePOSTRequest("https://" + webSite + "/backend/user_be.php",posstr,toDo, userAC);
	}
}

function startLoginUser(username, password) {
	var toDo="loginUser";
	posstr="toDo=" + toDo;
	posstr+="&username=" + username;
	posstr+="&password=" + password;
	if(document.getElementById('remember').checked==true){
		var remember='t';
	} else {
		var remember='f';
	}
	posstr+="&remember=" + remember;
	makePOSTRequest("https://" + webSite + "/backend/user_be.php",posstr,toDo, userAC);
}

function startReloadUser(){
	var toDo="loginUser";
	posstr="toDo=" + toDo;
	makePOSTRequest("https://" + webSite + "/backend/user_be.php",posstr,toDo, userAC);
}

function startNewAccount() {
	var toDo="newAccount";
	posstr="toDo=" + toDo;
	makePOSTRequest("https://" + webSite + "/backend/user_be.php", posstr, toDo, userAC);
}

function startRegisterAccount(regid){
	var toDo="registerAccount";
	posstr="toDo=" + toDo;
	posstr+="&regid=" + regid;
	makePOSTRequest("https://" + webSite + "/backend/user_be.php", posstr, toDo, userAC);
}

function startListPurchases(){
	var toDo="listPurchases";
	posstr="toDo=" + toDo;
	makePOSTRequest("https://" + webSite + "/backend/user_be.php", posstr, toDo, userAC);
}

function startViewPurchaseDetails(lutrans){
	var toDo="viewPurchaseDetails";
	posstr="toDo=" + toDo;
	posstr+="&lutrans=" + lutrans;
	makePOSTRequest("https://" + webSite + "/backend/user_be.php", posstr, toDo, userAC);
}

function startLogOutUser(){
	if(confirm("Logging out will reset any current movie or ticket selections you may have made and you will also have to log in manually on your next visit.  Do you wish do proceed?")){
		var toDo="logOutUser";
		posstr="toDo=" + toDo;
		makePOSTRequest("https://" + webSite + "/backend/user_be.php", posstr, toDo, userAC);
	}
}

function dispForgotPassword(){
	opt="Enter your e-mail address in the field provided.  A new password will be generated for you and e-mailed to your account.<br>";
	opt+="e-Mail:<input type=text id='fgemail' size='40'><input type=button class='btn' value='Reset Password' onclick='startForgotPassword();'>";
	document.getElementById('customer_message').innerHTML=opt;
}

function startForgotPassword(){
	toDo="forgotPassword";
	posstr="toDo=" + toDo;
	posstr+="&fgemail=" + document.getElementById('fgemail').value;
	makePOSTRequest("https://" + webSite + "/backend/user_be.php", posstr, toDo, userAC);
}

function startCreateUserAccount(nuform) {
	if(document.getElementById('nuemail').value==""){
		document.getElementById('nuemail').style.backgroundColor='yellow';
		document.getElementById("status_text").innerHTML="Please Enter your e-mail address";
		document.getElementById('nuemail').focus();
		flashStatus()
	} else if (document.getElementById('vnuemail').value != document.getElementById('nuemail').value) {
		document.getElementById('nuemail').style.backgroundColor='yellow';
		document.getElementById('vnuemail').style.backgroundColor='yellow';
		document.getElementById("status_text").innerHTML="The e-mail and verify e-mail fields do not match";
		document.getElementById('nuemail').focus();
		flashStatus();
	} else if(document.getElementById('nupassword').value==""){
		document.getElementById('nupassword').style.backgroundColor='yellow';
		document.getElementById("status_text").innerHTML="Please Enter your password";
		document.getElementById('nupassword').focus();
		flashStatus();
	} else if(document.getElementById('nupassword').value != document.getElementById('vnupassword').value) {
		document.getElementById('nupassword').style.backgroundColor='yellow';
		document.getElementById('vnupassword').style.backgroundColor='yellow';
		document.getElementById("status_text").innerHTML="The password anve verify password fields do not match";
		document.getElementById('nupassword').focus();
		flashStatus();
	} else if(document.getElementById('nufname').value==""){
		document.getElementById('nufname').style.backgroundColor='yellow';
		document.getElementById("status_text").innerHTML="Please Enter your first name";
		document.getElementById('nufname').focus();
		flashStatus();
	} else if(document.getElementById('nulname').value==""){
		document.getElementById('nulname').style.backgroundColor='yellow';
		document.getElementById("status_text").innerHTML="Please Enter your last name";
		document.getElementById('nulname').focus();
		flashStatus();
	} else if(document.getElementById('nuaddress1').value==""){
		document.getElementById('nuaddress1').style.backgroundColor='yellow';
		document.getElementById("status_text").innerHTML="Please Enter your address";
		document.getElementById('nuaddress1').focus();
		flashStatus();
	} else if(document.getElementById('nucity').value==""){
		document.getElementById('nucity').style.backgroundColor='yellow';
		document.getElementById("status_text").innerHTML="Please Enter your city";
		document.getElementById('nucity').focus();
		flashStatus();
	} else if(document.getElementById('nustate').value==""){
		document.getElementById('nustate').style.backgroundColor='yellow';
		document.getElementById("status_text").innerHTML="Please Enter your state";
		document.getElementById('nustate').focus();
		flashStatus();
	} else if(document.getElementById('nuzip').value==""){
		document.getElementById('nuzip').style.backgroundColor='yellow';
		document.getElementById("status_text").innerHTML="Please Enter your Zip code";
		document.getElementById('nuzip').focus();
		flashStatus();
	} else if(document.getElementById('nuphone').value==""){
		document.getElementById('nuphone').style.backgroundColor='yellow';
		document.getElementById("status_text").innerHTML="Please Enter your phone number";
		document.getElementById('nuphone').focus();
		flashStatus();
	} else {
		var toDo="createUserAccount";
		posstr="toDo=" + toDo;
		posstr+="&email=" + document.getElementById('nuemail').value + "&fname=" + document.getElementById('nufname').value + "&lname=" + document.getElementById('nulname').value;
		posstr+="&address1=" + document.getElementById('nuaddress1').value + "&address2=" + document.getElementById('nuaddress2').value + "&city=" + document.getElementById('nucity').value;
		posstr+="&state=" + document.getElementById('nustate').value + "&zip=" + document.getElementById('nuzip').value + "&phone=" + document.getElementById('nuphone').value;
		posstr+="&password=" + document.getElementById('nupassword').value;
		optin='f';
		if(document.getElementById('nuoptin').checked) optin='t';
		posstr+="&optin=" + optin;
		makePOSTRequest("https://" + webSite + "/backend/user_be.php", posstr, toDo, userAC);
		
	}
}

function startUpdateAccountInfo(nuform){
	if(document.getElementById('edpassword').value!="" && (document.getElementById('edpassword').value != document.getElementById('edpasswordv').value)){
		document.getElementById('edpassword').style.backgroundColor='yellow';
		document.getElementById('edpasswordv').style.backgroundColor='yellow';
		document.getElementById("status_text").innerHTML="The values for your new password do not match";
		document.getElementById('edpassword').focus();
	} else if(document.getElementById('edfname').value==""){
		document.getElementById('edfname').style.backgroundColor='yellow';
		document.getElementById("status_text").innerHTML="Please Enter your first name";
		document.getElementById('edfname').focus();
	} else if(document.getElementById('edlname').value==""){
		document.getElementById('edlname').style.backgroundColor='yellow';
		document.getElementById("status_text").innerHTML="Please Enter your last name";
		document.getElementById('edlname').focus();
	} else if(document.getElementById('edaddress1').value==""){
		document.getElementById('edaddress1').style.backgroundColor='yellow';
		document.getElementById("status_text").innerHTML="Please Enter your address";
		document.getElementById('edaddress1').focus();
	} else if(document.getElementById('edcity').value==""){
		document.getElementById('edcity').style.backgroundColor='yellow';
		document.getElementById("status_text").innerHTML="Please Enter your city";
		document.getElementById('edcity').focus();
	} else if(document.getElementById('edstate').value==""){
		document.getElementById('edstate').style.backgroundColor='yellow';
		document.getElementById("status_text").innerHTML="Please Enter your state";
		document.getElementById('edstate').focus();
	} else if(document.getElementById('edzip').value==""){
		document.getElementById('edzip').style.backgroundColor='yellow';
		document.getElementById("status_text").innerHTML="Please Enter your Zip code";
		document.getElementById('edzip').focus();
	} else if(document.getElementById('edphone').value==""){
		document.getElementById('edphone').style.backgroundColor='yellow';
		document.getElementById("status_text").innerHTML="Please Enter your phone number";
		document.getElementById('edphone').focus();
	} else {
		var toDo="updateAccountInfo";
		posstr="toDo=" + toDo;
		posstr+="&fname=" + document.getElementById('edfname').value + "&lname=" + document.getElementById('edlname').value;
		posstr+="&address1=" + document.getElementById('edaddress1').value + "&address2=" + document.getElementById('edaddress2').value + "&city=" + document.getElementById('edcity').value;
		posstr+="&state=" + document.getElementById('edstate').value + "&zip=" + document.getElementById('edzip').value + "&phone=" + document.getElementById('edphone').value;
		posstr+="&password=" + document.getElementById('edpassword').value;
		optin='f';
		if(document.getElementById('edoptin').checked) optin='t';
		posstr+="&optin=" + optin;
		makePOSTRequest("https://" + webSite + "/backend/user_be.php", posstr, toDo, userAC);
	}
}

function startReSendActivationMail(){
	var toDo="reSendActivationMail";
	posstr="toDo=" + toDo;
	makePOSTRequest("https://" + webSite + "/backend/user_be.php", posstr, toDo, userAC);
}

function feedbackForm() {
	var fb="<table><tr><td>If you have questions, concerns or suggestions please enter them below. ";
	fb+="We are always interested in hearing feedback from everyone who visits our site.<br>";
	fb+="Your Message:";
	fb+="<tr><td><textarea id='feedback' rows='15' cols='50'></textarea>";
	fb+="<tr><td><input type=button class='btn' name='Submit Feedback' value='Submit Feedback' onclick='startSendFeedback();'>";
	document.getElementById("customer_message").innerHTML=fb;
	slidedown("customer_body");
}

function startSendFeedback() {
	var toDo="sendFeedback";
	posstr="toDo=" + toDo;
	posstr+="&feedback=" + escape(document.getElementById("feedback").value);
	makePOSTRequest("https://" + webSite + "/backend/user_be.php", posstr, toDo, userAC);
}

function startShowShippingInfo() {
	var toDo="showShippingInfo";
	posstr="toDo=" + toDo;
	makePOSTRequest("https://" + webSite + "/backend/user_be.php", posstr, toDo, userAC);
}

function startSetShippingToBilling() {
	var toDo="setShippingToBilling";
	posstr="toDo=" + toDo;
	makePOSTRequest("https://" + webSite + "/backend/user_be.php", posstr, toDo, userAC);
}

function startSaveShippingAddress() {
	if(document.getElementById('edsfname').value==""){
		document.getElementById('edsfname').style.backgroundColor='yellow';
		document.getElementById("status_text").innerHTML="Please Enter the recipient's first name.";
		document.getElementById('edsfname').focus();
	} else if(document.getElementById('edslname').value==""){
		document.getElementById('edslname').style.backgroundColor='yellow';
		document.getElementById("status_text").innerHTML="Please Enter the recipient's last name.";
		document.getElementById('edslname').focus();
	} else if(document.getElementById('edsaddress1').value==""){
		document.getElementById('edsaddress1').style.backgroundColor='yellow';
		document.getElementById("status_text").innerHTML="Please Enter the recipient's street address.";
		document.getElementById('edsaddress1').focus();
	} else if(document.getElementById('edscity').value==""){
		document.getElementById('edscity').style.backgroundColor='yellow';
		document.getElementById("status_text").innerHTML="Please Enter the recipient's city.";
		document.getElementById('edscity').focus();
	} else if(document.getElementById('edsstate').value==""){
		document.getElementById('edsstate').style.backgroundColor='yellow';
		document.getElementById("status_text").innerHTML="Please Enter the recipient's state.";
		document.getElementById('edsstate').focus();
	} else if(document.getElementById('edszip').value==""){
		document.getElementById('edszip').style.backgroundColor='yellow';
		document.getElementById("status_text").innerHTML="Please Enter the recipient's zip code.";
		document.getElementById('edszip').focus();
	} else {
		var toDo="saveShippingAddress";
		posstr="toDo=" + toDo;
		posstr+="&fname=" + document.getElementById('edsfname').value + "&lname=" + document.getElementById('edslname').value;
		posstr+="&address1=" + document.getElementById('edsaddress1').value + "&address2=" + document.getElementById('edsaddress2').value + "&city=" + document.getElementById('edscity').value;
		posstr+="&state=" + document.getElementById('edsstate').value + "&zip=" + document.getElementById('edszip').value;
		makePOSTRequest("https://" + webSite + "/backend/user_be.php", posstr, toDo, userAC);
	}
}

function showCVVInfo() {
	var cvvi="<p><b>What is a CVV Number?</b></p>";
	cvvi+="<p>CARD VERIFICATION VALUE CODE (CVV)</p>";
	cvvi+="<p>CVV is an authentication procedure established by credit card ";
	cvvi+="companies to further efforts towards reducing fraud for internet transactions.";
	cvvi+="It consists of requiring a card holder to enter the CVV number in at transaction ";
	cvvi+="time to verify that the card is on hand. The CVV code is a security feature for ";
	cvvi+="\"card not present\" transactions (e.g., Internet transactions), and appears ";
	cvvi+="on most major credit and debit cards. This new feature is a three- ";
	cvvi+="or four-digit code which provides a cryptographic check of the information embossed ";
	cvvi+="on the card. Therefore, the CVV code is not part of the card number itself.</p>";
	cvvi+="<p>The CVV code helps ascertain that the customer placing the order actually possesses ";
	cvvi+="the credit/debit card and that the card account is legitimate. Each credit card ";
	cvvi+="company has its own name for the CVV code, but it functions the same for all major ";
	cvvi+="card types. (VISA refers to the code as CVV2, MasterCard calls it CVC2, and American ";
	cvvi+="Express calls it CID.)</p>";
	document.getElementById('customer_message').innerHTML=cvvi;
}

function showCVVLoc() {
	var cvvl="<p><b>Where is the CVV Number?</b></p>";
	cvvl+="<img src='images/cardid_v2.gif' /> <img src='images/cvc.jpe' /> <br>";
	cvvl+="<p>This number is printed on your MasterCard &amp; Visa cards in the ";
	cvvl+="signature area of the back of the card. (it is the last 3 digits AFTER ";
	cvvl+="the credit card number in the signature area of the card).</p>";
	cvvl+="<img src='images/amexco.gif' />";
	cvvl+="<p>You can find your four-digit card verification number on the front ";
	cvvl+="of your American Express credit card above the credit card number on ";
	cvvl+="either the right or the left side of your credit card.</p>";
	cvvl+="<p>Please note that not all theaters accept American Express credit cards.</p>";
	document.getElementById('customer_message').innerHTML=cvvl;
}

function csInvalid(){
	var csi="<p><b>What is a Credit Card Checksum?</b></p>";
	csi+="<p>Credit card numbers are arranged in such a way that by applying a mathematical formula ";
	csi+="to the entire card number, it can be quickly determined if the number is \"valid\".</p>";
	csi+="<p>In this context valid simply means that the calculation performed on the number returns ";
	csi+="the expected result.  It doesn't indicate that a valid number is actually associated ";
	csi+="to a proper credit account or that an invalid number (though highly unlikely) is not.</p>";
	csi+="If you are seeing an invalid message for the number you entered, please double check it.  ";
	csi+="The system will still attempt to make the charge on the card, however you are likely to receive ";
	csi+="a message back similar to \"invalid field format\".  If this is the case, please re-check the ";
	csi+="number entered or use a different card.</p>";
	document.getElementById('customer_message').innerHTML=csi;
}
