
/*********************************** TOP ECOM***********************************/
function EcomcarouselTOP_initCallback(carousel) {
    
    jQuery('#ecomControlsNextTOP').click(function() {
    carousel.startAuto(0);
        carousel.next();
       return false;
    });

    jQuery('#ecomControlsPrevTOP').click(function() {
    carousel.startAuto(0);
        carousel.prev();          
        return false;
    });
  
    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });

    
    
   
}
jQuery(document).ready(function() {
if(jQuery("#EcomScrollerThumbsTOP").length>0) {
 jQuery('#EcommerceTOPBg').show(); 
     jQuery("#EcommerceTOPBg").jcarousel({      
        auto: 3,
        wrap: 'last', 
        scroll:1,    
        initCallback: EcomcarouselTOP_initCallback,         
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });   
       
     }
});



/*START ROTATOR*/
jQuery(document).ready(function()  {  
   if(jQuery("#RotatorBox").length>0) {    
   jQuery('#scroller').show();
   jQuery('#scrollerThumbs').show();
    jQuery('#scroller').cycle({
        fx:     'fade', 
        speed:  'slow', 
        timeout: 6000, 
        prev:    '#prev',
        next:    '#next',     
         pager:  '#scrollerThumbs', 
        pagerAnchorBuilder: function(idx, slide) { 
        // return selector string for existing anchor 
        return '#scrollerThumbs li:eq(' + idx + ') a'; 
        }                     
    });   
    }
    
});

/*END ROTATOR*/


/*PROMO*/
jQuery(document).ready(function()  {  

   if(jQuery("#PromoScroller").length>0) { 
    jQuery('#PromoScroller').show(); 
    jQuery('#PromoScroller').cycle({
        fx:     'fade', 
        speed:  'slow', 
        timeout: 6000, 
        prev:    '#PromoControlsPrev',
        next:    '#PromoControlsNext'   
        
    });   
    }
    
});


/***************************************************************TABS***********************************************/
	function highlight1() {	
	    document.getElementById('img_'+4).setAttribute("src", "/fls/10000/site_graphics/Tabs/LiveGamesTab_OFF.jpg");
	    document.getElementById('img_'+3).setAttribute("src", "/fls/10000/site_graphics/Tabs/MoreHeadlinesTab_OFF.jpg");
        document.getElementById('img_'+2).setAttribute("src", "/fls/10000/site_graphics/Tabs/RecentScoresTab_OFF.jpg");
        document.getElementById('img_'+1).setAttribute("src", "/fls/10000/site_graphics/Tabs/UpcomingSchTab_ON.jpg");			
	}
	
	function highlight2() {	
        document.getElementById('img_'+4).setAttribute("src", "/fls/10000/site_graphics/Tabs/LiveGamesTab_OFF.jpg");
	    document.getElementById('img_'+3).setAttribute("src", "/fls/10000/site_graphics/Tabs/MoreHeadlinesTab_OFF.jpg");
        document.getElementById('img_'+2).setAttribute("src", "/fls/10000/site_graphics/Tabs/RecentScoresTab_ON.jpg");
        document.getElementById('img_'+1).setAttribute("src", "/fls/10000/site_graphics/Tabs/UpcomingSchTab_OFF.jpg");			
	}
	
	function highlight3() {	
        document.getElementById('img_'+4).setAttribute("src", "/fls/10000/site_graphics/Tabs/LiveGamesTab_OFF.jpg");
	    document.getElementById('img_'+3).setAttribute("src", "/fls/10000/site_graphics/Tabs/MoreHeadlinesTab_ON.jpg");
        document.getElementById('img_'+2).setAttribute("src", "/fls/10000/site_graphics/Tabs/RecentScoresTab_OFF.jpg");
        document.getElementById('img_'+1).setAttribute("src", "/fls/10000/site_graphics/Tabs/UpcomingSchTab_OFF.jpg");			
	}
	function highlight4() {	
        document.getElementById('img_'+4).setAttribute("src", "/fls/10000/site_graphics/Tabs/LiveGamesTab_ON.jpg");
	    document.getElementById('img_'+3).setAttribute("src", "/fls/10000/site_graphics/Tabs/MoreHeadlinesTab_OFF.jpg");
        document.getElementById('img_'+2).setAttribute("src", "/fls/10000/site_graphics/Tabs/RecentScoresTab_OFF.jpg");
        document.getElementById('img_'+1).setAttribute("src", "/fls/10000/site_graphics/Tabs/UpcomingSchTab_OFF.jpg");			
	}



