


$(function(){$(".carouselViewport").itemSlider({nextBtn:'#nextBtn',prevBtn:'#prevBtn',loop:true,autoScroll:true,autoScrollTimer:30000});$('div.carouselControls').hide();$('div.promoAreaContent').mousemove(function(e){var x,y;x=e.pageX-this.offsetLeft;y=e.pageY-this.offsetTop;if(y>=330&&x<=735){$('div.carouselControls').show('normal');$('a#prevBtn').css({backgroundPosition:"top left"});$('a#nextBtn').css({backgroundPosition:"top left"});$('div.carouselControlsBg').css('opacity',0.3);}else{$('div.carouselControls').hide('normal');$('a#prevBtn').css({backgroundPosition:"bottom left"});$('a#nextBtn').css({backgroundPosition:"bottom left"});}});var checkDims=function(dayString){};var videoFeatureThumbs=$('a.videoLinkA');videoFeatureThumbs.each();var populateSFP=function(clipid){};var HPvidCloseBtn=$();HPvidCloseBtn.click(function(){});});

  
(function($){$.fn.itemSlider=function(options){var defaults={nextBtn:".nextBtn",prevBtn:".prevBtn",speed:1000,resetSpeed:250,loop:true,autoScroll:false,autoScrollTimer:4000},settings=$.extend({},defaults,options);return this.each(function(){var obj=$(this).children();var thumbs=$('a.carouselThumb');var viewport=obj.parent();var panelNums=obj.children().length;var currPanel=0;var lastPanel=panelNums-1;var firstPanel=0;var w=obj.children().width();var h=obj.children().height();obj.width(w*panelNums);obj.css({position:"absolute"});obj.children().css({display:"inline",float:"left"})
viewport.width(w);viewport.height(h);viewport.css("overflow","hidden");viewport.css("position","relative");var checkPanels=function(){if((currPanel==lastPanel)&&(!settings.loop)){$(settings.nextBtn).hide();}else if((currPanel==lastPanel)&&(settings.loop)){$(settings.nextBtn).show();}else{$(settings.nextBtn).show();}
if((currPanel==firstPanel)&&(!settings.loop)){$(settings.prevBtn).hide();}else if((currPanel==firstPanel)&&(settings.loop)){$(settings.prevBtn).show();}else{$(settings.prevBtn).show();}
var block=obj.children();block.click(function(e){if($(this).find("a.slidelink").attr("href").length>0){window.location=$(this).find("a.slidelink").attr("href");}});block.addClass("isClickable");block.hover(function(){window.status=$(this).find("a.slidelink").attr("href")},function(){window.status=""})}
checkPanels();thumbs.each(function(){$(this).click(function(){if($('#videoPlayerOverlay:visible')){$('#videoPlayerOverlay').hide();}
thumbs.each(function(){$(this).removeClass("active");});$(this).addClass("active");var tempArray=this.id.split("thumb");var num=tempArray[1];if(currPanel>parseInt(num)){var amountToMove=parseInt(currPanel)-parseInt(num);if(settings.autoScroll){clearInterval(theTimer);}
slideLeft(amountToMove);}else if(currPanel<parseInt(num)){var amountToMove=parseInt(num)-parseInt(currPanel);if(settings.autoScroll){clearInterval(theTimer);}
slideRight(amountToMove);}
return false;});})
var movingRight=function(){thumbs.each(function(){$(this).removeClass("active");});if(currPanel==lastPanel){$("#thumb0").addClass("active");}else{$("#thumb"+(currPanel+1)).addClass("active");}}
var movingLeft=function(){thumbs.each(function(){$(this).removeClass("active");});if(currPanel==firstPanel){$("#thumb"+(panelNums-1)).addClass("active");}else{$("#thumb"+(currPanel-1)).addClass("active");}}
var slideLeft=function(){var moveNum=(arguments[0]!=null)?arguments[0]:1;var currentOffset=obj.position();if(!obj.is(":animated")){movingLeft();if((currPanel==0)&&(settings.loop)){obj.fadeTo('fast',0.0,function(){obj.animate({left:((currentOffset.left)-(panelNums*w)+(w))},settings.resetSpeed,function(){obj.fadeTo('normal',1);});});currPanel=lastPanel;checkPanels();}else{obj.animate({left:(currentOffset.left+(w*moveNum))},settings.speed);currPanel=(arguments[0]!=null)?currPanel-moveNum:currPanel-1;checkPanels();}}}
var slideRight=function(){var moveNum=(arguments[0]!=null)?arguments[0]:1;var currentOffset=obj.position();if(!obj.is(":animated")){movingRight();if((currPanel==(panelNums-1))&&(settings.loop)){obj.fadeTo('fast',0.0,function(){obj.animate({left:(panelNums/w)},settings.resetSpeed,function(){obj.fadeTo('normal',1);});});currPanel=0;checkPanels();}else if((currPanel==(panelNums-1))&&(settings.autoScroll)){obj.animate({left:(panelNums/w)},settings.speed);currPanel=0;checkPanels();}else{obj.animate({left:(currentOffset.left-(w*moveNum))},settings.speed);currPanel=(arguments[0]!=null)?currPanel+moveNum:currPanel+1;checkPanels();}}}
if(settings.autoScroll){autoScroll=function(){theTimer=setInterval(function(){slideRight();},settings.autoScrollTimer);}
autoScroll();$(this).hover(function(){clearInterval(theTimer);},function(){if($('#videoPlayerOverlay').is(':visible')){}else{clearInterval(theTimer);autoScroll();}});$('div.carouselControls').hover(function(){clearInterval(theTimer);},function(){clearInterval(theTimer);autoScroll();});}
$(settings.nextBtn).click(function(){if($('#videoPlayerOverlay:visible')){$('#videoPlayerOverlay').hide();}
if(settings.autoScroll){clearInterval(theTimer);}
slideRight();return false;});$(settings.prevBtn).click(function(){if($('#videoPlayerOverlay:visible')){$('#videoPlayerOverlay').hide();}
if(settings.autoScroll){clearInterval(theTimer);}
slideLeft();return false;});});};})(jQuery);