// ---------------- for testing only start
function setWebTrendTestCookie(){
  var dt = new Date();
  var sCookie = "WT_FPC=" + 
                "id=172.22.112.102-1670850736.29942234:lv=1215625801705:ss=1215625801705";
  dt.setDate( dt.getDate() + 90 );
  sCookie += ";expires=" + dt.toGMTString();
  sCookie += ";path=/" + ""; //";domain=.legalzoom.com";
  document.cookie = sCookie;
}
function clearWebTrendTestCookie(){
  var cookie_date = new Date ( );  // current date & time
  cookie_date.setTime ( cookie_date.getTime() - 1 );
  document.cookie = "WT_FPC=; expires=" + cookie_date.toGMTString();
}
// ---------------- for testing only end

var sLWTBNName = "lwtBN";
var iLWTBNCampaignIndex = 0;
var iLWTBNRecipeIndex = 1;

var iLWTBNCampaign = 0;

var iLWTBNRecipeControl = 0;
var iLWTBNRecipePathA = 1;
var iLWTBNRecipePathB = 2;

function firstVisit(){
  var sCookies = document.cookie;
  var bOut = sCookies.match( /WT_FPC=/gim )? false: true;
  return bOut;
}

function setLastWillBuyNowCookie( iCampaign, iRecipe ){
  var bFirstVisit = firstVisit();
  var dt = new Date();
  var sCookie = sLWTBNName + "=";
  if ( bFirstVisit ){
    dt.setDate( dt.getDate() + 90 );
    sCookie += iCampaign + "|" + iRecipe;
    sCookie += ";expires=" + dt.toGMTString();
    sCookie += ";path=/" + ""; //";domain=.legalzoom.com";
    document.cookie = sCookie;
  }
}
function getLastWillBuyNowRecipe(){
  var saCookies = document.cookie.split( ";" ); 
  var sCookie = sCookies? sCookies.match( reCookie ): null;
  var saFields = "";
  var iOut = -1;
  if ( sCookie ){
    saFields = String( sCookie ).replace( new RegExp( sLWTBNName + "=", "gim" ), "" ).split( "|" );
    if ( saFields.length > iLWTBNRecipeIndex ){
      iOut = saFields[ iLWTBNRecipeIndex ];  
    }
  }
  return iOut;
}