jQuery(document).ready(function() {
   if(jQuery("#Content_1").length>0) { 
     jQuery('#Content_1').css({'display' : 'block'});    	
    jQuery('#Content_2').css({'display' : 'none'});
    jQuery('#Content_3').css({'display' : 'none'});
    jQuery('#Content_4').css({'display' : 'none'});
        
    }

	jQuery('#Tab_1').click(function() {
		highlight1();    
        jQuery('#Content_1').css({'display' : 'block'}); 
        jQuery('#Content_2').css({'display' : 'none'}); 
	    jQuery('#Content_3').css({'display' : 'none'}); 
	    jQuery('#Content_4').css({'display' : 'none'}); 	  	
	});
	
	
	jQuery('#Tab_2').click(function() {
	    highlight2(); 
	    jQuery('#Content_1').css({'display' : 'none'}); 
	    jQuery('#Content_2').css({'display' : 'block'});
	    jQuery('#Content_3').css({'display' : 'none'}); 
	    jQuery('#Content_4').css({'display' : 'none'});        
	});   
	
	jQuery('#Tab_3').click(function() {
	    highlight3(); 
	    jQuery('#Content_1').css({'display' : 'none'}); 
	    jQuery('#Content_2').css({'display' : 'none'});
	    jQuery('#Content_3').css({'display' : 'block'}); 
	    jQuery('#Content_4').css({'display' : 'none'});        
	});  
	
	jQuery('#Tab_4').click(function() {
	    highlight4(); 
	    jQuery('#Content_1').css({'display' : 'none'}); 
	    jQuery('#Content_2').css({'display' : 'none'});
	    jQuery('#Content_3').css({'display' : 'none'}); 
	    jQuery('#Content_4').css({'display' : 'block'});        
	});  


    
});

/*****************************************************COMMON TABS ************************************************/
//http://www.deckerdev.com/blog/category/JQuery.aspx//





/*****************************************************SCHEDULE TAB ************************************************/


 function getTop() {
	// get the top of the content
	var top = jQuery('#scroll-content').css('top');
	return trimPx(top);
}
function getHeight(id) {
	// get the height, including padding
	var height = jQuery(id).height();

	return height;
}

function trimPx(value) {
	// remove "px" from values
	var pos = value.indexOf("px");
	if (pos != 0)
		return parseInt(value.substring(0, pos));
	else
		return 0;
}
var container;
var content;
var hidden;	// # of pixels hidden by the container

function setScrollerDimensions(idContainer,idContent) {
	container = getHeight(idContainer);
	content = getHeight(idContent);
	hidden = content - container +50;
}

function resetScroller(idContainer,idContent) {
	setScrollerDimensions(idContainer,idContent);
	jQuery(idContent).css('top', 0);
}


