// If the affiliate ID has been passed in via a URL, save it in a cookie.
//
// Before using this routine, you must also have included the
// JavaScript file fsc_cookies.js.

// Set the affiliate ID.
//
// To use this, call this routine as part of the onLoad function
// in the <body> statement.
//
// The affiliate ID is passed in as part of the query string, like this:
//
//   http://www.firststep.com.au/fred.html?aff-blah
//
// (where "blah" is the affiliate ID).

function setAffiliate()
{
  var query = window.location.search.substring(1);
  var vars = query.split("-");

  if (vars[0] == "aff")
  {
    var now = new Date();
    fscfixDate(now);
    now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
    fscdeleteCookie("fscaffiliate");
    fscsetCookie("fscaffiliate", vars[1], now, "/");
  }
}

