/***********************************************************************
 * JavaScript Document
 * Author: Jeff Ammon
 * ©2007-2010 AAA ®All Rights Reserved
 ***********************************************************************
 * AAA_ActionTags.js
 * $LastChangedRevision: 6464 $: 
 * $LastChangedDate: 2012-01-18 13:36:15 -0500 (Wed, 18 Jan 2012) $:
 * $LastChangedBy: jammon $:
 ***********************************************************************/
 
// National Office Club Id
var NO_CLUB_ID = "999";

// Currency Codes
var CURRENCY_USD = "840";

// Page Actions
var ACTION_MBRSHP = "2345";
var ACTION_TEEN_DRIVING = "2346";
var ACTION_TRAVEL_BOOKING = "2706";
var ACTION_ZIP_REDIRECT = "2344";

// Membership Acquisition Benefit Levels
var MBRSHP_BASIC = "Basic";
var MBRSHP_PLUS = "Plus";
var MBRSHP_PREMIER = "Premier";

// Membership Acquisition Transaction Types
var MBRSHP_NEW = "New";
var MBRSHP_ADD_ASSOCIATE = "AddAssociate";
var MBRSHP_GIFT = "Gift";
var MBRSHP_TRANSFER = "Transfer";
var MBRSHP_RENEWAL = "Renewal";
var MBRSHP_UPGRADE = "Upgrade";
var MBRSHP_OTHER = "Other";

// Travel Reservation Booking Types
var TRAVEL_ACTIVITY = "Activity";
var TRAVEL_AIR = "Air";
var TRAVEL_CAR = "Car";
var TRAVEL_CRUISE = "Cruise";
var TRAVEL_HOTEL = "Hotel";
var TRAVEL_PACKAGE = "Package";

// Global variables and accessors for the OO look and feel...
var _salesAmount;         //  the amount associated with the sales transaction
var _salesType;           //  the sales type (i.e. AIR, CAR, HOTEL, MEMBERSHIP)
var _protocol;            //  the protocol being used, http or https
var _serverAndPath;       //  the server and path that we are logging SEMActions to

var io = new Array();
io[0] = new Image();
io[1] = new Image();

var pageAction, price, sku, order_code, currency_id, user_defined1, user_defined2, user_defined3, user_defined4, ic_cat, ic_bu, ic_bc, ic_ch, ic_nso, altid, ic_type, urlA, prefix;

function pixel()
{
  var icstring =".ic-live.com/goat.php?cID=1639&cdid=5189&campID=8";
  var refVar = (document.referrer);
  var locURL = location.href;
  var locHttp = locURL.split(":")[0];

  if (!pageAction) { pageAction = 0; };
  if (!price) { price=""; }
  if (!sku) { sku=""; }
  if (!order_code) { order_code=""; }
  if (!user_defined1) { user_defined1=""; }
  if (!user_defined2) { user_defined2=""; }
  if (!user_defined3) { user_defined3=""; }
  if (!user_defined4) { user_defined4=""; }
  if (!currency_id) { currency_id=""; }
  if (!ic_bu) { ic_bu=""; }
  if (!ic_bc) { ic_bc=""; }
  if (!ic_ch) { ic_ch=""; }
  if (!ic_nso) { ic_nso=""; }
  if (!altid) { altid=""; }
  if (!ic_cat) { ic_cat=""; }
  if (!ic_type) { ic_type=""; }
  if (locHttp.toLowerCase( ) == "https")  { prefix="https://www"+icstring+"";}
  if (locHttp.toLowerCase( ) == "http")  { prefix="http://1639"+icstring+"";}

  if (pageAction > 0) {
    urlA = prefix+"&convID="+pageAction+"&convP="+price+"&curID="+currency_id+"&ordID="+escape(order_code)+"&ud1="+escape(user_defined1)+"&ud2="+escape(user_defined2)+"&ud3="+escape(user_defined3)+"&ud4="+escape(user_defined4)+"&ic_cat="+escape(ic_cat)+"&ic_type="+escape(ic_type)+"&ic_bu="+escape(ic_bu)+"&ic_bc="+escape(ic_bc)+"&ic_ch="+escape(ic_ch)+"&ic_nso="+escape(ic_nso)+"&altid="+escape(altid)+"&sku="+escape(sku)+"&refVar="+escape(refVar);
  } else {
    urlA = prefix+"&ic_cat="+escape(ic_cat)+"&ic_type="+escape(ic_type)+"&ic_bu="+escape(ic_bu)+"&ic_bc="+escape(ic_bc)+"&ic_ch="+escape(ic_ch)+"&ic_nso="+escape(ic_nso)+"&altid="+escape(altid)+"&refVar="+escape(refVar);
  } 
  io[0].src = urlA;
}
// pixel();