jQuery(document).ready(function() {

 if(jQuery("#scroll-container").length>0) { 

    
    jQuery('#up .up-arrow').css("filter","alpha(opacity=50)");
    jQuery('#up .up-arrow').css("opacity","0.4");
                
	setScrollerDimensions('#scroll-container','#scroll-content');

	jQuery('#up a.up-arrow').click(function() {
		return false;
	});

	jQuery('#down a.down-arrow').click(function() {
		return false;
	});

	jQuery('#down a.down-arrow').hover(
		function() {
			if (hidden > 0) {
				var current = getTop();
				jQuery('#scroll-content').animate({ top: -hidden }, Math.abs(current - hidden) * 5);
				jQuery('#down .down-arrow').css("filter","alpha(opacity=50)");
                jQuery('#down .down-arrow').css("opacity","0.4");	
                 jQuery('#up .up-arrow').css("filter","alpha(opacity=100)");
                jQuery('#up .up-arrow').css("opacity","1");
			}
		},
		function() {
			jQuery('#scroll-content').stop();
			  	  

		}
	);

	jQuery('#up a.up-arrow').hover(
		function() {
			if (hidden > 0) {
				var current = getTop();
				jQuery('#scroll-content').animate({ top: "0" }, Math.abs(current) * 5);
				 jQuery('#up .up-arrow').css("filter","alpha(opacity=50)");
                jQuery('#up .up-arrow').css("opacity","0.4");
                jQuery('#down .down-arrow').css("filter","alpha(opacity=100)");
                jQuery('#down .down-arrow').css("opacity","1");	
			}
		},
		function() {
			jQuery('#scroll-content').stop();
				
		}
	);

   } 
   
   
  
});

/*****************************************************END SCHEDULE TAB ************************************************/


/*****************************************************SCORES TAB ************************************************/

function getHeight2(id) {
	// get the height, including padding
	var height2 = jQuery(id).height();

	return height2;
}

function trimPx2(value) {
	// remove "px" from values
	var pos2 = value.indexOf("px");
	if (pos2 != 0)
		return parseInt(value.substring(0, pos2));
	else
		return 0;
}
 function getTop2() {
	// get the top of the content
	var top2 = jQuery('#scroll-content2').css('top');
	return trimPx2(top2);
	
	}
var container2;
var content2;
var hidden2;	// # of pixels hidden by the container


function setScrollerDimensions2(idContainer,idContent) {
	container2 = getHeight2(idContainer);
	content2 = getHeight2(idContent);
	hidden2 = content2 - container2 +50;
}

function resetScroller2(idContainer,idContent) {
	setScrollerDimensions2(idContainer,idContent);
	jQuery(idContent).css('top', 0);
}


jQuery(document).ready(function() {

 if(jQuery("#scroll-container2").length>0) { 
    
    jQuery('#up2 .up-arrow').css("filter","alpha(opacity=50)");
    jQuery('#up2 .up-arrow').css("opacity","0.4");
                
	setScrollerDimensions2('#scroll-container2','#scroll-content2');

	jQuery('#up2 a.up-arrow').click(function() {
		return false;
	});

	jQuery('#down2 a.down-arrow').click(function() {
		return false;
	});

	jQuery('#down2 a.down-arrow').hover(
		function() {
			if (hidden2 > 0) {
				var current2 = getTop2();
				jQuery('#scroll-content2').animate({ top: -hidden2 }, Math.abs(current2 - hidden2) * 5);
				jQuery('#down2 .down-arrow').css("filter","alpha(opacity=50)");
                jQuery('#down2 .down-arrow').css("opacity","0.4");	
                 jQuery('#up2 .up-arrow').css("filter","alpha(opacity=100)");
                jQuery('#up2 .up-arrow').css("opacity","1");
			}
		},
		function() {
			jQuery('#scroll-content2').stop();
			  	  

		}
	);

	jQuery('#up2 a.up-arrow').hover(
		function() {
			if (hidden > 0) {
				var current2 = getTop2();
				jQuery('#scroll-content2').animate({ top: "0" }, Math.abs(current2) * 5);
				 jQuery('#up2 .up-arrow').css("filter","alpha(opacity=50)");
                jQuery('#up2 .up-arrow').css("opacity","0.4");
                jQuery('#down2 .down-arrow').css("filter","alpha(opacity=100)");
                jQuery('#down2 .down-arrow').css("opacity","1");	
			}
		},
		function() {
			jQuery('#scroll-content2').stop();
				
		}
	);

    }
});

/*****************************************************END SCORES TAB ************************************************/


/*****************************************************HEADLINES TAB ************************************************/

function getHeight3(id) {
	// get the height, including padding
	var height3 = jQuery(id).height();

	return height3;
}

