<% 
Areanum = Request.QueryString("area")
'## Function to display new icon 
%>
<%
Public Sub DisplayNews
	If Request.QueryString("catid") = "" then
		CatID = 0
		CatTitle = SiteName
	Else
		CatID = Request.QueryString("catid")
		CatTitle = Request.QueryString("cattitle")
	End If

	'Create a recordset with the top level categories in it.
	Set objRec2 = CreateObject("ADODB.Recordset")
	Set objRec2.ActiveConnection = my_Conn
	objRec2.LockType = 2
	If mLev = 4 Then
		SQL = "SELECT VOTES,SCORE,ADDED,NAME,URL,AUTHOR,PRICE,LINKID,IMG,FORUM_TOPIC,CATID,VALIDATED,LINKDESC FROM " & strTablePrefix & "Site_Links WHERE LinkType = " & areanum & " ORDER BY Added DESC;"
	Else 
		SQL = "SELECT VOTES,SCORE,ADDED,NAME,URL,AUTHOR,PRICE,LINKID,IMG,FORUM_TOPIC,CATID,VALIDATED,LINKDESC FROM " & strTablePrefix & "Site_Links WHERE LinkType = " & areanum & " AND Validated = 1 ORDER BY Added DESC;"
	End If

	objRec2.Open SQL  ,my_Conn
	if objRec2.EOF then
' do Nothing
	else %>
<table bgColor="<% =strTableBorderColor %>" border="0" cellpadding="1" cellspacing="1" width="100%">
 <tr>
  <td bgcolor="<% =strHeadCellColor %>">
	<font face="<% =strDefaultFontFace %>" color="<% =strHeadFontColor %>" size="<% =strDefaultFontSize %>">
	<img src="<%= strImageURL %>news.gif" width="15" height="15" border="0">&nbsp;<b>NEWS</b></font
  </td>
 </tr>
<!-- News in this category. -->
<% DO UNTIL objRec2.EOF 
LinkDesc = objRec2("LinkDesc")
If objRec2("Votes") <> "0" then
Rate = round(objRec2("Score")/objRec2("Votes"))
star = 0
Rating = ""
DO UNTIL star = Rate
Rating = Rating & "<img src="& strImageURL &"icon_star_gold.gif border=0>"
star = star +1
Loop
Else
Rating = "Not Rated"
End If
%> 
<tr>
  <td bgcolor="<%=strForumCellColor%>">
  <table border="0" cellspacing="1" width="100%" cellpadding="2" bgcolor="<%=strForumCellColor%>">
   <tr>
    <td bgcolor="<%=strAltForumCellColor%>" align="right">
    <font face="<%=strDefaultFontFace%>" size="<%=strDefaultFontSize%>"><b><%=ChkDate(objRec2("Added"))%></b></font>
    </td>
   </tr>
   <TR>
    <TD bgcolor="<%=strForumCellColor%>" valign="middle"><font face="<%=strDefaultFontFace%>" size="<%=strDefaultFontSize%>"><%=isNew(objRec2("Added"))%>&nbsp;<b><%=objRec2("Name")%></b>&nbsp;</font>