function setSalesAmount(salesAmount) {
  _salesAmount = salesAmount;
}

function getSalesAmount() {
  return (_salesAmount == null ? "" : _salesAmount);
}

function setSalesType(salesType) {
  _salesType = salesType;
}

function getSalesType() {
  return (_salesType == null ? "" : _salesType);
}

function setProtocol(protocol) {
  _protocol = protocol;
}

function getProtocol() {
  return _protocol;
}

function setServerAndPath(serverAndPath) {
  _serverAndPath = serverAndPath;
}

function getServerAndPath() {
  return _serverAndPath;
}

function setURLBase(protocol, serverAndPath) {
    setProtocol(protocol);
    setServerAndPath(serverAndPath);
}

//  computational getter
function getURLBase() {
  return _protocol+"://"+_serverAndPath;
}

//  Setup the above for use by clubs - they will not be setting 
//  the server and path so we do it here,
//  a test server that does not exist
//setServerAndPath("theserver/action");
//  developers test
//setServerAndPath("sflatley/action");
// production
setServerAndPath("switch.atdmt.com/action");

//  set the protocol to the one being used
setProtocol("http"+(window.location.protocol.indexOf('https')==0?'s':''));
    
// private function to support client side waits
function pause(millis)
{
  var date = new Date();
  var curDate = null;

  do
  {
    curDate = new Date();
  }
  while(curDate-date < millis);
}

// private function logPage(p_action)
// private function logPage(p_action, p_clubId, p_customerId, p_type, p_salesAmount, p_quantity)
// Logs a page for the p_action and the other parameters passed.
function logPage() {

  switch(logPage.arguments.length) {
  
    case 1:
      var _url = buildURL(logPage.arguments[0]);
      requestImage(_url);
      return _url;
  
    case 6:
      var _url = buildURL(logPage.arguments[0], logPage.arguments[1], 
              logPage.arguments[2], logPage.arguments[3], 
              logPage.arguments[4], logPage.arguments[5]);
      requestImage(_url);
      setSalesAmount(logPage.arguments[5]);
      setSalesType(logPage.arguments[3]);

      if (logPage.arguments[0] == "AAA_LP_Membership_Confirmation_ED") {
          logAESMembershipConfirmation(logPage.arguments[1], logPage.arguments[5]);
      }
      
      else if (logPage.arguments[0] == "AAA_LP_Zip_Code_ReDirect_ED") {
          logZipRedirect(logPage.arguments[1]);
          pause(500);
      }
      
      return _url;
  
    case 7:
      var _url = buildURL(logPage.arguments[0], logPage.arguments[1], 
              logPage.arguments[2], logPage.arguments[3], 
              logPage.arguments[4], logPage.arguments[5]);
      requestImage(_url);
      setSalesAmount(logPage.arguments[5]);
      setSalesType(logPage.arguments[3]);
      return _url;
      
    default: 
      return "Error: logPage() - invalid number of arguments";
  }
}

//  private function getExtendedDataPath()
//  Define and return the extended data path 
function getExtendedDataPath() {
  return "/v3/ato.ClubID/atm1.Quantity/atm2.Sales/atc1.Type/atc2.CustomerID";
}

