<html>
<head>
<title>Article redirect page</title>
<META NAME="ROBOTS" CONTENT="NOINDEX, FOLLOW">
</head>
<body>


<!--#INCLUDE VIRTUAL="/inc/connect.inc" -->
<%
theArticle = Request("Article")

'*
'*****     GET AUTHORS AND TITLE
'*
sqlstr="Select TblArticle.ID,TblArticle.Name,TblArticle.MentorID,TblArticle.MentorID2,TblArticle.File as thefile,TblArticle.DateAdded,TblArticle.CategoryID,TblArticle.Image as ArticleImage,TblArticle.PubMonth,TblMentor.ID as MentorId,TblMentor.Fname,TblMentor.Lname,TblMentor.Title as theTitle,TblMentor.image as mentorimage,TblCategory.Name AS ArtName,TblCategory.ID as CatID From TblArticle,TblMentor,TblCategory Where (TblArticle.MentorID=TblMentor.ID OR TblArticle.MentorID2=TblMentor.ID) AND TblArticle.CategoryID=TblCategory.ID AND TblArticle.ID='" & theArticle & "'"

rs = connect.execute(sqlstr)



theTitle = (rs("theTitle").value) 
Fname = (rs("Fname"))
Lname = (rs("Lname"))
ArtName = (rs("ArtName"))
'Dim thename = (Server.HtmlEncode(rs("name").value ))
thename = (rs("name").value)
CatId = (rs("CatId"))
MentorId = (rs("MentorId"))
MentorID2 = (rs("MentorID2").value)
'Response.Write (thename)

'Dim thenamemeta as string
thenamemeta = thename
  'Dim RegExStr As String = “<[^>]*>”
  '    Dim R As New Regex(RegExStr)
   '   thenamemeta = R.Replace(thenamemeta, ” “)




'Response.Write ("<br>" & thenamemeta & "<br>")
'*
'*****     CHECK FOR NULL SECOND AUTHOR
'*
Men2 = "Not Null"
If Men2 = "" Then
Men2 = ("Null")
Else
Men2 = ("Not Null")
End  If 
'Response.Write ("MentorID2 is " & Men2)

if Men2 = "Not Null" then
MentorId2 = (rs("MentorId2"))
end if

authorstr = Fname & " " & Lname 

'Response.Write ("<FONT SIZE=3 face=arial,helevetica,geneva>By:<b> "& Fname &" "& Lname)

						If rs("MentorID2")<>"" Then'write out the second author
							Set SecAuthRS = Server.CreateObject("ADODB.Recordset")
							Set	SecAuthRS.ActiveConnection=Connect
							SecAuthRS.Source ="Select Title,Fname,Lname from TblMentor Where ID="&rs("MentorID2")
							'Response.Write SQLSource&"<BR>"
							SecAuthRS.Open
							authorstr = authorstr & " and " &SecAuthRS("Title")&" "&SecAuthRS("Fname")&" "&SecAuthRS("Lname")
							'Response.Write " and "&SecAuthRS("Title")&" "&SecAuthRS("Fname")&"&nbsp;"&SecAuthRS("Lname")
							SecAuthRS.Close
							Set SecAuthRS=nothing
						End IF'end test for second author
'*
'*****     REMOVE HTML FROM STRING
'*


stoploop = 0
Do until stoploop = 5
l = (Len(thenamemeta))
lp = (instr(thenamemeta,"<"))
rp = (instr(thenamemeta,">"))


'Response.Write (l)
'Response.Write ("<br>lp: " & lp)
'Response.Write ("<br>rp: " & rp)
if lp <> 0 then
lthenamemeta = (left(thenamemeta,lp-1))

'Response.Write ("<br>left: " & lthenamemeta)
end if

if rp <> 0 then
rthenamemeta = (right(thenamemeta,l-rp))
'Response.Write ("<br>right: " & rthenamemeta)
end if

if lp <> 0 and rp <> 0 then
thenamemeta = lthenamemeta & " " & rthenamemeta
end if
stoploop = stoploop + 1
'Response.Write ("<br>thenamemeta: " & thenamemeta)

loop
'Response.Write ("<br>stoploop: " & stoploop)
'Response.Write ("<br>Author: " & authorstr)
'Response.Write ("<br>Article Title: " & thenamemeta)
'Response.Write ("<br>Article: " & theArticle)

Response.Redirect "article.aspx?author=" & authorstr &"&title=" & thenamemeta & "&Article=" & theArticle 
%>
</body></html>