// dmb1_options.js
// -----------------------------------------------------------------------------
// The TST options file: Set dealer ID
// and - optionally - set debugging options, and specify STPS plugin functions
// which append or override the data stored in the session log on the TST server
//
// Release    > 1.49.8
// Project    > dmClubAutumn06:S01_C32
// Changedate > 11-10-07
// Copyright  > (C) Digital Mail Limited (2005-2007)
// Author     > RAK for DML
// -----------------------------------------------------------------------------

// Set dealer ID
// Note that this can be over-ridden by dealer ID set in dmx_options.php
dmb1_dealer_id = 6781;

// Safe hosts array
// A list of additional hosts it's safe to pass the tst session reference to
dmb1_safehosts = ['www.dmclub.net', 'my.dmclub.net'];

// -------------------------------------------------
// Debugging options
// -------------------------------------------------

// Mater debugging option, equivalent to setting all of the following to on if set to 1
dmb1_debug.master 			= 0;

// Debugging options - set to 0 (off) or 1 (on)
dmb1_debug.session_ref 	    = 0; // Debug session generation / retrieval
dmb1_debug.session_request 	= 0; // Debug session request 
dmb1_debug.salesref			= 0; // Debug the sales ref data
dmb1_debug.plugins          = 0; // Debug plugin functionality
dmb1_debug.fetch_param      = 0; // Debug parameter recovery from URL and/or embedded objects
dmb1_debug.init             = 0; // Debug Brand One page initialisation

// -------------------------------------------------
// STPS Plugin functions
// -------------------------------------------------

// EXAMPLE 1 : OVERRIDE THE MARKETING REFERENCE
// Override the marketing reference 'dmb1_mktref'
// by setting it directly
//
/*
dmb1_STPS.override_mktref = function() {
	dmb1_mktref = 'My Marketing Camplain!';
}
*/

// EXAMPLE 2 : EXTRACT GOOGLE SEARCH KEYWORDS
// If the referring host was one of the 'google' sites
// extract search keywords from the referring URL,
// setting an extra property 'dmb1_salesref.google_search'.
// Otherwise set this to an empty string.
//
// Note that google search terms are stored in the 'q' parameter of the referring URL
/*
dmb1_STPS.google = function() {
	if (!dmb1_firstpage) return -1;
	dmb1_salesref.google_search = dmb1_pagedata.ref.host.toLowerCase().indexOf('google') != -1 && !dmb1_salesref ? dmb1_pagedata.ref.params.q : '';
}
*/

// EXAMPLE 2 (ALTTERNATIVE) : EXTRACT GOOGLE SEARCH KEYWORDS
// (alternative syntax, does the same as previous example)
/*
dmb1_STPS.google = function() {
	if (!dmb1_firstpage) return -1;
	var host = dmb1_pagedata.ref.host.toLowerCase();
	if (host.indexOf('google') != -1) {
		dmb1_salesref.google_search = dmb1_pagedata.ref.params.q;
	} else {
		dmb1_salesref.google_search = '';
	}
}
*/

// EXAMPLE 3 : ADD A TIMESTAMP TO THE SALES REF
// Add the current time in seconds since Jan 1, 1970
// (the Unix epoch) by defining a new property
// 'dmb1_salesref.unix_time'.
//
// Since this is computed when a visitor first enters
// your site, it could be used to examine the interval
// between a visitor 'landing' and buying something.
/*
dmb1_STPS.time = function() {
	var d = new Date();
	dmb1_salesref.unix_time = parseInt(d.getTime() / 1000);
}
*/
