<% Option Explicit %>
<!--#include file="config.asp"-->
<!--#include file="common.asp"-->
<%
	Dim EGold, rs

	EGold = Str2Num(Request.Querystring("EGold"))


	PageBegin
	If EGold = 0 Then
%>
	<script language=JavaScript src=common.js></script>

	<table border=0 cellspacing=0 cellpadding=2>

	<form name=LF onsubmit='return EGoldPresent()'>
	<tr>
		<td align=center class=Title colspan=2>
			Advertiser's Area<br><br class=HalfBreak>
		</td>
	</tr>
	<tr class=Odd>
		<td>E-Gold</td>
		<td>
			<input name=EGold size=10 maxlength=10 class=ClientText>
			<input type=submit value='Show statistics' class=Button>
		</td>
	</tr>
	</form>
	</table>
	<br>
<%
	Else
		PageContent
	End If
	PageEnd



	Sub PageContent()
%>
		<center class=Title>
		<br class=HalfBreak>Advertiser's Area<br><br class=HalfBreak>

		<a href=advertise.asp>Purchase More Visitors</a>&nbsp;&nbsp;&nbsp;
		<a href=advertise.asp>Purchase Unlimited Banner Impression</a>&nbsp;&nbsp;&nbsp;
		<a href="javascript:window.external.AddFavorite('<%= CurrentFile %>?EGold=<%= EGold %>','<%= SiteName %> - My Advertising Stats')">Bookmark My Stats</a>
		</center>
		<br>
<%
		OpenConnection

		Websites
		Response.Write "<br><br><br>"
		Banners
		Response.Write "<br>"
	End Sub


	Sub Websites()

	Set rs = DBC.Execute("SELECT * FROM Campaigns WHERE EGold = " & EGold)
%>
	<br>
	<table border=0 cellpadding=2 cellspacing=0 width=650>
	<tr class=Header valign=top>
		<td width=20>&nbsp;</td>
		<td align=center><b>Websites</b></td>
		<td align=center width=70><b>Visitors</b></td>
		<td align=center width=100><b>Visitors left</b></td>
		<td align=center width=110><b>Approved</b></td>
	</tr>
<%
	i = 1

	Do While Not rs.EOF
%>
	<tr class=Odd <%= IIf(i Mod 2 = 0, "bgcolor=EEEEEE", "") %> valign=top>
		<td><%= i %>.</td>
		<td><a href="<%= rs("SiteURL") %>" target=_blank><%= rs("SiteTitle") %></a></td>
		<td align=right><%= rs("Visits") %></td>
		<td align=right><%= rs("VisitsLeft") %></td>
		<td align=center>
			<%= IIf(rs("Approved"), "<font color=green>Yes", "<font color=red>No") %></font>
		</td>
	</tr>
<%
		i = i + 1
		rs.MoveNext
	Loop
%>
	</table>
<%
	End Sub


	Sub Banners()

	Set rs = DBC.Execute("SELECT * FROM Banners WHERE EGold = " & EGold)
%>
	<br>
	<table border=0 cellpadding=2 cellspacing=0 width=650>
	<tr class=Header valign=top>
		<td width=20>&nbsp;</td>
		<td align=center><b>Banner</b></td>
		<td align=center width=100><b>Visible to</b></td>
		<td align=center width=110><b>Approved</b></td>
	</tr>
<%
	i = 1

	Do While Not rs.EOF
%>
	<tr class=Odd <%= IIf(i Mod 2 = 0, "bgcolor=EEEEEE", "") %> valign=top>
		<td><%= i %>.</td>
		<td>
			<a href="<%= rs("URL") %>" target=_blank><img src="<%= rs("Banner") %>" border=0></a>
		</td>
		<td align=right><%= rs("ValidTo") %></td>
		<td align=center>
			<%= IIf(rs("Approved"), "<font color=green>Yes", "<font color=red>No") %></font>
		</td>
	</tr>
<%
		i = i + 1
		rs.MoveNext
	Loop
%>
	</table>
<%
	End Sub
%>