<% 
	Option explicit
	Response.Buffer=True  
	Const vDebug = 0
%>
<!--#include file="SFLib/incDesign.asp"-->
<!--#include file="SFLib/db.conn.open.asp"-->
<!--#include file="SFLib/adovbs.inc"-->
<!--#include file ="SFLib/incLogin.asp"-->
<!--#include file ="SFLib/incGeneral.asp"-->
<!--#include file="SFLib/mail.asp"-->
<!--#include file="error_trap.asp"-->
<%
'@BEGINVERSIONINFO

'@APPVERSION: 5.10.10

'@FILENAME: login.asp

'@FILEVERSION: 1.0.1

'@VERSIONDATETIME: 2/21/01

'@DESCRIPTION: Handles customer login

'@STARTCOPYRIGHT
'The contents of this file is protected under the United States
'copyright laws and is confidential and proprietary to
'LaGarde, Incorporated.  Its use or disclosure in whole or in part without the
'expressed written permission of LaGarde, Incorporated is expressly prohibited.
'
'(c) Copyright 2000, 2001 by LaGarde, Incorporated.  All rights reserved.
'@ENDCOPYRIGHT

'@ENDVERSIONINFO
%>
<%
Dim sFirstTime, sReturn, sFormActionType, sThanks, iCustID, sOutput, sChangeUser, sCustomerForm, sSubmitAction
Dim iCookieID, sForgotPwd, sSendEmail, iAuthenticate, bSvdCartCustomer, bEmailAddress, sNewAccount, sChangeCart, sChange, sDirection, sSvdCartCustEmail, sPaymentMethod
Dim sLoggedIn, sEmail, sPassword, sLogin

'------------------------------------------------------------
' For savecart
'------------------------------------------------------------

' Check which button has been depressed
sFirstTime	  	= Trim(Request.Form("SignUp.x"))
sLoggedIn	  	= Trim(Request.Cookies("sfOrder")("SessionID"))
sReturn	  	= Trim(Request.Form("Return.x"))
sChangeUser 	= Trim(Request.Form("ChangeUser.x"))
sForgotPwd	  	= Trim(Request.QueryString("FPWD")) ' Request.Form("FPWD.x")
sSendEmail	  	= Trim(Request.Form("SendEmail.x"))
sNewAccount  	= Trim(Request.QueryString("New")) '.Form("New.x")
If sNewAccount = "" Then
	sNewAccount = Trim(Request.QueryString("Type"))
End If
sChangeCart = Trim(Request.Form("ChangeCart.x"))
sChange		= Trim(Request.Form("Change.x"))
sLogin = Request.Cookies("sfThanks")("PreviousAction") <> ""
iCustID = Request.Cookies("sfCustomer")("custID")

 ' Get payment method and write to a cookie
If Trim(Request.Form("PaymentMethod")) <> "" Then
    sPaymentMethod = Trim(Request.Form("paymentmethod"))
    Response.Cookies("sfOrder").Expires = Date() + 1
    Response.Cookies("sfOrder")("PaymentMethod") = sPaymentMethod    
End If


' For people already logged in 
If (sLoggedIn = Session("SessionID") AND iCustID <> "" And sChangeCart = "" And sChange = "" AND sForgotPwd = "") Then
	
	' Possibility - get a new account 
	If sNewAccount <> "" Then	   
	   sFormActionType = "NewAccount"
	
	' Through new account, get them a new account   
	ElseIf sFirstTime <> "" Then	
		sFormActionType = "FirstTime"
	
	' If there is email and password, authenticate
	ElseIf Trim(Request.Form("Email")) <> "" And Trim(Request.Form("Passwd")) <> "" Then
		sEmail	  = Trim(Request.Form("Email"))
		sPassword = Trim(Request.Form("Passwd"))
	
		iAuthenticate = customerAuth(sEmail,sPassword,"loose")
							
		If iAuthenticate <> "" AND iAuthenticate > 0 Then
				' Check if there is a custID
				If Trim(Request.Cookies("sfCustomer")("custID")) = "" Then
					sFormActionType = "Returning"	
				Else	
					If Request.Cookies("sfCustomer")("custID") <> iAuthenticate Then
					   Response.Cookies("sfCustomer")("custID") = iAuthenticate
					   Response.Cookies("sfCustomer").Expires = Date() + 730
					End If		
					' Redirect to proc_order
					  Response.Redirect(C_SecurePath)
				' End custId if		
				End If 		  
		  Else
				sFormActionType = "FirstTime"
		  ' End Authenticate If
		  End If		 
		   
		Else
			If Request.Cookies("sfCustomer")("custID") <> "" Then
				 Response.Redirect(C_SecurePath)
			Else
				sFormActionType	= "Returning"	
			End If		 	
				
		' End auth if		
		End If			
	
