var openedWin = null;

function launch() {
 var args = launch.arguments;
 var url = args[0];
 var width = args[1];
 var height = args[2];
 var params = '';
 if (!url || !width || !height) {
  alert("Error");
 } else {
  var NewX = Math.max(0, Math.floor((screen.availWidth - (width + 8)) / 2));
  var NewY = Math.max(0, Math.floor((screen.availHeight - (height + 27)) / 2));
  params += "width=" + width;
  params += ",height=" + height;
  params += ",screenx=" + NewX;
  params += ",screeny=" + NewY;
  params += ",left=" + NewX;
  params += ",top=" + NewY;
  params += ",scrollbars=" + (args[3] ? "yes" : "no");
  params += ",resizable=" + (args[3] ? "yes" : "no");
  params += ",location=" + (args[4] ? "yes" : "no");

  closeChild();

  openedWin = window.open(url, "", params + ",toolbar=no,menubar=no,status=no,directories=no" );
  }
 }

function closeChild() {
 if (openedWin !== null) {
   if (!openedWin.closed) {
   openedWin.close();
   }
  }
 }

function verifyEmail(form) {
 checkEmail = form.email.value;
 if ((checkEmail.indexOf('@') < 0) || ((checkEmail.charAt(checkEmail.length-4) != '.') && (checkEmail.charAt(checkEmail.length-3) != '.'))) {
  alert("Please enter a valid email address.");
  form.email.select();
  return false;
  }
 else {
  pop = 1;
  form.method="post";
  form.target="_self";
  form.action="http://www.couponcabins.com/optin/offers.php";
  form.submit();
  }
 }

onfiltered= closeChild;