//  private function buildURL(p_action)
//  private function buildURL(p_action, p_clubId, p_customerId, p_type, p_quantity, p_salesAmount)
//
//  builds a URL using getURLBase(), the local variable _extendedData and the parameters passed

function buildURL() {

  switch (buildURL.arguments.length) {
  
    case 1:
      //  Note that we need so add the slash.
      //return  getURLBase()+ "/" + buildURL.arguments[0];
            return getURLBase()+"/"+buildURL.arguments[0];
            
    case 6:

      var _extendedData = getExtendedDataPath();
  
      //  replace clubID, CustomerID, Type, Quantity and Sales literals with parameter values
      _extendedData = _extendedData.replace("ClubID", buildURL.arguments[1]);
      _extendedData = _extendedData.replace("CustomerID", handleCharString(buildURL.arguments[2]));
      _extendedData = _extendedData.replace("Type", handleCharString(buildURL.arguments[3]));
      _extendedData = _extendedData.replace("Quantity", handleNumeric(buildURL.arguments[4]));
      _extendedData = _extendedData.replace("Sales", handleNumeric(buildURL.arguments[5]));

      //  combine the base URL with the action and extended data and return it
      return getURLBase() + "/" + buildURL.arguments[0] + _extendedData;

    default: 
      return "Error:  buildURL()- invalid number of arguments";
  }
}

//  changes parameter to "0" if empty
function handleNumeric(p_numeric) {
  if (p_numeric == "") {
    return "0"; 
  }
  else {
    return p_numeric;
  }
}

//  changes parameter to "NULL" if empty
function handleCharString(p_charstring) {
  if (p_charstring == "") {
    return "NULL";  
  }
  else {
    return p_charstring;
  }
}

//  private function requestImage(p_URL)
//    Write an image located at p_URL to memory.  This event is logged
//    at the p_URL"s web server and should result in a http 404 error.
function requestImage(p_URL) {
    var _imgarray = new Array; 
  var _imagePointer = 0;
  _imgarray[_imagePointer] = new Image;
  _imgarray[_imagePointer].src = p_URL;
}

//  public function logHomePage()
function logHomePage() {
  return logPage("AAA_LP_Home_Page");
}

//  public function logMaps(p_clubId)
//  public function logMaps(p_clubId, p_customerId)
//      Logs the action AAA_LP_Maps_ED for the p_clubId and optional p_customerID
function logMaps() {
  switch (logMaps.arguments.length) {
    case 1:
      return logPage("AAA_LP_Maps_ED", 
          logMaps.arguments[0], "NULL", "NULL", "0", "0");
    case 2:
      return logPage("AAA_LP_Maps_ED", 
          logMaps.arguments[0], logMaps.arguments[1], "NULL", "0", "0");
    default:
      return "Error:  invalid number of arguments";
  } 
}

//  public function logQuickFinder(p_clubId) {
//     Logs the action AAA_LP_QuickFinder_ED for the p_club_id 
function logQuickFinder(p_clubId) {
  return logPage("AAA_LP_QuickFinder_ED",
            p_clubId, "NULL", "NULL", "0", "0");
}

//  public function logZipCodeRedirect(p_clubId) {
//     Logs the action AAA_LP_Zip_Code_ReDirect_ED for the p_club_id 
function logZipCodeRedirect(p_clubId) {
    return logPage("AAA_LP_Zip_Code_ReDirect_ED",
            p_clubId, "NULL", "NULL", "0", "0");
}

//  public function logClubVisitorRedirect(p_clubId) {
//     Logs the action AAA_LP_Club_Visitor_ReDirect_ED for the p_club_id 
function logClubVisitorRedirect(p_clubId) {
  return logPage("AAA_LP_Club_Visitor_ReDirect_ED",
            p_clubId, "NULL", "NULL", "0", "0");
}

