I have been tasked with creating a popup warning window for my day job. I was able to find some dhtml code that does this quite nicely, however, I cannot get it to do 1 task that is needed. If the user does not agree with the terms, then they are sent somewhere else.

I have posted both pages below if anyone can help. Both pages are Cold Fusion pages with some JS mixed in.

Can anyone offer any help?

Thanks

Chris

PHP Code:
Page 1:

<
html>
<
head>
    <
title>WARNING! FOR OFFICIAL USE ONLY</title>
<
script>
// set the popup window width and height
var windowW=500 // wide
var windowH=550 // high

// set the screen position where the popup should appear
var windowX = (screen.width/2)-(windowW/2);
var 
windowY = (screen.height/2)-(windowH/2);

// set the url of the page to show in the popup

var urlPop "warning_banner.cfm"

// set the title of the page

var title =  "WARNING! FOR OFFICIAL USE ONLY"

// set this to true if the popup should close
// upon leaving the launching page; else, false

var autoclose true

// ============================
// do not edit below this line
// ============================

"width="+windowW+",height="+windowH;
var 
beIE document.all?true:false

function openFrameless(){
  if (
beIE){
    
NFW window.open("","popFrameless","fullscreen,"+s)     
    
NFW.blur()
    
window.focus()       
    
NFW.resizeTo(windowW,windowH)
    
NFW.moveTo(windowX,windowY)
    var 
frameString=""+
"<html>"+
"<head>"+
"<title>"+title+"</title>"+
"</head>"+
"<frameset rows='*,0' framespacing=0 border=0 frameborder=0>"+
"<frame name='top' src='"+urlPop+"' scrolling=auto>"+
"<frame name='bottom' src='about:blank' scrolling='no'>"+
"</frameset>"+
"</html>"
    
NFW.document.open();
    
NFW.document.write(frameString)
    
NFW.document.close()
  } else {
    
NFW=window.open(urlPop,"popFrameless","scrollbars,"+s)
    
NFW.blur()
    
window.focus() 
    
NFW.resizeTo(windowW,windowH)
    
NFW.moveTo(windowX,windowY)
  }   
  
NFW.focus()   
  if (
autoclose){
    
window.onunload = function(){NFW.close()}
  }
}

function 
Declined_click(){
    
window.location('http://www.usps.com');
}
</script>
</head>

<body onload="openFrameless()">
<a href="javascript:openFrameless()">click here</a>
</body>
</html> 
PHP Code:
Page 2:

<
cfsetting showdebugoutput "no">

<
cfif IsDefined("agree") and agree eq 'y'>
<!--- 
What happens here? --->
<!--- 
Set accepted session cookie --->
<!--- 
Close Window --->
<
script>
top.window.close();
</script>
<cfelseif  IsDefined("agree") and agree eq 'n'>
<!--- What happens here? --->
<!--- Close Window --->
<!--- Force the user to go to X URL --->
<script>
alert('You are supposed to go somewhere now.  But it\'s not working. :(');
//window.opener.execScript('Declined_click()', 'javascript');
top.window.close();
</script>

</cfif>

<html>
<head>
    <title>WARNING! FOR OFFICIAL USE ONLY</title>
<style>
body{
border: 4px solid #000000;
}
</style>
<script>
function stayontop(){ //Brings the current window on top of others
    self.focus();
    setTimeout("stayontop()", 1000); //1000 = 1 sec
}
</script>
</head>
<body>
<br>
<table cellspacing="0" cellpadding="0" border="0" align="center">
<tr>
<td colspan="2">
<font face="Helvetica, verdana, arial">
<center><b>WARNING! FOR OFFICIAL USE ONLY</b></center><br><br>
This is a U.S. Government computer system and is intended<br>
for official and other authorized use only.  Unauthorized access<br>
or use of this system may subject violators to administrative<br>
action, civil, and/or criminal prosecution under the United<br>
States Criminal Code (Title 18 U.S.C &sect; 1030).<br><br>

All information on this computer system may be monitored,<br>
intercepted, recorded, read, copied, or captured and disclosed<br>
by and to authorized personnel for official purposes, including<br>
criminal prosecution.  <b>You have no expectations of privacy<br>
using this system.</b><br><br>

Any authorized or unauthorized use of this computer system<br>
signifies consent to and comploance with postal service policies<br>
and these terms.<br><br></font>
</td>
</tr>
<tr>
<td align="center"><font face="Helvetica, verdana, arial"><a href="./warning_banner.cfm?agree=y" target="_self">I agree</a></font></td>
<td align="center"><font face="Helvetica, verdana, arial"><a href="./warning_banner.cfm?agree=n" target="_self" onClick>I disagree</a></font></td>
</tr>
</table>
</body>
</html>