Else 
	If sFirstTime <> "" Then
		sFormActionType = "FirstTime"
	ElseIf sReturn <> "" Then
		sFormActionType = "Returning"	
	ElseIf sForgotPwd <> "" Then
		sFormActionType = "ForgotPwd"
	ElseIf sSendEmail <> "" Then
		sFormActionType = "SendEmail"	
	ElseIf sNewAccount <> "" Then
		sFormActionType = "NewAccount"	
	ElseIf sChangeCart <> "" Then
		sFormActionType = "ChangeCart"	
	ElseIf sChange <> "" Then
		sFormActionType = "Change"	
	End If
End If


'-----------------------------------------------------------
' Cases for saved cart
'-----------------------------------------------------------	
	
	If vDebug = 1 Then Response.Write "<br>FormActionType: " & sFormActionType	
		
	' First time at login, no actions	
	If sFormActionType = "" And Request.Cookies("sfCustomer")("custID") = "" Then		
		sOutput = "General"
		
	ElseIf sFormActionType = "" And Request.Cookies("sfCustomer")("custID") <> "" Then		
		sOutput = "HasID"
 
	ElseIf sFormActionType = "NewAccount" Then		
		sOutput = "NewAccount"
	
	' Forgot password
	ElseIf sFormActionType = "ForgotPwd" Then		
		sOutput = "Email"		
	
	ElseIf sFormActionType = "ChangeCart" Then
		sOutput = "ChangeCart"
	
	ElseIf sFormActionType = "Change" Then
		sEmail = Trim(Request.Form("Email"))
		sPassword = Trim(Request.Form("Passwd"))

		' Authenticate
		iAuthenticate = customerAuth(sEmail,sPassword,"loose")
		
		If iAuthenticate <> "" AND iAuthenticate > 0 Then
			' Write New Cookie
			Response.Cookies("sfCustomer")("custID") = iAuthenticate
			Response.Cookies("sfCustomer").Expires = Date() + 730		
			
			' Associate sessionID with cookie
			Response.Cookies("sfOrder")("SessionID") = Session("SessionID")
			Response.Cookies("sfOrder").Expires = Date() + 1
			
			' Redirect to Svd Cart
			Response.Redirect("savecart.asp")
		Else 
			sOutput = "FailedAuthChange"
		End If		
	
	' Send Mail
	ElseIf sFormActionType = "SendEmail" Then		
		sEmail = Request.Form("Email")
		' Send email with password, returns a success or failure boolean
		bEmailAddress = SendPassword(sEmail)
		
		If bEmailAddress = 1 Then
			sOutPut = "SentEmail"
		Else
			sOutPut = "FailedEmail"
		End If		
		
	' First time login		
	ElseIf sFormActionType = "FirstTime" Then	
		 sEmail = Request.Form("Email")
		 sPassword = Request.Form("Passwd")
		
		' Check if email and password correspond to any customer on record	
			If customerAuth(sEmail,sPassword,"loose") > 0 Then
					
					' Get custID
					iCustID = customerAuth(sEmail,sPassword,"loose")	
				
					' Write a new cookie with found custID
					Response.Cookies("sfCustomer")("custID") = iCustID
					Response.Cookies("sfCustomer").Expires = Date() + 730	
				
					' Associate sessionID with cookie
					Response.Cookies("sfOrder")("SessionID") = Session("SessionID")
					Response.Cookies("sfOrder").Expires = Date() + 1				
			
						' For Customers from SaveCart, special case
						If sLogin <> "" Then
				
							' Update Saved Table with iCustID in Table
							Call UpdateCustID(iCustID)							
									If Request.Cookies("sfThanks")("PreviousAction") = "SaveCart" Then
										' Redirect to thanks page
										Response.Cookies("sfThanks").Expires = NOW()
										Response.Redirect "addproduct.asp?logedin=1" 
							
									ElseIf Request.Cookies("sfThanks")("PreviousAction") = "FromShopCart" Then
										' Delete from temp										
										Call setDeleteOrder("odrdttmp",Request.Cookies("sfThanks")("DeleteTmpOrderID"))
										Response.Cookies("sfThanks")("DeleteTmpOrderID") = ""
										Response.Cookies("sfThanks").Expires = NOW()										
										Response.Redirect "order.asp" 					
									End If	
							
						' End SaveCart New customers If
						End If 	

			ElseIf customerAuth(sEmail,sPassword,"loosest") > 0 Then			
				' Email match. Prompt for new email				  
				sOutput = "EmailMatch"
			
			Else		
				
				' Write to customer table, write a cookie, and get back the id							
				iCustID = getCustomerID(sEmail,sPassword)	
			   If vDebug = 1 Then Response.write "CustID:" & iCustID
			   
 						' Associate sessionID with cookie
						Response.Cookies("sfOrder")("SessionID") = Session("SessionID")
						Response.Cookies("sfOrder").Expires = Date() + 1
	
					    ' For Customers from SaveCart, special case
						If Request.Cookies("sfThanks")("PreviousAction") <> "" Then
				
							' Update Saved Table with iCustID in Table
							Call UpdateCustID(iCustID)							
							
							If Request.Cookies("sfThanks")("PreviousAction") = "SaveCart" Then							
								Response.Cookies("sfThanks").Expires = NOW()
								' Redirect to thanks page
								Response.Redirect "addproduct.asp?logedin=1" 
							ElseIf Request.Cookies("sfThanks")("PreviousAction") = "FromShopCart" Then
								' Delete from temp
								Call setDeleteOrder("odrdttmp",Request.Cookies("sfThanks")("DeleteTmpOrderID"))
								Response.Cookies("sfThanks")("DeleteTmpOrderID") = ""
								Response.Cookies("sfThanks").Expires = NOW()
								Response.Redirect "order.asp"								
							End If								
							
						' End SaveCart New customers If
						End If 	
			
				    ' Assume new customer checkout for other cases
					' Redirect to form to enter customer Info  
					Response.Redirect("order.asp")
					
		' End existing cookie if			
		  End If			

	ElseIf sFormActionType = "Returning" Then	
		sEmail = Trim(Request.Form("Email"))
		sPassword = Trim(Request.Form("Passwd"))
		
		' Authenticate customer
		iAuthenticate = customerAuth(sEmail,sPassword,"loose")
			
		If iAuthenticate <> "" AND iAuthenticate > 0 Then
		
			' Associate sessionID with cookie
			Response.Cookies("sfOrder").Expires = Date() + 1
			Response.Cookies("sfOrder")("SessionID") = Session("SessionID")				
			
				' Check if customer still has a cookie				
				iCustID = Request.Cookies("sfCustomer")("custID")				
			
				' Write to cookie if none exists for custID	
				If iCustID <> iAuthenticate Or iCustID = "" Then
					Response.Cookies("sfCustomer")("custID") = iAuthenticate					
					Response.Cookies("sfCustomer").Expires = Date() + 730
					iCustID = iAuthenticate
				End If			
				
						' For Customers from SaveCart, special case
						If Request.Cookies("sfThanks")("PreviousAction") <> "" Then
										
							' Update Saved Table with iCustID in Table
							Call UpdateCustID(iCustID)
		
							If Request.Cookies("sfThanks")("PreviousAction") = "SaveCart" Then
								' Redirect to thanks page
								Response.Cookies("sfThanks").Expires = NOW()
								Response.Redirect "addproduct.asp?logedin=1" 
							ElseIf Request.Cookies("sfThanks")("PreviousAction") = "FromShopCart" Then
								' Delete from temp
								Call setDeleteOrder("odrdttmp",Request.Cookies("sfThanks")("DeleteTmpOrderID"))
								Response.Cookies("sfThanks")("DeleteTmpOrderID") = ""
								Response.Cookies("sfThanks").Expires = NOW()
								Response.Redirect "order.asp"								
							End If	
							
						' End SaveCart New customers If
						End If 
			
				' Check if it is a savedcart customer
				bSvdCartCustomer = getSvdCartCustomer(iCustID,"boolean")
			
				If bSvdCartCustomer = 1 Then
					If vDebug = 1 Then Response.Write "<Br> Saved Cart Customer " & iCustID
					Response.Redirect("order.asp")					
				Else
					' Redirect to proc_order
					Response.Redirect("savecart.asp")
				End If 
				
		Else
			' Assume new person
			' Write to customer table, write a cookie, and get back the id							
				iCustID = getCustomerID(sEmail,sPassword)	
			   If vDebug = 1 Then Response.write "CustID:" & iCustID
			   
 						' Associate sessionID with cookie
						Response.Cookies("sfOrder")("SessionID") = Session("SessionID")
						Response.Cookies("sfOrder").Expires = Date() + 1
	
					    ' For Customers from SaveCart, special case
						If Request.Cookies("sfThanks")("PreviousAction") <> "" Then
				
							' Update Saved Table with iCustID in Table
							Call UpdateCustID(iCustID)							
							
							If Request.Cookies("sfThanks")("PreviousAction") = "SaveCart" Then							
								Response.Cookies("sfThanks").Expires = NOW()
								' Redirect to thanks page
								Response.Redirect "addproduct.asp?logedin=1" 
							ElseIf Request.Cookies("sfThanks")("PreviousAction") = "FromShopCart" Then
								' Delete from temp
								Call setDeleteOrder("odrdttmp",Request.Cookies("sfThanks")("DeleteTmpOrderID"))
								Response.Cookies("sfThanks")("DeleteTmpOrderID") = ""
								Response.Cookies("sfThanks").Expires = NOW()
								Response.Redirect "order.asp"								
							End If								
							
						' End SaveCart New customers If
						End If 	
						
					' If all else fails, just go to order.asp	
					Response.Redirect("order.asp")  
		End If	

	' End FormAction If	
	End If	
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</script>
<title>StoreFront Web Store Login Page</title>
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<script language="javascript" src="SFLib/sfCheckErrors.js"></script>
</head>

