";
break;
case 2:
sReturn = "" + oFl.imageMap;
break;
case 3:
sReturn = oFl.htm;
break;
default:
sReturn = "
" +
noFlashLink1 + "" + noFlashLink2 +
"
";
}
}
// Do we have a sufficient version of Flash for this application?
if (oSniff.flash >= oFl.flashVer)
{
// Wrap flashvars to allow for empty values
// TODO: Can't we set default of this to empty in flashObj2 below?
var flashvars = "";
if (oFl.flashVars)
{
flashvars = oFl.flashVars;
}
// Select separator for additional parameters on Flash app name
// TODO: Just add the additional parameters here?
var sSep = (oFl.flashFile.indexOf("?") > -1) ? "&": "?";
var seamlessTabbing = 'true';
if (oFl.hasOwnProperty('seamlessTabbing') && oFl.seamlessTabbing.toLowerCase() == 'false') seamlessTabbing = 'false';
// Write out correct code for browser
if (oSniff.mac || oSniff.nn >= 4 || oSniff.webtv)
{
// Use EMBED tag on Mac, Netscape/Firefox, and WebTV
sReturn = "";
}
else if (oSniff.ie >= 4)
{
// Use OBJECT tag on Internet Explorer
// TODO: Remove newlines from below
sReturn = "\n";
// Prevent News Menu flyouts from hiding this Flash app if
// parameters permit this.
// TODO: Can we just set this property on OBJECT tag in HTML?
if ((oFl.mode.toLowerCase != "window") && (oSniff.ie >= 5))
{
sReturn += "document.getElementById('" +
oFl.ID + "').nm_bOk=true;";
}
}
}
return sReturn;
},
///
/// Creates an JS object for Flash applications with default values.
///
/// JS object for Flash application
///
/// Call written by components\Flash.xsl.
/// TODO: Can we reduce download size by counting on these defaults?
/// TODO: Are some of these parameters no longer used?
/// TODO: Instrumentation appears to no longer be used. Remove?
///
flashObj2: function() {
note("flashObj2");
this.flashFile = "filename.swf";
this.altImg =
"http://msnbcmedia.msn.com/i/msnbc/Components/Art/SITEWIDE/no_flash.gif";
this.imageMap = "";
this.defaultType = "";
this.url = "";
this.htm = "";
this.height = "400";
this.width = "520";
this.ID = "dw";
this.downloadLink = "top";
this.webTV = "true";
this.play = "true";
this.loop = "false";
this.quality = "best";
this.scale = "noborder";
this.salign = "LT";
this.menu = "false";
this.deviceFont = "false";
this.mode = "opaque";
this.cabVersion = "4,0,0,0";
this.flashVer = 4;
this.notCompatImg =
"http://www.msnbc.com/images/msnbc/flash_default.gif";
this.instrumented = false;
this.instrumentInit =
new Function("sMainSection", "sRefferer",
"this.instrument=new instrumentObj(sMainSection,sRefferer,'0fa')");
this.debug = true;
this.fullScreen = false;
this.seamlessTabbing = 'true';
this.render = new Function("return writeFlashComponent2(this)");
var self = this;
this.shim;
this.write = function() {
if (jQuery&&jQuery.browser.mozilla&&jQuery.fn.flash) {
// find the script that created this
//$(function() {
$('#story script').each(function(i,script) {
var search = new RegExp(self.ID);
var match = search.exec($(script).text());
if (match) {
var embedParams = {
width:self.width,
height:self.height,
id:self.ID,
play:self.play,
loop:self.loop,
fullscreen:self.fullScreen,
src:self.flashFile+'?'+window.location.host+'&'+self.flashVars
};
var pluginOptions = {
version:self.flashVer
};
$(script).replaceWith('');
$('#'+self.ID).flash(embedParams, pluginOptions);
}
});
//});
} else {
document.write(this.render());
}
};
this.innerWrite = function(destination) {
var e = document.createElement("div");
e.innerHTML = this.render();
if (destination.firstChild) {
destination.replaceChild(e, destination.firstChild);
}
else {
destination.appendChild(e);
}
};
},
///
/// Creates a encapsulating Flash instrumentation parameters.
///
/// Main section ID, never passed?
/// Referrer, never passed?
/// Parameter prefix, always 0fa?
/// JS object encapsulating parameters
///
/// TODO: Instrumentation appears to no longer be used. Remove?
///
instrumentObj: function(sMain, sRef, sPrefix) {
note("instrumentObj");
this.prefix = sPrefix;
this.mainSection = sMain;
this.referrer = sRef;
this.flashVer = "0";
this.browser = "0";
this.browserVer = "0";
this.os = "0";
// TODO: Is instrumentObj.render used?
this.render = new Function(
"return this.prefix+'='+this.mainSection+this.referrer+this.flashVer+this.browser+this.browserVer+this.os");
},
//
// Cookies
//
///
/// Parses a value associated with the given key out of cookie.
///
/// Key for value to be read from cookie
/// Value associated with key in cookie
///
/// INTERNAL: Called only from several functions in Std.js.
/// TODO: Rename for consistency?
/// TODO: May return wrong value if one key is a suffix of an earlier key.
///
readCookie: function(ck) {
note("readCookie");
var anyCookies = document.cookie;
var pos = anyCookies.toUpperCase().indexOf(ck.toUpperCase() + "=");
var value = "";
if (pos != -1)
{
var start = pos + ck.length + 1;
var end = anyCookies.indexOf(";", start);
if (end == -1)
{
end = anyCookies.length;
}
value = anyCookies.substring(start, end);
value = unescape(value);
}
return value;
},
///
/// Adds a key-value pair to the cookie, with path and domain handled
/// correctly for the live site, and expiration in the distant future.
///
/// Key name for new item in cookie
/// Value name for new item in cookie
/// expire date for the cookie
///
/// INTERNAL: Called only from several functions in Std.js.
/// TODO: Might we want to allow an optional expiry parameter?
///
SetCookie: function(sName, sValue, expDate) {
note("SetCookie");
var sExpires;
if (expDate == "session") {
sExpires = "";
} else {
sExpires = ";expires=" + (expDate ? expDate: new Date(2021, 10, 4).toGMTString());
}
document.cookie = sName + "=" + escape(sValue) + sExpires + ";path=/" +
((location.host.toLowerCase().indexOf("msnbc.msn.com") >= 0) ?
";domain=msnbc.msn.com": "");
},
//
// PAGE DATA
//
pd_me: {},
// Collects properties of this page
defer_pd_om: false,
// defer call pd_om for some page still using omniture G code
cssList: [],
// List of CSS stylesheets already rendered
curDoc: null,
// DEPRECATED: Id of the current document (use pd_me.id)
PSTaxonomy: null,
// DEPRECATED: Taxonomy value for Newsweek (use pd_me.ps)
//s_msn.pageName, // Omniture: Page name as shown in SiteCatalyst
//s_msn.pageType, // Omniture: errorPage if 404, else unused
//s_msn.channel, // Omniture: Section name
//s_msn.campaign, // Omniture: Not used
//s_msn.zip, // Omniture: User's zip, from P2 cookie
s_account: undefined,
// Omniture: Site account, msnbcom in production
//s_visitorSampling, // Omniture: Sampling rate, usually 100
//s_msn.prop1, // Omniture: Not used (was headline)
//s_msn.prop2, // Omniture: Not used (was deck)
//s_msn.prop3, // Omniture: Byline
//s_msn.prop4, // Omniture: Section name
s_prop4_orig: undefined,
// Omniture: Used for link tracking
//s_msn.prop5, // Omniture: Subsection name
s_prop5_orig: undefined,
// Omniture: Used for link tracking
//s_msn.prop6, // Omniture: Subsubsection name
s_prop6_orig: undefined,
// Omniture: Used for link tracking
//s_msn.prop7, // Omniture: Layout (template name, handheld, etc.)
//s_msn.prop8, // Omniture: Is user personalized (Y/N)
//s_msn.prop9, // Omniture: User's zip, from P2 cookie
//s_msn.prop10, // Omniture: Connection speed (from MSN Video)
//s_msn.prop11, // Omniture: Stock choices, from P1 cookie
//s_msn.prop12, // Omniture: Weather choices, from P1 cookie
//s_msn.prop13, // Omniture: Local News choice, from P1 cookie / from Stid(Station id) cookie for NBC sports
//s_msn.prop14, // Omniture: Sports choices, from P1 cookie
//s_msn.prop15, // Omniture: Document ID (Phase 2)
//s_msn.prop16, // Omniture: DocType, or external page type (Phase 2)
s_prop16_orig: undefined,
// Omniture: Used for link tracking
//s_msn.prop17, // Omniture: Search terms (Phase 2)
//s_msn.prop18, // Omniture: Hour updated (Phase 2)
//s_msn.prop19, // Omniture: Local affiliate of page (Phase 2)
//s_msn.prop20, // Omniture: Tracking of From (Phase 2)
//s_msn.prop21, // Omniture: Tracking of From RS (Phase 2)
//s_msn.prop22, // Omniture: Tracking of From RL (Phase 2)
//s_msn.prop23, // Omniture: Tracking of From RSS (Phase 2)
//s_msn.prop24, // Omniture: Tracking of From ET (Phase 2)
//s_msn.prop26, // Omniture: Tracking of the "Name" field of the Source document
//s_msn.prop27, // Omniture: Tracking of link location (autobox, databox, tabbox)
//s_msn.prop28, // Omniture: Tracking of "dst" in the query string
//s_msn.prop30, // Omniture: Tracking Domain Consolidation (Phase 2)
//s_msn.prop31, // Omniture: Tracking of "ocid" in the query string
//s_msn.prop33, // Omniture: Tracking of From Radio (Phase 2)
//s_msn.prop35, // Omniture: Partner Wrapper Name
//s_msn.prop39, // Omniture: Flyout user setting
//s_msn.prop41, // Omniture: Tracking "AVERAGE RATING | NUMBER OF RATINGS"
//s_msn.eVar1, // Omniture: Tracking of From (Phase 2)
//s_msn.eVar2, // Omniture: Tracking of From RS (Phase 2)
//s_msn.eVar3, // Omniture: Tracking of From RL (Phase 2)
//s_msn.eVar4, // Omniture: Tracking of From RSS (Phase 2)
//s_msn.eVar5, // Omniture: Tracking of From ET (Phase 2)
//s_msn.eVar39; // Omniture: Tracking of From MSN Referrer
/// Called at the top of each page to initialize page data and other
/// constructs for client-side JavaScript code.
///
/// DocType, or external page type
/// Device name (html40, msntv, handheld)
/// Document ID
/// Headline
/// Description (aka Abstract)
/// Section
/// Subsection
/// Subsubsection
/// Page number, if available
/// Page count, if appropriate
/// Last update time, as 'hh:mm, dd/mm/yy' in ET (24h)
/// Byline, without 'By ' prefix
/// Layout name
/// Affiliate name, on local pages
/// Email promo text for Email This
/// ID of Section Navigation
/// PS Taxonomy value
/// Partner wrapper Name (for NFN)
/// News menu default setting
/// tv Tags Count
/// Adpackage Object
/// request Site Name, as "MSNBC", "Today", etc.
/// Link Tracking enabled
/// the "Name" field of the Source document
/// subsubSubSection
/// subsubsubSubSection
/// request Site Name
///
/// The call to this function is usually inserted by BodyTop in
/// SectionDescription.xsl. May also be called from non-Workbench pages.
/// Unused values can be passed as '' or undefined if a placeholder is needed.
/// TODO: Create UberSniff object here?
///
pd_top: function(dt, dv, id, h, d, s, ss, sss, pn, pc, t, b, l, af, ep, sn, ps, pw, nd, tvc, adp, snm, olt, sc, ssss, sssss, sitename) {
note("pd_top");
// Set up pd_me with values passed in, pd_me may be instanted and filled at other places, so don't remove the if(pd_me==null), by v-starli@microsoft.com 2007/2/13
if (pd_me == null) pd_me = new Object;
pd_me.dt = dt;
pd_me.dv = pd_str(dv);
pd_me.id = curDoc = pd_str(id);
pd_me.h = pd_str(h);
pd_me.d = pd_str(d);
pd_me.s = pd_str(s);
pd_me.ss = pd_str(ss);
pd_me.sss = pd_str(sss);
if (ssss != null) pd_me.ssss = pd_str(ssss);
else pd_me.ssss = '';
if (sssss != null) pd_me.sssss = pd_str(sssss);
else pd_me.sssss = '';
if (sitename != null) pd_me.site = sitename;
else pd_me.site = '';
///
pd_me.site = "MSNBC";
///
pd_me.pn = pd_str(pn);
pd_me.pc = pd_str(pc);
pd_me.t = pd_str(t);
pd_me.b = pd_str(b);
pd_me.l = pd_str(l);
pd_me.af = pd_str(af);
pd_me.ep = pd_str(ep);
pd_me.sn = pd_str(sn);
pd_me.ps = PSTaxonomy = pd_str(ps);
pd_me.pw = pd_str(pw);
pd_me.nd = pd_str(nd);
pd_me.tvc = tvc;
pd_me.snm = pd_str(snm);
pd_me.olt = (olt == 'true');
pd_me.sc = pd_str(sc);
//adpackage and encapsulated dap call
if (null != adp)
{
pd_me.adp = adp;
pd_me.adp.dap = function(adpS) {
var adpO = adp[adpS];
if (adpO && adpO.AdGroup && (typeof(dap) == "function")) {
dap("&PG=" + adpO.AdGroup + "&AP=" + adpO.AdSizeCode, adpO.Width, adpO.Height);
return true;
}
return false;
};
}
// Get values from personalization cookies
var p1r = readCookie('P1');
var p2r = readCookie('P2');
pd_me.p1 = (p1r + '|||||||||||').split('|');
pd_me.zip = ((p2r.length > 8) && (p2r.substring(0, 4) == 'pi6='))
? p2r.substring(4, 9) : '';
// Derived: nw true for Newsweek pages
pd_me.nw = location.href.indexOf('/site/newsweek') > 0;
// Derived: su is site suffix
pd_me.su = (pd_me.nw) ? '/site/newsweek': '';
// Derived: isF true for Front pages
pd_me.isF = (pd_me.dt == 'Front');
// Derived: isS true for Story/Tools/Handbuilt pages
pd_me.isS = ((dt == 'Story') || (dt == 'ToolsHandbuilt'));
// Forward: isRp is true for Related Photos pages
pd_me.isRp = false;
// Other page initialization for html40 device
if (dv == 'html40')
{
// Initialize list of tabs for Most Popular boxes
pop_tabBoxes = new Array();
// Add OnLoad hook for next story box
pd_me.onlNext = window.onload;
window.onload = pd_onl;
}
// Add stories to IPN / Recommended Stories history
/* CH remove - not clear we're using this functionality any more
if (pd_me.isS)
add_history(pd_me.id, pd_me.sn);
*/
// Specify a default Omniture account so we can detect when there's no tracking
s_account = '';
if (location.href.indexOf('from=rss') > -1) SetCookie("FROMRSS", "true");
//Check for MSN Referrer, and set cookie.
var ref = document.referrer;
if (ref.indexOf('msn.com') > -1) {
if (ref.indexOf('msnbc') < 0) {
SetCookie("FROMMSN", "true", "session");
//document.cookie = "FROMMSN=true";
}
}
// add document onclick event to capture omniture data
/** REMOVED BY
if (pd_me.olt)
{
if (document.addEventListener) //Firefox model
document.addEventListener('click', linkTrackHandler, false);
else if (document.attachEvent) //IE model
document.attachEvent('onclick', linkTrackHandler);
}
*/
// add new case for Related Photos - today domain
if (snm == "MSNBC" || (snm == "Today" && s == "Related Photos"))
BrowserDetect.init();
pd_me.nsa = readCookie('STID');
//nbc sports station id
pd_me.nsl = (pd_me.nsa == '' ? 'N': 'Y');
//nbc sports localized
// CH: moved into pd_top
// TODO: INLINE: Move into pd_top?
if (document.cookie.indexOf("TZM=") == -1)
{
// TODO: Is parseInt necessary here? Why 0-x rather than -x?
SetCookie("TZM", parseInt(0 - (new Date().getTimezoneOffset())));
}
},
///
/// Called at the top of Related Photos pages to set up parameters for
/// Omniture.
///
/// Document ID from related story
/// Headline from related story
/// Section from related story
/// Subsection from related story
/// Document ID from related photo
/// Photo number
/// Photo count
///
/// The pd_top function must be called before this function.
/// The call to this function is inserted by BodyTop in
/// SectionDescription.xsl when a Related Photos component exists.
///
pd_rp: function(rsId, rsH, rsS, rsSs, rpId, phn, phc, layo) {
note("pd_rp");
// Extend pd_me with values passed in
pd_me.rsId = rsId;
pd_me.rsH = rsH;
pd_me.rsS = rsS;
pd_me.rsSs = rsSs;
pd_me.rpId = rpId;
pd_me.phn = phn;
pd_me.phc = phc;
// fix bug 10048, add value from input layout
pd_me.s = "Related Photos";
//s_prop4
pd_me.l = (layo == 'Photo-L') ? layo: 'Photo-R';
//s_prop7
pd_me.dt = (layo == 'Photo-L') ? layo: 'Photo-R';
//s_prop16
pd_me.pw = phn + "|" + phc;
//s_prop35
// Set related photos flag
pd_me.isRp = true;
},
///
/// Called at the top of each page to set up parameters for Omniture.
///
/// Account, usually 'msnbcdev' or 'msnbcom'
/// Sampling rate, usually 100
///
/// The pd_top function must be called before this function.
/// The call to this function is usually inserted by BodyTop in
/// SectionDescription.xsl. May also be called from non-Workbench pages.
///
pd_om: function(a, s) {
note("pd_om");
// Set up base Omniture values
s_account = a;
if (typeof(s_msn) == "undefined" || s_msn == null)
{
defer_pd_om = true;
return;
}
//s_visitorSampling = s;
s_msn.pageName = '';
s_msn.campaign = '';
s_msn.zip = pd_me.zip;
// Set up basic properties
s_msn.prop3 = pd_nou(pd_me.b);
s_msn.prop4 = pd_nou(pd_me.s);
s_prop4_orig = pd_nou(pd_me.s);
s_msn.prop5 = pd_nou(pd_me.ss);
s_prop5_orig = pd_nou(pd_me.ss);
s_msn.prop6 = pd_nou(pd_me.sss);
s_prop6_orig = pd_nou(pd_me.sss);
s_msn.prop7 = pd_me.l;
//CNBC Omniture Settings
if (s_account == "CNBCOmnitureAccount")
{
s_msn.prop8 = "cnbc";
s_msn.prop9 = "cnbc.com";
s_msn.prop10 = pd_nou((pd_me.dt == 'Cagle') ? pd_me.dt: pd_me.s);
//For Cagle, we want channel to be doctype ('Cagle') instead of section name
s_msn.channel = "free:CNBC.com";
}
else
{
s_msn.prop8 = (pd_me.p1[0] != '') ? 'Y': 'N';
s_msn.prop9 = pd_me.zip;
s_msn.prop10 = readCookie('CP');
s_msn.channel = pd_nou((pd_me.dt == 'Cagle') ? pd_me.dt: pd_me.s);
//For Cagle, we want channel to be doctype ('Cagle') instead of section name
}
s_msn.prop11 = pd_me.p1[6];
s_msn.prop12 = pd_me.p1[2];
s_msn.prop13 = pd_me.p1[5];
s_msn.prop14 = pd_me.p1[11];
s_msn.prop15 = pd_me.id;
s_msn.prop16 = pd_me.dt;
s_prop16_orig = pd_me.dt;
s_msn.prop19 = pd_me.af;
s_msn.prop26 = pd_me.sc;
var tOREF = readCookie("OREF");
if (pd_me.h != 'Page not found') {
s_msn.prop30 = tOREF;
}
document.cookie = "OREF=" + tOREF + ";path=/;expires=" + new Date(1900, 1, 1).toGMTString();
s_msn.prop27 = readCookie('lt');
s_msn.prop28 = pd_bet(location.href, 'dst=', '&', 'true');
s_msn.prop31 = pd_bet(location.href, 'ocid=', '&', 'true');
s_msn.prop35 = pd_me.pw;
s_msn.prop46 = pd_me.tvc;
if (pd_me.site == "NBCSPORTS")
{
s_msn.prop13 = readCookie('STID');
s_msn.prop8 = (s_msn.prop13 != '') ? 'Y': 'N';
}
// clear cookie
var date = new Date();
date.setTime(date.getTime() - 120000);
SetCookie('lt', '', date.toGMTString());
// Get flyout user setting
var nm = readCookie("NM");
if (nm.length == 0)
{
s_msn.prop39 = pd_me.nd == '1' ? "ON": "OFF";
}
else
{
switch (nm)
{
case '1':
s_msn.prop39 = 'ON';
break;
case '0':
s_msn.prop39 = 'OFF';
break;
case '1|0':
s_msn.prop39 = 'ON|OFF';
break;
case '0|1':
s_msn.prop39 = 'OFF|ON';
break;
default:
break;
}
}
// Populate evar39 if FROMMSN = true in the cookie
var msnRefer = readCookie("FROMMSN");
if (msnRefer == "true") {
s_msn.eVar39 = "msn referrer";
}
// Get search terms from referrer
var ref = document.referrer,
st = '';
if ((ref.indexOf('http://search.msn.com/') == 0) &&
(ref.indexOf('id=3053419') > 0))
{
if (ref.indexOf('search=MSNBC') > 0)
{
st = 'MSNMSNBC|' + pd_une(pd_bet(ref, '&q=', '+site%3A'));
}
else
{
st = 'MSN|' + pd_une(pd_bet(ref, '&q=', '&'));
}
}
else if (ref.indexOf(location.host +
'/Apps/Search/ArchiveResults.aspx?id=3053419') > 0)
{
st = 'MSNBC|' + pd_bet(ref, '&qt=', '');
}
else if (ref.indexOf(location.host +
'/?search') > 0)
{
st = 'MSNBC|' + pd_bet(ref, '&q=', '');
st = (st.indexOf('&') > 0) ? st.substring(0, st.indexOf('&')) : '';
}
if (st != '')
s_msn.prop17 = pd_nou(st);
// Get hour property from updated time
if (pd_me.t.length > 2)
s_msn.prop18 = pd_me.t.substring(0, 2);
// Get from properties/events from query string
var f1 = pd_bet(location.href, '/from/', '/');
if (f1 != '')
{
var f2 = pd_me.id + '|from|' + f1.replace('.', '|');
s_msn.prop20 = f2;
s_msn.eVar1 = f2;
switch (f1.split('.')[0])
{
case 'RS':
// Recommended stories (IPN)
s_msn.prop21 = f2;
break;
case 'RL':
// Related stories (Relevance)
s_msn.prop22 = f2;
break;
case 'RSS':
// RSS
s_msn.prop23 = f2;
break;
case 'ET':
// Email This
s_msn.prop24 = f2;
break;
case 'radio':
// RSS
s_msn.prop33 = f2;
break;
}
}
// Adjust doc type to page type for Omniture purposes
var pt = pd_me.dt;
if (pd_me.isRp)
pt = (pd_me.l == 'Photo-L') ? pd_me.l: 'Photo-R';
// Implement doctype-specific business rules for pageName, etc.
switch (pt)
{
case 'Error':
// Error (404) page tracking
s_msn.pageType = "errorPage";
break;
case 'Photo-R':
case 'Photo-L':
// Related Photos
s_msn.pageName =
pt +
'|' + pd_nou(pd_me.rsS.substring(0, 10)) +
(pd_me.site != "MSNBC" ? '|' + pd_nou(pd_me.rsSs.substring(0, 10)) : '') +
'|' + pd_me.rsId +
'|' + pd_nou(pd_me.rsH.substring(0, 50));
s_msn.prop16 = pt;
s_msn.prop35 = pd_me.phn + '|' + pd_me.phc;
break;
// Recipe doc page
case 'Recipe':
s_msn.pageName = pd_nou(pd_me.s.substring(0, 10)) +
(pd_me.site != "MSNBC" ? '|' + pd_nou(pd_me.ss.substring(0, 10)) : '') +
'|' + pd_me.id +
'|' + 'Recipe ' + pd_nou(pd_me.h.substring(0, 50));;
break;
case 'Slideshow':
if (parseInt(pd_me.pn) > 0)
s_msn.prop35 = 'p' + pd_me.pn;
else {
s_msn.prop35 = '#' + ((pd_bet(location.href, '#', '', 'true').length > 0) ? pd_une(pd_bet(location.href, '#', '', 'true')) : 'slide=1');
}
s_msn.pageName =
pd_me.dt +
'|' + pd_nou(pd_me.s.substring(0, 10)) +
(pd_me.site != "MSNBC" ? '|' + pd_nou(pd_me.ss.substring(0, 10)) : '') +
'|' + pd_me.id +
((pd_me.id == '8903108') ? ('|' + pd_une(pd_bet(location.href, 'qt=', '&', 'true')).replace(/\|/g, ' ')) : '') +
'|' + pd_nou(pd_me.h.substring(0, 50));
break;
case 'Fun':
s_msn.channel = 'Fun';
var sPage = '';
var FunP = new RegExp("sFile=(\\D*)(\\d*)");
var nset = {
"ftr": "Trivia",
"fcx": "Crossword",
"uj": "Jigsaw",
"sudoc": "Sudoku",
"co": "Checkout",
"nt": "Nile Tiles",
"ps": "Poker Solitaire"
};
var result = FunP.exec(location.href);
if (result != null)
{
s_msn.prop15 = result[1] + result[2];
if (nset[result[1]] != null)
{
s_msn.prop5 = nset[result[1]];
sPage = ((s_msn.prop5 != 'Crossword') ? (s_msn.prop5) : 'DailyCrossword');
}
else
{
s_msn.prop5 = 'Comics';
sPage = 'Entertainment ' + s_msn.prop15;
}
}
else {
s_msn.prop15 = '';
sPage = 'Comics,Sudoku,Puzzle front';
}
s_msn.prop35 = s_msn.prop15 + '|' + sPage;
s_msn.pageName = pd_me.dt + '|' + s_msn.prop4 + '|' + s_msn.prop5;
break;
case 'SportsTools':
s_msn.channel = 'SportsTools';
s_msn.prop4 = 'Sports';
s_msn.prop5 = 'Scores/Sched';
var url = location.href;
var SptRet = /([^\/]*)\.(?:asp\?|html|asp)(?:frames=\w*)?/i.exec(url);
if (SptRet != null)
{
var sport = /[&|?]sport=(\w*)/i.exec(url);
var cat = /&cat=(\w*)/i.exec(url);
var team = /&team=(\w*)/i.exec(url);
var player = /&player=(\w*)/i.exec(url);
var rank = /&rank=(\w*)/i.exec(url);
var format = /&format=(\w*)/i.exec(url);
s_msn.prop35 = SptRet[1] + '|' + ((sport == null) ? '': sport[1]) + '|' + ((cat == null) ? '': cat[1]) + '|' + ((team == null) ? '': team[1]) + '|' + ((player == null) ? '': player[1]) + '|' + ((rank == null) ? '': rank[1]) + ((format == null) ? '': format[1]);
}
s_msn.pageName = pd_me.dt + '|' + s_msn.prop4 + '|' + s_msn.prop5;
break;
default:
// Story, Tools/Handbuilt, Front, and Cagle tracking
var pn = '';
if (parseInt(pd_me.pn) > 0)
pn = 'p' + pd_me.pn;
else
if (pd_me.dt == 'Cagle') pn = pd_me.pn;
//For Cagle, set pn to page name if page name couldn't be parsed as int.
s_msn.pageName =
((pd_me.dt == 'ToolsHandbuilt') ? 'HandTool': pd_me.dt) +
'|' + pd_nou(pd_me.s.substring(0, 10)) +
(pd_me.site != "MSNBC" ? '|' + pd_nou(pd_me.ss.substring(0, 10)) : '') +
'|' + pd_me.id +
((pd_me.id == '8903108') ? ('|' + pd_une(pd_bet(location.href, 'qt=', '&', 'true')).replace(/\|/g, ' ')) : '') +
'|' + pd_nou(pd_me.h.substring(0, 50));
s_msn.prop35 = pn;
break;
}
s_msn.pageName = s_msn.pageName.toLowerCase();
// Check if weird case (all underscores or start with 5 underscores) happens
var reg = /\|((.*_____.*)|(_+))\|/;
if (reg.test(s_msn.pageName))
s_msn.pageName = pt + "|Other";
$O.G.Init();
//Gerry Initialization call
},
///
/// Consolidated window.onload method for all of Std.js
///
///
/// INTERNAL: event hooked by pd_top.
/// Currently only called for html40 device.
/// There were three different onload functions across Std.js which
/// were hooked and chained differently; this caused PS 5244 on
/// consolidation because of the evil of multiple Std.js references
/// from a single page.
///
pd_onl: function() {
note("pd_onl");
// Former nxtStoryLoad
// Firefox float issue workaround for byline components
/* CH REMOVE - will fix with css or won't include byline in v2
if (pd_me.isS)
moveByline();
*/
// Former /id/7181974
// Show tabs in any Most Popular boxes
/* CH REMOVE - Not tabs
pop_ShowTabs();
//Check both boxes available
boxMove("bba","bb1","bb2");
boxMove("bbb","bb3","bb4");
// Former nmjs07.js
if (nm_nIE)
nm_done();
*/
// Chain to previous event handler
if (pd_me.onlNext != null)
pd_me.onlNext();
/*CH REMOVE
//hide frames with no ads in it, and change the sponsor ad title if there is any, by v-starli@microsoft.com 2007/2/15
HideAdFramesAndChangeTitles();
renderTimestampIcon();
*/
},
///
/// Helper function that returns the part of string s after string a and
/// before string b.
///
/// String to look in
/// String that precedes our target
/// String that follows our target
/// String in s between a and b
///
/// INTERNAL: called only from within Std.js.
///
pd_bet: function(s, b, a, r) {
note("pd_bet");
var i = s.indexOf(b);
if (i < 0)
return '';
s = s.substring(i + b.length, s.length);
if (a == '')
return s;
i = s.indexOf(a);
if (r == 'true')
{
return (i > 0) ? s.substring(0, i) : s;
}
else
{
return (i > 0) ? s.substring(0, i) : '';
}
},
///
/// Helper function that converts its argument into a string, handling
/// undefined values.
///
/// Object to convert
/// Value of object as a string, or '' if undefined
///
/// INTERNAL: called only from within Std.js.
///
pd_str: function(o) {
note("pd_str");
return (typeof(o) == 'undefined') ? '': '' + o;
},
///
/// Helper function that unescapes strings from URLs
///
/// String to unescape
/// String unescaped for normal use
///
/// INTERNAL: called only from within Std.js.
///
pd_une: function(s) {
note("pd_une");
return unescape(s.replace(/\+/g, ' '));
},
///
/// Helper function that escapes strings
///
/// String to escape
/// String escaped for URL use
///
/// INTERNAL: called only from within Std.js.
///
pd_esc: function(s) {
note("pd_esc");
return escape(pd_nou(s));
},
///
/// light version of pd_nou, won't strip character with accent
///
/// String to fix up
/// String fixed up with no Unicode characters
///
/// INTERNAL: called only from within Std.js.
///
pd_noul: function(s) {
note("pd_noul");
return s.replace(/\u2013/g, '-').replace(/\u2014/g, '-').replace(/\u2018/g, '\'').replace(/\u2019/g, '\'').replace(/\u201C/g, '"').replace(/\u201D/g, '"');
},
///
/// Helper function that removes Unicode chars from strings
///
/// String to fix up
/// String fixed up with no Unicode characters
///
/// INTERNAL: called only from within Std.js.
///
pd_nou: function(s) {
note("pd_nou");
return pd_noul(s).replace(/[^\x20-\x7F]/g, '_');
},
///
/// Hyperlink tracking function
///
/// Area that Link is located in
/// Colorbox or Image that link is in.
/// e for exit, o for custom, d for download (not used)
/// Position of Link in link list, and total # of links (i.e. 1|5)
/// value of text, if image then it will be the alt text
/// Link being click on
/// submits the link values to omniture
///
pd_onc: function(area, module, linkType, linkPos, textVal, obj) {
note("pd_onc");
// Only do click tracking if Omniture code exists on this page
if (typeof(s_account) != "undefined" && s_account != '' && typeof(s_msn) != "undefined")
{
s_msn.prop48 = area;
s_msn.prop49 = s_msn.channel;
s_msn.prop50 = module;
if (area == 'Related Stories')
{
s_msn.prop20 = pd_me.id + '|from|RL|' + linkPos;
s_msn.prop22 = s_msn.prop20;
}
if (area == 'Recommended Stories')
{
s_msn.prop20 = pd_me.id + '|from|RS|' + linkPos;
s_msn.prop21 = s_msn.prop20;
}
s_msn.tl(this, linkType, area + '|' + s_msn.channel + '|' + module + '|' + linkPos + '|' + textVal);
}
},
// ratings
pd_rr: function(ct, ii, it, ai, key, hc, usrR, totalU) {
if (!pd_me) return;
pd_me.ct = ct;
pd_me.ii = ii;
pd_me.it = it;
pd_me.ai = ai;
pd_me.key = key;
pd_me.hc = hc;
pd_me.rated = false;
pd_me.usrRating = usrR;
pd_me.totalUsers = totalU;
if (typeof(s_msn) != "undefined")
{
s_msn.prop41 = usrR + "|" + totalU;
}
},
DateTime: function() {
note("DateTime");
var ma = ["Jan", "Feb", "March", "April", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec"];
var wa = ["Sun", "Mon", "Tues", "Wed", "Thurs", "Fri", "Sat"];
var za = ["ET", "CT", "MT", "PT", "AKT", "HT", "HT"];
this.D2S = function(d, f) {
var r = "updated ";
if (f) {
var c = new Date();
var m = parseInt(((c - d) / 1000) / 60);
if (m == 0) {
return r + "less than 1 minute ago";
}
else if (m < 180 && m > 0) {
return r + M2S(m);
}
}
return r + "" + GetT(d) + " " + this.GetTZ(d) + "," + GetD(d) + "";
};
var M2S = function(m) {
var r = "";
if (m > 59) {
var h = parseInt(m / 60);
m = m - (h * 60);
r = h + " hour" + ((h > 1) ? "s": "") + ((m > 0) ? ", ": "");
}
return r += ((m > 0) ? (m + " minute" + ((m > 1) ? "s": "")) : "") + " ago";
};
var T2M = function(t) {
return parseInt((t - 621355968000000000) / 10000);
};
this.T2D = function(t) {
return new Date(T2M(t));
};
var GetT = function(d) {
var h = d.getHours();
var m = d.getMinutes();
return ((h < 13) ? ((h == 0) ? 12: h) : (h - 12)) + ":" + ((m < 10) ? "0" + m: m) + " " + ((h < 12) ? "a.m.": "p.m.");
};
var GetD = function(d) {
var m = wa[d.getDay()] + "., " + ma[d.getMonth()] + ". " + d.getDate() + ", " + d.getFullYear();
return m;
};
this.GetTZ = function(d) {
var o = d.getTimezoneOffset() / 60;
var st = (d.toString().lastIndexOf("ST") > -1 || d.toString().lastIndexOf("Standard Time") > -1) ? 5: 4;
return (o <= 10 && o >= st) ? za[o - st] : false;
};
},
/// ALBERT'S OLD OMNITURE
linkTrackHandler: function(e) {
/** CH REMOVED
var target;
var targetNodename;
var doLinkTrack = false;
if (!e) var e = window.event;
if (e.target) target = e.target; // mozilla
else if (e.srcElement) target = e.srcElement; // ie
if (target)
{
var bVideo = false;
switch (target.nodeName.toUpperCase())
{
case "A":
doLinkTrack = true;
if (target.getAttribute('href').indexOf('msnvDwd(') != -1) {bVideo = true;}
break;
case "TD"://newsmenu button cells
if(target.firstChild)
{
target = target.firstChild;
}
if(target.nodeName.toUpperCase()=='A')
{
doLinkTrack = true;
if (target.getAttribute('href').indexOf('msnvDwd(') != -1) {bVideo = true;}
}
break;
case "AREA":
doLinkTrack = true;
if (target.getAttribute('href').indexOf('msnvDwd(') != -1) {bVideo = true;}
break;
case "IMG":
if (target.parentNode && target.parentNode.nodeName.toUpperCase() == "A")
{
doLinkTrack = true;
if (target.parentNode.getAttribute('href').indexOf('msnvDwd(') != -1) {bVideo = true;}
}
break;
case "INPUT":
if (target.getAttribute('type') && target.getAttribute('type').toUpperCase() == "BUTTON")
{
doLinkTrack = true;
if (target.getAttribute('onclick').toString().indexOf('msnvDwd(') != -1) {bVideo = true;}
}
break;
default:
doLinkTrack = false;
}
}
if (doLinkTrack)
{
var ltData = getLinkTrackData(target);
if (ltData)
{
bVideo? s_msn.prop27 = ltData:SetCookie('lt',ltData);
}
}
*/
},
getLinkTrackData: function(target) {
/* CH REMOVED
note("getLinkTrackData");
var ct, cn, pn = null, node = target;
// wipe any previous omniture cookie
var date = new Date();
date.setTime(date.getTime() - 120000);
SetCookie('lt', '', date.toGMTString());
// crawl up dom until 'control type' property is found
while (node)
{
if (node.getAttribute && node.getAttribute('ct'))
{
if (ct && !pn)
{
// we already got component type from
// a previous node, but project name
// is still empty. in this case set
// the project name to this newfound
// component type
pn = node.getAttribute('ct');
break;
}
else if (!ct) // we're finding a node for the first time
{
ct = node.getAttribute('ct');
cn = node.getAttribute('cn').substring(0,30);
pn = node.getAttribute('pn');
if (pn)
{
pn = pn.substring(0,15);
break;
}
}
}
node = node.parentNode;
}
if (ct) return Omni.LinkTrack.GetDoctype() + '|' + Omni.LinkTrack.GetSection() + '|' + pn + '|' + ct + '|' + cn;
*/
},
// CH: wrapped this stuff in single object definition
Omni: {
NewsMenu: {
ProjectName: '',
Top: '',
FirstHeadline: '',
FirstFront: '',
SecondHeadline: '',
ExpandFront: '',
ExpandHeadline: ''
},
LinkTrack: {
///
/// Omniture link track onclick handler for news menu flyout links
/// Process linkTrackHandler function and stop event bubble
///
///
///
///
OnclickHandler: function(e) {
note("OnclickHandler");
if (e)
{
linkTrackHandler(e);
//stop the event bubble up
if (e.target)
{
e.stopPropagation();
//dom/firefox
}
else if (e.srcElement)
{
e.cancelBubble = true;
//ie
}
}
},
/////
/// LinkTrack.GetDoctype method, returns doc type string
///
GetDoctype: function() {
note("GetDoctype");
if (s_prop16_orig) {
return s_prop16_orig.substring(0, 15);
}
return '';
},
/////
/// LinkTrack.GetSection method, returns section string
/// Determines whether link is from section, sub-section, or sub-sub-section.
///
GetSection: function() {
note("GetSection");
///trims the section to 15 characters
function TrimSection(str) {
if (str)
{
return str.substr(0, 15);
}
return '';
}
///Determine section type
if (s_prop6_orig)
{
return TrimSection(s_prop6_orig);
}
else if (s_prop5_orig)
{
return TrimSection(s_prop5_orig);
}
else
{
return TrimSection(s_prop4_orig);
}
}
}
// end .LinkTrack
},
// end Omni
getTimestampTitle: function(currencyDate) {
note("getTimestampTitle");
var time = Math.floor((new Date().getTime() - new Date(parseInt((currencyDate - 621355968000000000) / 10000)).getTime()) / (60 * 1000));
var alt = 'Updated';
if (time > 0)
{
alt += ' ';
var d = Math.floor(time / 1440);
var h = Math.floor(time % 1440 / 60);
var m = Math.floor(time % 60);
if (d == 1)
{
alt += d + ' day';
}
else if (d > 1)
{
alt += d + ' days';
}
if (h == 1)
{
if (d > 0)
{
alt += ', ';
}
alt += h + ' hour';
}
else if (h > 1)
{
if (d > 0)
{
alt += ', ';
}
alt += h + ' hours';
}
if (m == 0)
{
if (d == 0 && h == 0)
{
alt += 'less than 1 minute ago';
}
else
{
alt += ' ago';
}
}
else if (m == 1)
{
if (d > 0 || h > 0)
{
alt += ', ';
}
alt += m + ' minute ago';
}
else
{
if (d > 0 || h > 0)
{
alt += ', ';
}
alt += m + ' minutes ago';
}
}
return alt;
},
BrowserDetect: {
init: function() {
note("BrowserDetect.init");
this.browser = this.searchString(this.dataBrowser) || "unknown browser";
this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "unknown version";
this.OS = this.searchString(this.dataOS) || "unknown OS";
document.getElementsByTagName("body")[0].className = BrowserDetect.OS + " " + BrowserDetect.browser + " " + BrowserDetect.browser + "-" + Math.floor(BrowserDetect.version) + " " + BrowserDetect.OS + "-" + BrowserDetect.browser;
},
searchString: function(data) {
note("BrowserDetect.searchString");
for (var i = 0; i < data.length; i++) {
var dataString = data[i].string;
var dataProp = data[i].prop;
this.versionSearchString = data[i].versionSearch || data[i].identity;
if (dataString) {
if (dataString.indexOf(data[i].subString) != -1)
return data[i].identity;
}
else if (dataProp)
return data[i].identity;
}
},
searchVersion: function(dataString) {
note("BrowserDetect.searchVersion");
var index = dataString.indexOf(this.versionSearchString);
if (index == -1) return;
return parseFloat(dataString.substring(index + this.versionSearchString.length + 1));
},
dataBrowser: [
{
string: navigator.vendor,
subString: "Apple",
identity: "Safari"
},
{
prop: window.opera,
identity: "Opera"
},
{
string: navigator.userAgent,
subString: "Firefox",
identity: "Firefox"
},
{
string: navigator.userAgent,
subString: "Netscape",
identity: "Netscape"
},
{
string: navigator.userAgent,
subString: "MSIE",
identity: "IE",
versionSearch: "MSIE"
},
{
string: navigator.userAgent,
subString: "Gecko",
identity: "Mozilla",
versionSearch: "rv"
},
{
string: navigator.userAgent,
subString: "Mozilla",
identity: "Netscape",
versionSearch: "Mozilla"
}
],
dataOS: [
{
string: navigator.platform,
subString: "Win",
identity: "Win"
},
{
string: navigator.platform,
subString: "Mac",
identity: "Mac"
},
{
string: navigator.platform,
subString: "Linux",
identity: "Linux"
}
]
},
// GRIDS
gridList: [],
//adds grid to list of grids that need their height checked
addGrid: function(gridName) {
note("addGrid");
if (gridList == null) gridList = new Array();
gridList[gridName] = gridName;
},
getQueryVariable: function(variable) {
note("getQueryVariable");
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
return "";
}
});
// CH refactored to class definition
//Generic Hashtable Object
$utils.Hashtable = Class.extend({
init: function() {
note("Hashtable.init");
this.keys = [];
this.values = [];
},
//Public Clear Function
// - Reset all keys and values
Clear: function() {
this.keys = new Array();
this.values = new Array();
},
//Public Get Function
// - Retrieve a value for a specific key
Get: function(key) {
try
{
return (this.values[key]);
}
catch(e)
{
return null;
}
},
//Public Set Function
// - Assign and store a value to a specified key
Set: function(key, value) {
if (key && value)
{
if (this.values[key] == null)
{
this.keys[this.keys.length] = key;
}
this.values[key] = value;
}
},
//Public Remove Function
// -
Remove: function(key) {
for (var i = 0; i < this.keys.length; i++)
{
if (key == this.keys[i])
{
//remove key from the hash
this.values[this.keys[i]] = null;
this.keys.splice(i, 1);
return;
}
}
},
//Public ContainsKey Function
// - Check to see if a specified key exists
ContainsKey: function(key) {
return (this.Get(key) != null);
},
//Public Size Funtion
// - Returns the number of key/value pairs in the collection
Size: function() {
return this.keys.length;
}
});
// ------GLOBAL SCOPE EXPORT--------
var toGlobal = {};
if (exportToGlobal) {
if (exportToGlobal.length) {
jQuery.each(exportToGlobal,
function() {
toGlobal[this] = $legacy[this];
});
} else {
jQuery.extend(toGlobal, $legacy);
}
toGlobal["Hashtable"] = $utils.Hashtable;
}
// return this object from the closure, effectively: jQuery.extend(window, toGlobal)
return toGlobal;
})());
// END outer $.extend();
};
msnbc.utils.activateLegacySupport(false, true);