// set the reload time on the ad cycles
var adSettingsReloadTime = 120000;
mtvn.btg.config.AdSettings.reloadInterval = adSettingsReloadTime;

// set up FreeWheel if it's not already present
//if (!mtvn.btg.config.AdSettings.FreeWheel) { mtvn.btg.config.AdSettings.FreeWheel = {}; }
//mtvn.btg.config.AdSettings.FreeWheel.enabled = (enableFreeWheel)?true:false;
//mtvn.btg.config.AdSettings.FreeWheel.type = "MRM";
//mtvn.btg.config.AdSettings.FreeWheel.reloadable = true;
//mtvn.btg.config.AdSettings.FreeWheel.reloadTime = adSettingsReloadTime;

// DoubleClick settings
if (typeof adZoneOverride == "string") {
	mtvn.btg.config.AdSettings.DoubleClick.sections = adZoneOverride;
}
mtvn.btg.config.AdSettings.DoubleClick.positionThreshold = '3';

mtvn.btg.config.ReportSettings.Omniture.trackinlinestats = true;

// must be present for ads to appear
mtvn.btg.Controller.init();

// BEGIN Omniture Call
var _rcamp = /[\?&]brand=(.*)[#&$]/,
	_camp = (_rcamp.test(location.search))?unescape(_rcamp.exec(location.search)[1]):'',
	_pageName = (location.pathname == "/")?"/":location.pathname.substr(1).replace(/(.)\/$/,'$1'), // replaces legacy call com.mtvi.metadata.getDefaultPageName()
	_channel = location.pathname.substr(1).split("/")[0]; // replaces legacy call com.mtvi.metadata.getDefaultChannel()
// "IF" logic added to not send the report on games or video pages until the custom
// version of the report in utilities.ftl which has the custom vars in scope - mcy
if (!/\/(funny_videos|fun_games)\/.+/.test(location.pathname) && adZoneOverride != "404") {
	// Test for AXE page
	if (location.host == "axe-q.atom.com" || location.host == "axe.atom.com") {
		// update _pageName
		_pageName = "Atom/Axe/" + ((_pageName == "/")?"homepage":_pageName);
		// fix all non-axe links
		$j(document).ready(function(){
			$j('a[href^="/"]').each(function(){
				var link = $j(this).attr('href');
				if (	link != "/" 
						&& link != "/hosts/"
						&& link != "/results/") {
					this.href = "http://www.atom.com" + link;
				}
			});
		});
	}
	
	mtvn.btg.Controller.sendPageCall({
		pageName: _pageName,	
		channel: _channel,
		hier1:	_pageName,
		events: "event16",
	    campaign: _camp
	});
}
// END Omniture Call
