<!-- #include virtual="/incDB.asp"-->
<%
	strTest = Request("test") 
	If strTest <> "" Then
		Response.write "TESTRUN"
	End If
	strStep = "start"
	'Handle order (javascript validated)
	If Request.Form("btnOrder") <> "" Then
		strStep = "confirm"
	ElseIf Request.Form("btnConfirmOrder") <> "" Then
		intProductID = Clng(Request.Form("intProductID"))
		intNumCopies = clng(Request.Form("intNumCopies"))
		intDeliveryTypeID = clng(Request.Form("intDeliveryTypeID"))
		strName = FA(Request.Form("strName"))
		strAddress = FA(Request.Form("strAddress"))
		strZip = FA(Request.Form("strZip"))
		strCity = FA(Request.Form("strCity"))
		strCountry = FA(Request.Form("strCountry"))
		strEmail = FA(Request.Form("strEmail"))
		mnyTotalValue = GetTotalValue(intProductID, intNumCopies, intDeliveryTypeID)
		If strTest = "" Then
			intCustomerID = conn.execute("sp_addCustomer @strName='" & strName & "',@strAddress='" & strAddress & "',@strZip='" & strZip & "',@strCity='" & strCity & "',@strCountry='" & strCountry & "',@strEmail='" & strEmail & "'")(0)
			intOrderID = conn.execute("sp_addOrder @intCustomerID=" & intCustomerID & ",@intProductID=" & intProductID & ",@intNumCopies=" & intNumCopies & ",@intDeliveryType=" & intDeliveryTypeID & ",@mnyTotalValue=" & mnyTotalValue)(0)
		Else
			intCustomerID = -1
			intOrderID = -1
		End If
		
		strInvoiceHTML = CreateInvoice(intOrderID)
		
		SendMail "contact@runislemusic.com", "Run Isle Music", ADMIN_EMAIL, "Run Isle Music: Order confirmation/Invoice (" & Year(Date)&GetInvoiceNumber(intOrderID) & ")", strInvoiceHTML, strInvoiceHTML
		'SendMail "contact@runislemusic.com", "Run Isle Music", "per@netstar.se", "RUN ISLE MUSIC: Order confirmation/Invoice (" & Year(Date)&GetInvoiceNumber(intOrderID) & ")", strInvoiceHTML, strInvoiceHTML
		If strEmail <> "" Then
			SendMail "contact@runislemusic.com", "Run Isle Music", strEmail, "RUN ISLE MUSIC: Order confirmation/Invoice (" & Year(Date)&GetInvoiceNumber(intOrderID) & ")", strInvoiceHTML, strInvoiceHTML
		End If
		
		strStep = "order_placed"
	End If
%>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/style.css">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<style fprolloverstyle>A:hover {text-decoration: blink}</style>
<title>Run Isle Music</title>
<script language="javascript">
	function validateOrderForm(form){
		if(form.intNumCopies[5].checked==true && form.strNumCopies.value==''){
			alert('Please, enter: Number of copies ');
			return false;
		}
		if(form.strName.value==''){
			alert('Please, enter your: Name ');
			return false;
		}
		if(form.strAddress.value==''){
			alert('Please, enter your: Street ');
			return false;
		}
		if(form.strZip.value==''){
			alert('Please, enter your: Postal code ');
			return false;
		}
		if(form.strCity.value==''){
			alert('Please, enter your: City ');
			return false;
		}
		if(form.strCountry.value==''){
			alert('Please, enter your: Country ');
			return false;
		}
		return true;
		
	}
</script>
</head>
<body>
<div align="center">
<table width="750" height="560" cellspacing="0" cellpadding="3" border="0">
<tr height="10">
	<td colspan="2" valign="top">
		<table width="100%" cellpadding="4" cellspacing="0">
		<tr>
			<td width="50%" class="white_text" bgcolor="#000000">RUN ISLE MUSIC STORE</td>
			<td width="50%" class="white_text" bgcolor="#000000" align="right"><a href="default.htm"><font color="white">HOME</font></a></td>
		</tr>
		</table>
	</td>
</tr>
<%If strStep = "start" Or strStep = "" Then %>
<tr>
<td width="300" valign="top">
<a href="http://www.lastloversstanding.com"><img border="0" src="/images/cover_rimcda01.JPG" style="border: 1px solid #000000;" width="300" height="275"></a>

