<!--#include file="includes/dbfunctions.asp"-->
<!--#include file="includes/datefunctions.asp"-->
<!--#include file="includes/resifunctions.asp"-->
<%
If Session("Transacted") = "" Or isNull(Session("Transacted")) = True Then
 	Session("Transacted") = "verifytx.asp"
 	
Dim SQLCheckItin, Contact_ID, sqlShipTo
Set RSCheckItin = Server.CreateObject("ADODB.Recordset")
SQLCheckItin = "Select Contact_ID From Itinerary Where Itinerary_ID = '" & Session("Itinerary_ID") & "'"
RSCheckItin.Open SQLCheckItin, Conn
Contact_ID = RSCheckItin("Contact_ID")

If  (Contact_ID = Null Or Contact_ID = 0 Or Contact_ID = "0") And Not (IsNull(Session("UserID")) Or Session("UserID") = 0 Or Session("UserID") = "0") Then
SQLCheckItin = "Update Itinerary Set Contact_ID = '" & Session("UserID") & "' Where Itinerary_ID = '" & Session("Itinerary_ID") & "'"
Conn.Execute(SQLCheckItin)
ElseIf (Contact_ID = Null Or Contact_ID = 0 Or Contact_ID = "0") And (IsNull(Session("UserID")) Or Session("UserID") = 0 Or Session("UserID") = "0") Then
Dim SQLUser, RSUser
SQLUser = "[Avante].[dbo].[Add_Web_User] @Name_First = '" & Request.Form("x_first_name") & "', @Name_Last = '" & Request.Form("x_last_name") & "', @Gender = Null, @Age = Null, "
SQLUser = SQLUser &	"@Address_1 = '" & Request.Form("x_address") & "', @City = '" & Request.Form("x_city") & "', @State = '" & Request.Form("x_state") & "', @Country = '" & Request.Form("Country2") & "', "
SQLUser = SQLUser &	"@Phone_HM_AreaCode = '" & Request.Form("PhHomeArea2") & "', @Phone_HM = '" & Request.Form("PhHome2") & "', "
SQLUser = SQLUser &	"@EMail_Home = '" & Request.Form("x_email") & "', @User_Name = '" & Session.SessionID & "', @User_PWD = '" & Session.SessionID & "'"
Set RSUser = Conn.Execute(SQLUser)
Session("UserID") = RSUser("User_ID")
SQLCheckItin = "Update Itinerary Set Contact_ID = '" & Session("UserID") & "' Where Itinerary_ID = '" & Session("Itinerary_ID") & "'"
Conn.Execute(SQLCheckItin)
SQLCheckItin = "Update Itinerary_Detail_Vars Set Special_Request = '" & Request("Special_Request") & "' Where Itinerary_ID = '" & Session("Itinerary_ID") & "'"
Conn.Execute(SQLCheckItin)
End If
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000" onload="if (nosub.mit.value='False') { nosub.mit.value='True'; authnet.submit(); }">
<form name="nosub" id="nosub">
<input type="hidden" name="mit" id="mit" value="False">
</form>
<TABLE WIDTH=100% ALIGN=center BORDER=0 CELLSPACING=1 CELLPADDING=1>
<TR>
<TD align=center>Please Wait While We Verify Your Transaction.</TD>
</TR>
</TABLE>
<form name="authnet" method="post" action="https://secure.authorize.net/gateway/transact.dll">
<input type="hidden" name="x_Company" value="<%=Request.Form("x_company")%>">
<input type="hidden" name="x_first_name" value="<%=Request.Form("x_first_name")%>">
<input type="hidden" name="x_last_name" value="<%=Request.Form("x_last_name")%>">
<input type="hidden" name="x_address" value="<%=Request.Form("x_address")%>">
<input type="hidden" name="x_city" value="<%=Request.Form("x_city")%>">
<input type="hidden" name="x_state" value="<%=Request.Form("x_state")%>">
<input type="hidden" name="x_zip" value="<%=Request.Form("x_zip")%>">
<input type="hidden" name="x_email" value="<%=Request.Form("x_email")%>">
<input type="hidden" name="x_Amount" value="<%=FormatNumber(CartTotalwTax(Session("Itinerary_ID")),2)%>">
<input type="hidden" name="x_Card_Num" value="<%=Request.Form("x_Card_Num")%>">
<input type="hidden" name="x_Exp_Date" value="<%=Request.Form("x_Exp_Date")%>">
<input type="hidden" name="x_Version" value="3.0">
<input type="hidden" name="x_ADC_Relay_Response" value="TRUE">
<input type="hidden" name="x_ADC_URL" value="http://tpr.emagineering.com/authnet.asp" size="60">
<input type="hidden" name="x_Type" value="AUTH_ONLY">
<input type="hidden" name="x_Login" value="cdittrich">
<input type="hidden" name="x_Cust_ID" value="<%=Session("UserID")%>">
<input type="hidden" name="x_Description" value="Tropical Palms transaction">
<input type="hidden" name="Contact_ID" value="<%=Session("UserID")%>">
<input type="hidden" name="CSR_ID" value="<%=Session("CSR_ID")%>">
<input type="hidden" name="Itinerary_ID" value="<%=Session("Itinerary_ID")%>">
<input type="hidden" name="Merchant_ID" value="007">
<input type="hidden" name="Customer_IP" value="<% Response.Write(Request.ServerVariables("REMOTE_ADDR")) %>">
<input type="hidden" name="x_Customer_IP" value="<% Response.Write(Request.ServerVariables("REMOTE_ADDR")) %>">
<input type="hidden" name="Payment_Type" value="<%=GetCardType(Request.Form("x_Card_Num"))%>">
<input type="hidden" name="CC_Num" value="<%=Request.Form("x_Card_Num")%>">
</form>
</body>
</html>
<%
End If
%>