<% Option Explicit %>
<!--#include file="../config.asp"-->
<!--#include file="../common.asp"-->
<!--#include file="main.asp"-->
<%
	PageHeader

	If Not Session("IsAdminLogin") Then
		PageLogin
		Response.End
	End If



	OpenConnection

	If Request.Querystring("Command") = "Delete" Then
		DBC.Execute("DELETE FROM Banners WHERE BID = " & Str2Num(Request.Querystring("BID")))
	End If

	AdminPageBegin "Banners List"
	BannersList
	AdminPageEnd


	Sub BannersList()
		Dim rs, i

		Set rs = DBC.Execute("SELECT * FROM Banners ORDER BY BID DESC")
%>
		<form>
		<table border=0 align=center bgcolor=black width=500 cellspacing=1 cellpadding=3>
		<col>
		<col>
		<col align=right>
		<col align=center>
		<col align=center>
		<col align=center>
		<tr class=SelectedParent>
			<td>&nbsp;</td>
			<td align=center>Banner</td>
			<td align=center>Rotate to</td>
			<td align=center>Approved</td>
			<td align=center>Advertiser's E-Gold</td>
			<td>&nbsp;</td>
		</tr>
<%
		i = 1
		Do While Not rs.EOF
%>
			<tr class=Odd>
				<td><%= i %>.</td>
				<td>
					<a href="<%= rs("URL") %>" target=_blank><img src="<%= rs("Banner") %>" border=0></a>
				</td>
				<td>
					<%= IIf(DateDiff("d", rs("ValidTo"), Date) > 0, "<font color=red>", "<font color=green>") %>
					<%= rs("ValidTo") %></font>
				</td>
				<td>
					<%= IIf(rs("Approved"), "<font color=green>Yes</font>", "<font color=red>No</font>") %>
				</td>
				<td>
					<%= rs("EGold") %>
				</td>
				<td>
					<a href="mailto:<%= rs("EMail") %>">Send Mail</a>&nbsp;
					<a href="banner_edit.asp?BID=<%= rs("BID") %>">Edit</a>&nbsp;
					<a href="javascript: Delete(<%= rs("BID") %>)">Delete</a>
				</td>
			</tr>
<%
			i = i + 1
			rs.MoveNext
		Loop
%>
		</table>
		</form>


		<script language=JavaScript>
		<!--
		function Delete(ID)
		{
			if (confirm("This record will be delete. Do you want to proceed?"))
				document.location = "banner_list.asp?Command=Delete&BID=" + ID;
		}
		//-->
		</script>
<%
	End Sub
%>