function logZipRedirect() {
        // Begin iCrossing Implementation
        pageAction = ACTION_ZIP_REDIRECT; // 2344 = Association Zip Redirect
        
        // Set the club id
        if (logZipRedirect.arguments[0] != null) {
            sku = logZipRedirect.arguments[0];
        } else {
          sku = "";
        }
        
        // Log the data associated with the transaction
        pixel();
        // End iCrossing Implementation

    // Start of DoubleClick Floodlight Tag: Please do not remove
    // Activity name of this tag: AAA National - Visitors
    // URL of the webpage where the tag is expected to be placed: http://tbd.com
    // This tag must be placed between the <body> and </body> tags, as close as possible to the opening tag.
    // Creation Date: 04/01/2011

    var axel = Math.random() + "";
    var a = axel * 10000000000000;
    
    io[1].src = location.protocol + "//fls.doubleclick.net/activityi;src=3153617;type=gener841;cat=aaana449;u4=" + sku + ";ord=1;num=" + a + "?";

    // End of DoubleClick Floodlight Tag: Please do not remove

}

function logTeenDriving() {
  // Begin iCrossing Implementation
  pageAction = ACTION_TEEN_DRIVING; // 2346 = Teen Driving

  sku = NO_CLUB_ID;     // 999 = National Office

  // Set the state identifier
  if (logTeenDriving.arguments[0] != null) {
      user_defined1 = logTeenDriving.arguments[0];
  }

  // Set the site identifier
  if (logTeenDriving.arguments[1] != null) {
    user_defined2 = logTeenDriving.arguments[1];
  }
  
  // Set the section identifier
  if (logTeenDriving.arguments[2] != null) {
      user_defined3 = logTeenDriving.arguments[2];
  }
  
  // Set the page title
  if (logTeenDriving.arguments[3] != null) {
      user_defined4 = logTeenDriving.arguments[3];
  }

  // Log the data associated with the transaction
  pixel();
  // End iCrossing Implementation
        
  // Start of DoubleClick Floodlight Tag: Please do not remove
  // Activity name of this tag: Generic Teen Driver landing page
  // URL of the webpage where the tag is expected to be placed: http://teendriving.aaa.com/map/
  // This tag must be placed between the <body> and </body> tags, as close as possible to the opening tag.
  // Creation Date: 10/26/2011

  var axel = Math.random() + "";
  var a = axel * 10000000000000;

  io[1].src = location.protocol + "//fls.doubleclick.net/activityi;src=3153617;type=teend917;cat=state467;u3=" + escape(user_defined3) + ";u1=" + escape(user_defined1) + ";u2=" + escape(user_defined4) + ";u12=" + escape(user_defined2) + ";ord=" + a + "?";

  // End of DoubleClick Floodlight Tag: Please do not remove
       
}

//  public function logMembershipStart(p_clubId) {
//     Logs the action AAA_LP_Membership_Start_ED for the p_club_id 
function logMembershipStart(p_clubId) {
  return logPage("AAA_LP_Membership_Start_ED",
            p_clubId, "NULL", "NULL", "0", "0");
}

function logAESMembershipConfirmation() {
        // Begin iCrossing Implementation
        pageAction = ACTION_MBRSHP; // 2345 = Membership Acquisition
        currency_id = CURRENCY_USD;   // 840 = US Dollar
                
        // Set the club id
        if (logAESMembershipConfirmation.arguments[0] != null) {
            sku = logAESMembershipConfirmation.arguments[0];
        }
        
        // Set the price in 00.00 format
        if (logAESMembershipConfirmation.arguments[1] != null) {
            price = logAESMembershipConfirmation.arguments[1];
        }
        
        // Log the data associated with the transaction
        pixel();
        // End iCrossing Implementation
}