function trimPx3(value) {
	// remove "px" from values
	var pos3 = value.indexOf("px");
	if (pos3 != 0)
		return parseInt(value.substring(0, pos3));
	else
		return 0;
}
 function getTop3() {
	// get the top of the content
	var top3 = jQuery('#scroll-content3').css('top');
	return trimPx3(top3);
	
	}

var container3;
var content3;
var hidden3;	// # of pixels hidden by the container

function setScrollerDimensions3(idContainer,idContent) {
	container3 = getHeight3(idContainer);
	content3 = getHeight3(idContent);
	hidden3 = content3 - container3 + 40;
}

function resetScroller3(idContainer,idContent) {
	setScrollerDimensions3(idContainer,idContent);
	jQuery(idContent).css('top', 0);
}


jQuery(document).ready(function() {

 if(jQuery("#scroll-container3").length>0) { 
    
    jQuery('#up3 .up-arrow').css("filter","alpha(opacity=50)");
    jQuery('#up3 .up-arrow').css("opacity","0.4");
                
	setScrollerDimensions3('#scroll-container3','#scroll-content3');

	jQuery('#up3 a.up-arrow').click(function() {
		return false;
	});

	jQuery('#down3 a.down-arrow').click(function() {
		return false;
	});

	jQuery('#down3 a.down-arrow').hover(
		function() {
			if (hidden3 > 0) {
				var current3 = getTop3();
				jQuery('#scroll-content3').animate({ top: -hidden3 }, Math.abs(current3 - hidden3) * 5);
				jQuery('#down3 .down-arrow').css("filter","alpha(opacity=50)");
                jQuery('#down3 .down-arrow').css("opacity","0.4");	
                 jQuery('#up3 .up-arrow').css("filter","alpha(opacity=100)");
                jQuery('#up3 .up-arrow').css("opacity","1");
			}
		},
		function() {
			jQuery('#scroll-content3').stop();
			  	  

		}
	);

	jQuery('#up3 a.up-arrow').hover(
		function() {
			if (hidden3 > 0) {
				var current3 = getTop3();
				jQuery('#scroll-content3').animate({ top: "0" }, Math.abs(current3) * 5);
				 jQuery('#up3 .up-arrow').css("filter","alpha(opacity=50)");
                jQuery('#up3 .up-arrow').css("opacity","0.4");
                jQuery('#down3 .down-arrow').css("filter","alpha(opacity=100)");
                jQuery('#down3 .down-arrow').css("opacity","1");	
			}
		},
		function() {
			jQuery('#scroll-content3').stop();
				
		}
	);

    }
});

/*****************************************************END MORE HEADLINES TAB ************************************************/

/*****************************************************LIVE TAB ************************************************/

function getHeight4(id) {
	// get the height, including padding
	var height4 = jQuery(id).height();

	return height4;
}

function trimPx4(value) {
	// remove "px" from values
	var pos4 = value.indexOf("px");
	if (pos4 != 0)
		return parseInt(value.substring(0, pos3));
	else
		return 0;
}
 function getTop4() {
	// get the top of the content
	var top4 = jQuery('#scroll-content4').css('top');
	return trimPx4(top3);
	
	}

var container4;
var content4;
var hidden4;	// # of pixels hidden by the container

function setScrollerDimensions4(idContainer,idContent) {
	container4 = getHeight(idContainer);
	content4 = getHeight(idContent);
	hidden4 = content4 - container4 +40;
}

function resetScroller4(idContainer,idContent) {
	setScrollerDimensions4(idContainer,idContent);
	jQuery(idContent).css('top', 0);
}


