
Function.NoOp = function(a) { return (a); }
if (!window.BtvOverlay) window.BtvOverlay = {};
(function(){
if (!BtvOverlay.Util) BtvOverlay.Util = {};
BtvOverlay.Util.ArrayToHash = function(a, fnc)
{
fnc = fnc || Function.NoOp;
var ht = {};
for (var i = 0; a && (i < a.length); i++) ht[fnc(a[i])] = true;
return (ht);
}
BtvOverlay.Util.ToLowerCase = function(s)
{
return(s.toLowerCase());
}
BtvOverlay.Util.ToUpperCase = function(s)
{
return(s.toUpperCase());
}
var re = new RegExp("[\\[\\]{}\\\\|().*+?\^\$]", "g");
BtvOverlay.Util.RegExpEscape = function(s)
{
return s.replace(re, "\\$&");
}
})();
BtvOverlay.Dom = new function()
{
var oThis = this;
oThis.Traverse = function(oNode, fnc, fncStop)
{
function Loop()
{
while (aNodesToSearch.length > 0)
{
if (iDelayIterations++ == 100)
{
iDelayIterations = 0;
window.setTimeout(Loop, 10);
fncStop(true);
return;
}
else
{
oNode = aNodesToSearch[aNodesToSearch.length-1];
if (oNode == aParentNodes[aParentNodes.length-1])
{
aParentNodes.pop();
aNodesToSearch.pop();
fnc(oNode, false);
}
else
{
if (!fnc(oNode, true) && oNode.childNodes.length)
{
aParentNodes.push(oNode);
for (var i = oNode.childNodes.length - 1; i >= 0; i--)
{
aNodesToSearch.push(oNode.childNodes[i]);
}
}
else
{
aNodesToSearch.pop();
fnc(oNode, false)
}
}
}
}
fncStop(false);
}
var iDelayIterations = 0;
var aNodesToSearch = oNode ? [oNode] : [];
var aParentNodes = [];
Loop();
}
oThis.FindNodes = function(oNode, aNodeTypes, oRules, fncCallback)
{
function Nodify(oNode, bln)
{
if (bln)
{
var iType = oNode.nodeType;
if (iInclude && htNodeTypes[iType]) aTextNodes.push(oNode);
if (iType != 1) return(true);
var id = oNode.getAttribute("id");
if (lookup[0] && lookup[0].ids[id]) return(true);
var strTagName = oNode.tagName;
if (lookup[0] && lookup[0].tags[strTagName]) return(true);
var strClasses = oNode.className;
if (lookup[0] && lookup[0].classes[strClasses]) return(true);
if (lookup[1] && (lookup[1].tags[strTagName] || lookup[1].ids[id] || lookup[1].classes[strClasses]))
{
aIncludeNodes.push(oNode);
iInclude++;
}
return(false);
}
else
{
if (aIncludeNodes.length && (aIncludeNodes[aIncludeNodes.length-1] == oNode))
{
aIncludeNodes.pop();
iInclude--;
}
}
}
function Stop(bln)
{
fncCallback(aTextNodes, bln);
aTextNodes = [];
}
function CreateLookup()
{
var lookup = [];
if (oRules.oExclude) lookup[0] = {
tags: ath(oRules.oExclude.aTags, BtvOverlay.Util.ToUpperCase)
,ids: ath(oRules.oExclude.aIds)
,classes: ath(oRules.oExclude.aClasses)
};
if (oRules.oInclude) lookup[1] = {
tags: ath(oRules.oInclude.aTags, BtvOverlay.Util.ToUpperCase)
,ids: ath(oRules.oInclude.aIds)
,classes: ath(oRules.oInclude.aClasses)
};
return(lookup);
}
oRules.aNodeTypes = aNodeTypes;
var iInclude = oRules.oInclude ? 0 : 1;
var ath = BtvOverlay.Util.ArrayToHash;
var htNodeTypes = BtvOverlay.Util.ArrayToHash(oRules.aNodeTypes);
var lookup = CreateLookup();
var aIncludeNodes = [];
var aTextNodes = [];
BtvOverlay.Dom.Traverse(oNode, Nodify, Stop);
}
};
BtvOverlay.Dom.Tokenizer = new function()
{
var oThis = this;
oThis.Run = function(oNode, astrKeywords, htTermsData, oRules, strTermColor, fnc)
{
function RunSet(aNodes, astrKeywords, fnc)
{
function BuildReplacement(oNode, strText, aMatches)
{
function InAnchor()
{
var o = oNode;
while (o.parentNode)
{
if (o.parentNode.tagName && (o.parentNode.tagName.toLowerCase() == "a")) return(true);
o = o.parentNode
}
return(false);
}
function Adorn(str)
{
var span = document.createElement("foo");
if (!span.addEventListener) span.style.position = "relative";
span.style.display = "inline";
span.style.textDecoration = "underline";
span.style.borderBottom = "solid 1px " + strTermColor;
if (!span.addEventListener) span.style.top = "1px";
span.style.cursor = "pointer";
span.style.zoom = 1;
fnc(span, str);
span.innerHTML = str;
return (span);
}
function CheckSpan(span)
{
var str = span.innerHTML;
span.innerHTML = '&nbsp;';
var iOneLineHeight = span.offsetHeight;
span.innerHTML = str;
var iEntireHeight = span.offsetHeight;
span._blnWrap = (iEntireHeight > (1.5 * iOneLineHeight));
}
function CreateIcon(str)
{
var img = document.createElement('img');
img.src = '/images/overlay-action.png';
img.style.borderWidth = '0px';
img.style.display = 'inline';
//img.style.verticalAlign = 'text-bottom';
img.style.padding = '1px 0px 0px 4px';
img.style.margin = '0px';
img.style.cursor = "pointer";
img.style.zoom = 1;
img.__blnOverlay = true;
fnc(img, str);
return(img);
}
if (!oNode.parentNode) return;
for (var i=0; i < oNode.parentNode.childNodes.length; i++)
{
if (oNode.parentNode.childNodes[i].__blnOverlay) return;
}
var iStart = 0;
for (var i = 0; i < aMatches.length; i++)
{
var strMatch = aMatches[i][0];
var strTerm = aMatches[i][1];
if (true)
{
var iPlainTextLength = aMatches[i].index + strMatch.indexOf(strTerm);
var textNode = document.createTextNode(strText.substring(iStart, iPlainTextLength));
oNode.parentNode.insertBefore(textNode, oNode);
var span = Adorn(strTerm);
oNode.parentNode.insertBefore(span, oNode);
CheckSpan(span);
iStart = iPlainTextLength + strTerm.length;
}
else
{
var iPlainTextLength = aMatches[i].index + strMatch.indexOf(strTerm) + strTerm.length;
var textNode = document.createTextNode(strText.substring(iStart, iPlainTextLength));
oNode.parentNode.insertBefore(textNode, oNode);
oNode.parentNode.insertBefore(CreateIcon(strTerm), oNode);
iStart = iPlainTextLength;
}
}
var textNode = document.createTextNode(strText.substring(iStart));
oNode.parentNode.insertBefore(textNode, oNode);
oNode.parentNode.removeChild(oNode);
}
function SortKeywords(s1, s2)
{
var i1 = s1.length;
var i2 = s2.length;
return((i1 < i2) ? 1 : ((i1 > i2) ? -1 : 0));
}
astrKeywords.sort(SortKeywords);
var aReKeywords = [];
for (var i=0; i < astrKeywords.length; i++)
{
aReKeywords.push(BtvOverlay.Util.RegExpEscape(astrKeywords[i]));
}
var reSearch = new RegExp("(?:^|[^0-9A-Za-z])(" + aReKeywords.join('|') + ")([^0-9A-Za-z]|$)", "g");
var aMatch;
var aMatches;
var strTerm;
for (var i = 0; i < aNodes.length; i++)
{
aMatches = null;
var str = aNodes[i].nodeValue;
while ((aMatch = reSearch.exec(str)) != null)
{
aMatches = aMatches || [];
strTerm = aMatch[1];
if (!htTermMatches[strTerm]) htTermMatches[strTerm] = 0;
if (!htTermsData[strTerm] || (htTermsData[strTerm].MaxCount <= 0) || (htTermMatches[strTerm] < htTermsData[strTerm].MaxCount))
{
htTermMatches[strTerm]++;
aMatches.push(aMatch);
}
if (aMatch[2]) reSearch.lastIndex -= 1;
}
if (aMatches) BuildReplacement(aNodes[i], str, aMatches);
}
}
function HaveNodes(aTextNodes, bln)
{
RunSet(aTextNodes, astrKeywords, fnc);
if (!bln)
{
var dtEnd = (new Date()).valueOf();
//alert(dtEnd - dtStart);
}
}
var dtStart = (new Date()).valueOf();
if (!oRules.oExclude) oRules.oExclude = {};
if (!oRules.oExclude.aTags) oRules.oExclude.aTags = [];
if (!oRules.oExclude.aClasses) oRules.oExclude.aClasses = [];
oRules.oExclude.aTags.push("script");
oRules.oExclude.aTags.push("foo");
oRules.oExclude.aTags.push("textarea");
oRules.oExclude.aClasses.push("nooverlay", "btv_orange_button", "article_page_title");
var htTermMatches = {};
var aTextNodes = BtvOverlay.Dom.FindNodes(oNode, [3], oRules, HaveNodes);
}
};
(function()
{
var oOverlayData = {"data":[{"Url":"ken-washington.aspx","PhotoCount":6,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Ken-Washington.jpg","Term":"Ken, Washington","ID":1822,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"pam-indiana.aspx","PhotoCount":6,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Pam-Indiana.jpg","Term":"Pam, Indiana","ID":1824,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"filipe-fa.aspx","PhotoCount":72,"Rank":3007,"ImageSrc":"/usrimages/usr-1/-1_b747c291-4b0a-42fe-9bd2-0779378a7718-a-1-80ed0e9a-9223-4a0e-997a-a0250efe869d-20090303-tblfilipe.jpg","Term":"Filipe Fa","ID":40000533,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"mike-morelli.aspx","PhotoCount":46,"Rank":3007,"ImageSrc":"/usrimages/usr-1/-1_b3a07240-6810-49e0-b55e-e25cd28d91bc-a-1-1d51a1f2-fa2a-457a-b8bf-3c74f2b5263f-20090303-tblmike.jpg","Term":"Mike Morelli","ID":40000538,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"aubrey-cheney.aspx","PhotoCount":55,"Rank":3007,"ImageSrc":"/usrimages/usr-1/-1_3324fa38-258e-4416-ae8c-90f490bc4df1-a-1-3e1fbb44-8cf1-45c3-8da6-3b1e340748a0-20090303-tblaubrey.jpg","Term":"Aubrey Cheney","ID":40000531,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"bernie-salazar.aspx","PhotoCount":3,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Bernie-Salazar.jpg","Term":"Bernie Salazar","ID":17348,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"stacey-capers.aspx","PhotoCount":1,"Rank":3007,"ImageSrc":"/articles/profiles/stacey-capers.jpg","Term":"Stacey Capers","ID":30000193,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"melinda-alabama.aspx","PhotoCount":10,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Melinda-Alabama.jpg","Term":"Melinda, Alabama","ID":1831,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"patty-gonzalez.aspx","PhotoCount":2,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Patty-Gonzalez.jpg","Term":"Patty Gonzalez","ID":10000231,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"alison-sweeney-1.aspx","PhotoCount":124,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Alison-Sweeney.jpg","Term":"Alison Sweeney","ID":9810,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"daniel-and-david.aspx","PhotoCount":935,"Rank":3007,"ImageSrc":"/usrimages/usr-1/-1_a-------------tbld-nield-vidg-llery.jpg","Term":"Daniel and David","ID":40000304,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"liz-young.aspx","PhotoCount":0,"Rank":3007,"ImageSrc":"/usrimages/usr3465121/3465121_bab4ddf2-1e06-48d8-a124-9321f157bb6f-3465121-a081986f-63af-4f6d-90ab-64cd8c6c56b8-liz-young.jpg","Term":"Liz Young","ID":500000596,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"caroline-rhea.aspx","PhotoCount":50,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Caroline-Rhea.jpg","Term":"Caroline Rhea","ID":1956,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"kelly-and-paul.aspx","PhotoCount":3,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Kelly-Fields.jpg","Term":"Kelly Fields","ID":15226,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"david.aspx","PhotoCount":2,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/David-Griffin.jpg","Term":"David Griffin","ID":9733,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"heba-salama.aspx","PhotoCount":1,"Rank":3007,"ImageSrc":"/articles/profiles/heba-salama.jpg","Term":"Heba Salama","ID":30000189,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"rudy-pauls.aspx","PhotoCount":0,"Rank":3007,"ImageSrc":"/usrimages/usr3465121/3465121_a400a06f-a38a-4e54-9955-b56bc9b347ad-3465121-72e494db-8d16-4872-a120-ab204fa5c3be-rudy-pauls.jpg","Term":"Rudy Pauls","ID":500000599,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"adam-capers.aspx","PhotoCount":1,"Rank":3007,"ImageSrc":"/articles/profiles/adam-capers.jpg","Term":"Adam Capers","ID":30000194,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"isabeau.aspx","PhotoCount":2,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Isabeau-Miller.jpg","Term":"Isabeau Miller","ID":9738,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"bobby-tennessee.aspx","PhotoCount":6,"Rank":2461,"ImageSrc":"/articles/the-biggest-loser/profile/Bobby-Tennessee.jpg","Term":"Bobby, Tennessee","ID":1827,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"neil-tejwani.aspx","PhotoCount":2,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Neil-Tejwani.jpg","Term":"Neil Tejwani","ID":10000210,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"damien-and-nicole.aspx","PhotoCount":2,"Rank":3007,"ImageSrc":"/usrimages/usr-1/-1_a-------------tbld-miennicoleg-llery.jpg","Term":"Damien and Nicole","ID":40000308,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"sean-algaier.aspx","PhotoCount":0,"Rank":3007,"ImageSrc":"/usrimages/usr3465121/3465121_101605b2-acdc-44dd-9ca5-e9f9c7d520d2-3465121-e1e453b1-4f5f-41b4-acfa-b7bcdcc6fcbd-sean-algaier.jpg","Term":"Sean Algaier","ID":500000600,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"bill.aspx","PhotoCount":2,"Rank":2575,"ImageSrc":"/articles/the-biggest-loser/profile/Bill-Germanakos.jpg","Term":"Bill Germanakos","ID":9746,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"paul-marks.aspx","PhotoCount":3,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Paul-Marks.jpg","Term":"Paul Marks","ID":17353,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"jerry-and-estella.aspx","PhotoCount":3,"Rank":3007,"ImageSrc":"/usrimages/usr-1/-1_a-------------tbljerryestell-g-llery.jpg","Term":"Jerry and Estella","ID":40000311,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"brian-california.aspx","PhotoCount":6,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Brian-California.jpg","Term":"Brian, California","ID":1828,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"danny-cahill.aspx","PhotoCount":0,"Rank":3007,"ImageSrc":"/usrimages/usr3465121/3465121_b67dbc89-537f-4cce-83d3-1adc24418c88-3465121-d4a072b2-b634-44f0-bb7d-999bd68c9e2c-charles-daniel.jpg","Term":"Danny Cahill","ID":400000006,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"amy-parham.aspx","PhotoCount":1,"Rank":3007,"ImageSrc":"/articles/profiles/amy-parham.jpg","Term":"Amy Parham","ID":30000195,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"kai-alaska.aspx","PhotoCount":6,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Kai-Alaska.jpg","Term":"Kai, Alaska","ID":1821,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"bryan.aspx","PhotoCount":2,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Bryan-Washington.jpg","Term":"Bryan Washington","ID":9743,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"erik-new-york.aspx","PhotoCount":6,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Erik-New-York.jpg","Term":"Erik, New York","ID":1829,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"mark-kruger.aspx","PhotoCount":3,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Mark-Kruger.jpg","Term":"Mark Kruger","ID":17355,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"julie.aspx","PhotoCount":2,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Julie-Hadden.jpg","Term":"Julie Hadden","ID":9732,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"kristin-steede.aspx","PhotoCount":84,"Rank":3007,"ImageSrc":"/usrimages/usr-1/-1_9a63057e-4e48-4346-94c8-75de4d188fa2-a-1-4d222a64-9f02-44d5-a6b1-8c7f6d64c3aa-20090303-tblkristin.jpg","Term":"Kristin Steede","ID":40000535,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"vicky-vilcan.aspx","PhotoCount":1,"Rank":3007,"ImageSrc":"/articles/profiles/vicky-vilcan.jpg","Term":"Vicky Vilcan","ID":30000191,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"helen-and-shanon.aspx","PhotoCount":54,"Rank":3007,"ImageSrc":"/usrimages/usr-1/-1_a-------------tblhelensh-nnong-llery.jpg","Term":"Helen and Shanon","ID":40000306,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"allen-smith.aspx","PhotoCount":0,"Rank":3007,"ImageSrc":"/usrimages/usr3465121/3465121_cfa2b496-d5b1-4a47-928e-3757ed0eadde-3465121-3c802cd4-5f2e-47c5-a841-36adff565789-allen-smith-ii.jpg","Term":"Allen Smith","ID":400000003,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"tom-desrochers-jr.aspx","PhotoCount":1,"Rank":3007,"ImageSrc":"/articles/profiles/tom-desrochers-jr.jpg","Term":"Tom Desrochers Jr.","ID":30000184,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"daniel-wright.aspx","PhotoCount":0,"Rank":3007,"ImageSrc":"/usrimages/usr3465121/3465121_6db8c5bd-3d3e-40a5-9954-e2c1a8589662-3465121-b250c9c0-06e2-4e5c-a8a8-bf543c5a4a6d-daniel-wright.jpg","Term":"Daniel Wright","ID":500000594,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"lynn-westphal.aspx","PhotoCount":3,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Lynn-Westphal.jpg","Term":"Lynn Westphal","ID":10000140,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"coleen-skeabeck.aspx","PhotoCount":1,"Rank":3007,"ImageSrc":"/articles/profiles/coleen-skeaback.jpg","Term":"Coleen Skeabeck","ID":30000188,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"hollie.aspx","PhotoCount":2,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Hollie-Self.jpg","Term":"Hollie Self","ID":9740,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"phil-hawk.aspx","PhotoCount":2,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Phil-Hawk.jpg","Term":"Phil Hawk","ID":10000237,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"jillian-michaels.aspx","PhotoCount":74,"Rank":570,"ImageSrc":"/articles/the-biggest-loser/profile/Jillian-Michaels.jpg","Term":"Jillian Michaels","ID":15233,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"renee-wilson.aspx","PhotoCount":1,"Rank":3007,"ImageSrc":"/articles/profiles/renee-wilson.jpg","Term":"Renee Wilson","ID":30000181,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"mandi-and-aubrey.aspx","PhotoCount":124,"Rank":3007,"ImageSrc":"/usrimages/usr-1/-1_a-------------tblm-ndi-ubreyg-llery.jpg","Term":"Mandi and Aubrey","ID":40000302,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"phillip-parham.aspx","PhotoCount":1,"Rank":3007,"ImageSrc":"/articles/profiles/phillip-parham.jpg","Term":"Phillip Parham","ID":30000196,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"rebecca-meyer.aspx","PhotoCount":0,"Rank":2541,"ImageSrc":"/usrimages/usr3465121/3465121_3d721281-b7f4-4c35-ab52-173e35be9a0a-3465121-e56223bb-9fda-4301-80fa-c76659e09d18-rebecca-meyer.jpg","Term":"Rebecca Meyer","ID":500000598,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"jerry-skeabeck.aspx","PhotoCount":1,"Rank":3007,"ImageSrc":"/articles/profiles/jerry-skeabeck.jpg","Term":"Jerry Skeabeck","ID":30000187,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"cathy-and-kristin.aspx","PhotoCount":83,"Rank":3007,"ImageSrc":"/usrimages/usr-1/-1_a-------------tblc-thykristing-llery.jpg","Term":"Cathy and Kristin","ID":40000310,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"mallory-bray.aspx","PhotoCount":2,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Mallory-Bray.jpg","Term":"Mallory Bray","ID":17569,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"marty-missouri.aspx","PhotoCount":6,"Rank":2910,"ImageSrc":"/articles/the-biggest-loser/profile/Marty-Missouri.jpg","Term":"Marty, Missouri","ID":1830,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"ron-and-mike.aspx","PhotoCount":85,"Rank":3007,"ImageSrc":"/usrimages/usr-1/-1_a-------------tblronmikeg-llery.jpg","Term":"Ron and Mike","ID":40000309,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"maggie-king.aspx","PhotoCount":3,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Maggie-King.jpg","Term":"Maggie King","ID":10000144,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"cathy-skel.aspx","PhotoCount":33,"Rank":3007,"ImageSrc":"/usrimages/usr-1/-1_7c573e63-db4c-457f-8e50-92a9653965a9-a-1-2e63edc6-43dd-4f08-82c9-494eecc8425e-20090303-tblcathy.jpg","Term":"Cathy Skel","ID":40000532,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"ryan-rodriguez.aspx","PhotoCount":2,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Ryan-Rodriguez.jpg","Term":"Ryan Rodriguez","ID":10000269,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"shay-sorrells.aspx","PhotoCount":0,"Rank":3007,"ImageSrc":"/usrimages/usr3465121/3465121_3c885597-a799-47da-93df-dd1979fa6e47-3465121-eb905de5-3116-4e2f-af5a-00ccfffaac78-shay-sorrells.jpg","Term":"Shay Sorrells","ID":500000601,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"neill-harmer.aspx","PhotoCount":3,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Neill-Harmer.jpg","Term":"Neill Harmer","ID":10000211,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"amber-1.aspx","PhotoCount":2,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Amber-Walker.jpg","Term":"Amber Walker","ID":9742,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"helen-phillips.aspx","PhotoCount":68,"Rank":3007,"ImageSrc":"/usrimages/usr-1/-1_77934a64-b02a-4184-8948-ffbca6eaee53-a-1-f5a21f33-4d1a-4ea8-9b71-caa2694ec53b-20090303-tblhelen.jpg","Term":"Helen Phillips","ID":40000534,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"jennifer-minnesota.aspx","PhotoCount":6,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Jennifer-Minnesota.jpg","Term":"Jennifer, Minnesota","ID":1820,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"curtis-and-mallory.aspx","PhotoCount":3,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Curtis-Bray.jpg","Term":"Curtis Bray","ID":15230,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"tom-desrochers-sr.aspx","PhotoCount":1,"Rank":3007,"ImageSrc":"/articles/profiles/tom-desrochers-sr.jpg","Term":"Tom Desrochers Sr.","ID":30000183,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"amanda-arlauskas.aspx","PhotoCount":0,"Rank":3007,"ImageSrc":"/usrimages/usr3465121/3465121_93ace454-32d1-4a58-92c5-8c06219cf6d5-3465121-8e85915a-b2fb-4311-bede-c3086099cf78-amanda-arlauskas.jpg","Term":"Amanda Arlauskas","ID":400000004,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"ali-vincent.aspx","PhotoCount":2,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Ali-Vincent.jpg","Term":"Ali Vincent","ID":17551,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"amy-maryland.aspx","PhotoCount":6,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Amy-Maryland.jpg","Term":"Amy, Maryland","ID":1826,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"alexandra-white.aspx","PhotoCount":0,"Rank":2840,"ImageSrc":"/usrimages/usr3465121/3465121_7469f032-1dbb-4f42-9e6d-f86616ced56a-3465121-198939a3-bd44-4419-be83-ea0d3623b6f6-alexandra-white.jpg","Term":"Alexandra White","ID":400000002,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"brady-vilcan.aspx","PhotoCount":1,"Rank":3007,"ImageSrc":"/articles/profiles/brady-vilcan.jpg","Term":"Brady Vilcan","ID":30000192,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"laura-denoux.aspx","PhotoCount":62,"Rank":3007,"ImageSrc":"/usrimages/usr-1/-1_92e09ae9-4c35-43d5-addb-f7b1a1eb6390-a-1-2b7fb2f9-1244-43cc-ad08-5955f6ac238d-20090303-tbllaura.jpg","Term":"Laura Denoux","ID":40000536,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"tracey-yukich.aspx","PhotoCount":0,"Rank":3007,"ImageSrc":"/usrimages/usr3465121/3465121_33894543-2a14-48bc-b6ae-62753cddfe5f-3465121-cb4f578b-41da-477a-b07d-eb60896e8263-tracey-yukich.jpg","Term":"Tracey Yukich","ID":500000602,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"wylie-florida.aspx","PhotoCount":6,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Wylie-Florida.jpg","Term":"Wylie, Florida","ID":1825,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"kim-lyons.aspx","PhotoCount":17,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Kim-Lyons.jpg","Term":"Kim Lyons","ID":1957,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"jim-1.aspx","PhotoCount":2,"Rank":1936,"ImageSrc":"/articles/the-biggest-loser/profile/Jim-Germanakos.jpg","Term":"Jim Germanakos","ID":9747,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"jenni-westphal.aspx","PhotoCount":3,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Jenni-Westphal.jpg","Term":"Jenni Westphal","ID":17576,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"ron-morelli.aspx","PhotoCount":37,"Rank":3007,"ImageSrc":"/usrimages/usr-1/-1_ac85beb0-5064-4208-897b-54f6a13cdfb7-a-1-e12689c8-e768-4b05-b313-63d66f1b0043-20090303-tblron.jpg","Term":"Ron Morelli","ID":40000539,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"mo-dewalt.aspx","PhotoCount":0,"Rank":3007,"ImageSrc":"/usrimages/usr3465121/3465121_9a5b6b00-a06b-4e4b-85d6-1fffe02de6d8-3465121-8c262ca0-def5-4efa-8053-99e3522717ec-mozziz-dewalt.jpg","Term":"Mo Dewalt","ID":500000597,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"jackie-evans.aspx","PhotoCount":3,"Rank":2646,"ImageSrc":"/articles/the-biggest-loser/profile/Jackie-Evans.jpg","Term":"Jackie Evans","ID":17350,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"sione-fa.aspx","PhotoCount":86,"Rank":3007,"ImageSrc":"/usrimages/usr-1/-1_b3051f05-7a63-4388-8d67-9b237113d00c-a-1-3e81f4df-7e3c-462b-a1ab-015799b816b8-20090303-tblsione.jpg","Term":"Sione Fa","ID":40000540,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"nicole-michalik.aspx","PhotoCount":2,"Rank":2785,"ImageSrc":"/articles/the-biggest-loser/profile/Nicole-Michalik.jpg","Term":"Nicole Michalik","ID":10000218,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"carla-and-joelle.aspx","PhotoCount":3,"Rank":3007,"ImageSrc":"/usrimages/usr-1/-1_a-------------tblc-rl-joelleg-llery.jpg","Term":"Carla and Joelle","ID":40000305,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"antoine-dove.aspx","PhotoCount":0,"Rank":1916,"ImageSrc":"/usrimages/usr3465121/3465121_965a54d9-bffc-46ee-a606-a867187d8758-3465121-47256018-99f9-4443-a232-75e615556ebe-antoine-dove.jpg","Term":"Antoine Dove","ID":400000005,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"michelle-aguilar.aspx","PhotoCount":1,"Rank":2227,"ImageSrc":"/articles/profiles/michelle-aguilar.jpg","Term":"Michelle Aguilar","ID":30000182,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"jez.aspx","PhotoCount":2,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Jez-Luckett.jpg","Term":"Jez Luckett","ID":9736,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"mark-and-jay.aspx","PhotoCount":2,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Jay-Kruger.jpg","Term":"Jay Kruger","ID":15225,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"tara-costa.aspx","PhotoCount":138,"Rank":3007,"ImageSrc":"/usrimages/usr-1/-1_199b6f60-b030-4350-954e-c280d6da388c-a-1-2cd35388-18a8-430f-81ee-166f85704b66-20090303-tbltara.jpg","Term":"Tara Costa","ID":40000541,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"julio-gomez.aspx","PhotoCount":0,"Rank":3007,"ImageSrc":"/usrimages/usr3465121/3465121_22080512-e5f1-4e44-adc2-03ac501ad038-3465121-41433da6-7556-400b-8d7d-4c913ad1008f-julio-gomez.jpg","Term":"Julio Gomez","ID":500000595,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"mandi-kramer.aspx","PhotoCount":96,"Rank":3007,"ImageSrc":"/usrimages/usr-1/-1_b9cfb525-8c95-4df3-b530-089ad76fe574-a-1-62a639b4-875d-41ec-86d8-1aa969a9332e-20090303-tblmandi.jpg","Term":"Mandi Kramer","ID":40000537,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"dane-and-blaine.aspx","PhotoCount":3,"Rank":3007,"ImageSrc":"/usrimages/usr-1/-1_a-------------tbld-nebl-ineg-llery.jpg","Term":"Dane and Blaine","ID":40000303,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"bob-harper.aspx","PhotoCount":43,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Bob-Harper.jpg","Term":"Bob Harper","ID":1955,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"tiffany-texas.aspx","PhotoCount":6,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Tiffany-Texas.jpg","Term":"Tiffany, Texas","ID":1832,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"dan-and-jackie.aspx","PhotoCount":4,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Dan-Evans.jpg","Term":"Dan Evans","ID":15229,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"nelson-massachusets.aspx","PhotoCount":6,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Nelson-Massachusets.jpg","Term":"Nelson, Massachusets","ID":1823,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"trent-patterson.aspx","PhotoCount":3,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Trent-Patterson.jpg","Term":"Trent Patterson","ID":17356,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"filipe-and-sione.aspx","PhotoCount":112,"Rank":3007,"ImageSrc":"/usrimages/usr-1/-1_a-------------tblfilipesioneg-llery.jpg","Term":"Filipe and Sione","ID":40000312,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"amy.aspx","PhotoCount":2,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Amy-Zimmer.jpg","Term":"Amy Zimmer","ID":9745,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"tara-and-laura.aspx","PhotoCount":115,"Rank":3007,"ImageSrc":"/usrimages/usr-1/-1_a-------------tblt-r-l-ur-g-llery.jpg","Term":"Tara and Laura","ID":40000307,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"heather-utah.aspx","PhotoCount":43,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Heather-Utah.jpg","Term":"Heather, Utah","ID":1819,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"jerry.aspx","PhotoCount":36,"Rank":1790,"ImageSrc":"/articles/the-biggest-loser/profile/Jerry-Lisenby.jpg","Term":"Jerry Lisenby","ID":9734,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"amy-cremen.aspx","PhotoCount":1,"Rank":3007,"ImageSrc":"/articles/profiles/amy-cremen.jpg","Term":"Amy Cremen","ID":30000186,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"ali-and-bette-sue.aspx","PhotoCount":3,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Bette-Sue-Birkland.jpg","Term":"Bette-Sue Birkland","ID":15232,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"shellay-cremen.aspx","PhotoCount":1,"Rank":3007,"ImageSrc":"/articles/profiles/shellay-cremen.jpg","Term":"Shellay Cremen","ID":30000185,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"jenn-widder.aspx","PhotoCount":3,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Jenn-Widder.jpg","Term":"Jenn Widder","ID":17351,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"amanda-harmer.aspx","PhotoCount":3,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Amanda-Harmer.jpg","Term":"Amanda Harmer","ID":17558,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"ed-brantley.aspx","PhotoCount":1,"Rank":3007,"ImageSrc":"/articles/profiles/ed-brantley.jpg","Term":"Ed Brantley","ID":30000190,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"kae-whang.aspx","PhotoCount":2,"Rank":2375,"ImageSrc":"/articles/the-biggest-loser/profile/Kae-Whang.jpg","Term":"Kae Whang","ID":10000070,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"lezlye-donahue.aspx","PhotoCount":2,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Lezlye-Donahue.jpg","Term":"Lezlye Donahue","ID":10000121,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"dina-mercado.aspx","PhotoCount":0,"Rank":3007,"ImageSrc":"/usrimages/usr3465121/3465121_064a717f-a6c0-447c-b3ac-37fa9233416d-3465121-d6813d47-5edf-49fc-bf29-987471edf6d8-dina-mercado.jpg","Term":"Dina Mercado","ID":400000007,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"abby-rike.aspx","PhotoCount":0,"Rank":3007,"ImageSrc":"/usrimages/usr3465121/3465121_0c641858-7496-4f24-979a-4977720f4d88-3465121-c91aae6d-893a-420a-8dfb-59c374b056bd-abigail-rike.jpg","Term":"Abby Rike","ID":400000001,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"roger-shultz.aspx","PhotoCount":2,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Roger-Shultz.jpg","Term":"Roger Shultz","ID":10000260,"RelatedID":323,"Scope":0,"MaxCount":3},{"Url":"bernie-and-brittany.aspx","PhotoCount":3,"Rank":3007,"ImageSrc":"/articles/the-biggest-loser/profile/Brittany-Aberle.jpg","Term":"Brittany Aberle","ID":15231,"RelatedID":323,"Scope":0,"MaxCount":3}]};
var oExcludeData = {"Ids":null,"Tags":["h2"],"Classes":["wiki-text"]};
var oIncludeData = {"Ids":null,"Tags":null,"Classes":["content-col"]};
var strTermColor = null || "#999999";
var strBaseUrl = '';
var oRules = {};
if (oExcludeData)
{
oRules.oExclude = {
aIds: oExcludeData.Ids || []
,aTags: oExcludeData.Tags || []
,aClasses: oExcludeData.Classes || []
};
}
if (oIncludeData)
{
oRules.oInclude = {
aIds: oIncludeData.Ids || []
,aTags: oIncludeData.Tags || []
,aClasses: oIncludeData.Classes || []
};
}
var afncCastOverlayBuilders = {};
afncCastOverlayBuilders[0] = function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('<div id=\"divHoverHandle');_write(Term);_write('\" style=\"width:285px;background:url(\'');_write(strBaseUrl);_write('/images/pop-shadow.png\');zoom:1;\">\n<div style=\"border:1px solid #666666; background:#eeeeee; font-size:11px;  padding:7px; position:relative;bottom:3px;right:3px;zoom:1;\">\n<a href=\"');_write(strBaseUrl);_write('/');_write(Url);_write('\"><img src=\"http://www.buddytv.com');_write(ImageSrc);_write('\" style=\"border:none;width:92px;float:left;margin-right:5px;\"/></a>\n<div style=\"float:right;width:165px;zoom:1;\">\n<div style=\"font-size:16px;font-weight:bold;margin:-2px 0px 5px 0px;zoom:1;\"><a href=\"');_write(strBaseUrl);_write('/');_write(Url);_write('\">');_write(Term);_write('</a></div>\n<div style=\"margin-bottom:2px;zoom:1;\">Today’s Ranking: ');_write(Rank);_write('</div>\n<div style=\"margin-bottom:3px;zoom:1;\"><a href=\"');_write(strBaseUrl);_write('/btvredir.aspx?ctxtypid=21&ctxid=');_write(ID);_write('&pid=21&pnum=-1\">View Photos</a></div>\n<div style=\"zoom:1;\"><a href=\"');_write(strBaseUrl);_write('/btvredir.aspx?ctxtypid=21&ctxid=');_write(ID);_write('&pid=28&pnum=-1\">Rate now &raquo;</a></div>\n</div>\n<div style=\"clear:both;\"></div>\n</div>\n</div>');}return $text.join("");};
afncCastOverlayBuilders[1] = function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('<div id=\"divHoverHandle');_write(Term);_write('\" style=\"width:285px;background:url(\'');_write(strBaseUrl);_write('/images/pop-shadow.png\'); zoom:1;\">\n<div style=\"border:1px solid #666666; background:#eeeeee; font-size:11px;  padding:7px; position:relative;bottom:3px;right:3px;zoom:1;\">\n<a href=\"');_write(strBaseUrl);_write('/');_write(Url);_write('\"><img src=\"http://www.buddytv.com');_write(ImageSrc);_write('\" style=\"border:none;width:92px;float:left;margin-right:5px;\"/></a>\n<div style=\"float:right;width:165px;zoom:1;\">\n<div style=\"font-size:16px;font-weight:bold;margin:-2px 0px 5px 0px;zoom:1;\"><a href=\"');_write(strBaseUrl);_write('/');_write(Url);_write('\">');_write(Term);_write('</a></div>\n<div style=\"margin-bottom:2px;zoom:1;\">Today’s Ranking: ');_write(Rank);_write('</div>\n<div style=\"margin-bottom:3px;zoom:1;\"><a href=\"');_write(strBaseUrl);_write('/btvredir.aspx?ctxtypid=-1000&ctxid=');_write(ID);_write('&pid=21&pnum=-1\">View Photos (');_write(PhotoCount);_write(')</a></div>\n<div style=\"margin-bottom:3px;zoom:1;\"><a href=\"');_write(strBaseUrl);_write('/btvredir.aspx?ctxtypid=-1000&ctxid=');_write(ID);_write('&pid=35&pnum=-1\">Play Trivia &raquo;</a></div>\n</div>\n<div style=\"clear:both;\"></div>\n</div>\n</div>');}return $text.join("");};
function Run()
{
function GiveElementLayout(el)
{
if (el && !el.hasLayout) el.style.zoom = 1;
}
function GetWindowPosition()
{
function f(p1, p2)
{
var iWin = window[p1] ? window[p1] : 0;
var iDocEl = document.documentElement ? document.documentElement[p2] : 0;
var iBody = document.body ? document.body[p2] : 0;
var i = iWin ? iWin : 0;
if (iDocEl && (!i || (i > iDocEl))) i = iDocEl;
return(iBody && (!i || (i > iBody)) ? iBody : i);
}
var iW = f('innerWidth', 'clientWidth');
var iH = f('innerHeight', 'clientHeight');
var iL = f('pageXOffset', 'scrollLeft');
var iT = f('pageYOffset', 'scrollTop');
return({t:iT, r:(iW + iL), b:(iH + iT), l:iL});
}
function GetElPosition(el)
{
var pt = GetAbsPos(el);
return({t:pt.y, r:(pt.x + el.offsetWidth), b:(pt.y + el.offsetHeight), l:pt.x});
}
function GetOverlayPlacementPoint(elContext, elOverlay)
{
var elPos = GetElPosition(elContext);
var wndPos = GetWindowPosition();
var iSpace = 10;
var posSpace = {t:(elPos.t - wndPos.t - iSpace), r:(wndPos.r - elPos.r - iSpace), b:(wndPos.b - elPos.b - iSpace), l:(elPos.l - wndPos.l - iSpace)};
var iW = elOverlay.offsetWidth;
var iH = elOverlay.offsetHeight;
var pt = {x:wndPos.l, y:wndPos.t};
if (posSpace.t >= iH)
{
pt.y = elPos.t - iH;
}
else if (posSpace.b >= iH)
{
pt.y = elPos.b;
}
if (posSpace.r >= iW)
{
pt.x = elPos.r;
}
else if (posSpace.l >= iW)
{
pt.x = elPos.l - iW;
}
//pt.y += 3;
return(pt);
}
function AdjustPlacementPoint(pt, elOverlay)
{
var iW = elOverlay.offsetWidth;
var iH = elOverlay.offsetHeight;
var posOverlay = {t:pt.y, r:(pt.x + iW), b:(pt.y + iH), l:pt.x};
var wndPos = GetWindowPosition();
var iSpace = 10;
var posSpace = {t:(posOverlay.t - wndPos.t - iSpace), r:(wndPos.r - posOverlay.r - iSpace), b:(wndPos.b - posOverlay.b - iSpace), l:(posOverlay.l - wndPos.l - iSpace)};
if (posSpace.r < 0)
{
pt.x += posSpace.r;
}
else if (posSpace.l < 0)
{
pt.x += (0 - posSpace.l);
}
if (posSpace.t < 0)
{
pt.y += (0 - posSpace.t);
}
else if (posSpace.b < 0)
{
pt.y += posSpace.b;
}
return(pt);
}
function GetAbsPos(element)
{
function F(el)
{ 
var pt = {x:0,y:0};
if (el)
{ 
GiveElementLayout(el); 
pt.x += el.offsetLeft;
pt.y += el.offsetTop; 
var elOffset = el.offsetParent;
var elParent = el.parentNode;
while (elOffset)
{
GiveElementLayout(elOffset);
pt.x += elOffset.offsetLeft; 
pt.y += elOffset.offsetTop; 
if ((document.body != elOffset) && (document.documentElement != elOffset))
{ 
pt.x -= elOffset.scrollLeft; 
pt.y -= elOffset.scrollTop; 
} 
if (false && blnFirefox)
{ 
while (elParent && (elOffset != elParent))
{ 
pt.x -= elParent.scrollLeft; 
pt.y -= elParent.scrollTop; 
elParent = elParent.parentNode; 
}
} 
elParent = elOffset.parentNode;
elOffset = elOffset.offsetParent; 
} 
} 
return pt; 
} 
var blnFirefox = !!element.addEventListener;
if (!blnFirefox)
{
F(element, blnFirefox);
}
return(F(element, blnFirefox));
}
function AddEvent(obj, type, fn)
{
if (obj.addEventListener)
{
obj.addEventListener(type, fn, false);
}
else if (obj.attachEvent)
{
obj["e" + type + fn] = fn;
obj[type + fn] = function() { obj["e" + type + fn](window.event); }
obj.attachEvent("on" + type, obj[type + fn]);
}
}
function GetOverlayNode(strTerm)
{
if (!htOverlays[strTerm])
{
var oData = htTermsData[strTerm];
var strOverlayHtml = afncCastOverlayBuilders[oData.Scope](oData);
var div = document.createElement("div");
div.innerHTML = strOverlayHtml;
htOverlays[strTerm] = div.childNodes[0];
}
return(htOverlays[strTerm]);
}
function ShowOverlay(oNode, strTerm, pt)
{
blnNeedEventHookup = !htOverlays[strTerm];
HideCurrentOverlay(true);
elCurrentOverlay = GetOverlayNode(strTerm);
divOverlay.appendChild(elCurrentOverlay);
document.body.appendChild(divOverlay);
if (blnNeedEventHookup)
{
var elHandler = document.getElementById("divHoverHandle" + strTerm);
AddEvent(elHandler, blnIsIE ? "mouseenter" : "mouseover", OverlayOver);
AddEvent(elHandler, blnIsIE ? "mouseleave" : "mouseout", CommonOut);
}
var oPoint = GetAbsPos(oNode);
var overlayPt = GetOverlayPlacementPoint(oNode, divOverlay);
if (oNode._blnWrap)
{
overlayPt.x = pt.x - divOverlay.offsetWidth;
AdjustPlacementPoint(overlayPt, divOverlay);
}
divOverlay.style.visibility = "hidden";
divOverlay.style.top = overlayPt.y + "px";
divOverlay.style.left = overlayPt.x + "px";
divOverlay.style.visibility = "visible";
}
function MouseCoordinates(evt)
{
if (blnIsIE)
{
var oPoint = GetAbsPos(evt.srcElement);
return({x:(evt.x + oPoint.x), y:(evt.y + oPoint.y)});
}
else
{
return({x:evt.pageX, y:evt.pageY});
}
}
function HideCurrentOverlay(bln)
{
function F()
{
if ((elCurrentOverlay) && (iCounter_local == iCounter) && (!iOverCount))
{
iOverCount = 0;
divOverlay.removeChild(elCurrentOverlay);
divOverlay.parentNode.removeChild(divOverlay);
elCurrentOverlay = null;
}
}
iCounter++;
var iCounter_local = iCounter;
if (bln)
{
iOverCount= 0;
F();
}
else
{
window.setTimeout(F, 400);
}
}
var iCounter = 0;
if (Btv && Btv.Ads)
{
//Btv.Ads.onChangeRequest.Attach(RunFromBody);
}
var elCurrentOverlay;
var htOverlays = {};
function HookupTerm(oNode, strTerm)
{
function Over(evt)
{
ShowOverlay(oNode, strTerm, MouseCoordinates(evt));
iOverCount++;
}
AddEvent(oNode, blnIsIE ? "mouseenter" : "mouseover", Over);
AddEvent(oNode, blnIsIE ? "mouseleave" : "mouseout", CommonOut);
AddEvent(oNode, "click", function(){HideCurrentOverlay(true);});
}
function OverlayOver()
{
iOverCount++;
}
function CommonOut()
{
iOverCount--;
HideCurrentOverlay();
}
var iOverCount = 0; 
var divOverlay = document.createElement('div');
divOverlay.style.position = "absolute";
divOverlay.style.zIndex = "9999";
var blnIsIE = !divOverlay.addEventListener;
var astrTerms = [];
var htTermsData = {};
function ProcessOverlayData()
{
for (var i=0; i < oOverlayData.data.length; i++)
{
if (!htTermsData[oOverlayData.data[i].Term])
{
astrTerms.push(oOverlayData.data[i].Term);
htTermsData[oOverlayData.data[i].Term] = oOverlayData.data[i];
oOverlayData.data[i].strBaseUrl = "";
}
}
}
ProcessOverlayData();
window["RunBtvTokenizer"] = function(el, oOverlayData_)
{
if (oOverlayData_)
{
oOverlayData.data = oOverlayData_;
ProcessOverlayData();
} 
if (el)
{
if (astrTerms.length > 0) BtvOverlay.Dom.Tokenizer.Run(el, astrTerms, htTermsData, oRules, strTermColor, HookupTerm);
blnPending = false;
}
else
{
Refresh();
}
}
function RunFromBody()
{
RunBtvTokenizer(document.body);
}
function TimedRun()
{
if (blnPending) RunFromBody();
}
function Refresh()
{
if (!blnPending)
{
blnPending = true;
window.setTimeout(TimedRun, 1000);
}
}
var blnPending = true;
if (true)
{
if (window["YAHOO"] && YAHOO.Btv && YAHOO.Btv.Runtime && YAHOO.Btv.Runtime.RegisterOnInit)
{
YAHOO.Btv.Runtime.RegisterOnInit(RunFromBody);
}
else
{
window.setTimeout(RunFromBody, 100);
}
} 
}
Run();
})();