// public function logMembershipConfirmation(p_clubId, p_customerId, p_salesAmount) 
// public function logMembershipConfirmation(p_clubId, p_salesAmount) {
//      Logs the action AAA_LP_Membership_Confirmation_ED for the given parameters
function logMembershipConfirmation() {
        // Begin iCrossing Implementation
        pageAction = ACTION_MBRSHP; // 2345 = Membership Acquisition
        currency_id = CURRENCY_USD;   // 840 = US Dollar
                
        // Set the club id
        if (logMembershipConfirmation.arguments[0] != null) {
            sku = logMembershipConfirmation.arguments[0];
        } else {
          sku = "";
        }
        
        // Set the price in 00.00 format
        if (logMembershipConfirmation.arguments[1] != null) {
            price = logMembershipConfirmation.arguments[1];
        } else {
          price = "";
        }
        
        // Set the order id
        if (logMembershipConfirmation.arguments[2] != null) {
            order_code = logMembershipConfirmation.arguments[2];
        } else {
          order_code = "";
        }
        
        // Set the member benefit level
        if (logMembershipConfirmation.arguments[3] != null) {
            user_defined1 = logMembershipConfirmation.arguments[3];
        } else {
          user_defined1 = "";
        }
        
        // Set the number of primary members
        if (logMembershipConfirmation.arguments[4] != null) {
        user_defined2 = logMembershipConfirmation.arguments[4];
        } else {
          user_defined2 = "";
        }
  
  // Set the number of associate members
  if (logMembershipConfirmation.arguments[5] != null) {
      user_defined3 = logMembershipConfirmation.arguments[5];
    } else {
      user_defined3 = "";
    }
  
  // Set the transaction type
  if (logMembershipConfirmation.arguments[6] != null) {
      user_defined4 = logMembershipConfirmation.arguments[6];
    } else {
      user_defined4 = "";
    }

  // Log the data associated with the transaction
  pixel();
  // End iCrossing Implementation


  // Start of DoubleClick Floodlight Tag: Please do not remove
  // Activity name of this tag: AAA National - Membership Conversions
  // URL of the webpage where the tag is expected to be placed: http://tbd.com
  // This tag must be placed between the <body> and </body> tags, as close as possible to the opening tag.
  // Creation Date: 04/12/2011

  io[1].src = location.protocol + "//fls.doubleclick.net/activityi;src=3153617;type=conve866;cat=aaana437;qty=1;cost=" + price + ";u4=" + sku + ";u5=" + order_code + ";u6=" + price + ";u7=" + user_defined1 + ";u8=" + user_defined2 + ";u9=" + user_defined3 + ";u10=" + user_defined4 + ";ord=" + order_code + "?";
  
  // End of DoubleClick Floodlight Tag: Please do not remove
        
  // Begin RazorFish Implementation
  // NOTE: This will be deprecated starting 1/1/11
  if (logMembershipConfirmation.arguments.length > 1) {
  return logPage("AAA_LP_Membership_Confirmation_ED",
         logMembershipConfirmation.arguments[0], "NULL", 
         "NULL",  "0", logMembershipConfirmation.arguments[1], "NULL");
  }
  else {
    return "error: logMembershipConfirmation: invalid number of arguments";
  }
  // End RazorFish Implementation
        
}

// public function logBookingStart(p_clubId) {
//    Logs the action AAA_LP_Booking_Start_ED for the p_clubId
function logBookingStart(p_clubId) {
  return logPage("AAA_LP_Booking_Start_ED", 
            p_clubId, "NULL", "NULL", "0", "0");
}