<table cellspacing="0" cellpadding="0" border="0" width="100%">
  <tr>
    <td width="100%" valign="top" colspan="2">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top"><a href="http://www.lastloversstanding.com"><img border="1" src="/images/cover_rimcds01_small.JPG" width="100" height="91" style="border: 1px solid #000000;"></a></td>
    <td valign="top"><font color="#666666"><br>Morning is broken (CD single):<br><br>1-2 items 15,00 SEK.<br>3 or more items 10,00 SEK.<br><br>Listen <a href="http://www.lastloversstanding.com/music.htm" target="_blank">here</a>!</font></td>
  </tr>
  <tr>
    <td width="100%" valign="top" colspan="2">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top"><a href="http://www.lastloversstanding.com"><img border="1" src="images/cover_rimcde01_small.JPG" width="100" height="91" style="border: 1px solid #000000;"></a></td>
    <td valign="top"><font color="#666666"><br>The time is near (CD EP):<br><br>1-2 items: 59,00 SEK.<br>3 or more items: 50,00 SEK.<br><br>Listen <a href="http://www.lastloversstanding.com/music.htm" target="_blank">here</a>!</font></td>
  </tr>
  <tr>
    <td valign="top" colspan="2"><font color="#666666"><br>The time is near (CD EP) + Morning is broken (CD single):<br><br>1-2 items: 69,00 SEK.<br>3 or more items: 60,00 SEK.</font></td>
  </tr>
</table>

