/*                                                                 */
/* ================== Site-specific settings ======================*/
/* ================== for                    ======================*/
/* ==================== Version 121603 ============================*/
/*                                                                 */

// New for McClatchy tracking ... Nov. 9, 2004

/* ================ MANDATORY MCCLATCHY TAGGING   ================ */
/* ================ By Bill Hunter, version 1.03  ================ */

function GetCookie(cname) {
 var arg=cname+"="; var alen=arg.length;
 var clen=document.cookie.length; var i=0;
 while (i<clen) {
        var j=i+alen;
        if (document.cookie.substring(i,j)==arg) return getCookieVal (j); i=document.cookie.indexOf("",i)+ 1;
        if (i==0) break;
 } return null;
}


// Adding InSite user reporting - 3/15/2005 Norm Cloutier
var user=GetCookie("modbee_user_auth"), RMID=GetCookie("RMID");
if (user) { var override_prop5 = user.replace(/\|.*/,"") }
else { var override_prop5 = "not_logged_in |" + (RMID) }

// Set some global variables
var mcclatchy_cat = "MOD|MB";
var host = window.location.hostname;
var qs = window.location.search;
var myURL = window.location.href;
var tail = "Unknown";
var sections = new Array(); // Create only, we'll fill later

// Get the path from the URL
// Convert host and myURL to lowercase
host = host.toLowerCase();
myURL = myURL.toLowerCase();
//ss added next line; uncommented next two
myURL = myURL.split(host)[1];
myURL=myURL.replace(/\/\d\d-\d\d-\d\d\d\d\//, "/");
myURL=myURL.replace(/\/(to|yester|mon|tues|wednes|thurs|fri|satur|sun)day\//, "/");

// If the path ends in a query string (?), remove the query string
//	so you can test the pagename in the sections array
//	Else if there are any ".html" (or other)  pages, strip back to the slash (/)
//	if you want to test ".html" pages in the array, comment out the "else if"
//	other extensions can be added, such as ".asp" or ".htm"
if (myURL.lastIndexOf('?') > -1){
	myURL = myURL.substring(0, myURL.lastIndexOf('?'));
} 
//ss changed this from else if to if
if (myURL.lastIndexOf('\.html') > -1){
	myURL = myURL.substring(0, myURL.lastIndexOf('/'));
} else if (myURL.lastIndexOf('\.php') > -1){
	myURL = myURL.substring(0, myURL.lastIndexOf('/'));
} 

// Strip trailing slashes before going further
if (myURL.lastIndexOf('/') == myURL.length-1) {myURL = myURL.substr(0, myURL.length-1)}

/* =============================================================== */
/* ================    USER MAINTAINED ARRAYS     ================ */
/* ================          HOSTS ARRAY          ================ */
// Array of hosts, mapped to mcclatch_cat (set tag based on host)
var hosts = new Array();
	hosts["apartments.com"] = "MOD|TP-AP";
	hosts["p2ionline.com"] = "MOD|TP-PT";
	hosts["capwiz.com"] = "MOD|TP-CW";
	hosts["careersite.com"] = "MOD|TP-CS";
	hosts["cars.com"] = "MOD|TP-CR";
	hosts["legacy.com"] = "MOD|TP-LG";
	hosts["valley-insider.com"] = "MOD|MB";
	hosts["centralvalleyshopping.com"] = "MOD|MB";
	hosts["people2people.com"] = "MOD|TP-PP";
	hosts["search.modbee.com"] = "MOD|MB";
	hosts["forums.modbee.com"] = "MOD|MB";	
	hosts["modestobee.com"] = "MOD|MB";
	hosts["modesto.com"] = "MOD|MB";
	hosts["modbeewc-proxy.nandomedia.com"] = "MOD|MB";
	hosts["modbeewc-preview.nandomedia.com"] = "MOD|MB";
	hosts["themodestobee.com"] = "MOD|MB";
	hosts["modbee.com"] = "MOD|MB";
	hosts["modbee.greatschools.net"] = "MOD|TP-GS";
	hosts["studio.financialcontent.com"] = "MOD|TP-FC";


// Set our "mcclatch_cat" tag based on the host
// then build our array
for (var i in hosts){
	if (host.match(i)){
		mcclatchy_cat = hosts[i];
		buildSections(i);
		break;
	} else {mcclatchy_cat = "MOD|Unknown"; tail = "Unknown";}
}

/* ================         SECTIONS ARRAY        ================ */
// Function to build our array of paths, mapped to McClatchy tags
function buildSections(site) {
	// We maintain different arrays for different hosts
	// so find the correct host before adding paths

// MODBEE.COM
	if ((site == "modbee.com") || (site == "modbeewc-proxy.nandomedia.com") || (site == "modestobee.com") || (site == "modesto.com") || (site == "themodestobee.com")|| (site == "valley-insider.com")|| (site == "centralvalleyshopping.com")) {
		if (myURL == "") {tail = "News"; return}  // Root value
		sections["/state_wire"] = "News|Nation_World";
		sections["/24hour"] = "News|Nation_World";
		sections["/24hour/business"] = "News|Business";
		sections["/24hour/consumer"] = "News|Business";
		sections["/24hour/entertainment"] = "News|Entertainment";
		sections["/24hour/entertainment/awards/oscars"] = "News|Entertainment|Movies";
		sections["/24hour/entertainment/music"] = "News|Entertainment|Music";
		sections["/24hour/food_wine"] = "News|Entertainment|Dining";
		sections["/24hour/sports"] = "News|Sports";
		sections["/24hour/travel"] = "News|Entertainment";
		sections["/24hour/weird"] = "News|Entertainment";
		sections["/24hour/nation"] = "News|Nation_World";
		sections["/ag"] = "News|Local";
		sections["/columnists"] = "News|Local";
		sections["/galleries"] = "News|Local";
		sections["/images"] = "News|Local";
		sections["/dwb_gallery"] = "News|Local";
		sections["/extras"] = "News|Local";
		sections["/obituaries"] = "News|Local";
		sections["/movies"] = "News|Entertainment|Movies";
		sections["/life"] = "News|Entertainment";
		sections["/arts"] = "News|Entertainment";
		sections["/business"] = "News|Business";
		sections["/workwise"] = "News|Business";
		sections["/front"] = "News|Local";
		sections["/nie"] = "News|Local";
		sections["/circulation"] = "Other";
		sections["/standing"] = "Other";
		sections["/man"] = "Other";
		sections["/man/archive"] = "Other";
		sections["/service"] = "Other";
		sections["/reports"] = "News|Local";
		sections["/reports/peterson"] = "News|Local";
		sections["/reports/laci"] = "News|Local";
		sections["/reports/peterson/trialupdates"] = "News|Local";
		sections["/reports/peterson/trial"] = "News|Local";
		sections["/reports/laci/galleries"] = "News|Local";
		sections["/polls"] = "News|Local";
		sections["/2001"] = "News|Local";
		sections["/2002"] = "News|Local";
		sections["/2003"] = "News|Local";
		sections["/2004"] = "News|Local";
		sections["/wifi"] = "News|Local";
		sections["/images/photogallery"] = "News|Local";
		sections["/technology"] = "News|Local";		
		sections["/local"] = "News|Local";
		sections["/local/crime"] = "News|Local";
		sections["/local/policecalls"] = "News|Local";
		sections["/opinion"] = "News|Local";
		sections["/photos"] = "News|Local";
		sections["/search-bin"] = "News|Search";
		sections["/search_tmpl"] = "News|Search";
		sections["/sports"] = "News|Sports";
		sections["/sports/prep"] = "News|Sports|Preps";
		sections["/sports/mercedcollege"] = "News|Sports|College";
		sections["/weather"] = "News|Local";
		sections["/extras/classified"] = "Class";
		sections["/classified"] = "Class";
		sections["/classified/automotive"] = "Class|Automotive";
		sections["/classified/apartments"] = "Class|Real_Estate";
		sections["/valleyhomes"] = "Class|Real_Estate";
		sections["/classified/garagesales"] = "Class";
		sections["/classified/jobs"] = "Class|Employment";
		sections["/classified/employment/topjobs"] = "Class|Employment";
		sections["/classpremium"] = "Class|Employment";
		sections["/classified/pets"] = "Class";
		sections["/classified/realestate"] = "Class|Real_Estate";
		sections["/classified/employment"] = "Class|Employment";
		sections["/classified/rentals"] = "Class|Real_Estate";
		sections["/classified/transportation"] = "Class|Automotive";
		sections["/today"] = "Class";
		sections["/search-bin"] = "News|Search";
		sections["/search_tmpl"] = "News|Search";
		sections["/test"] = "Test";
		sections["/user_registration"] = "Other";
		sections["/weather"] = "News|Local";
		sections["/register-bin"] = "Other";		
		sections["/gas"] = "Other";
		sections["/winawedding"] = "Other";	
		

// SEARCH.MODBEE.COM
    } else if (site == "search.modbee.com") {
        if (myURL == "") {tail = "News|Search"; return}  // Root value
        // Determine tail based on query string (qs)
        if (qs.match(/product=classads/)) {
            tail = "Class|Search";
        }  else { tail = "News|Search";} // Assumes everything else must be news|search
      // Note: you don't want to include a default value other than an ending "else"


// CARS.COM
	} else if (site == "cars.com") {
		if (myURL == "") {tail = "Class|Automotive"; return}  // Root value
		sections["/search"] = "Class|Automotive|Search";
		tail = "Class|Automotive";		// Set a default value

// APARTMENTS.COM
	} else if (site == "apartments.com") {
		if (myURL == "") {tail = "Class|Real_Estate"; return}  // Root value
		sections["/search"] = "Class|Real_Estate|Search";
		tail = "Class|Real_Estate";		// Set a default value

// FORUMS.MODBEE.COM
	} else if (site == "forums.modbee.com") {
		if (myURL == "") {tail = "Other"; return}  // Root value
		tail = "Other"; // Set a default value

// CAPWIZ.COM
	} else if (site == "capwiz.com") {
		if (myURL == "") {tail = "News"; return}  // Root value
		sections["/modbee"] = "News";

// CAREERSITE.COM
	} else if (site == "careersite.com") {
		if (myURL == "") {tail = "Class|Employment"; return}  // Root value
		sections["/perl/vaui/Search"] = "Class|Employment|Search";
		sections["/perl/candidate"] = "Class|Employment";
		sections["/perl/employer"] = "Class|Employment";
		sections["/perl/vaui"] = "Class|Employment";
		sections["/perl/vrui"] = "Class|Employment";
		sections["/faq"] = "Class|Employment";
		sections["/postajob"] = "Class|Employment";
		sections["/candidate"] = "Class|Employment";

// CARS.COM
	} else if (site == "cars.com") {
		if (myURL == "") {tail = "Class|Automotive"; return}  // Root value
		sections["/go/search"] = "Class|Automotive|Search";
		sections["/go/index.jsp"] = "Class|Automotive|Search";
		sections["/go/buyIndex.jsp"] = "Class|Automotive|Search";

// LEGACY.COM
	} else if (site == "legacy.com") {
		if (myURL == "") {tail = "News|Local|Search"; return}  // Root value
		sections["/modbee"] = "News|Local|Search";


// P2IONLINE.COM
	} else if (site == "p2ionline.com") {
		if (myURL == "") {tail = "Other"; return}  // Root value
		sections["/shoppingchannel"] = "Other";
		sections["/default2.asp"] = "Other";
		tail = "Other";		// Set a default value


// MODBEEWC-PREVIEW.NANDOMEDIA.COM (preview site)
	} else if (site == "modbeewc-preview.nandomedia.com") {
		if (myURL == "") {tail = "Test"; return}  // Root value
		sections["/news"] = "Test";
		tail = "Test";		// Set a default value

// GREAT SCHOOLS
	} else if (site == "modbee.greatschools.net") {
		if (myURL == "") {tail = "Other"; return}  // Root value
		tail = "Other";		// Set a default value

// PEOPLE 2 PEOPLE
	} else if (site == "people2people.com") {
		if (myURL == "") {tail = "Other"; return}  // Root value
		tail = "Other";		// Set a default value

// FINANCIAL CONTENT
	} else if (site == "studio.financialcontent.com") {
		if (myURL == "") {tail = "News|Business"; return}  // Root value
		sections["/search"] = "News|Business";
		tail = "News|Business";		// Set a default value


// NOMATCH
	} else { // If we don't recognize the host, set the tag to unknown
		sections[site] = site;
		mcclatchy_cat = "MOD|Unknown-" + site; tail = "Unknown";
	}
}
/* ================ END OF USER MAINTAINED ARRAYS ================ */
/* =============================================================== */

/* ================      PATH WALKER ROUTINE      ================ */
// Start walking up the URL path
while (myURL.lastIndexOf('/') > -1){
	if (sections[myURL]) {tail = sections[myURL]; break;}
	myURL = myURL.substring(0, myURL.lastIndexOf('/'));
}

override_prop6 = mcclatchy_cat + "|" + tail;
/* =============== END MANDATORY MCCLATCHY TAGGING =============== */

/////////////////////////////////////////////////////////////////////////
var default_pageName='';/* Blank defaults to HTML page title */
var default_server='ModBee.com';/* Blank defaults to host domain if available */
var default_channel='';/* Blank defaults to high-level path if available */
var default_pageType='';/* Blank defaults to blank */
var default_pageValue='';/* Blank defaults to blank */
var default_product='';/* Blank defaults to blank */
var default_URL=window.location.href;
var default_version='';/* Blank defaults to blank */
var default_pagelevel='';/* Blank defaults to section vs. front calculation */
var default_content_source='';/* Blank defaults to blank */
var default_prop5='';/* Blank defaults to blank */
var default_prop6='';/* Blank defaults to blank */
var default_prop7='';/* Blank defaults to blank */
var default_prop8='';/* Blank defaults to blank */
var default_prop9='';/* Blank defaults to blank */
var default_prop10='';/* Blank defaults to blank */
/*                                                                 */
var car_make, car_model, car_zip;
if(car_make || car_model || car_zip) {
var override_prop7;
if(!override_prop7)override_prop7=car_make+"|"+car_model+"|"+car_zip;
}

/* ++++++++++++++++++++ New code as of 121603 ++++++++++++++++++++ */
/*                                                                 */
var default_prop11='';/* Blank defaults to blank */
/*                                                                 */
var default_dynamicAccountSelection=false; /* Set to true to turn on dyanamic account selection */
var default_dynamicAccountList='nmtracking,nmtesttest=docs.nandomedia';
/*                 Set to form of account(s)=matching_string,account(s)=matching_string, etc.
                   where account is the site identifier and matching string is either the domain 
                   or a string that will be matched against the dynamicAccountMatch string.
                   The stats will go to the first account group that matches. To send to multiple
                   accounts, separate the site identifiers by a comma.                         */
var default_dynamicAccountMatch='docs.nandomedia'; /* Blank defaults to matching against domain */

var reserve_popular_stories=false;/* This causes stats.js to ignore attempts to set prop10 and prop11 so that they are clear for use by popular pages code */
        /* Do NOT set this to true for Modesto as long as their popular pages code 
           attempts to directly set s_prop11.       */
var popular_headline_min_length=20; /* Set a minimum length of a headline in case it has to be truncated in the list */
var popular_root_url1='http://www.modbee.com'; /* e.g., 'http://www.modbee.com' */
var popular_root_url2='http://www.modestobee.com';
var popular_root_url3='http://www.themodestobee.com';
var popular_root_url4='http://www.modesto.com';
        /* These two should be set to the two most common root URLs used in the 
           URLs of stories being measured for Most Popular Story. 
           Both root URLs should refer to the same doc root.  */
/*                                                                 */
/* ++++++++++++++++++++++++ End new code +++++++++++++++++++++++++ */
/*                                                                 */
var default_trackDownloadLinks=false;/* Set to true to enable tracking of downloads */
var default_linkDownloadFileTypes='aif,aiff,aifc,au,avi,dif,doc,dv,exe,mid,midi,mov,mpg,mp2,mp3,mpeg,mpv2,msg,pdf,ppt,pps,qtl,ra,ram,rm,rpm,rv,txt,vbe,wav,wm,wma,wmv,wvx,xls,zip';
/* Only files types listed in the string will be tracked */
/*                                                                 */
var default_trackExternalLinks=false;/* Set to true to track outside links */
var default_linkInternalFilters='nandomedia,nando,nandotimes,sportserver';
/* List internal i.e., non-tracked domains in string */
/*                                                                 */
var default_channels_by_server=false;/* Prefix server name in channel report */
var default_pages_by_channel=false; /* Add channel name to page name prefix (after server name) */
var default_pages_by_server=true;/* Prefix server name to page name */
/*                                                                 */
var prefix_spacer_prepage=' -- ';/* No override. This can be set only sitewide */
var prefix_spacer_prechannel=' | ';/* No override. This can be set only sitewide */
/*


/*                                                                 */
/* ================= End Site-specific settings ===================*/
/*                                                                 */
