Here's an example using vbscript. I'm sure you can replace it with javascript and it will work as well. You query the db on each refresh, correct? If a certain criterial is met you want the popup. What happens here is that if the condition is met I force the execution through a patch of client-side script that opens a new window.
Set Conn = Server.CreateObject("Adodb.Connection"

Conn.open myConnString
strSql = "SELECT YourColumn FROM tbl_YourTable WHERE YourColumn = Whatever"
set rs=Conn.execute(strSql)
if not rs.eof then%>
<script language="vbscript">
strOptions = "toolbar=No, location=no, directories=no, "
strOptions = strOptions & "status=no, menubar=no, scrollbars=yes, "
strOptions = strOptions & "resizable=Yes, width=350, height=300"
Window.Open "YourPopupPage.asp","myNewWindow",strOptions
</script>
<%end if
set rs=nothing
conn.close
set conn=nothing
%>