/******************************************************************************
* @title Statistics customization functions
* @author DENIS ROUSSEAU
* @version 1.4.1.0.1
* @Note: All functions are optional. Unnecessary ones can be removed
******************************************************************************/

/**************************************************************
* Customize base path (window.location.pathname - common - next) to remove unsuitable folders or to add virtual folders
*/
function getCustomPath(sp, isGlobal)
{
var msp = sp ;
/* Mapped with getStatGlobalMap */
if (isGlobal)
{
}
else
/* Mapped with getStatSettingsMap */
{
if (msp.indexOf('w/index') > 0)
{
var p = null, st = getPageParam('title') ;
var isSpecial = false ;
if (st == null || st.length == 0)
{
st = getPageLastTag('h1') ;
}
else if (st.indexOf(':') > 0)
{
isSpecial = true ;
}
st = st.replace(':', '/') ;
if (st && st.length > 0) 
{
p = getPageParam('printable');
if (p && p.length > 0) 
{
msp = msp.replace('index', 'printable/') + st ;
}
else
{ 
p = getPageParam('target');
if (p && p.length > 0) 
{
msp = msp.replace('index', st) ;
msp += '/' + p ;
}
else 
{
p = getPageParam('action');
if (p && p.length > 0) 
{
msp = msp.replace('index', p + '/' + st) ;
} 
else 
{
p = getPageParam('page');
if (p && p.length > 0) 
{
msp = msp.replace('index', st + '/' + p) ;
} 
else if (isSpecial)
{
msp = msp.replace('index', st) ;
}
else
{
msp = msp.replace('index', 'others/' + st) ;
}
} 
}
}
}
}else{
 msp= msp.replace(':', '/') ;
}

}
return msp ;
}

/**************************************************************
* Allow settings of specific Xiti parameters (search engines, segmentation,...)
*/
function setCustomXt(pu)
{
var p = getPageParam('search') ;
// search engine tracking
if (p && p.length)
{
xt_mtcl = p ; 
if (xt_mtcl != undefined)
{
var np = 0 ;
var an2 = document.getElementsByTagName('div') ;
for (var j = 0; j < an2.length; j++)
{
if (an2[j].className == 'results-info') 
{
np = 1 ;
}
}
xt_npg = np ;
window.xtparam+="&mc="+xt_mtcl+"&np="+xt_npg; 
}
}

}

/**************************************************************
* Allow any specific marking (like other marking systems)
* Called after standard content marker
*/
function doCustomMarker()
{
stat_download.activate() ;
stat_link.activateExternal() ;
}