// public function logBookingConfirmation(p_clubId, p_bookingType, p_salesAmount) 
// public function logBookingConfirmation(p_clubId, p_customerId, p_bookingType, p_salesAmount)
//    Logs the action AAA_LP_Booking_Confirmation_ED for the parameters passed
function logBookingConfirmation() {
        // Begin iCrossing Implementation
        pageAction = ACTION_TRAVEL_BOOKING; // 2706 = Travel Reservations
        currency_id = CURRENCY_USD;     // 840 = US Dollar
                
        // Set the club id
        if (logBookingConfirmation.arguments[0] != null) {
            sku = logBookingConfirmation.arguments[0];
        } else {
          sku = "";
        }
        
        // Set the travel booking type
        if (logBookingConfirmation.arguments[1] != null) {
            user_defined1 = logBookingConfirmation.arguments[1];
        } else {
          user_defined1 = "";
        }
        
        // Set the price in 00.00 format
        if (logBookingConfirmation.arguments[2] != null) {
            price = logBookingConfirmation.arguments[2];
        } else {
          price = "";
        }

        if (logBookingConfirmation.arguments[3] != null) {
            order_code = logBookingConfirmation.arguments[3];
        } else {
          order_code = "";
        }
        
        // Log the data associated with the transaction
        pixel();
        // End iCrossing Implementation

    // Start of DoubleClick Floodlight Tag: Please do not remove 
    // Activity name of this tag: AAA National - Booking Conversion 
    // URL of the webpage where the tag is expected to be placed: http://tbd.com 
    // This tag must be placed between the <body> and </body> tags, as close as possible to the opening tag. 
    // Creation Date: 06/21/2011 

    io[1].src = location.protocol + "//fls.doubleclick.net/activityi;src=3153617;type=conve866;cat=aaana584;qty=1;cost=" + price + ";u4=" + sku + ";u6=" + price + ";u10=" + user_defined1 + ";ord=" + order_code + "?";

    // End of DoubleClick Floodlight Tag: Please do not remove
        
        
        // Begin RazorFish Implementation
        // NOTE: This will be deprecated starting 1/1/11
  switch(logBookingConfirmation.arguments.length) {
  
    case 3: 
      return logPage("AAA_LP_Booking_Confirmation_ED", 
            logBookingConfirmation.arguments[0], "NULL", 
            logBookingConfirmation.arguments[1], 
             "0", logBookingConfirmation.arguments[2]); 
    
    case 4:
      return logPage("AAA_LP_Booking_Confirmation_ED", 
            logBookingConfirmation.arguments[0], 
            logBookingConfirmation.arguments[1], 
            logBookingConfirmation.arguments[2], 
             "0", logBookingConfirmation.arguments[3]);
    
    default:
      return "error: logBookingConfirmation: invalid number of arguments";    
  }
        // End RazorFish Implementation
}

//  logBookingConfirmation convenience methods - one method for each booking type

// public function logBookingConfirmationAir(p_clubId, p_salesAmount)
// public function logBookingConfirmationAir(p_clubId, p_customerId, p_salesAmount)

function logBookingConfirmationAir() {

  switch (logBookingConfirmationAir.arguments.length) {
  
    case 2:
      return logBookingConfirmation(logBookingConfirmationAir.arguments[0], 
          "Air", 
          logBookingConfirmationAir.arguments[1]);
    case 3:
      return logBookingConfirmation(logBookingConfirmationAir.arguments[0], 
          logBookingConfirmationAir.arguments[1], "Air", 
          logBookingConfirmationAir.arguments[2]);
    default:
      return "error: logBookingConfirmationAir: invalid number of arguments"; 
  }
}

// public function logBookingConfirmationCar(p_clubId, p_salesAmount)
// public function logBookingConfirmationCar(p_clubId, p_customerId, p_salesAmount)

function logBookingConfirmationCar() {

  switch (logBookingConfirmationCar.arguments.length) {
  
    case 2:
      return logBookingConfirmation(logBookingConfirmationCar.arguments[0], 
          "Car", 
          logBookingConfirmationCar.arguments[1]);
    case 3:
      return logBookingConfirmation(logBookingConfirmationCar.arguments[0], 
          logBookingConfirmationCar.arguments[1], "Car", 
          logBookingConfirmationCar.arguments[2]);
    default:
      return "error: logBookingConfirmationCar: invalid number of arguments"; 
  }
}

// public function logBookingConfirmationHotel(p_clubId, p_salesAmount)
// public function logBookingConfirmationHotel(p_clubId, p_customerId, p_salesAmount)

