// 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
//
// Project    > dmClubNewYear08:C37
// Copyright  > (C) Digital Mail Limited (2005-2008)
// 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 = 9111;

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

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

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

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

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

// Test
/*
dmb1_STPS.add_apple = function()
{
	tst_additional_params.tstZ = 'APPLE';
}
*/

// -------------------------------------------------------------------------------------------------
// Add dmABS specific 'debug' param, if it is defined in the dmx_debug_settings cookie (JSON)
/*
dmb1_STPS.add_tstd = function()
{
	
	if (!dmb1_firstpage) return -1;
	var json_debug = dmb1_get_cookie('dmx_debug_settings');
	try
	{
		var debug = json_debug ? eval('(' + json_debug + ')') : new Object;
	}
	catch(err)
	{
		return false;
	}
	if (debug.send_tstd && debug.tstd) tst_additional_params.tstd = debug.tstd;
}
*/

// -------------------------------------------------------------------------------------------------

// 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;
	tst_additional_params.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)
	{
		tst_additional_params.google_search = dmb1_pagedata.ref.params.q;
	}
	else
	{
		tst_additional_params.google_search = '';
	}
}
*/
