/*                                                                 */
/* ========= custom.js file for Raleigh News & Observer ===========*/
/*                                                                 */

var host = window.location.hostname;
var qs = window.location.search;
var sections = window.location.pathname.split("/");

/* mistats.custom1 - stores the original N&O channel, before the MI omniture conversion. */
mistats.custom1 = 'UNKNOWN';

if (host.match(/cars\.com/)) {
	mistats.custom1 = "MISCELLANEOUS - Automotive";
	}
else if (host.match(/apartments\.com/)) {
	mistats.custom1 = "MISCELLANEOUS - Rentals";
	}
else if (host.match(/capwiz\.com/)) {
	mistats.custom1 = "NEWS - Nation & World";
	}
else if (host.match(/head2head\.com/)) {
	mistats.custom1 = "SPORTS";
	}
else if (host.match(/switchboard\.com/)) {
	mistats.custom1 = "LIFESTYLES - Directory";
	}
else if ((host.match(/careerbuilder\.com/)) || (window.location.pathname.match(/careerbuilder/i))) {
    if(window.location.pathname.match(/jobseeker/i) )    { 
		mistats.custom1 = "TriangleJobs.com - Job Seekers";   } 
    else if (window.location.pathname.match(/(jobposter|employers)/i)) { 
		mistats.custom1 = "TriangleJobs.com - Employers"; } 
    else { 
		mistats.custom1 = "TriangleJobs.com"; } 
	}
else if (host.match(/financialcontent\.com/)) {
	mistats.custom1 = "BUSINESS - Stocks";
	}
else if (host.match(/wsj\.com/)) {
	mistats.custom1 = "BUSINESS - Personal Finance";
	}
else if (host.match(/p2ionline/)) {
	mistats.custom1 = "LIFESTYLES - Shopping";
	}
else if (host.match(/(localsearch|planetdiscover)/)) {
	nao_server = "www.triangle.com";
	mcc_tail = "NO|TRI|TP-PD|News|Search";
	mistats.custom1 = "LIFESTYLES - Directory";
        var query = '' + window.location.search.substring(1);
        var pairs = query.split("&");
        var aff = '';
        for (var i=0;i<pairs.length;i++) {
                var pos = pairs[i].indexOf('=');
                if (pos >= 0) {
                        var argname = pairs[i].substring(0,pos);
                        var value = pairs[i].substring(pos+1);
                        if (argname == 'aff') {
                                aff = value;
                                }
                        }
                }
        if (aff == '6') {
                mistats.custom1 = 'LIFESTYLES - Shopping';
                }
	}
else if (host.match(/ncneighbors\.com/)) {
        mistats.custom1 = "MISCELLANEOUS - Communities";
        }
else if ((host.match(/triangle\.teetimeking\.com/)) || host.match(/golf\.triangle\.com/)) {
        mistats.custom1 = "SPORTS - Golf";
        }
else if (host.match(/146\.145\.120\.3/)) {
        mistats.custom1 = "SPORTS - College Sports";
        }
else if (host.match(/wunderground\.com/)) { 
        mistats.custom1 = "MISCELLANEOUS - Weather";
        }
else if (host.match(/newsobserver\.typepad\.com/)) {
        mistats.custom1 = "LIFESTYLES - Food & Fitness";
        } 
else if (host.match(/home(scape|finder)\.com/)) {
        mistats.custom1 = "MISCELLANEOUS - Real Estate";
        }
else if (host.match(/miva\.nando\.com/)) {
        mistats.custom1 = "MISCELLANEOUS - Member Center";
        } 
else if (host.match(/blogs/)) {
	if (sections[1] == 'joemiller') {
		mistats.custom1 = "SPORTS - Outdoors";
		}
        else if (sections[1] == 'riggs') {
                mistats.custom1 = "SPORTS - Racing";
                }
        else if (sections[1] == 'readers') { 
                mistats.custom1 = "MISCELLANEOUS - Opinion";
                } 
        else if (sections[1] == 'wakepol') {
                mistats.custom1 = "MISCELLANEOUS - Politics";
                }
        else if (sections[1] == 'notions') {
                mistats.custom1 = "LIFESTYLES - Home & Garden";
                } 
        else if (sections[1] == 'forgotten') {
                mistats.custom1 = "NEWS - Nation & World";
                }
        else if (sections[1] == 'open') {
                mistats.custom1 = "SPORTS - Golf";
                }
        else if (sections[1] == 'accnow') {
                mistats.custom1 = "SPORTS - College";
                }
        else if (sections[1] == 'wakeed') {
                mistats.custom1 = "NEWS - Education";
                }
        else if (sections[1] == 'fashion') {
                mistats.custom1 = "LIFESTYLES";
                }
        else if (sections[1] == 'tv') {
                mistats.custom1 = "LIFESTYLES";
                }
        else if (sections[1] == 'washington') {
                mistats.custom1 = "MISCELLANEOUS - Politics";
                }
        else if (sections[1] == 'canes') {
                mistats.custom1 = "SPORTS - Hurricanes";
                }
        else if (sections[1] == 'china') {
                mistats.custom1 = "MISCELLANEOUS - Politics";
                }
        else if (sections[1] == 'beach') {
                mistats.custom1 = "LIFESTYLES - Travel";
                }
        else if (sections[1] == 'usopen') {
			    mistats.custom1 = "SPORTS - Golf";
			    }
	else {
        	mistats.custom1 = "NEWS - Local & State";
		}
        }
else if (host.match(/appsdev/)) {
	mistats.custom1 = "MISCELLANEOUS - Test";
}
else if ((host.match(/newsobserver\.com/)) && (window.location.pathname.match(/news\/growth\/traffic/i))) {
	mistats.custom1 = "NEWS - Growth, Develop & Environ";
}
else if (host.match(/(newslibrary|newsbank)/)) {
	mistats.custom1 = "MISCELLANEOUS - Search";
}
else if (host.match(/classads/)) {
        mistats.custom1 = "LIFESTYLES - Shopping";
        }

/*                                                                 */
/* ================= End Site-specific settings ===================*/
/*                                                                 */

