<!--#INCLUDE virtual="/head.asp"-->
<!-- #INCLUDE virtual="/bars/common/dbconn1.asp" -->
<%
MyORDER = request.querystring("order")
MyOLDO = request.querystring("oldo")
barORDER = 0
RateORDER = 0
VoteORDER = 0
	if MyORDER = "" then
		if MyOLDO = "1" then
			MyORDER = "pagename DESC"
		else
			MyORDER = "pagename"
			barORDER = 1
		end if
	elseif MyORDER = "1" then
		if MyOLDO = "1" then
			MyORDER = "rateing, pagename"
		else
			MyORDER = "rateing DESC, pagename"
			RateORDER = 1
		end if

	elseif MyOrder = "2" then
		if MyOLDO = "1" then
			MyORDER = "votes, pagename"
		else
			MyORDER = "votes DESC, pagename"
			VoteORDER = 1
		end if
	else
		MyORDER = "pageorder, pagename"
	end if
%>
<%
'*****GRAB PAGE COLORS*****
Set settingsRS = Server.CreateObject("ADODB.RecordSet")
settingsSQL = "Select sitetitle, sitetitlecolor, linkcolor, sitecolor, menutitlecolor, menucolor, sitefont from tblSettings;"
'Response.Write dataSQL
'response.end
settingsRS.Open settingsSQL, whtConn
'*******

sitecolor = settingsRS("sitecolor")
sitetitle = settingsRS("sitetitle")
sitetitlecolor = settingsRS("sitetitlecolor")
menucolor = settingsRS("menucolor")
menutitlecolor = settingsRS("menutitlecolor")
sitefont = settingsRS("sitefont")

settingsRS.close
set settingsRS = nothing

select case sitecolor
	case "violet"
	site_bgcolor = "#6600FF"
	case "white"
	site_bgcolor = "#FFFFFF"
	case "black"
	site_bgcolor = "#000000"
	case "fadedred"
	site_bgcolor = "#FF6666"
	case "darkgray"
	site_bgcolor = "#666666"
	case "paleblue"
	site_bgcolor = "#99CCFF"
	case "magenta"
	site_bgcolor = "#663366"
	case "brickred"
	site_bgcolor = "#990000"
	case "darkblue"
	site_bgcolor = "#000066"
	case "lightgreen"
	site_bgcolor = "#99FF66"
	case "darkgreen"
	site_bgcolor = "#336633"
	case "yellow"
	site_bgcolor = "yellow"
	case "lime"
	site_bgcolor = "#DDFF78"
	case "dustyrose"
	site_bgcolor = "#856363"
	case "brown"
	site_bgcolor = "#804000"
	case "steelblue"
	site_bgcolor = "#336699"
	case "purple"
	site_bgcolor = "#660099"
	case "orange"
	site_bgcolor = "#FF9900"
	case "pink"
	site_bgcolor = "#FF66CC"
	case else
	site_bgcolor = "white"
end select
border_tl = sitecolor & "_tl.gif"
border_tr = sitecolor & "_tr.gif"
border_bl = sitecolor & "_bl.gif"
border_br = sitecolor & "_br.gif"
'*****END SITE SETTINGS*****


'*****GRAB PAGE NAMES FROM DATABASE TO CREATE SIDE MENU*****
Set menuRS = Server.CreateObject("ADODB.RecordSet")
menuSQL = "Select pagename, ID, directlink, rateing, votes FROM tblPages where active = 1 and deleted = 2 order by " & MyORDER & ";"
'Response.Write dataSQL
'response.end
menuRS.Open menuSQL, whtConn, 1
recordcount = MenuRS.recordcount
if recordcount <> 0 then
'		menuRS.close
'		set menuRS = nothing
'	end if
'*****STICK DATA INTO AN ARRAY*****
data = menuRS.GetRows()
'*****Setup for array usage*****
iRecFirst   = LBound(data, 2)
iRecLast    = UBound(data, 2)
end if
'*****CLOSE RECORDSET*****
menuRS.close
set menuRS = nothing
%>



<CENTER>
<span style="font-size: x-large; color: <%=sitetitlecolor%>; letter-spacing: 5px; text-indent: 15px;"><%=sitetitle%></span><br><br>

<table  border="0" cellspacing="0" cellpadding="5" align="center">
  <tr>
    <TD class="barmenu"><A HREF="/bars/bars.asp?oldo=<% =BarORDER %>" class="barorder">Bar</A></TD>
    <TD class="barmenu" width="150"><A HREF="/bars/bars.asp?order=1&oldo=<% =RateORDER %>" class="barorder">Rating</A></TD>
    <TD class="barmenu"><A HREF="/bars/bars.asp?order=2&oldo=<% =VoteORDER %>" class="barorder">Votes</A></TD><TR>
<%
if recordcount > 0 then
' Loop through the records (second dimension of the array)
For I = iRecFirst To iRecLast
'set array values to variable that is easy to read.

'put loop content here
	pagename = data(0,I)
	pID = data(1,I)
	directlink = data(2,I)
	rateing = data(3,I)
	votes = data(4,I)
		if directlink <> "" then
		response.write ("<TD><a href='" & directlink & "' class='bars'>" & pagename & "</a>&nbsp;</TD>")
		else
		response.write ("<TD><a href='" & appurl & "/page.asp?id=" & pID & "' class='bars'>" & pagename & "</a>&nbsp;</TD>")
		end if
		response.write ("<TD><IMG SRC='/images/" & rateing & ".gif' border=0 alt='Rating: " & rateing & "'>")
		response.write ("</TD><TD>" & votes & "</TD><TR>")
Next ' I
end if
%>
	<hr style="color: #FFFFFF;">
<%
'CHECK IF LOGGED IN
If Session("loginID") <> "" Then
dim loginstatus
loginstatus = "<br><a href='" & appurl & "/admin/default.asp' class='menu'>admin</a><br><a href='" & appurl & "/admin/logout.asp' class='menu'>logout</a>"
end if
response.write loginstatus
%>
	</td>

    </TABLE>
    </CENTER>