<% ShowCurrentPage = PageToShow If CurrentSubPage>0 Then ShowCurrentPage = CurrentSubPage End If If CurrentSubSubPage>0 Then ShowCurrentPage = CurrentSubSubPage End If GotPage = 0 If ShowCurrentPage>0 Then Set RScontent = Conn.Execute("SELECT pContent FROM PageContent WHERE pID=0" & ShowCurrentPage & " AND Datalength(pContent)>0 AND pActive=1") If NOT RScontent.eof Then GotPage = 1 Response.Write replace(replace("" & RScontent("pContent"),"",""),"","") End If RScontent.Close Set RScontent = Nothing End If 'If page was empty get first sub page If GotPage <> 1 AND CurrentPage>0 AND CurrentSubPage=0 Then Set RScontent = Conn.Execute("SELECT TOP 1 pContent FROM PageContent WHERE pParent=0" & CurrentPage & " ORDER BY pMenuOrder") If NOT RScontent.eof Then GotPage = 1 Response.Write replace(replace("" & RScontent("pContent"),"",""),"","") End If RScontent.Close Set RScontent = Nothing End If 'If page was empty get first sub page If GotPage <> 1 AND CurrentPage>0 AND CurrentSubPage>0 Then Set RScontent = Conn.Execute("SELECT TOP 1 pContent FROM PageContent WHERE pParent=0" & CurrentSubPage & " ORDER BY pMenuOrder") If NOT RScontent.eof Then GotPage = 1 Response.Write replace(replace("" & RScontent("pContent"),"",""),"","") End If RScontent.Close Set RScontent = Nothing End If If CurrentPage=0 Then Set RScontent = Conn.Execute("SELECT pContent FROM PageContent WHERE pIsDefault=1 AND pActive=1 ORDER BY NewID()") If NOT RScontent.eof Then GotPage = 1 Response.Write replace(replace("" & RScontent("pContent"),"",""),"","") End If RScontent.Close Set RScontent = Nothing End If %>