function logBookingConfirmationHotel() {

  switch (logBookingConfirmationHotel.arguments.length) {
  
    case 2:
      return logBookingConfirmation(logBookingConfirmationHotel.arguments[0], 
          "Hotel", 
          logBookingConfirmationHotel.arguments[1]);
    case 3:
      return logBookingConfirmation(logBookingConfirmationHotel.arguments[0], 
          logBookingConfirmationHotel.arguments[1], "Hotel", 
          logBookingConfirmationHotel.arguments[2]);
    default:
      return "error: logBookingConfirmationHotel: invalid number of arguments"; 
  }
}


// public function logBookingConfirmationCruise(p_clubId, p_salesAmount)
// public function logBookingConfirmationCruise(p_clubId, p_customerId, p_salesAmount)

function logBookingConfirmationCruise() {

  // Begin Disney Month Campaign
  var disneyTag = new Image();
  var disneyURL = "https://view.atdmt.com/jaction/DCL_AAA_BookingEngine/v3/ato.ORDERID/[atm1.ClubID/atm2.Revenue]";

  //  replace Club ID and Sales literals with parameter values
  disneyURL = disneyURL.replace("ClubID", logBookingConfirmationCruise.arguments[0]);
  disneyURL = disneyURL.replace("Revenue", handleNumeric(logBookingConfirmationCruise.arguments[1]));
  disneyTag.src = disneyURL;
  // End Disney Month Campaign
  
  switch (logBookingConfirmationCruise.arguments.length) {
  
    case 2:
      return logBookingConfirmation(logBookingConfirmationCruise.arguments[0], 
          "Cruise", 
          logBookingConfirmationCruise.arguments[1]);
    case 3:
      return logBookingConfirmation(logBookingConfirmationCruise.arguments[0], 
          logBookingConfirmationCruise.arguments[1], "Cruise", 
          logBookingConfirmationCruise.arguments[2]);
    default:
      return "error: logBookingConfirmationCruise: invalid number of arguments";  
  }
}

// public function logBookingConfirmationPackage(p_clubId, p_salesAmount)
// public function logBookingConfirmationPackage(p_clubId, p_customerId, p_salesAmount)

function logBookingConfirmationPackage() {

  switch (logBookingConfirmationPackage.arguments.length) {
  
    case 2:
      return logBookingConfirmation(logBookingConfirmationPackage.arguments[0], 
          "Package", 
          logBookingConfirmationPackage.arguments[1]);
    case 3:
      return logBookingConfirmation(logBookingConfirmationPackage.arguments[0], 
          logBookingConfirmationPackage.arguments[1], "Package", 
          logBookingConfirmationPackage.arguments[2]);
    default:
      return "error: logBookingConfirmationPackage: invalid number of arguments"; 
  }
}

// -- end of booking confirmation convenience methods

//  public function logInsuranceStart(p_clubId)
//     Logs the action AAA_LP_Insurance_Start_ED for the p_clubId.
function logInsuranceStart(p_clubId) {
  return logPage("AAA_LP_Insurance_Start_ED",
            p_clubId, "NULL", "NULL", "0", "0");
}

//  public function logInsuranceConfirmation(p_clubId, p_insuranceType)
//  public function logInsuranceConfirmation(p_clubId, p_customerId, p_insuranceType)
//     Logs the action AAA_LP_Insurance_Confirmation_ED for the parameters passed.

function logInsuranceConfirmation() {
  switch (logInsuranceConfirmation.arguments.length) {
  
    case 2:
      return logPage("AAA_LP_Insurance_Confirmation_ED",
                logInsuranceConfirmation.arguments[0], "NULL", 
                logInsuranceConfirmation.arguments[1], "0", "0");
    case 3:
      return logPage("AAA_LP_Insurance_Confirmation_ED",
                logInsuranceConfirmation.arguments[0], 
                logInsuranceConfirmation.arguments[1], 
                logInsuranceConfirmation.arguments[2], "0", "0");
    default:
      return "error: logInsuranceConfirmation: invalid number of arguments";  
  }
}
