// Pop-up windows

// Before including this file, set these variables:
//
// var fscPopupCookie = "fscEzine";	// Name of pop-up cookie
// var fscPopupURL = "http://blah ...";	// URL of pop-up window
// var fscPopupWidth = 420;		// Width of pop-up window
// var fscPopupHeight = 420;		// Height of pop-up window
// var fscPopupWait = 1;		// How long (in seconds) to wait before the pop-up
// var fscPopupExpiry = 30;		// How long (in days) to keep the cookie that prevents repeat pop-ups

function fscOpenWindow()
{
  preview = window.open(fscPopupURL, "preview", "left=50,top=50,width=" + fscPopupWidth + ",height=" + fscPopupHeight + ",status=no,directories=no,location=no,toolbar=no,menubar=no,scrollbars=yes,resizable");
}

function fscPopup()
{
  if (fscgetCookie(fscPopupCookie)=='')
  {
    fscsetCookie(fscPopupCookie, "first", now, "/");

    if (fscgetCookie(fscPopupCookie)=='')
    {
      return;
    }
  }

  if (fscgetCookie(fscPopupCookie)=='first')
  {
    if (fscPopupWait == 0)
    {
      fscOpenWindow();
    }
    else
    {
      timer = setTimeout("fscOpenWindow()", fscPopupWait*1000);
    }
    var now = new Date();
    fscfixDate(now);
    now.setTime(now.getTime() + fscPopupExpiry * 24 * 60 * 60 * 1000);
    fscsetCookie(fscPopupCookie, "done", now, "/");
  }
}

// Specific entry pop-up and exit pop-up
//
// To use this on your Fast Forward site:
//
// Add these lines to the <head> of your document:
//
//   <!-- POPUP -->
//   <script language="JavaScript" src="http://www.eservice.com.au/fsc_popup.js"></script>
//
// Optionally, add these lines to modify the pop-up behaviour:
//
//   <script language=JavaScript>
//   fscEPopupWidth = 600;      (defaults to 600 pixels)
//   fscEPopupHeight = 400;     (defaults to 400 pixels)
//   fscEPopupExpiry = 90;      (defaults to 90 days)
//   fscEPopupWait = 30;	(defaults to 30 seconds)
//   fscXPopupWidth = 600;      (defaults to 600 pixels)
//   fscXPopupHeight = 400;     (defaults to 400 pixels)
//   fscXPopupExpiry = 90;      (defaults to 90 days)
//   </script>
//
// Then, in the <body> tag, add this:
//
//   <body onLoad="fscEpopup()" onUnload="fscXpopup()" ...>
//
// Then make sure you have this setting in your proj_common.cfg file:
//
//   $fsc_smart_text_extra_a_tag = qq~onClick="xpop=0"~;
//
// Also make sure that all links in your template file are like this:
//
//   <a href="xxx" onclick="xpop=0" ...>

var xpop=1;

var fscEPopupCookie = "";
var fscEPopupURL = "";
var fscEPopupWidth = 600;
var fscEPopupHeight = 400;
var fscEPopupExpiry = 90;
var fscEPopupWait = 30;

function fscEpopup()
{
  if (fscEPopupCookie != "")
  {
    fscPopupURL		= fscEPopupURL;
    fscPopupCookie	= fscEPopupCookie;
    fscPopupWait	= fscEPopupWait;
    fscPopupWidth	= fscEPopupWidth;
    fscPopupHeight	= fscEPopupHeight;
    fscPopupExpiry 	= fscEPopupExpiry;
    fscPopup();
  }
}

var fscXPopupCookie = "";
var fscXPopupURL = "";
var fscXPopupWidth = 600;
var fscXPopupHeight = 400;
var fscXPopupExpiry = 90;

function fscXpopup()
{
  if (fscXPopupCookie != "")
  {
    fscPopupURL		= fscXPopupURL;
    fscPopupCookie	= fscXPopupCookie;
    fscPopupWait	= 0;
    fscPopupWidth	= fscXPopupWidth;
    fscPopupHeight	= fscXPopupHeight;
    fscPopupExpiry 	= fscXPopupExpiry;
    fscPopup();
  }
}