<% If mLev >= 2 Then %>
<br>
&nbsp;<font face="<%=strDefaultFontFace%>" size="<%=strDefaultFontSize%>"><%=objRec2("URL") %></font>
<% End If %>
</TD>
</tr>
<tr>
<td bgcolor="<%=strForumCellColor%>" valign="top" align="left">
<font face="<%=strDefaultFontFace%>" size="<%=strFooterFontSize%>">
<%If objRec2("Author") <> "" Then%><b><font color="<%=strDefaultFontColor%>">Author:</font>&nbsp;</b><font color="<%=strLinkColor%>"><%=objRec2("Author")%></font>
&nbsp;&nbsp;<%End If%>
<%If objRec2("Price") <> 0 Then%>
<b><font color="<%=strDefaultFontColor%>">Price:</font></b>&nbsp;<font color="<%=strLinkColor%>"><%= strCurrencySymbol %><%=objRec2("Price")%></font><%End If%>
<% If objRec2("Price") <> 0 OR objRec2("Author") <> "" Then%><br><%End If%></font>
</td>
</tr>
<tr>
<td>
 <table width="100%" cellpadding="1">
  <tr>
  <% if objRec2("IMG") <> "" Then %>
  <TD bgcolor="<%=strForumCellColor%>" align="center" width="70">
    <a href="portal_redirect.asp?linkid=<%=objRec2("LinkID")%>&linkname=<%=Server.URLEncode(objRec2("Name"))%>&catid=<%=CatID%>&cattitle=<%=Server.URLEncode(CatTitle)%>&area=<%=areanum%>&refID=<%=refID%>" onmouseover="javascript:self.status='<%=objRec2("Name")%>';return true;" onmouseout="javascript:self.status='';return true;"><img src="<%=objRec2("IMG")%>" border="0"></a>
  </TD>
  <%End If%>          
  <td><font face="<%=strDefaultFontFace%>" size="<%=strDefaultFontSize%>"><%=chkString(LinkDesc, "message")%></font>
  </td>
  </tr>
  </table>
</td>
</tr>
<% If objRec2("Forum_Topic") <> "" Then %>
</tr>
<td bgcolor="<%=strForumCellColor%>" align="center"><font face="<%=strDefaultFontFace%>" size="<%=strFooterFontSize%>">
<a href="<%=strForumURL%>topic.asp?topic_id=<%=objRec2("Forum_Topic")%>"><b>Click To Discuss This Resource</b></a></font></td>
</tr>
<% End If %>
<% If mLev >= 3 Then %>
<tr><td bgcolor="<%=strForumCellColor%>" align="center"><font face="<%=strDefaultFontFace%>" size="<%=strFooterFontSize%>"> | <A href="javascript: openWindow5('include/editlink.asp?link=<%=objRec2("LinkID")%>&category=<%=CatID%>')">Edit Link</A> |
<% If mLev = 4 Then %>
<A href="javascript: OpenValidate('include/deletelink.asp?link=<%=objRec2("LinkID")%>')">Delete Link</A> |
	<% If objRec2("Validated") <> 1 Then %>
	<A href="javascript:OpenValidate('include/validate.asp?link=<%=objRec2("LinkID")%>')"> Validate Link</A> |
	<% End If %>
<% End If %>
</font></TD></tr>
<% End If %>
</table>
<%
'Move to the next record in the record set.
objRec2.MoveNext
LOOP %> 
</td>
</tr>
</table>
<%
end if
%>
<!-- End Links in this Category -->

<% 'Time to clean up
objRec2.Close
Set objRec2 = Nothing
End Sub 'Displaylinks %> 

<%
Public Sub DisplayNewsDetail

	If Request.QueryString("catid") = "" then
		CatID = 0
		CatTitle = SiteName
	Else
		CatID = Request.QueryString("catid")
		CatTitle = Request.QueryString("cattitle")
	End If

	'Create a recordset with the top level categories in it.
	Set objRec2 = CreateObject("ADODB.Recordset")
	Set objRec2.ActiveConnection = my_Conn
	objRec2.LockType = 2
	If mLev = 4 Then
		SQL = "SELECT VOTES,SCORE,ADDED,NAME,URL,AUTHOR,PRICE,LINKID,IMG,FORUM_TOPIC,CATID,VALIDATED,LINKDESC FROM " & strTablePrefix & "Site_Links WHERE LinkID = " & Request.QueryString("linkid") & " ORDER BY Added DESC;"
	Else 
		SQL = "SELECT VOTES,SCORE,ADDED,NAME,URL,AUTHOR,PRICE,LINKID,IMG,FORUM_TOPIC,CATID,VALIDATED,LINKDESC FROM " & strTablePrefix & "Site_Links WHERE LinkID = " & Request.QueryString("linkid") & " AND Validated = 1 ORDER BY Added DESC;"
	End If
	objRec2.Open SQL, my_Conn