jQuery(document).ready(function() {

 if(jQuery("#scroll-container4").length>0) { 
    
    jQuery('#up4 .up-arrow').css("filter","alpha(opacity=50)");
    jQuery('#up4 .up-arrow').css("opacity","0.4");
                
	setScrollerDimensions4('#scroll-container4','#scroll-content4');

	jQuery('#up4 a.up-arrow').click(function() {
		return false;
	});

	jQuery('#down4 a.down-arrow').click(function() {
		return false;
	});

	jQuery('#down4 a.down-arrow').hover(
		function() {
			if (hidden4 > 0) {
				var current4 = getTop4();
				jQuery('#scroll-content4').animate({ top: -hidden4 }, Math.abs(current4 - hidden4) * 5);
				jQuery('#down4 .down-arrow').css("filter","alpha(opacity=50)");
                jQuery('#down4 .down-arrow').css("opacity","0.4");	
                 jQuery('#up4 .up-arrow').css("filter","alpha(opacity=100)");
                jQuery('#up4 .up-arrow').css("opacity","1");
			}
		},
		function() {
			jQuery('#scroll-content4').stop();
			  	  

		}
	);

	jQuery('#down4 a.up-arrow').hover(
		function() {
			if (hidden > 0) {
				var current4 = getTop4();
				jQuery('#scroll-content4').animate({ top: "0" }, Math.abs(current4) * 5);
				 jQuery('#up4 .up-arrow').css("filter","alpha(opacity=50)");
                jQuery('#up4 .up-arrow').css("opacity","0.4");
                jQuery('#down4 .down-arrow').css("filter","alpha(opacity=100)");
                jQuery('#down4 .down-arrow').css("opacity","1");	
			}
		},
		function() {
			jQuery('#scroll-content4').stop();
				
		}
	);
}
    
});

/*****************************************************END LIVE TAB ************************************************/



/***************************************************************TAB ADS***********************************************/


jQuery(document).ready(function()  { 
if(jQuery("#TabAdsArea").length>0) { 
	document.getElementById('TabAdsArea').style.display = 'block'; 
jQuery('#TabAdsArea').cycle({       
        fx:     'fade', 
        speed:  'slow', 
        startingSlide: 0,
        timeout: 4000, 
        pager:  '#TabAdsNav',
        pagerAnchorBuilder: function(idx, slide) {
            // return sel string for existing anchor
            return '#TabAdsNav li:eq(' + (idx) + ') a';
        }      
    }); 
    
    }
});



/***************************************************************MULTIPLE DAY SCHEDULE HACK***********************************************/

function hideBadDates(obj)
{
	//Dates are recieved as mm/dd/yy
	//split array indexes:
	//	Month = 0
	//	Day = 1
	//	Year = 2
	var s='';
//***************************************************************************************************************************
//		Cycle over each item in the schedule and hide items where the display date is not within the bounds of the event date
//***************************************************************************************************************************
	jQuery(obj).find('.item').each(function(){
		date=jQuery(this).attr('date');
		eventStart=jQuery(this).attr('eventStartDate');
		eventEnd=jQuery(this).attr('eventEndDate');
		date=date.split('/');
		eventStart=eventStart.split('/');
		eventEnd=eventEnd.split('/');

		jDate=new Date(date[0]+'/'+date[1]+'/20'+date[2]);
		jEventStart=new Date(eventStart[0]+'/'+eventStart[1]+'/20'+eventStart[2]);
		jEventEnd=new Date(eventEnd[0]+'/'+eventEnd[1]+'/20'+eventEnd[2]);

		if(jDate<jEventStart || jDate>jEventEnd){
			jQuery(this).hide();
//				s+='The date of '+jDate.toDateString()+' IS NOT between '+jEventStart.toDateString()+' and '+jEventEnd.toDateString()+'\n';
		}
		else{
//				s+='The date of '+jDate.toDateString()+' is between '+jEventStart.toDateString()+' and '+jEventEnd.toDateString()+' ***SHOWN***\n';
		}
	});

//********************************************************************************************************
//		Traverse over each day container, and if all events are set to be hidden, hide the day container
//********************************************************************************************************
	jQuery(obj).find('.dayContainer').each(function(){
		var hideDate=true;
		jQuery(this).find('.item').each(function(){
			var cssDisplay=jQuery(this).css('display');
			if(cssDisplay=='block')
			{
				hideDate=false;
			}
		});
		if(hideDate)
		{
			jQuery(this).hide();
		}
	});
	
	
	
}


