// Parses in Unix Time and prints out formatted timestamp
function nbaRenderTimeStamp(date,timeString) {
nbaStoryPublishTime = (date) ? new Date(date) : nbaStoryPublishTime;
var days = new Array('Sun','Mon','Tue','Wed','Thur','Fri','Sat');
var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
var nbaDay = days[nbaStoryPublishTime.getUTCDay()];
var nbaMonth = months[nbaStoryPublishTime.getUTCMonth()];
var nbaYear = nbaStoryPublishTime.getUTCFullYear();
var nbaDate = nbaStoryPublishTime.getUTCDate();
var nbaHour = nbaStoryPublishTime.getHours();
var nbaMinutes = nbaStoryPublishTime.getMinutes();
var nbaAMPM = '';
var nbaDateSuffix='';
//Set am/pm
if (nbaHour > 11) {
nbaAMPM = "pm";
}else{
nbaAMPM = "am";
}
// Set Hour
if (nbaHour > 12) { nbaHour = nbaHour - 12;}
// Add a zero if less than 10
if (nbaMinutes < 10){nbaMinutes = "0" + nbaMinutes;}
// Add number suffix
if (nbaDate == 1){
nbaDateSuffix = "st";
}else if (nbaDate == 2) {
nbaDateSuffix = "nd";
}else if (nbaDate == 3) {
nbaDateSuffix = "rd";
}else{
nbaDateSuffix = "th";
}
document.write(nbaMonth + ' ' + nbaDate+nbaDateSuffix+' '+ nbaYear + ' ' + nbaHour+ ':' +nbaMinutes+ ' ' +nbaAMPM);
}
// T1 functionality
var stories = new Array('nbaT1Story1','nbaT1Story2','nbaT1Story3','nbaT1Story4','nbaT1Story5');
var rotate = null;
var r = 1;
function nbaRotateT1() {
nbaShowT1(r);
if (r < 5) {
rotate = setTimeout('nbaRotateT1()',15000);
} else if (r = 5) {
r = 0;
rotate = setTimeout('nbaRotateT1()',15000);
}
r++;
}
function nbaRotateT1Continue(){
clearTimeout(rotate);
rotate = null;
//push to next position
//r = ( (r+1) >= 1 && (r+1) <= 5) ? (r+1) : 1;
nbaRotateT1();
}
function nbaSetPosition(oPosition){
r = oPosition;
//alert("position: " + r);
}
function nbaShowT1(n) {
// changes visibility of current story
for (i = 0; i < stories.length; i++) {
if (document.getElementById(stories[i])) {
document.getElementById(stories[i]).style.display = (('nbaT1Story' + n) == stories[i]) ? 'block':'none';
}
}
// Gets current position of the array
// changes class of current thumb
var thumbs = document.getElementById('nbaT1Thumbs').getElementsByTagName('a');
for (j = 0; j < thumbs.length; j++) {
thumbs[j].className = ((j + 1) == n) ? 'nbaSelected':'';
}
//set the positon of the rotate array
nbaSetPosition(n);
}
//Switcher functionality for nba store
var si = 1;
function swicththis2(che){
var attera = "";
if(che == 1)
{ si = si + 1;
if(si > 5){ si = 1;}
attera = 's' + si;
}
if(che == 2)
{ si = si - 1;
if(si < 1){ si = 5;}
attera = 's' + si;
}
document.getElementById('scounter').innerHTML = si;
var jumps = 0;
var storejump =new Array("s1","s2","s3","s4","s5");
for (jumps;jumps<=4;jumps++)
{
document.getElementById(storejump[jumps]).style.display = "none";
}
document.getElementById(attera).style.display = "block";
}
var Fabtabs = Class.create();
Fabtabs.prototype = {
initialize : function(element) {
try{
this.element = $(element);
var options = Object.extend({}, arguments[1] || {});
this.menu = $A(this.element.getElementsByTagName('a'));
this.show(this.getInitialTab());
this.menu.each(this.setupTab.bind(this));
}
catch(err)
{
}
},
setupTab : function(elm) {
Event.observe(elm,'click',this.activate.bindAsEventListener(this),false)
},
activate : function(ev) {
var elm = Event.findElement(ev, "a");
Event.stop(ev);
this.show(elm);
this.menu.without(elm).each(this.hide.bind(this));
},
hide : function(elm) {
try{
$(elm).removeClassName('active-tab');
$(this.tabID(elm)).removeClassName('active-tab-body');
}
catch(err)
{
}
},
show : function(elm) {
try{
$(elm).addClassName('active-tab');
$(this.tabID(elm)).addClassName('active-tab-body');
}
catch(err)
{
}
},
tabID : function(elm) {
return elm.href.match(/#(\w.+)/)[1];
},
getInitialTab : function() {
if(document.location.href.match(/#(\w.+)/)) {
var loc = RegExp.$1;
var elm = this.menu.find(function(value) { return value.href.match(/#(\w.+)/)[1] == loc; });
return elm || this.menu.first();
} else {
return this.menu.first();
}
}
}
Event.observe(window,'load',function(){ new Fabtabs('tabs'); },false);
Event.observe(window,'load',function(){ new Fabtabs('nbaSubNav'); },false);
Event.observe(window,'load',function(){ new Fabtabs('subNbaTvTabs'); },false);
Event.observe(window,'load',function(){ new Fabtabs('subTopPlaysTabs'); },false);
Event.observe(window,'load',function(){ new Fabtabs('subTntOvertimeTabs'); },false);
Event.observe(window,'load',function(){ new Fabtabs('subBarkleyTabs'); },false);
// Headline Tabs
function HideLinks() {
var MainLinks = new Array ("nbaRailPodsnav1", "nbaRailPodsnav2");
var SubLinks = new Array ("nbaRailPodsnavL", "nbaRailPodsnavR");
for (var i=0; i<MainLinks.length; i++) {
document.getElementById(MainLinks[i]).className = "nbaRailPodsNavItem";
document.getElementById(MainLinks[i]).hideFocus = true;
}
for (var i=0; i<SubLinks.length; i++) {
document.getElementById(SubLinks[i]).className = "nbaRailPodsnavL hide";
}
}
function ShowLink(MainLinkId, SubLinkId) {
document.getElementById(MainLinkId).className = "nbaRailPodsNavItem RailPodsNavactive";
document.getElementById(SubLinkId).className = "nbaRailPodsnavL show";
}
function ActiveMenu(MainLinkId, SubLinkId) {
HideLinks();
ShowLink(MainLinkId, SubLinkId);
}
// Zebra color for Headline div
function init() {
alternate('nbaTabHeader');
}
function alternate(nbaTabHeader){
if(document.getElementsByTagName){
var list = document.getElementById(nbaTabHeader);
var rows = list.getElementsByTagName("li");
for(i = 0; i < rows.length; i++){
//manipulate rows
if(i % 2 == 0){
rows[i].className = "nbaHeadlinesLiBg";
}
}
}
}
window.onload = function (){
nbaRotateT1();
init();
}