//Open a popup window with no nav etc. for the tour
function winopen(sURL) {
   window.open(sURL,null,"height=504,width=750,status=no,toolbar=no,menubar=no,location=no");
}
//Create an array of paramaters passed in on the url
var dURL=unescape(document.URL);
var x = dURL.indexOf('?');
var params = new Array();
if (x != -1) {
   var pairArray = dURL.substring(x+1, dURL.length).split('&');
   for (var i=0; i<pairArray.length; i++) {
      pair = pairArray[i].split('=');
      params[pair[0]] = pair[1];
   }
}
//If a coupon paramater was passed, set a 30 day cookie
if (typeof params["coupon"] != "undefined") {
  setMonthCookie("coupon",params["coupon"]);
}
//If a coupon paramater was passed, set a 30 day cookie (accept alternate parameter c)
if (typeof params["c"] != "undefined") {
  setMonthCookie("coupon",params["c"]);
}
//If the link was from an affialiate, set a 30 day cookie remembering that
if (typeof params["aid"] != "undefined") {
  setMonthCookie("aid",params["aid"]);
}
//Call the set cookie function passing in one month and a for the path
function setMonthCookie(name,value) {
  var now = new Date();
  now.setTime(now.getTime() + 30* 24 * 60 * 60 * 1000);
  setCookie(name,value,now,"/");
}
//Print the signup link, if they have a coupon, include that into the parameter, if sent from an affiliate, pass that into moderbill
function printlink(link_text) {
  var coupon = getCookie("coupon");
  var aid = getCookie("aid");
  var thelink = 'https://billing.e-jaz.com.au/order/?v=2' + ((coupon) ? "&coupon=" + coupon : "") + ((aid) ? "&aid=" + aid : "");
  document.write('<a href="' + thelink + '">' + link_text + '</a>');
}
var now = new Date();
now.setTime(now.getTime() + 24 * 60 * 60 * 1000);
setCookie("jr_to_gilletts","test",now,"/","ezytrack.com.au");
