Btv.Templating.Register([{id:"Container.BtvModule",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');Main = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n<div ');_write(o.Elem('Root'));_write(' class=\"');_write((o.d.classes && o.d.classes.Module) ? o.d.classes.Module : 'btv_module');_write('\" style=\"');_write(o.Style());_write('\">\n<div class=\"btv_module_head\"><div class=\"c\"></div></div>\n<div class=\"btv_module_body\" ');_write(o.d.bodyStyle ? 'style="' + o.d.bodyStyle + '"' : '');_write('>\n<div class=\"c\">');if(o.d.header) {_write('<h2>');_write(o.d.header);_write('</h2>');}_write(o.d.body.Render());_write('</div>\n</div>\n<div class=\"btv_module_foot\"><div class=\"c\"></div></div>\n</div>\n');;return($text.join(""));};_write('\n');Version3 = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n<div ');_write(o.Elem('Root'));_write(' class=\"content-container\">');_write(o.d.body.Render());_write('</div>\n');;return($text.join(""));};_write('\n');
new (function(d, fncMain, fncVersion3)
{
var s, oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThis.d = d;
var blnDisplay = true;
function Render()
{
var fnc = (Btv.iPageVersion == 3) ? fncVersion3 : fncMain;
if (!s) s = fnc(oThis);
return(s);
}
oThis.ElementProps = function(id, scope, name, isInit, params, ht)
{
switch(scope)
{
case "Root":
ht.style.display = blnDisplay ? 'block' : 'none';
break;
}
}
oThis.Display = function(bln)
{
blnDisplay = bln;
oThis.ElMan().Style('Root'
, 'display', (blnDisplay ? 'block' : 'none')
);
}
oThis.DeclareVirtualMethods({
Render: Render
});
})($data, Main, Version3);
_write('\n');}return $text.join("");}},{id:"Container.Panel",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');Main = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n<div class=');_write(o.d.outerClass);_write('>\n');
var iNumRows = Math.ceil(o.d.items.length / o.d.cols);
var iIndex = 0;
for (var iRow=0; iRow < iNumRows; iRow++) {
_write('\n<div style=\"clear:both;\">\n'); for (var iCol=0; (iCol < o.d.cols) && o.d.items[iIndex]; iCol++) { _write(' \n');if((iCol > 0)) {_write(o.d.separator || '');}_write(' \n');_write(o.RenderItem(iIndex++));_write('\n'); } _write(' \n</div>\n'); } _write(' \n<div style=\"clear:both;\"></div>\n</div>\n');;return($text.join(""));};_write('\n');
new (function(d, fncMain)
{
var s, data, oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThis.d = d;
d.cols = 5;
oThis.RenderItem = function(i)
{
var oItem = Btv.Templating.GetInstance(d.itemTemplateID, d.itemTemplateConfig);
oItem.SetData(d.items[i]);
return(oItem.Render());
}
oThis.Render = function()
{
if (!s)
{
s = fncMain(oThis);
}
return(s);
}
})($data, Main);
_write('\n');}return $text.join("");}},{id:"Container.PagedPanel",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');Main = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n');_write(o.InitPager());_write('\n<h2 ');_write(o.Elem('header'));_write(' style=\"');_write(o.Style());_write('\">');_write(o.InnerHTML());_write('</h2>\n<div ');_write(o.Elem('divPage'));_write('>');_write(o.InnerHTML());_write('</div>\n');;return($text.join(""));};_write('\n');
new (function(d, fncMain)
{
var s, oPageNav, oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
var iCurrent = d.initialPage || 0;
var aoPanels = [];
var blnPagerInited = false;
var adRenderedPanels = [];
oThis.Render = function()
{
if (!s)
{
s = fncMain(oThis);
}
return(s);
}
function GetPanelHtml(i, fnc)
{
function CreatePanel(aData)
{
if (!blnPagerInited)
{
oPageNav.InitLinks(new Array(GetPageCount()));
blnPagerInited = true;
}
aoPanels[i] = Btv.Templating.GetInstance('Container.Panel', {
itemTemplateID: d.itemTemplateID,
itemTemplateConfig: d.itemTemplateConfig,
items:aData
});
return(R());
}
function R()
{
var s = aoPanels[i].Render();
if (fnc)
{
fnc(s);
}
else
{
return(s);
}
}
if (aoPanels[i]) return(R());
if (fnc) 
{
d.dataSource.GetPartition(i, CreatePanel)
}
else
{
var oPageData = d.dataSource.GetPartition(i);
return(oPageData ? CreatePanel(oPageData) : '');
}
}
function ChangePage(type, i)
{
function HaveHtml(s)
{
function F()
{
$(oThis.htIds['divPage']).innerHTML = s;
}
YAHOO.util.Event.onAvailable(oThis.htIds['divPage'], F);
}
Btv.Ads.Change();
GetPanelHtml(i, HaveHtml);
}
function GetPageCount()
{
var iCount = d.dataSource.GetCount();
return((iCount == -1) ? -1 : Math.ceil(iCount / d.pageSize));
}
oThis.InitPager = function()
{
var iPages = GetPageCount();
var oConfig = {};
if (iPages != -1)
{
blnPagerInited = true;
if (iPages == 1) return("");
oConfig = {links: new Array(iPages)};
} 
oPageNav = Btv.Templating.GetInstance('Navigation.Pager', oConfig);
oPageNav.onChange.subscribe(ChangePage);
return(oPageNav.Render());
}
oThis.ElementProps = function(id, scope, name, isInit, params, ht)
{
switch(scope)
{
case "header":
ht.innerHTML = d.header || '&nbsp;';
break;
case "divPage":
if (isInit)
{
var s = GetPanelHtml(iCurrent);
if (s)
{
ht.innerHTML = s;
}
else
{
ChangePage(null, iCurrent);
}
}
break;
}
}
})($data, Main);
_write('\n');}return $text.join("");}},{id:"Container.Tabs",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');Body = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n'); for (var i=0; i < o.d.tabs.length; i++) { _write('\n<div ');_write(o.Elem('divTab.' + i, i));_write(' style=\"');_write(o.Style());_write('\">');_write(o.InnerHTML());_write('</div>\n'); } _write('\n');;return($text.join(""));};_write('\n');Main = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n<div class=\"');_write(o.d.outerClass || 'btv_module_tabs');_write('\">\n'); for (var i=0; i < o.d.tabs.length; i++) { _write('\n<a ');_write(o.Elem('lnkTab.' + i, i));_write(' style=\"');_write(o.Style());_write('; \"><span ');_write(o.Elem('labelTab.' + i, i));_write('>');_write(o.InnerHTML());_write('</span></a>\n'); } _write('\n<div class=\"clearfix\"></div>\n</div>\n');_write(o.InitModule());_write('\n');;return($text.join(""));};_write('\n');
new (function(d, fncMain, fncBody)
{
var s, data, oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThis.d = d;
var iCurrentTab = d.currentTab || 0;
var ablnTabsRendered = [];
var oElMan = oThis.ElMan();
var ablnTabsVisible = [];
for (var i=0; i < d.tabs.length; i++) ablnTabsVisible[i] = true;
oThis.InitModule = function()
{
function F()
{
return(fncBody(oThis));
}
var oModule = Btv.Templating.GetInstance("Container.BtvModule", {bodyStyle: d.bodyStyle, body:{Render:F}});
return(oModule.Render());
}
oThis.SetTabVisibility = function(i, bln)
{
ablnTabsVisible[i] = bln;
if (!bln && (iCurrentTab == i))
{
for (var j=0; j < ablnTabsVisible.length; j++)
{
if (ablnTabsVisible[j])
{
oThis.ChangeTab(j);
}
}
}
oElMan.Style('divTab.' + i, 'display', bln ? 'block' : 'none');
oElMan.Style('lnkTab.' + i, 'display', bln ? 'inline' : 'none');
}
oThis.ChangeTab = function(i)
{
if (i != iCurrentTab)
{
Btv.Ads.Change();
iCurrentTab = i;
oThis.UpdateElements();
}
}
function Render()
{
if (!s) s = fncMain(oThis);
return(s);
}
oThis.ElementProps = function(id, scope, name, isInit, params, ht)
{
switch(scope)
{
case "lnkTab":
var i = params;
ht.attr['class'] = (iCurrentTab == i) ? 'strong' : '';
if (isInit)
{
ht.attr.onclick = $F('{0}({1})', $R(oThis.ChangeTab), i);
}
break;
case "labelTab":
ht.innerHTML = d.tabs[params].label;
break;
case "divTab":
var i = params;
if ((iCurrentTab == i) && !ablnTabsRendered[i])
{
ablnTabsRendered[i] = true;
ht.innerHTML = d.tabs[i].body.Render();
}
if((iCurrentTab == i) && d.tabs[i].body.UpdateTab){
d.tabs[i].body.UpdateTab();
}
ht.style.display = (iCurrentTab == i) ? 'block' : 'none';
break;
}
}
oThis.DeclareVirtualMethods({
Render: Render
});
})($data, Main, Body);
_write('\n');}return $text.join("");}},{id:"Container.HeaderTabs",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');Body = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n'); for (var i=0; i < o.d.tabs.length; i++) { _write('\n<div ');_write(o.Elem('divTab.' + i, i));_write(' style=\"');_write(o.Style());_write('\">');_write(o.InnerHTML());_write('</div>\n'); } _write('\n');;return($text.join(""));};_write('\n');Main = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n<div class=\"');_write(o.d.classes.outer);_write('\">\n'); for (var i=0; i < o.d.tabs.length; i++) { _write('\n');if((i > 0)) {_write(o.d.separator || '');}_write(' \n<a ');_write(o.Elem('lnkTab.' + i, i));_write(' style=\"cursor:pointer;\">');_write(o.InnerHTML());_write('</a>\n'); } _write('\n</div>\n');_write(o.InitModule());_write('\n');;return($text.join(""));};_write('\n');
new (function(d, fncMain, fncBody)
{
var s, data, oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThis.d = d;
var iCurrentTab = d.currentTab || 0;
var ablnTabsRendered = [];
oThis.InitModule = function()
{
return(fncBody(oThis));
}
function ChangeTab(i)
{
if (i != iCurrentTab)
{
Btv.Ads.Change();
iCurrentTab = i;
oThis.UpdateElements();
}
}
var strChangeTab = $R(ChangeTab);
oThis.Render = function()
{
if (!s) s = fncMain(oThis);
return(s);
}
oThis.ElementProps = function(id, scope, name, isInit, params, ht)
{
switch(scope)
{
case "lnkTab":
var i = params;
ht.attr['class'] = (iCurrentTab == i) ? (d.classes.active || '') : (d.classes.inactive || '');
if (isInit)
{
ht.attr.onclick = $F('{0}({1})', strChangeTab, i);
ht.innerHTML = d.tabs[params].label;
}
break;
case "divTab":
var i = params;
if ((iCurrentTab == i) && !ablnTabsRendered[i])
{
ablnTabsRendered[i] = true;
ht.innerHTML = d.Render ? d.Render(d.tabs[i]) : d.tabs[i].body.Render();
}
ht.style.display = (iCurrentTab == i) ? 'block' : 'none';
break;
}
}
})($data, Main, Body);
_write('\n');}return $text.join("");}},{id:"Navigation.Pager",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');Main = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n<div ');_write(o.Elem('outerDiv'));_write(' class=\"next-graphic-toggle\" style=\"width:65%; ');_write(o.Style());_write('\">\n<div>\n<a ');_write(o.Elem('lnkPrev'));_write(' class=\"next-graphic-toggle-left\"></a>\n<a ');_write(o.Elem('lnkNext'));_write(' class=\"next-graphic-toggle-right\"></a>\n</div>\n<div ');_write(o.Elem('lnkPageParent'));_write(' class=\"next-graphic-toggle-position\">');_write(o.InnerHTML());_write('</div>\n</div>\n');;return($text.join(""));};_write('\n');LinkPages = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n'); for (var i=0; o.d.links && (i < o.d.links.length); i++) { _write('\n<a ');_write(o.Elem('lnkPage.' + i, i));_write('></a>\n'); } _write('\n');;return($text.join(""));};_write('\n');
new (function(d, fncMain, fncLinkPages)
{
var s, oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThis.d = d;
var iCurrent = d.currentIndex || 0;;
var id = $I();
oThis.onChange = new YAHOO.util.CustomEvent("onChange");
function GoTo(i)
{
var iNext = Math.max(0, Math.min(links.length-1, i));
if (iCurrent != iNext)
{
iCurrent = iNext;
oThis.UpdateElements();
oLinkPagesTemplate.UpdateElements();
oThis.onChange.fire(iCurrent);
}
}
var strGoTo = $R(GoTo); 
function GoBy(i)
{
GoTo(iCurrent + i);
}
var strGoBy = $R(GoBy); 
oThis.InitLinks = function(links_)
{
if (!blnLinksRendered)
{
d.links = oLinkPagesTemplate.d.links = links_;
oThis.UpdateElement('lnkPageParent');
oThis.UpdateElement('outerDiv');
}
}
var blnLinksRendered = false;
oThis.Render = function()
{
if (!s)
{
s = fncMain(oThis);
}
return(s);
}
function PagesTemplate(d)
{
var oThisPagesTemplate = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThisPagesTemplate.d = d;
oThisPagesTemplate.ElementProps = function(id, scope, name, isInit, params, ht)
{
switch(scope)
{
case "lnkPage":
var i = params;
if (isInit)
{
ht.attr.onclick = $F('{0}({1})', strGoTo, i);
ht.attr.title = links[i] && links[i].tooltip ? links[i].tooltip : '';
}
ht.attr['class'] = (i == iCurrent) ? 'strong' : '';
break;
}
}
}
var oLinkPagesTemplate = new PagesTemplate({links:d.links});
oThis.ElementProps = function(id, scope, name, isInit, params, ht)
{
switch(scope)
{
case "outerDiv":
ht.style.visibility = (d.links && (d.links.length > 1)) ? 'visible' : 'hidden';
break;
case "lnkPrev":
if (isInit) ht.attr.onclick = $F('{0}(-1)', strGoBy);
break;
case "lnkNext":
if (isInit) ht.attr.onclick = $F('{0}(1)', strGoBy);
break;
case "lnkPageParent":
if (!blnLinksRendered && d.links)
{
blnLinksRendered = true;
ht.innerHTML = fncLinkPages(oLinkPagesTemplate);
}
break;
}
}
})($data, Main, LinkPages);
_write('\n');}return $text.join("");}},{id:"Rater.Big",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');Main = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n<div ');_write(o.Elem('outerDiv'));_write('>\n<a onclick=\"');_write(o.strRater);_write('(5)\" id=\"stars-5\" style=\"cursor:pointer;\"></a>\n<a onclick=\"');_write(o.strRater);_write('(4)\" id=\"stars-4\" style=\"cursor:pointer;\"></a>\n<a onclick=\"');_write(o.strRater);_write('(3)\" id=\"stars-3\" style=\"cursor:pointer;\"></a>\n<a onclick=\"');_write(o.strRater);_write('(2)\" id=\"stars-2\" style=\"cursor:pointer;\"></a>\n<a onclick=\"');_write(o.strRater);_write('(1)\" id=\"stars-1\" style=\"cursor:pointer;\"></a>\n<div ');_write(o.Elem('voteOverlay'));_write(' class=\"big-stars-voted-fill\" style=\"');_write(o.Style());_write('\"></div>\n</div>\n');;return($text.join(""));};_write('\n');
new (function(d, fncMain)
{
var s, oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThis.d = d;
function Rate(i)
{
d.fncRate(i);
}
oThis.strRater = $R(Rate);
oThis.Render = function()
{
if (!s) s = fncMain(oThis);
return(s);
}
oThis.UpdateRating = function(rating)
{
d.rating = rating;
oThis.UpdateElements();
}
oThis.ElementProps = function(id, scope, name, isInit, params, ht)
{
switch(scope)
{
case "outerDiv":
ht.attr['class'] = 'rate-stars-big' + ((!d.rating || (d.rating.RatingUser <= 0)) ? '' : ' big-stars-voted');
break;
case "voteOverlay":
var bln = d.rating && (d.rating.RatingUser > 0);
ht.style.visibility = bln ? 'visible' : 'hidden';
if (bln) ht.style.width = (100 - Math.round(d.rating.RatingAvg * 10)) + '%';
break;
case "rate":
if (isInit) ht.attr.onclick = $F('{0}({1})', strRater, params);
break;
}
}
})($data, Main);
_write('\n');}return $text.join("");}},{id:"Video.VideoSummary",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');Main = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n<div class=\"horizonal-video-layout');_write((o.d.info.Type == 'full') ? '' : ' video-clip-only');_write('\">\n<a ');_write(o.Elem('lnk.thumb'));_write(' rel=\"nofollow\" class=\"video-thumb-link\" style=\"cursor:pointer;\"><img src=\"');_write(o.d.info.ThumbnailUrl);_write('\" /><div class=\"full-eppy-star\"></div></a>\n<div class=\"video-thumb-info\">\n<b><a ');_write(o.Elem('lnk.episode'));_write(' rel=\"nofollow\" style=\"cursor:pointer;\">');_write(o.d.info.Title);_write('</a></b>\n<div class=\"eppy-info\">\n<div><a ');_write(o.Elem('lnk.category'));_write(' style=\"cursor:pointer;\">');_write(o.d.info.CategoryTitle);_write('</a></div>\n<span class=\"star-rating star-rating-no-input\"><span class=\"rate-star-fill\" style=\"width:');_write(100 - ((o.d.info.RatingAvg / 10) * 100));_write('%;\"></span></span>\n<div class=\"clip-details-excerpt\">');if(((o.d.info.Season > 0) && (o.d.info.Episode > 0))) {_write('<span>Episode ');_write(o.d.info.Season);_write(':');_write(o.d.info.Episode);_write(' - </span>');}_write(o.d.info.Description);_write('</div>\n</div>\n</div>\n</div>\n');;return($text.join(""));};_write('\n');
new (function(d, fncMain)
{
var s, data, oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThis.d = d;
var strOnClick = d.fncOnClick ? $R(d.fncOnClick) : '';
oThis.SetData = function(info)
{
d.info = info;
}
oThis.Render = function()
{
if (!s) s = fncMain(oThis);
return(s);
}
oThis.ElementProps = function(id, scope, name, isInit, params, ht)
{
switch(scope)
{
case "lnk":
if (isInit)
{
if (d.hrefTemplate) ht.attr.href = $F(d.hrefTemplate, d.info.ID);
if (d.fncOnClick) ht.attr.onclick = $F('{0}({1})', strOnClick, d.info.ID);
}
break;
}
}
})($data, Main);
_write('\n');}return $text.join("");}},{id:"Video.CategorySummary",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');Main = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n<div class=\"');_write(o.d.classes.outer);_write('\">\n<a ');_write(o.Elem('lnkImage'));_write('><img ');_write(o.Elem('imgPreview'));_write(' /></a>\n<a ');_write(o.Elem('lnkTitle'));_write(' class=\"tv-video-by-show-title\">');_write(o.InnerHTML());_write('</a>\n<a ');_write(o.Elem('lnkEpisodes'));_write('>');_write(o.InnerHTML());_write('</a>\n<a ');_write(o.Elem('lnkClips'));_write('>');_write(o.InnerHTML());_write('</a>\n</div>\n');;return($text.join(""));};_write('\n');
new (function(d, fncMain)
{
var s, data, oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThis.d = data = d;
data.hrefTemplate = data.hrefTemplate || '/videos2/watchvideos.aspx?cid={0}';
oThis.SetData = function(info)
{
data.info = info;
}
oThis.ElementProps = function(id, scope, name, isInit, params, ht)
{
switch(scope)
{
case "imgPreview":
ht.attr.src = Btv.UI.FixImage(data.info.ImageSrc);
break;
case "lnkImage":
ht.attr.href = $F(data.hrefTemplate, data.info.CategoryID);
break;
case "lnkTitle":
ht.attr.href = $F(data.hrefTemplate, data.info.CategoryID);
ht.innerHTML = data.info.Title;
break;
case "lnkEpisodes":
ht.attr.href = $F(data.hrefTemplate, data.info.CategoryID);
ht.innerHTML = $F('({0}) {1}', data.info.FullCount, (data.info.CategoryScopeId == 19) ? 'Full length' : 'Full episodes');
break;
case "lnkClips":
ht.attr.href = $F(data.hrefTemplate, data.info.CategoryID);
ht.innerHTML = $F('({0}) clips', data.info.ClipCount);
break;
}
}
oThis.Render = function()
{
if (!s)
{
s = fncMain(oThis);
}
return(s);
}
})($data, Main);
_write('\n');}return $text.join("");}},{id:"Video.FeaturedTvShows",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');
new (function(d)
{
var s, oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThis.d = d;
oThis.Render = function()
{
var oPanel = Btv.Templating.GetInstance("Container.PagedPanel", d);
var oModule = Btv.Templating.GetInstance("Container.BtvModule", {body:oPanel});
return(oModule.Render());
}
})($data);
_write('\n');}return $text.join("");}},{id:"Video.BrowseSection",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');
new (function(d)
{
var s, oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThis.d = d;
oThis.Render = function()
{
function BuildCategoryTab(oCategoryData)
{
function BuildPagedPanel(ds)
{
return(Btv.Templating.GetInstance("Container.PagedPanel", {
dataSource: ds
,pageSize: ds.GetPartitionSize()
,itemTemplateID: "Video.CategorySummary"
,itemTemplateConfig: {
classes: {outer:oCategoryData.classes.outer}
}
}));
}
function BuildTabItem(oPartitionData, oRenderer)
{
return({
label: oPartitionData.label
,body: oRenderer
});
}
function BuildHeaderTabs()
{
var astrPossible = ['recent', 'popular', 'favorites'];
var aTabs = [];
for (var i=0; i < astrPossible.length; i++)
{
var oPd = oCategoryData[astrPossible[i]];
if (oPd) aTabs.push(BuildTabItem(oPd, BuildPagedPanel(oPd.dataSource)));
}
if (oCategoryData.alpha) aTabs.push(BuildAlphaTab(oCategoryData.alpha));
return(aTabs);
}
function BuildAlphaTab(oAlphaData)
{
function Render(oTab)
{
function GetData(fnc)
{
function R()
{
fnc(htSummaries[oTab.label]);
}
function HaveSummary(oSummary)
{
htSummaries[oTab.label] = oSummary;
R();
}
if (htSummaries[oTab.label])
{
R();
}
else
{
oAlphaData.asyncGet(oTab.label, HaveSummary);
}
}
var pp = BuildPagedPanel(YAHOO.Btv.Data.BuildSimpleAsyncSparseDataSource(GetData, null, null, null, 20, htSummaries[oTab.label]));
return(pp.Render());
}
var htSummaries = oAlphaData.summaries;
var oAlphaTabs = Btv.Templating.GetInstance("Container.HeaderTabs", {
tabs: oAlphaData.partitions
,Render : Render
,currentTab: 0
,classes: {
outer: 'alpha-nav"'
,active: 'strong'
,inactive: '' 
}
,separator: ''
});
return(BuildTabItem(oAlphaData, oAlphaTabs));
}
var oHeaderTabs = Btv.Templating.GetInstance("Container.HeaderTabs", {
tabs: BuildHeaderTabs()
,currentTab: 0
,classes: {
outer: 'vid-sort-nav'
,active: 'strong'
,inactive: '' 
}
,separator: ' | '
});
return({
label: oCategoryData.label
,body: oHeaderTabs
});
}
var oTabs = Btv.Templating.GetInstance("Container.Tabs", 
{
tabs: [
BuildCategoryTab(d.data.tv)
,BuildCategoryTab(d.data.movie)
]
,currentTab: 0
}
);
return(oTabs.Render());
}
})($data);
_write('\n');}return $text.join("");}},{id:"Video.MostPopularVideos",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');
new (function(d)
{
var s, oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThis.d = d;
oThis.Render = function()
{
function BuildPagedPanel(ds)
{
return(Btv.Templating.GetInstance("Container.PagedPanel", {
dataSource: ds
,pageSize: ds.GetPartitionSize()
,itemTemplateID: "Video.VideoSummary"
,itemTemplateConfig: {hrefTemplate: '/videos2/WatchVideos.aspx?vid={0}'}
}));
}
function BuildTabItem(oTabInfo, oRenderer)
{
return({
label: oTabInfo.label
,body: BuildPagedPanel(oTabInfo.dataSource)
});
}
function BuildHeaderTabs()
{
var aTabs = [];
for (var i=0; i < d.segments.length; i++)
{
aTabs.push(BuildTabItem(d.segments[i]));
}
return(aTabs);
}
var oHeaderTabs = Btv.Templating.GetInstance("Container.HeaderTabs", {
tabs: BuildHeaderTabs()
,currentTab: 0
,classes: {
outer: 'vid-sort-nav'
,active: 'strong'
,inactive: '' 
}
,separator: ' | '
});
var oModule = Btv.Templating.GetInstance("Container.BtvModule", {body:oHeaderTabs, header:'Most Popular'});
return(oModule.Render());
}
})($data);
_write('\n');}return $text.join("");}},{id:"Video.NowPlaying",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');Main = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n<div style=\"padding-left:72px; background-color:#fff;\"><div ');_write(o.Elem('playerParent'));_write(' style=\"width:100%;margin-bottom:20px;\">');_write(o.InnerHTML());_write('</div></div>\n<div class=\"yellow-module show-for-movies\">\n<div class=\"yellow-module-top\"><div class=\"yellow-module-top-c\"></div></div>\n<div class=\"yellow-module-body\">\n<div class=\"video-share-option\">\n<a ');_write(o.Elem('lnkShare'));_write(' style=\"visibility:hidden;\">Share with BuddyTV friends</a> \n<a ');_write(o.Elem('huluLink'));_write(' style=\"');_write(o.Style());_write(';\">');_write(o.InnerHTML());_write(' on Hulu</a> \n<div class=\"btv_orange_button\" style=\"float:right;\">\n<span class=\"b1\"></span>\n<a ');_write(o.Elem('lnkShareWithFriends'));_write(' class=\"b2\">Share with friends</a>\n<span class=\"b3\"></span>\n</div>\n</div>\n<h2 ');_write(o.Elem('videoTitle'));_write('>');_write(o.InnerHTML());_write('</h2>\n<div ');_write(o.Elem('videoSubTitle'));_write('>');_write(o.InnerHTML());_write('</div>\n');_write(o.RenderRater());_write('\n<div ');_write(o.Elem('voteCount'));_write(' class=\"many-voted-vids\">');_write(o.InnerHTML());_write('</div>\n<div style=\"clear:both;\"></div>\n</div>\n<div class=\"yellow-module-bottom\"><div class=\"yellow-module-bottom-c\"></div></div>\n</div>\n<div class=\"yellow-module show-for-movies\">\n<div class=\"yellow-module-top\"><div class=\"yellow-module-top-c\"></div></div>\n<div class=\"yellow-module-body\">\n<div ');_write(o.Elem('nextEpisodeSection'));_write(' class=\"next-eppy-column\" style=\"');_write(o.Style());_write('; float:left;\">\n<h2 ');_write(o.Elem('nextEpisodeLabel'));_write('>');_write(o.InnerHTML());_write('</h2>\n<div ');_write(o.Elem('nextEpisodeParent'));_write('>');_write(o.InnerHTML());_write('</div>\n</div>\n<div ');_write(o.Elem('popularEpisodeSection'));_write(' class=\"next-eppy-column\" style=\"');_write(o.Style());_write('; float:right;\">\n<h2>Popular Clip</h2>\n<div ');_write(o.Elem('popularEpisodeParent'));_write('>');_write(o.InnerHTML());_write('</div>\n</div>\n<div style=\"clear:both;\"></div>\n</div>\n<div class=\"yellow-module-bottom\"><div class=\"yellow-module-bottom-c\"></div></div>\n</div>\n');if((o.d.showComments == null || o.d.showComments == true) ) {_write('\n');_write(o.GetCommentViewer());_write('\n');}_write('\n');;return($text.join(""));};_write('\n');
new (function(d, fncMain)
{
var s, oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThis.d = d;
var oRater, strNextVideoLabel, oCommentViewer;
var share = new Btv.ShareFriends();
oThis.onPlayVideo = new YAHOO.util.CustomEvent("onPlayVideo");
oThis.onAction = new YAHOO.util.CustomEvent("onAction");
function RateVideo(iRating)
{
if (d.info.RatingUser <= 0)
{
var iTotal = d.info.RatingAvg * d.info.RatingCount;
d.info.RatingUser = iRating * 2;
d.info.RatingCount += 1;
iTotal += d.info.RatingUser;
d.info.RatingAvg = iTotal / d.info.RatingCount;
oThis.UpdateElement('voteCount');
oRater.UpdateRating(d.info);
oThis.onAction.fire('rate', d.info.RatingUser);
}
}
function Share()
{
oThis.onAction.fire('share');
}
function EmailLink()
{
var strUrl = Btv.Links.BuildEmailLink(
YAHOO.Btv.String.Format("Watch '{0}' video: {1}", d.info.CategoryTitle, d.info.Title),
'',
Btv.Videos.BuildWatchVideoLink(d.info.ID)
);
return(strUrl);
}
function OnClick(iVideoID)
{
oThis.onPlayVideo.fire(iVideoID);
}
oThis.ShareInitialize = function(){
share.Initialize(32, d.info.ID, d.info);
}
oThis.RenderRater = function()
{
oRater = Btv.Templating.GetInstance("Rater.Big", {
rating: d.info
,fncRate: RateVideo
});
return(oRater.Render());
}
oThis.Render = function()
{
if (!s) s = fncMain(oThis);
return(s);
}
oThis.SetVideos = function(oCurrent, oNextData, oPopular, showComments)
{
d.info = oCurrent;
d.showComments = showComments;
d.popularVideo = oPopular;
d.nextVideo = null;
if (oNextData)
{
d.nextVideo = oNextData.info;
strNextVideoLabel = oNextData.label;
}
if (oRater) oRater.UpdateRating(d.info);
if (s) oThis.UpdateElements();
if (s) ChangeCommentContent();
}
function RenderVideoSummary(oInfo)
{
if (!oInfo) return('');
var oData = {
fncOnClick:OnClick
,info:oInfo
};
return(Btv.Templating.GetInstance("Video.VideoSummary", oData).Render());
}
function StartPreroll() {
if (null == document.getElementById('prerollDiv') || null == document.getElementById('VideoEntryDiv')) {
setTimeout(StartPreroll, 20);
return;
}
if (!showPreroll('prerollDiv','VideoEntryDiv',400)) {
showdiv('VideoEntryDiv');
hidediv('prerollDiv');
return; 
}
}
oThis.GetCommentViewer = function()
{
oCommentViewer = Btv.Templating.GetInstance("Common.CommentViewer", 
{ 
contentTypeId: 32
,contentId: d.info.ID
,thread: null
,comments: null
,numComments: 25
,page: 1
,isContextPage: false
,selectNewestFirst: false
,isUserProfilePage: false
});
return oCommentViewer.Render();
}
function ChangeCommentContent(){
oCommentViewer.ResetContent(32, d.info.ID);
}
oThis.ElementProps = function(id, scope, name, isInit, params, ht)
{
switch(scope)
{
case "huluLink":
if (d.info.SourceID == 3 && d.info.PageUrl.length > 0)
{
// if we have a hulu video we have to include a link back to their site
ht.attr.href = d.info.PageUrl;
ht.attr.rel = 'nofollow';
ht.attr.target = '_blank';
ht.innerHTML = d.info.CategoryTitle;
}
else
{
ht.innerHTML = '';
ht.style.visibility = 'hidden';
}
break;
case "playerParent":
ht.innerHTML = d.info.VideoEmbed.replace('<embed', '<param name="wmode" value="transparent" /><embed wmode="transparent"');
break;
case "lnkShare":
if (isInit)
{
ht.attr.href = $F('javascript:{0}()', $R(Share));
ht.attr.target = "EmailWindow";
}
break;
case "lnkEmail":
if (isInit)
{
ht.attr.href = EmailLink();
ht.attr.target = "EmailWindow";
}
break;
case "lnkShareWithFriends":
if(isInit){
ht.attr.onclick = $F('{0}();', $R(oThis.ShareInitialize));
}
break;
case "videoTitle":
var str = d.info.CategoryTitle;
if ((d.info.Season> 0) && (d.info.Episode > 0))
{
str += (' - ' + d.info.Season);
str += (':' + d.info.Episode);
}
if (d.info.Type == 'clip') str += ' (clip)';
ht.innerHTML = str;
break;
case "videoSubTitle":
ht.innerHTML = d.info.Title;
break;
case "voteCount":
ht.innerHTML = $F('{0} voted', d.info.RatingCount);
break;
case "nextEpisodeSection":
ht.style.visibility = d.nextVideo ? 'visible' : 'hidden';
break;
case "nextEpisodeParent":
ht.innerHTML = RenderVideoSummary(d.nextVideo);
break;
case "nextEpisodeLabel":
ht.innerHTML = strNextVideoLabel;
break;
case "popularEpisodeSection":
ht.style.visibility = d.popularVideo ? 'visible' : 'hidden';
break;
case "popularEpisodeParent":
ht.innerHTML = RenderVideoSummary(d.popularVideo);
break;
}
}
})($data, Main);
_write('\n');}return $text.join("");}},{id:"Video.WatchVideoController",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');
new (function(d)
{
var s, oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThis.d = d;
function SetNowPlayingData()
{
function GetNextVideoData()
{
var blnNext = (d.info.NowPlayingInfo.NowPlaying.Type == 'full');
var blnFound = false;
var catInfo = d.info.CategoryVideoInfo;
var npInfo = d.info.NowPlayingInfo;
for (var i=0; i < catInfo.Episodes.length; i++)
{
if (blnFound) return({label:'Next Episode', info:catInfo.Episodes[i]});
if ((catInfo.Episodes[i].Season == npInfo.NowPlaying.Season) && (catInfo.Episodes[i].Episode == npInfo.NowPlaying.Episode))
{
if (!blnNext) return({label:'Full Episode', info:catInfo.Episodes[i]});
blnFound = true;
}
}
var iMinEpisodes = blnNext ? 2 : 1;
if (catInfo.Episodes.length >= iMinEpisodes)
{
while (true)
{
var iRand = Math.floor(Math.random() * catInfo.Episodes.length);
if (catInfo.Episodes[iRand].ID != npInfo.NowPlaying.ID)
{
return({label:'Full Episode', info:catInfo.Episodes[iRand]});
}
}
}
var iMinClips = blnNext ? 2 : 3;
if (npInfo.RelatedClips.length >= iMinClips)
{
while (true)
{
var iRand = Math.floor(Math.random() * npInfo.RelatedClips.length);
if (npInfo.RelatedClips[iRand].ID != d.info.CategoryVideoInfo.MostPopularClip.ID)
{
if (blnNext || (npInfo.NowPlaying.ID != npInfo.RelatedClips[iRand].ID))
{
return({label:'Related Clip', info:npInfo.RelatedClips[iRand]});
}
}
}
}
return(null);
}
var catInfo = d.info.CategoryVideoInfo;
var npInfo = d.info.NowPlayingInfo;
var oNext = GetNextVideoData();
d.tmpltNowPlaying.SetVideos(d.info.NowPlayingInfo.NowPlaying, oNext, d.info.CategoryVideoInfo.MostPopularClip, d.showComments);
d.tmpltRelatedClips.SetData(d.info.NowPlayingInfo.RelatedClips);
d.fncWatchVideoCounter(d.info.NowPlayingInfo.NowPlaying.ID, (d.info.NowPlayingInfo.NowPlaying.Type == 'full'), Function.NoOp);
}
function ChangeVideo(type, args)
{
function F(oNowPlayingInfo)
{
d.info.NowPlayingInfo = oNowPlayingInfo;
SetNowPlayingData();
}
Btv.Url.State.SetQueryString(Btv.Videos.BuildWatchVideoQS(args[0]));
Btv.Ads.Change();
d.fncGetNowPlayingInfo(args[0], F);
}
function RateVideo(iRating)
{
function F()
{
}
d.fncRateVideo(d.info.NowPlayingInfo.NowPlaying.ID, iRating, F);
}
function TakeAction(type, args)
{
var strAction = args[0];
switch (strAction)
{
case "rate":
RateVideo(args[1]);
break;
case "email":
SendEmail();
break;
}
}
function Init()
{
d.tmpltNowPlaying.onPlayVideo.subscribe(ChangeVideo);
d.tmpltNowPlaying.onAction.subscribe(TakeAction);
SetNowPlayingData();
d.tmpltNavigator.SetData(d.info.CategoryVideoInfo, d.info.NowPlayingInfo.NowPlaying);
d.tmpltNavigator.onPlayVideo.subscribe(ChangeVideo);
d.tmpltRelatedClips.onPlayVideo.subscribe(ChangeVideo);
}
Init();
})($data);
_write('\n');}return $text.join("");}},{id:"Video.EpisodeNavigator",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');Main = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n<div class=\"video-episode-selector\">\n');_write(Btv.Templating.GetInstance("Video.CategoryVideoNavigatorHeader", {}).SetData(o.d.info).Render());_write('\n<div class=\"seasons-drop-links\">\n');var oSeason;if(o.oSeasons.a instanceof Array) {for(var oSeason_index=0; oSeason_index<o.oSeasons.a.length; oSeason_index++) {oSeason = o.oSeasons.a[oSeason_index];_write('\n'); if (oSeason.i != -1) { _write('<div ');_write(o.Elem('divEpisodeHeader.' + oSeason.i, oSeason.i));_write('>Season ');_write(oSeason.i);_write('</div>'); } _write('\n<div ');_write(o.Elem('divBrowseList.' + oSeason.i, oSeason.i));_write(' class=\"episode-browse-list\" style=\"');_write(o.Style());_write('\">\n');var oEpisode;if(oSeason.oEpisodes.a instanceof Array) {for(var oEpisode_index=0; oEpisode_index<oSeason.oEpisodes.a.length; oEpisode_index++) {oEpisode = oSeason.oEpisodes.a[oEpisode_index];_write('\n<div class=\"row\" onmouseover=\"');_write(o.strShowHover);_write('(true, this, ');_write(oEpisode.info._internalIndex);_write(')\" onmouseout=\"');_write(o.strShowHover);_write('(false)\" onclick=\"');_write(o.strEpisodeClicked);_write('(');_write(oEpisode.info.ID);_write(')\"><div class=\"col_1\">');_write((oEpisode.i == -1) ? '' : (oEpisode.i + '. '));_write(oEpisode.info.Title);_write('</div><div class=\"col_2\">');_write(Btv.DateTime.FormatHms(oEpisode.info.Length));_write('</div><div class=\"col_3\">');_write(Btv.DateTime.FormatDate(oEpisode.info.Time, null, new Date(2000, 0, 1)));_write('</div></div>\n');}} else {for (var oEpisode_index in oSeason.oEpisodes.a) {oEpisode = oSeason.oEpisodes.a[oEpisode_index];_write('\n<div class=\"row\" onmouseover=\"');_write(o.strShowHover);_write('(true, this, ');_write(oEpisode.info._internalIndex);_write(')\" onmouseout=\"');_write(o.strShowHover);_write('(false)\" onclick=\"');_write(o.strEpisodeClicked);_write('(');_write(oEpisode.info.ID);_write(')\"><div class=\"col_1\">');_write((oEpisode.i == -1) ? '' : (oEpisode.i + '. '));_write(oEpisode.info.Title);_write('</div><div class=\"col_2\">');_write(Btv.DateTime.FormatHms(oEpisode.info.Length));_write('</div><div class=\"col_3\">');_write(Btv.DateTime.FormatDate(oEpisode.info.Time, null, new Date(2000, 0, 1)));_write('</div></div>\n');}}_write('\n</div>\n');}} else {for (var oSeason_index in o.oSeasons.a) {oSeason = o.oSeasons.a[oSeason_index];_write('\n'); if (oSeason.i != -1) { _write('<div ');_write(o.Elem('divEpisodeHeader.' + oSeason.i, oSeason.i));_write('>Season ');_write(oSeason.i);_write('</div>'); } _write('\n<div ');_write(o.Elem('divBrowseList.' + oSeason.i, oSeason.i));_write(' class=\"episode-browse-list\" style=\"');_write(o.Style());_write('\">\n');var oEpisode;if(oSeason.oEpisodes.a instanceof Array) {for(var oEpisode_index=0; oEpisode_index<oSeason.oEpisodes.a.length; oEpisode_index++) {oEpisode = oSeason.oEpisodes.a[oEpisode_index];_write('\n<div class=\"row\" onmouseover=\"');_write(o.strShowHover);_write('(true, this, ');_write(oEpisode.info._internalIndex);_write(')\" onmouseout=\"');_write(o.strShowHover);_write('(false)\" onclick=\"');_write(o.strEpisodeClicked);_write('(');_write(oEpisode.info.ID);_write(')\"><div class=\"col_1\">');_write((oEpisode.i == -1) ? '' : (oEpisode.i + '. '));_write(oEpisode.info.Title);_write('</div><div class=\"col_2\">');_write(Btv.DateTime.FormatHms(oEpisode.info.Length));_write('</div><div class=\"col_3\">');_write(Btv.DateTime.FormatDate(oEpisode.info.Time, null, new Date(2000, 0, 1)));_write('</div></div>\n');}} else {for (var oEpisode_index in oSeason.oEpisodes.a) {oEpisode = oSeason.oEpisodes.a[oEpisode_index];_write('\n<div class=\"row\" onmouseover=\"');_write(o.strShowHover);_write('(true, this, ');_write(oEpisode.info._internalIndex);_write(')\" onmouseout=\"');_write(o.strShowHover);_write('(false)\" onclick=\"');_write(o.strEpisodeClicked);_write('(');_write(oEpisode.info.ID);_write(')\"><div class=\"col_1\">');_write((oEpisode.i == -1) ? '' : (oEpisode.i + '. '));_write(oEpisode.info.Title);_write('</div><div class=\"col_2\">');_write(Btv.DateTime.FormatHms(oEpisode.info.Length));_write('</div><div class=\"col_3\">');_write(Btv.DateTime.FormatDate(oEpisode.info.Time, null, new Date(2000, 0, 1)));_write('</div></div>\n');}}_write('\n</div>\n');}}_write('\n</div>\n</div>\n<div style=\"clear:both;\"></div>\n<div ');_write(o.Elem('divHoverOuter'));_write(' style=\"visibility:hidden;overflow:visible; padding:3px 0px 0px 10px;\"><div class=\"hover-info-container\"><div ');_write(o.Elem('divHoverInner'));_write(' class=\"hover-container-back\"></div></div></div>\n');;return($text.join(""));};_write('\n');
new (function(d, fncMain)
{
var s, oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThis.d = d;
oThis.onPlayVideo = new YAHOO.util.CustomEvent("onPlayVideo");
var htHovers = {};
var aiSeasonExpanded = [];
var iDefaultSeason;
oThis.id = $I();
function PartitionEpsiodes()
{
oThis.oSeasons = {a:[], ht:{}};
for (var i=0; i < d.info.Episodes.length; i++)
{
d.info.Episodes[i]._internalIndex = i;
var iSeason = d.info.Episodes[i].Season;
if (!oThis.oSeasons.ht[iSeason]) oThis.oSeasons.a.push(oThis.oSeasons.ht[iSeason] = {i:iSeason, oEpisodes:{a:[], ht:{}}});
var iEpisode = d.info.Episodes[i].Episode;
oThis.oSeasons.ht[iSeason].oEpisodes.a.push(oThis.oSeasons.ht[iSeason].oEpisodes.ht[iEpisode] = {i:iEpisode, info:d.info.Episodes[i]});
}
}
function RenderVideoSummary(oInfo)
{
if (!oInfo) return('');
var oData = {
fncOnClick:EpisodeClicked
,info:oInfo
};
return(Btv.Templating.GetInstance("Video.VideoSummary", oData).Render());
}
function ShowHover(bln, elContext, index)
{
if (bln)
{
if (!htHovers[index])
{
htHovers[index] = document.createElement('div');
htHovers[index].innerHTML = RenderVideoSummary(d.info.Episodes[index]);
}
oThis.tmpltHover.Show(htHovers[index], [elContext, 'tl', 'bl']);
}
else
{
oThis.tmpltHover.Hide();
}
}
oThis.strShowHover = $R(ShowHover);
function EpisodeClicked(iVideoID)
{
oThis.onPlayVideo.fire(iVideoID);
}
oThis.strEpisodeClicked = $R(EpisodeClicked);
function SeasonExpando(div, i)
{
SeasonExpanded(i, !SeasonExpanded(i));
oThis.UpdateElements();
}
oThis.strSeasonExpando = $R(SeasonExpando);
oThis.Render = function()
{
if (!s)
{
iDefaultSeason = d.currentVideo.Season;
//if (iDefaultSeason >= 0) aiSeasonExpanded[iDefaultSeason] = true;
s = fncMain(oThis);
}
oThis.tmpltHover = Btv.Templating.GetInstance("HoverPanel", {
idOuter:oThis.htIds['divHoverOuter']
,idInner:oThis.htIds['divHoverInner']
,width:'273px'
});
return(s);
}
oThis.SetData = function(info, currentVideo)
{
d.info = info;
d.currentVideo = currentVideo;
PartitionEpsiodes();
}
function SeasonExpanded(i, bln)
{
if (i == -1) return(true);
if (arguments.length == 2)
{
aiSeasonExpanded[i] = bln;
}
if (!aiSeasonExpanded[i]) aiSeasonExpanded[i] = false;
return(aiSeasonExpanded[i]);
}
oThis.ElementProps = function(id, scope, name, isInit, params, ht)
{
switch(scope)
{
case "divEpisodeHeader":
if (isInit) ht.attr.onclick = $F('{0}(this, {1})', oThis.strSeasonExpando, params);
ht.attr['class'] = 'video-episode-row' + (SeasonExpanded(params) ? ' drop-is-down' : '');
break;
case "divBrowseList":
var i = params;
ht.style.display = SeasonExpanded(params) ? 'block' : 'none';
break;
}
}
})($data, Main);
_write('\n');}return $text.join("");}},{id:"Video.ClipNavigator",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');Main = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n<div class=\"video-episode-selector\">\n');_write(Btv.Templating.GetInstance("Video.CategoryVideoNavigatorHeader", {}).SetData(o.d.info).Render());_write('\n<div ');_write(o.Elem('divClips'));_write('>');_write(o.RenderPanel());_write('</div>\n</div>\n<div style=\"clear:both;\"></div>\n');;return($text.join(""));};_write('\n');
new (function(d, fncMain)
{
var s, oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThis.d = d;
oThis.onPlayVideo = new YAHOO.util.CustomEvent("onPlayVideo");
function OnClick(iVideoID)
{
oThis.onPlayVideo.fire(iVideoID);
}
oThis.RenderPanel = function()
{
function HaveClipsData(oClipsData)
{
if (oClipsData)
{
d.oClipsData = oClipsData;
$(oThis.htIds['divClips']).innerHTML = oThis.RenderPanel();
}
}
if (d.oClipsData)
{
if (d.oClipsData.length > 0)
{
var ds = YAHOO.Btv.Data.GetStaticAsyncSparseDataSource(8, d.oClipsData);
var pp = Btv.Templating.GetInstance("Container.PagedPanel", {
dataSource: ds
,pageSize: ds.GetPartitionSize()
,itemTemplateID: "Video.VideoSummary"
,itemTemplateConfig: {fncOnClick:OnClick}
});
return(pp.Render());
}
}
else
{
d.fncGetClips(d.CategoryID, 100, HaveClipsData);
}
return('');
}
oThis.SetData = function(d_)
{
d = oThis.d = d_;
}
oThis.Render = function()
{
if (!s) s = fncMain(oThis);
return(s);
}
})($data, Main);
_write('\n');}return $text.join("");}},{id:"Video.CategoryVideoNavigator",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');Main = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n<div class=\"btv_orange_button other-shows-button\">\n<span class=\"b1\"></span>\n<a href=\"/videos2/videos.aspx\" class=\"b2\">Other Shows</a>\n<span class=\"b3\"></span>\n</div>\n');_write(o.RenderTabs());_write('\n');;return($text.join(""));};_write('\n');
new (function(d, fncMain)
{
var s, oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThis.d = d;
oThis.onPlayVideo = new YAHOO.util.CustomEvent("onPlayVideo");
var oEpisodeNavigator = Btv.Templating.GetInstance("Video.EpisodeNavigator", {});
var oClipNavigator = Btv.Templating.GetInstance("Video.ClipNavigator", {});
oThis.RenderTabs = function()
{
var aTabs = [];
if (d.info.Episodes && (d.info.Episodes.length > 0))
{
if (d.info.CategoryScopeId != 19) aTabs.push({
label: ((d.info.CategoryScopeId == 19) ? 'Movie' : 'Episodes')
,body: oEpisodeNavigator
});
}
if (d.info.ClipCount)
{
aTabs.push({
label: 'Clips'
,body: oClipNavigator
});
}
var oTabs = Btv.Templating.GetInstance("Container.Tabs", 
{
tabs: aTabs
,currentTab: 0
,outerClass: 'btv_module_tabs eppy-clips'
,bodyStyle:'z-index:999;'
}
);
return(oTabs.Render());
}
oThis.Render = function()
{
if (!s) s = fncMain(oThis);
return(s);
}
oThis.SetData = function(info, currentVideo)
{
d.info = info;
oEpisodeNavigator.SetData(info, currentVideo);
oClipNavigator.SetData({
info:info
,CategoryID: d.info.CategoryID
,fncGetClips: d.fncGetClips
});
}
function ChangeVideo(type, args)
{
oThis.onPlayVideo.fire(args[0]);
}
function Init()
{
oEpisodeNavigator.onPlayVideo.subscribe(ChangeVideo);
oClipNavigator.onPlayVideo.subscribe(ChangeVideo);
}
Init();
})($data, Main);
_write('\n');}return $text.join("");}},{id:"Video.RelatedClips",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');Main = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n<div ');_write(o.Elem('mainDiv'));_write('>');_write(o.RenderPanel());_write('</div>\n');;return($text.join(""));};_write('\n');
new (function(d, fncMain)
{
var s, oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThis.d = d;
oThis.onPlayVideo = new YAHOO.util.CustomEvent("onPlayVideo");
oThis.SetData = function(oClips)
{
d.info = oClips;
if (s) $(oThis.htIds['mainDiv']).innerHTML = oThis.RenderPanel();
}
function OnClick(iVideoID)
{
oThis.onPlayVideo.fire(iVideoID);
}
oThis.RenderPanel = function()
{
if (d.info && (d.info.length > 0))
{
var ds = YAHOO.Btv.Data.GetStaticAsyncSparseDataSource(5, d.info);
var pp = Btv.Templating.GetInstance("Container.PagedPanel", {
dataSource: ds
,pageSize: ds.GetPartitionSize()
,itemTemplateID: "Video.VideoSummary"
,itemTemplateConfig: {fncOnClick:OnClick}
,header: 'Clips From This Episode'
});
var oModule = Btv.Templating.GetInstance("Container.BtvModule", {body:pp});
return(oModule.Render());
}
return('');
}
oThis.Render = function()
{
if (!s) s = fncMain(oThis);
return(s);
}
})($data, Main);
_write('\n');}return $text.join("");}},{id:"Video.CategoryVideoNavigatorHeader",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');Main = function(o) {var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};_write('\n<a href=\"/');_write(o.d.info.Url);_write('\"><img class=\"video-logo-right\" src=\"');_write(Btv.UI.FixImage(o.d.info.ImageSrc));_write('\" /></a>\n<h2 style=\"margin-bottom:4px;\">');_write(o.d.info.Title);_write('</h2>\n');if(((o.d.info.SeasonCount) && (o.d.info.CategoryScopeId != 19))) {_write(Btv.UI.Utility.Pluralize('<div>{0} Season{1}</div>', o.d.info.SeasonCount));}_write('\n');if((o.d.info.FullCount) ) {_write('<div>');_write( o.EpisodeLabel );_write('</div>');}_write('\n');if((o.d.info.ClipCount) ) {_write('<div>');_write(Btv.UI.Utility.Pluralize('{0} Clip{1}', o.d.info.ClipCount));_write('</div>');}_write('\n');;return($text.join(""));};_write('\n');
new (function(d, fncMain)
{
var s, oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThis.d = d;
oThis.Render = function()
{
if (!s) s = fncMain(oThis);
return(s);
}
oThis.SetData = function(info)
{
d.info = info;
if (d.info.CategoryScopeId == 19)
{
oThis.EpisodeLabel = $F('{0} Full length', d.info.FullCount);
}
else
{
oThis.EpisodeLabel = Btv.UI.Utility.Pluralize('{0} Full episode{1}', d.info.FullCount);
}
return(oThis);
}
})($data, Main);
_write('\n');}return $text.join("");}},{id:"HoverPanel",fnc:function($data){var $text = [];var _write = function(text) {$text.push((typeof text == "number")?text:(text||""));};with($data){ _write('\n');
new (function(d, fncMain)
{
var oThis = Btv.Lang.Extend(this, Btv.Cst.BaseTemplate, arguments);
oThis.d = d;
var blnReady = false;
var fncPending;
function Init()
{
oThis.overlay = new YAHOO.widget.Overlay(d.idOuter, {
width: d.width,
visible: false,
constraintoviewport: true
});
oThis.overlay.render();
blnReady = true;
if (fncPending) fncPending();
}
function GetRequiredComponents()
{
// Instantiate and configure Loader:
var loader = new YAHOO.util.YUILoader({
require: ["container"],
loadOptional: true,
onSuccess: Init,
timeout: 10000,
combine: true
});
loader.insert();
}
GetRequiredComponents()
oThis.Show = function(elOverlay, oContext)
{
function Go()
{
fncPending = null;
var elP = $(d.idInner);
while (elP.childNodes.length > 0) elP.removeChild(elP.childNodes[0]);
elP.appendChild(elOverlay);
oThis.overlay.cfg.setProperty('context', oContext);
oThis.overlay.show(true);
$(d.idOuter).style.visibility = 'visible';
}
if (blnReady)
{
Go();
}
else
{
fncPending = Go;
}
}
oThis.Hide = function()
{
var elP = $(d.idInner);
while (elP.childNodes.length > 0) elP.removeChild(elP.childNodes[0]);
oThis.overlay.show(false);
$(d.idOuter).style.visibility = 'hidden';
}
})($data, Main);
_write('\n');}return $text.join("");}}]);
