/**
 * @title Statistics configuration for Electrical Wiki 
 * @author DENIS ROUSSEAU
 * @version 1.4.1.1
 */
/*****************************************************************************
* Xiti default settings (not mandatory): used when no settings below for current page 
******************************************************************************/
xtsd = '' ;
xtsite = '' ;
xtn2 = '';
xtpage = '';
/*****************************************************************************
* Google Analytic default account (not mandatory): used when no setting below for current page
******************************************************************************/
gasiteID = '' ;

/*****************************************************************************
* General settings
******************************************************************************/
/* Common path to be removed from URI before mapping (without end slash), remove next folder if required */
STAT_PathRemover = {Common:'', Next:false};
/* Decide for whole site if content markers are raised Asynchronously (true) or Synchronously (false) */
/* Preview is set to true to force getStatPreviewMap using */ 
STAT_Method = {Async:true, Preview:true};
/* Xiti sources relative path */
STAT_XitiSrc = {Sync:wgScriptPath+'/skins/stat/xtcore.js', Async:wgScriptPath+'/skins/stat/xtcore.js', Clicks:wgScriptPath+'/skins/stat/xtclicks.js'};
/*****************************************************************************
* Settings maps
******************************************************************************/
/* Retrieve only site accounts */
function getStatGlobalMap()
{
    var sm = [] ;
	/*-----------------------------------------------------------------------------------
	* Path pattern (without last slash), GA Site ID (if any), xiti server (xtsd), xiti Site ID (xtsite)
	* Notes: 
	* > None are mandatory, but if xiti server or xiti site ID are missing without default values defined above, no tag is raised
	*-----------------------------------------------------------------------------------*/
    sm.push(['*', 'UA-15019531-1', 'http://logi118', '446539']);
 	/*----------------------------------------------------------------------------------*/
    return sm;
}
/* Retrieve all settings, or only level 2 and pages (when site account are already set globally or in getStatGlobalMap) */
/*****************************************************************************
* Settings map
******************************************************************************/
function getStatSettingsMap()
{
    var sm = [] ;
	/*-----------------------------------------------------------------------------------
	* URL pattern (whole or part, without extension neither last slash), GA Site ID (if any), xiti server (xtsd), xiti Site ID (xtsite), xiti Level 2 (xtn2), chapters::pageName (xtpage)
	* Notes: 
	* > None are mandatory, but if xiti server or xiti site ID are missing without default values defined above, no tag is raised
	* > To exclude content tag while allowing click tags, put '!' in one of Xiti parameters (xtsd, xtsite or xtpage)
	* > Start by most complete path (specific cases), then decrease up to shorter paths (common cases)
	*   Example: /support will map /support/* except /support/others if declared above
	* > Don't write last slash: "/ww/en" will map "/ww/en/" too
	*-----------------------------------------------------------------------------------*/
	sm.push(['/enwiki', '', '', '', '1']); // English
	sm.push(['/frwiki', '', '', '', '2']); // French
	sm.push(['/eswiki', '', '', '', '3']); // Spanish
	sm.push(['/ruwiki', '', '', '', '4']); // russian
	sm.push(['/enw', '', '', '', '1']); // English
	sm.push(['/frw', '', '', '', '2']); // French
	sm.push(['/esw', '', '', '', '3']); // Spanish
	sm.push(['/ruw', '', '', '', '4']); // russian
	sm.push(['*', '', '', '', '102']); // default (miscellaneous)
	/*----------------------------------------------------------------------------------*/
    return sm;
}

function getStatPreviewMap()
{
    var pm = [] ;
	/*----------------------------------------------------------------------------------
	 * Xiti site ID, preview ID, preview server, GA preview ID
	 *----------------------------------------------------------------------------------*/
	var h = window.location.hostname ;
	/* if we're not on production server */
	if (h.indexOf('electrical-installation.org') < 0 || h.indexOf('sqe') >= 0 || h.indexOf('int') >= 0 || h.indexOf('dev') >= 0)
	{
		pm.push(['*', '485382', 'http://logi241']); // default 
	}
	return pm ;	
}

function getStatSecuredServerMap()
{
    var pm = [] ;
	/*----------------------------------------------------------------------------------
	 * http server, https server   
	 *----------------------------------------------------------------------------------*/
    pm.push(['http://logi118', 'https://logs177']); // default
    pm.push(['http://logi241', 'https://logs1241']); // default
	return pm ;	
}

function getStatDownloadMap()
{
    var pm = [] ;
	/*----------------------------------------------------------------------------------
	 * path, node (id or tag:class, default => document), extension1 | extension2 | ...    
	 *----------------------------------------------------------------------------------*/
    pm.push(['*', 'A:internal']); // default
	return pm ;	
}

function getStatExternalMap()
{
    var pm = [] ;
	/*----------------------------------------------------------------------------------
	 * path, node (id or tag:class, default => document)  
	 *----------------------------------------------------------------------------------*/
    pm.push(['*', 'A:external text']); // default
	return pm ;	
}

function getCustomLinkNodeName(node, type)
{
	var lpage = '' ;
	switch (type)
	{
	case 'S':
		lpage = xtpage + '::' + node.href.substr(node.href.indexOf('://') + 3);
		break ;
	default:
		lpage = stat_link.getLinkName(node.href, type) ;
		break ;
	}
	return lpage ;
}