%>
<!-- Links in this category. -->
<%
if objRec2.EOF then
' do Nothing
else 
%>
<table bgColor="<% =strTableBorderColor %>" border="0" cellpadding="1" cellspacing="1" width="100%">
<tr>
<td bgcolor="<% =strForumCellColor %>">
<font face="<%=strDefaultFontFace%>" size="<%=strDefaultFontSize%>">
<a href="javascript: history.back()">go back ...</a></font>
</td>
</tr> 
 <tr>
  <td bgcolor="<% =strHeadCellColor %>">
	<font face="<% =strDefaultFontFace %>" color="<% =strHeadFontColor %>" size="<% =strDefaultFontSize %>">
	<img src="<%= strImageURL %>news.gif" width="15" height="15" border="0">&nbsp;<b>NEWS</b></font
  </td>
 </tr>
<!-- News in this category. -->
<% DO UNTIL objRec2.EOF 
LinkDesc = objRec2("LinkDesc")
If objRec2("Votes") <> "0" then
Rate = round(objRec2("Score")/objRec2("Votes"))
star = 0
Rating = ""
DO UNTIL star = Rate
Rating = Rating & "<img src="& strImageURL &"icon_star_gold.gif border=0>"
star = star +1
Loop
Else
Rating = "Not Rated"
End If
%> 
<tr>
  <td bgcolor="<%=strForumCellColor%>">
  <table border="0" cellspacing="1" width="100%" cellpadding="2" bgcolor="<%=strForumCellColor%>">
   <tr>
    <td bgcolor="<%=strAltForumCellColor%>" align="right">
    <font face="<%=strDefaultFontFace%>" size="<%=strDefaultFontSize%>"><b><%=ChkDate(objRec2("Added"))%></b></font>
    </td>
   </tr>
   <TR>
    <TD bgcolor="<%=strForumCellColor%>" valign="middle"><font face="<%=strDefaultFontFace%>" size="<%=strDefaultFontSize%>"><%=isNew(objRec2("Added"))%>&nbsp;<b><%=objRec2("Name")%></b>&nbsp;</font>
<% If mLev >= 2 Then %>
<br>
&nbsp;<font face="<%=strDefaultFontFace%>" size="<%=strDefaultFontSize%>"><%=objRec2("URL") %></font>
<% End If %>
</TD>
</tr>
<tr>
<td bgcolor="<%=strForumCellColor%>" valign="top" align="left">
<font face="<%=strDefaultFontFace%>" size="<%=strFooterFontSize%>">
<%If objRec2("Author") <> "" Then%><b><font color="<%=strDefaultFontColor%>">Author:</font>&nbsp;</b><font color="<%=strLinkColor%>"><%=objRec2("Author")%></font>
&nbsp;&nbsp;<%End If%>
<%If objRec2("Price") <> "0" Then%>
<b><font color="<%=strDefaultFontColor%>">Price:</font></b>&nbsp;<font color="<%=strLinkColor%>"><%= strCurrencySymbol %><%=objRec2("Price")%></font><%End If%>
<% If objRec2("Price") <> "0" OR objRec2("Author") <> "" Then%><br><%End If%></font>
</td>
</tr>
<tr>
<td>
 <table width="100%" cellpadding="1">
  <tr>
  <% if objRec2("IMG") <> "" Then %>
  <TD bgcolor="<%=strForumCellColor%>" align="center" width="70">
    <a href="<%=strHomeURL%>portal_redirect.asp?linkid=<%=objRec2("LinkID")%>&linkname=<%=Server.URLEncode(objRec2("Name"))%>&catid=<%=CatID%>&cattitle=<%=Server.URLEncode(CatTitle)%>&area=<%=areanum%>&refID=<%=refID%>" onmouseover="javascript:self.status='<%=objRec2("Name")%>';return true;" onmouseout="javascript:self.status='';return true;"><img src="<%=objRec2("IMG")%>" border="0"></a>
  </TD>
  <%End If%>          
  <td bgcolor="<%=strAltForumCellColor%>" ><font face="<%=strDefaultFontFace%>" size="<%=strDefaultFontSize%>"><%=chkString(LinkDesc, "message")%></font>
  </td>
  </tr>
  </table>