<body bgcolor="<%= C_BGCOLOR %>" background="<%= C_BKGRND %>" link="<%= C_LINK %>" vlink="<%= C_VLINK %>" alink="<%= C_ALINK %>">

<table border="0" cellpadding="1" cellspacing="0" bgcolor="<%= C_BORDERCOLOR1 %>" width="<%= C_WIDTH %>" align="center">
  <tr>
    <td>
      <table width="100%" border="0" cellspacing="1" cellpadding="3">
		<%If C_BNRBKGRND = "" Then%>
            <td align="middle" background="<%= C_BKGRND1 %>" bgcolor="<%= C_BGCOLOR1 %>"><b><font face="<%= C_FONTFACE1 %>" color="<%= C_FONTCOLOR1 %>" SIZE="<%= C_FONTSIZE1 %>"><%= C_STORENAME %></font></b></td>
		<%Else%>
			<td align="middle" bgcolor="<%= C_BNRBGCOLOR %>"><img src="<%= C_BNRBKGRND %>" border="0"></td>
		<%End If%>
       
        <%
    '-----------------------------------------------------------
    ' Begin OutPut Block
    '-----------------------------------------------------------
    %>    
     
        <tr>
          <td bgcolor="<%= C_BGCOLOR2 %>" align="middle"><b><font face="<%= C_FONTFACE2 %>" color="<%= C_FONTCOLOR2 %>" size="<%= C_FONTSIZE2 %>">
  	        <%If sOutPut = "General" Then %>  
			Please Login
	        <%ElseIf sOutPut = "NewAccount" Then %>
			New Account 		
	        <%ElseIf sOutPut = "EmailMatch" Then %>	
			Matching Email Found			
	        <%ElseIf sOutPut = "HasID" Then %>  
			Returning Customer Login		
	        <%ElseIf sOutPut = "FailedAuth" Then %>	
			Failed Authentication
	        <%ElseIf sOutPut = "FailedAuthChange" Then %>	
			Change Cart Failed Authentication			
	        <%ElseIf sOutPut = "Email" Then %>	
			Send Password to Email Address
	        <%ElseIf sOutPut = "SentEmail" Then %>
			Email Sent to Address		
	        <%ElseIf sOutPut = "FailedEmail" Then %>
			No Email Found On Record 				
	        <%ElseIf sOutPut = "ChangeCart" Then %>	
			Change Saved Cart	
	        <%Else%>
	        Login with Email and Password
	        <%
	End If 
	
	If sOutPut = "FailedAuth" Then
		sSubmitAction = "" 
	Else
		sSubmitAction = "return sfCheck(this)"
	End If 
	%>	
	
		    </font></b>
		  </td>
		</tr>
		
		<% If sOutPut <> "Email" AND sOutPut <> "SentEmail"  AND sOutPut <> "FailedEmail" Then %>
		<tr>
		  <td bgcolor="<%= C_BGCOLOR3 %>"><font face="<%= C_FONTFACE3 %>" color="<%= C_FONTCOLOR3 %>" size="<%= C_FONTSIZE3 %>">
		    <%If sOutPut = "NewAccount" Then %>  
			 Your Saved Order is your personal, private collection of items that you are thinking about purchasing. Put as many items in your Saved Order as you want. When you decide to buy them, simply add them to your Current Order.<P>To access an existing Saved Order, log in with the e-mail and password you chose when you first signed in. If you've forgotten your password, click on
            Forgot Password for help. To create a new Saved Order, select New Account. 
            <% Elseif sOutPut = "General" Then %>
            Your Saved Order is your personal, private collection of items that you are thinking about purchasing. Put as many items in your Saved Order as you want. When you decide to buy them, simply add them to your Current Order.
           	 To create a new Saved Order, select New Account.            
		    <%ElseIf sOutPut = "HasID" Then %>  
            Please login with the e-mail address and password you chose when you first signed in. If you've forgotten your password, click on
            Forgot Password for help
		    <%ElseIf sOutPut = "FailedAuth" Then %>		
			We're sorry, but your combination of e-mail address and password is not recognized. If you've forgotten your password, you can click on
            Forgot Password and an e-mail will be sent to the address on record. Alternatively, you can sign in as a new user.	
		    <%ElseIf sOutPut = "FailedAuthChange" Then %>		
			We're sorry, but your combination of e-mail address and password is not recognized. Please retype them.
		    <%ElseIf sOutPut = "Email" Then %>
			If you're an existing customer (you've made a purchase or saved something to your order previously), then we can retrieve your password if you type in the e-mail address on record.
		    <%ElseIf sOutPut = "ChangeCart" Then %>	
			Please enter the e-mail address and password corresponding to an existing saved
            order. Your current saved order can be accessed through the change
            order option on the saved order page.
		    <%ElseIf sOutPut = "EmailMatch" Then %>	
			A matching e-mail address has been found. Please either create a new account, reauthenticate yourself, or click on
            Forgot Password for more help
		    <%Else%>
		    Please choose a login with an e-mail account and a password. This will be used for future retrieval of billing and shipping records.
		    <%End If %>	
		    </font>
		    </td>
		  </tr>
		  <tr>
		    <td bgcolor="<%= C_BGCOLOR4 %>" align="middle"><br>
		   
			  <%If (sOutput <> "FailedAuth" and sOutPut <> "HasID" and sOutPut <> "ChangeCart" and sOutPut <> "FailedAuthChange") Then
			
				If Request.Cookies("sfCustomer")("custID") = "" Or sOutPut = "NewAccount" Or sOutput = "EmailMatch" Or sOutPut <> "SameUser" Then %>		   
				<form method="post" action="login.asp" name="login" onSubmit="<%=sSubmitAction%>">
		          <table border="0" bgcolor="#000000" width="75%">
		            <tr>
		              <td width="100%" align="middle" bgcolor="<%= C_BGCOLOR3 %>"><b><font face="<%= C_FONTFACE3 %>" color="<%= C_FONTCOLOR3 %>" size="<%= C_FONTSIZE3 %>">
		       	       
			            <% If sOutPut = "NewAccount" or sOutput = "EmailMatch" Then %>
					New Account 		
		                <% Else  %>
					First Time Here?      
		                <% End If %>
		        
		                </font></b>
		              </td>
		            </tr>
		            <tr>
		              <td width="100%" align="middle" bgcolor="<%= C_BGCOLOR4 %>">
		                <table border="0" width="100%">
		                  <tr>
		                    <td width="50%" align="right"><b><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">E-Mail Address:</font></b></td>
		                    <td width="50%"><input type="text" name="Email" title="Email Address" style="<%= C_FORMDESIGN %>" maxlength="100">
		                    </tr>
		                    <tr>
		                      <td width="50%" align="right"><b><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Password:</font></b></td>
		                      <td width="50%"><input type="Password" name="Passwd" title="Password" style="<%= C_FORMDESIGN %>" maxlength="10"></td>
		                    </tr>
		                    <tr>
		                      <td width="100%" align="middle" colspan="2">
					            <input type="image" src="<%= C_BTN12 %>" width="108" height="21" border="0" name="SignUp" onsubmit="javascript:CheckLoginInput(this)">   
		                      </td>
		                    </tr>
		                  </table>
		                </td>
		              </tr>
		            </table>
		          </form>
		          <br>
		    
					<%If sOutput = "EmailMatch" Then %>
						<form method="post" action="login.asp" name="login" onSubmit="<%= sSubmitAction%>">
					       <table border="0" bgcolor="#000000" width="75%">
					        <tr>
					          <td width="100%" align="middle" bgcolor="<%= C_BGCOLOR3 %>"><b><font face="<%= C_FONTFACE3 %>" color="<%= C_FONTCOLOR3 %>" size="<%= C_FONTSIZE3 %>">Existing Member Login</font></b></td>
					        </tr>
					        <tr>
					          <td width="100%" align="middle" bgcolor="<%= C_BGCOLOR4 %>">
					            <table border="0" width="100%">
						           <tr>
						            <td width="50%" align="right"><b><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>"> E-Mail:</font></b></td>
						            <td width="50%"><input name="Email" type="text" title="Email Address" style="<%= C_FORMDESIGN %>" maxlength="100"></td>
						            </tr>
						            <tr>
						              <td width="50%" align="right"><b><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Password:</font></b></td>
						              <td width="50%"><input type="password" name="Passwd" title="Password" style="<%= C_FORMDESIGN %>" maxlength="10"></td>
						            </tr>
						            <tr>
						              <td width="100%" align="middle" colspan="2">
									    <input type="image" src="<%= C_BTN16 %>" name="Return" border="0">
						              </td>
						            </tr>
						          </table>
						      </td>
						      </tr>
						      </table>
						      <p>
						      <a href="login.asp?FPWD=True"><img src="<%= C_BTN17 %>" border="0"></a>
						      <!--<input type="image" border="0" src="<%= C_BTN17 %>" name="FPWD">-->
						      </form>
						  <%End If
						
						' End cookies check if
						End If%>
		    
		                  <%Else  %>
		                  <form method="post" action="login.asp" name="login" onSubmit="<%= sSubmitAction%>">
		                    <table border="0" bgcolor="#000000" width="75%">
		                      <tr>
		                        <td width="100%" align="middle" bgcolor="<%= C_BGCOLOR3 %>"><b><font face="<%= C_FONTFACE3 %>" color="<%= C_FONTCOLOR3 %>" size="<%= C_FONTSIZE3 %>">
		                          <%If sOutPut = "ChangeCart" Then %>	
					Existing Cart Log In
				                  <%Else%>		
					Existing Member
		                          <%End If%>
		                          </font></b>
		                        </td>
		                      </tr>
		                      <tr>
		                        <td width="100%" align="middle" bgcolor="<%= C_BGCOLOR4 %>">
		                          <table border="0" width="100%">
		                            <tr>
		                              <td width="50%" align="right"><b><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>"> E-Mail:</font></b></td>
		                              <td width="50%"><input name="Email" type="text" title="Email Address" style="<%= C_FORMDESIGN %>" maxlength="100"></td>
		                            </tr>
		                            <tr>
		                              <td width="50%" align="right"><b><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Password:</font></b></td>
		                              <td width="50%"><input type="password" name="Passwd" title="Password" style="<%= C_FORMDESIGN %>" maxlength="10"></td>
		                            </tr>
		                            <tr>
		                              <td width="100%" align="middle" colspan="2">
		                                <%If sOutPut = "ChangeCart" or sOutPut = "FailedAuthChange" Then %>	
						                <input Type="image" src="<%= C_BTN11 %>" name="Change" border="0">
		                                <%Else%>
						                <input type="image" src="<%= C_BTN16 %>" name="Return" border="0">
					                    <%End If%>
		                              </td>
		                            </tr>
		                          </table>
		                        </td>
		                      </tr>
		                    </table>
		                    <p><a href="login.asp?FPWD=True"><img src="<%= C_BTN17 %>" border="0"></a>
		                    <!--<input type="image" border="0" src="<%= C_BTN17 %>" name="FPWD">-->
				            <%If sOutPut = "FailedAuth" or sOutPut = "HasID" Then %>	
					        <a href="login.asp?New=true"><img src="<%= C_BTN19 %>" border="0"></a>
		                    <!--<input type="image" src="<%= C_BTN19 %>" border="0" name="New">-->
		                    <%End If%>	
		                    </form>
		                    <%End If%>
		                  </td>
		          </tr>
        
                  <%  
    Else ' Send Email or print confirmation of sent email
    %>
    
 
	                <tr>
	                  <td bgcolor="<%= C_BGCOLOR4 %>" align="middle"><br>
		                <%
		If sOutput = "Email" Then
		%>	
		                <form method="post" action="login.asp" onSubmit="<%= sSubmitAction%>">
                          <table border="0" bgcolor="#000000" width="75%">
                            <tr>
                              <td width="100%" align="middle" bgcolor="<%= C_BGCOLOR3 %>"><b><font face="<%= C_FONTFACE3 %>" color="<%= C_FONTCOLOR3 %>" size="<%= C_FONTSIZE3 %>">
			Please Type In Your E-Mail Address	
                                </font></b>
                              </td>
                            </tr>
                            <tr>
                              <td width="100%" align="middle" bgcolor="<%= C_BGCOLOR4 %>">
                                <table border="0" width="100%">
                                  <tr>
                                    <td width="50%" align="right"><b><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">E-Mail Address:</font></b></td>
                                    <td width="50%"><input type="text" name="Email" title="Email Address" style="<%= C_FORMDESIGN %>">
                                    </tr>
                                    <tr>
                                      <td width="100%" align="middle" colspan="2">
				                        <input type="image" src="<%= C_BTN18 %>" border="0" name="SendEmail">
                                      </td>         
                                    </tr>
                                  </table>
                                </td>
                              </tr>
                            </table>
                          </form>
                        </td>
                      </tr> 
        
		              <% ElseIf sOutPut = "SentEmail" Then %>
			          <table border="0" bgcolor="#000000" width="75%">
                        <tr>
                          <td width="100%" align="middle" bgcolor="<%= C_BGCOLOR4 %>">
                            <font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">
					An e-mail with the customer password has been sent to this e-mail:
					        <br><%=Request.Form("Email")%>
					        <br>
				            </font>					
				          </td>
                        </tr>
                      </table>
                      <br>
            
             	
            
  		              <% ElseIf sOutPut = "FailedEmail" Then %>
			          <table border="0" bgcolor="#000000" width="75%">
                        <tr>
                          <td width="100%" align="middle" bgcolor="<%= C_BGCOLOR4 %>">
                            <font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">
					No record exists for a customer with the following e-mail: 
					        <br><%=Request.Form("Email")%>
					        <p>Would you like to <a href="login.asp?Type=NewAccount">sign in</a> as a new customer?
					        </font>	
				            </td>
                          </tr>
                        </table>
                        <br>
            
                    
 	          	
	                    <%	
		' End sOutPut If 
		End If
    ' End Send Email If  
    End If
    '-----------------------------------------------------------
    ' End OutPut Block
    '-----------------------------------------------------------
    closeObj(cnn)
    %>
                        <!--#include file="footer.txt"-->
                      </table>
                    </td>
                  </tr>
              </table>
            </body>
          </html>