<td width="450" valign="top">
<span class="white_text">&nbsp;Order form&nbsp;</span> [Step 1/2]<br>
	<form action="<%=Request.ServerVariables("SCRIPT_NAME")%>" method="post" onsubmit="return validateOrderForm(this);">
	<input type="hidden" name="test" value="<%=Request("test")%>">
	Product:<br>
	<%
		Set rs = conn.execute("SELECT * FROM tblProducts WHERE blnInStore<>0")
		Do While Not rs.EOF
			Response.Write "<input type=""radio"" name=""intProductID"" value=""" & rs("intProductID") & """" 
				If rs("blnDefault") Then
				Response.Write " checked"
				End If
				Response.write ">" & rs("strName") & ": " & formatnumber(rs("mnyPrice"),2) & " SEK.<br>"
				rs.Movenext
		Loop
		Set rs = Nothing	 
	%>
	<br>
	Number of items:<br>
	<input type="radio" value="1" checked name="intNumCopies">1
	<input type="radio" value="2" name="intNumCopies">2 
	<input type="radio" value="3" name="intNumCopies">3
	<input type="radio" value="-1" name="intNumCopies">>3 <input type="text" name="strNumCopies" maxlength="2" size="2" style="font-family: Lucida Console; font-size: 8pt; color: #666666">
	<br>
	<br>
	Delivery by mail:<br>
	<input type="radio" value="0" checked name="intDeliveryTypeID">Sweden (5,00 SEK). 
	<input type="radio" value="1" name="intDeliveryTypeID">Rest of the world (10,00 SEK).
	<table cellpadding="1" cellspacing="0" width="200">
	<tr><td>&nbsp;</td></tr>
	<tr><td>Name:<br><input type="text" name="strName" size="30" style="font-family: Lucida Console; font-size: 8pt; color: #666666"></td><tr>
	<tr><td>Street:<br><input type="text" name="strAddress" size="30" style="font-family: Lucida Console; font-size: 8pt; color: #666666"></td><tr>
	<tr><td><table cellspacing="0" cellpadding="0" border="0" width="100%">
	<tr><td width="25%">Code:</td><td width="75%">City:</td>
	<tr><td width0"25%"><input type="text" name="strZip" size="5" style="font-family: Lucida Console; font-size: 8pt; color: #666666"></td>   
	<td width="75%"><input type="text" name="strCity" size="23" style="font-family: Lucida Console; font-size: 8pt; color: #666666"></td><tr></table></td></tr>        
	<tr><td>Country:<br><input type="text" name="strCountry" size="30" style="font-family: Lucida Console; font-size: 8pt; color: #666666"></td><tr>        
	<tr><td>E-mail:<br><input type="text" name="strEmail" size="30" style="font-family: Lucida Console; font-size: 8pt; color: #666666"></td><tr>       
	<tr><td align="right"><input type="submit" value="CONTINUE" name="btnOrder" style="border: 1 solid black; font-family: Lucida Console; font-size: 8pt">
	</form>
</table>
To pay in currencies other than Swedish kronor, simply<br>
re-calculate from SEK at the current exchange rate.<br>
SEK 10,00 is approximately €1,00.<br><br>
Invoices are paid via bank account or <a href="http://www.paypal.com"><img src="images/logo_paypal_small.gif" align="absbottom" width="28" height="10" border="0"></a>.<br><br>
Problems? Questions? Suggestions?<br>Write to: <img src="images/contact_rim.jpg" align="absbottom" border="0">.
</td>
</tr>
<%ElseIf strStep = "confirm" Then%>
<%
	If clng(Request.Form("intNumCopies")) = -1 Then
		intNumCopies = Request.Form("strNumCopies")
	Else
		intNumCopies = Request.Form("intNumCopies")
	End If
%>
<tr>
<td width="300" valign="top">
	<a href="http://www.lastloversstanding.com"><img border="0" src="<%=GetProductImage(Request.Form("intProductID"))%>" width="300" height="275" style="border: 1px solid #000000;"></a>
</td>
	
<td width="450" align="left" valign="top">
	
<span class="white_text">&nbsp;Order form&nbsp;</span> [Step 2/2]<br><br><br>
Please, check and confirm your order.<br><br>
Your order will be delivered by prioritaire mail<br>and should reach you in a few days.<br><br>
<hr size="1" color="#333333"> 
&nbsp;&nbsp;<%=Request.Form("strName")%><br>&nbsp;&nbsp;<%=Request.Form("strAddress")%><br>&nbsp;&nbsp;<%=Request.Form("strZip")%>&nbsp;<%=Request.Form("strCity")%><br>&nbsp;&nbsp;<%=Request.Form("strCountry")%><br>&nbsp;&nbsp;<%=Request.Form("strEmail")%>
<br><br>&nbsp;&nbsp;<%=intNumCopies%> 
	<%
		If clng(intNumCopies) < 2 Then
        		Response.write " item"
		Else
			Response.write " items"
		End If
	%>
	of: <%=GetProductName(Request.Form("intProductID"))%>.
<br><br>&nbsp;&nbsp;Delivery:&nbsp;<%=GetDeliveryTypeName(Request.Form("intDeliveryTypeID"))%>.
<br><br>&nbsp;&nbsp;Total: <%=formatnumber(GetTotalValue(Request.Form("intProductID"), intNumCopies, Request.Form("intDeliveryTypeID")),2)%> SEK.
<hr size="1" color="#333333">
<table border="0" width="350">
<tr>
<td align="left">
<form action="<%=Request.ServerVariables("SCRIPT_NAME")%>" method="post">
	<input type="hidden" name="strName" value="<%=Request.Form("strName")%>">
	<input type="hidden" name="strAddress" value="<%=Request.Form("strAddress")%>">
	<input type="hidden" name="strZip" value="<%=Request.Form("strZip")%>">
	<input type="hidden" name="strCity" value="<%=Request.Form("strCity")%>">
	<input type="hidden" name="strCountry" value="<%=Request.Form("strCountry")%>">
	<input type="hidden" name="strEmail" value="<%=Request.Form("strEmail")%>">
	<input type="hidden" name="intNumCopies" value="<%=intNumCopies%>">
	<input type="hidden" name="intProductID" value="<%=Request.Form("intProductID")%>">
	<input type="hidden" name="intDeliveryTypeID" value="<%=Request.Form("intDeliveryTypeID")%>">
	<input type="hidden" name="test" value="<%=Request.Form("test")%>">
<input type="reset" value="CHANGE ORDER" onclick="javascript:history.back();" style="border: 1 solid black; font-family: Lucida Console; font-size: 8pt">
&nbsp;<input type="submit" value="CONFIRM" name="btnConfirmOrder" style="border: 1 solid black; font-family: Lucida Console; font-size: 8pt">
</form>
</td>
</tr>
</table>
</td>
</tr>
<%ElseIf strStep = "order_placed" Then%>
<tr>
<td width="300" align="left" valign="top">
<a href="http://www.lastloversstanding.com"><img border="0" src="<%=GetProductImage(Request.Form("intProductID"))%>" width="300" height="275" style="border: 1px solid #000000;"</a>
<td width="450" align="left" valign="top">
<span class="white_text">&nbsp;Thank you!&nbsp;</span><br><br><br>
Your order has been sent.<br><br>
If you entered an e-mail address you will receive confirmation,<br>
and an invoice, immediately.<br><br>
Follow this link to get back to <a href="http://www.lastloversstanding.com">Last lovers standing</a>.<br><br>
Subscribe to the <a href="http://www.lastloversstanding.com/contact.asp">Newsletter</a>!
</td>
</tr>
<%End If%>
<tr>
<td align="center" width="750" colspan="2" height="10">
<hr size="1" color="#333333">
Copyright 2004-2011 <a href="http://www.runislemusic.com">Run Isle Music</a>. | <img src="images/contact_rim.jpg" align="absbottom" border="0"> | Design by <a href="http://www.runislemusic.com">Run Isle Music</a>.
</td>
</tr>
</table>
</div>
</html>