</td>
</tr>
<% If objRec2("Forum_Topic") <> "" Then %>
</tr>>
<td bgcolor="<%=strForumCellColor%>" align="center"><font face="<%=strDefaultFontFace%>" size="<%=strFooterFontSize%>">
<a href="<%=strForumURL%>topic.asp?topic_id=<%=objRec2("Forum_Topic")%>"><b>Click To Discuss This Resource</b></a></font></td>
</tr>
<% End If %>
<% If mLev >= 3 Then %>
<tr><td bgcolor="<%=strForumCellColor%>" align="center"><font face="<%=strDefaultFontFace%>" size="<%=strFooterFontSize%>"> | <A href="javascript: openWindow5('include/editlink.asp?link=<%=objRec2("LinkID")%>&category=<%=CatID%>')">Edit Link</A> |
<% If mLev = 4 Then %>
<A href="javascript: OpenValidate('include/deletelink.asp?link=<%=objRec2("LinkID")%>')">Delete Link</A> |
	<% If objRec2("Validated") <> 1 Then %>
	<A href="javascript: OpenValidate('include/validate.asp?link=<%=objRec2("LinkID")%>')"> Validate Link</A> |
	<% End If %>
<% End If %>
</font></TD></tr>
<% End If %>
</table>
<%
'Move to the next record in the record set.
objRec2.MoveNext
LOOP %> 
</td>
</tr>
</table>                                                                                                                   

<%
end if
%>
<!-- End Links in this Category -->

<% 'Time to clean up
objRec2.Close
Set objRec2 = Nothing
End Sub 'DisplayNewsDatail %>
<%
Public Sub DisplayTopNews

	If Request.QueryString("catid") = "" then
		CatID = 0
		CatTitle = SiteName
	Else
		CatID = Request.QueryString("catid")
		CatTitle = Request.QueryString("cattitle")
	End If
 	'Create a recordset with the top level categories in it.
	Set objRec2 = CreateObject("ADODB.Recordset")
	Set objRec2.ActiveConnection = my_Conn
	objRec2.LockType = 2
	If mLev = 4 Then
		if catid = 0 then    'display all NEWS
		  SQL = "SELECT Top 3 VOTES,SCORE,ADDED,NAME,URL,AUTHOR,PRICE,LINKID,IMG,FORUM_TOPIC,CATID,VALIDATED,LINKDESC FROM " & strTablePrefix & "Site_Links WHERE LinkType = 1 ORDER BY Added DESC;"
		else                 'display category related News
                  SQL = "SELECT Top 3 VOTES,SCORE,ADDED,NAME,URL,AUTHOR,PRICE,LINKID,IMG,FORUM_TOPIC,CATID,VALIDATED,LINKDESC FROM " & strTablePrefix & "Site_Links WHERE CatID = " & CatID & " AND LinkType = 1 ORDER BY Added DESC;"		
		end if
	Else          
		if catid = 0 then    'display category related news NEWS
                  SQL = "SELECT Top 3 VOTES,SCORE,ADDED,NAME,URL,AUTHOR,PRICE,LINKID,IMG,FORUM_TOPIC,CATID,VALIDATED,LINKDESC FROM " & strTablePrefix & "Site_Links WHERE LinkType = 1 AND Validated = 1 ORDER BY ADDED DESC;"
		else                 'display category related News
                SQL = "SELECT Top 3 VOTES,SCORE,ADDED,NAME,URL,AUTHOR,PRICE,LINKID,IMG,FORUM_TOPIC,CATID,VALIDATED,LINKDESC FROM " & strTablePrefix & "Site_Links WHERE CatID = " & CatID & " AND LinkType = 1 AND Validated = 1 ORDER BY ADDED DESC;"
		end if
	End If
	objRec2.Open SQL, my_Conn, 3, 3
'objRec2.moveFirst
if objRec2.EOF then
' do Nothing
else 
%>
<table bgColor="<% =strTableBorderColor %>" border="0" cellpadding="1" cellspacing="1" width="100%">
 <tr>
  <td bgcolor="<% =strHeadCellColor %>">
	<font face="<% =strDefaultFontFace %>" color="<% =strHeadFontColor %>" size="<% =strDefaultFontSize %>">
	<img src="<%= strImageURL %>news.gif" width="15" height="15" border="0">&nbsp;<b>NEWS</b></font
  </td>
 </tr>
<!-- Links in this category. -->
<% DO UNTIL objRec2.EOF %>

<%LinkDesc = objRec2("LinkDesc")
If objRec2("Votes") <> "0" then
Rate = round(objRec2("Score")/objRec2("Votes"))
star = 0
Rating = ""
DO UNTIL star = Rate
Rating = Rating & "<img src="& strImageURL &"icon_star_gold.gif border=0>"
star = star +1
Loop
Else
Rating = "Not Rated"
End If
%>
 <tr>
  <td bgcolor="<%=strForumCellColor%>">
  <table width=100%">
   <tr>
    <td align="right" bgcolor="<% =strAltForumCellColor %>")><%datum = chkdate(objRec2("Added"))
      %>
      <font face="<%=strDefaultFontFace%>" size="<%=strFooterFontSize%>"><b><%=datum%></b>
    </td>
   </tr>
   <tr>
    <td>
      <font face="<%=strDefaultFontFace%>" size="<%=strDefaultFontSize%>">
      <b><%=objRec2("Name") %></a></font></b>
    </td>
   </tr>
   <tr>
    <td>      
<%  
   FirstPara= split(LinkDesc,"<br>")
   if isArray(FirstPara) and ubound(FirstPara) >= 0 then
   t_Message= FirstPara(0)
   else T_Message = LinkDesc
   end if
   if len(LinkDesc) > len(t_Message) then
   T_Message = t_Message & "<br><a href=portal_redirect.asp?linkid=" & objRec2("LinkID") & "&linkname=" &Server.URLEncode(objRec2("Name")) & "&catid=" & CatID & "&cattitle=" & Server.URLEncode(CatTitle) & "&area=" & areanum & ">read entire message ...</a></font>"
   end if
   
%>
	<font face="<%=strDefaultFontFace%>" size="<%=strFooterFontSize%>"><%=chkString(LinkDesc, "message")%></font>	 
    </td>
   </tr>
<% 
If objRec2("Forum_Topic") <> "" Then %>
   <tr>
    <td bgcolor="<%=strPageBGColor%>" align="center">
      <font face="<%=strDefaultFontFace%>" size="<%=strFooterFontSize%>">
      <a href="<%=strForumURL%>topic.asp?topic_id=<%=objRec2("Forum_Topic")%>">Click To Discuss This Resource</a></font>
    </td>
   </tr>
<% End If %>
<% If mLev >= 3 Then %>
   <tr>
    <td bgcolor="<%=strForumCellColor%>" colspan="2" align="center">
      <font face="<%=strDefaultFontFace%>" size="<%=strFooterFontSize%>"> | <A href="javascript: openWindow5('include/editlink.asp?link=<%=objRec2("LinkID")%>&category=<%=CatID%>')">Edit Link</A> |
<% If mLev = 4 Then %>
      <A href="javascript: OpenValidate('include/deletelink.asp?link=<%=objRec2("LinkID")%>')">Delete Link</A> |
      <% If objRec2("Validated") <> 1 Then %>
        <A href="javascript: OpenValidate('include/validate.asp?link=<%=objRec2("LinkID")%>')"> Validate Link</A> |
      <% End If %>
    </Td>
   </tr>
<% End If %>
</font>
<% End If %>
<%
'Move to the next record in the record set.
objRec2.MoveNext
%>
  </table>
  </td>
 </tr>
<%
LOOP 
%>
<tr>
<td bgcolor="<%=strForumCellColor%>" align="center">
  <font face="<%=strDefaultFontFace%>" size="<%=strFooterFontSize%>">
  <a href="portal_news.asp?catid=<%=catid%>&area=1">more News ...</a></font> 
</td>
</tr>
</table>
<%
end if
%>

<!-- End Links in this Category -->

<% 'Time to clean up
objRec2.Close
Set objRec2 = Nothing
End Sub 'DisplayTopNews %> 
