var shareBar={shareSrc:false,init:function(){$(".sharebar").show();},swapShare:function(el){var toolBox=$(".sharebar .addthis_toolbox");if(shareBar.shareSrc){shareBar.shareSrc.append(toolBox.find(".addthis_button_facebook"));shareBar.shareSrc.append(toolBox.find(".addthis_button_twitter"));shareBar.shareSrc.append(toolBox.find(".addthis_button_email"));}
toolBox.empty();shareBar.shareSrc=$(el).next(".share");toolBox.append(shareBar.shareSrc.children(".addthis_button_twitter"));toolBox.append(shareBar.shareSrc.children(".addthis_button_facebook"));toolBox.append(shareBar.shareSrc.children(".addthis_button_email"));toolBox.find("a").each(function(){$(this).wrap("<li />");});}}
shareBar.init();var TwitVidSlider={init:function(){$("#twitvids-slider .overlay").show();$("#twitvids-slider .slide").css({"left":"57px"});}}
TwitVidSlider.init();function Slider(params){if(!$(params.sliderID).length){return false;}
this.init=function(){this.sliderID=params.sliderID;this.curPos=$(this.sliderID+" .slide").position().left;this.startPos=this.curPos;this.curGroup=1;this.interval=params.interval?params.interval:300;this.groups=Math.ceil($(params.sliderID+" "+params.element).length/params.elementsPerGroup);this.viewBoxWidth=params.viewBoxWidth;var slider=this;$(this.sliderID+" .larrow").mousedown(function(){slider.retreat();}).css({"visibility":"visible"});$(this.sliderID+" .rarrow").mousedown(function(){slider.advance();}).css({"visibility":"visible"});$(this.sliderID+" .larrow,"+this.sliderID+" .rarrow").click(function(){return false;});if(this.groups>1){$(this.sliderID+" .rarrow").addClass("active");}}
this.resetSlider=function(){this.curPos=this.startPos;this.curGroup=1;this.groups=Math.ceil($(params.sliderID+" "+params.element).length/params.elementsPerGroup);var slider=this;$(this.sliderID+" .larrow").mousedown(function(){slider.retreat();}).css({"visibility":"visible"});$(this.sliderID+" .rarrow").mousedown(function(){slider.advance();}).css({"visibility":"visible"});$(this.sliderID+" .larrow,"+this.sliderID+" .rarrow").click(function(){return false;});$(this.sliderID+" .larrow,"+this.sliderID+" .rarrow").removeClass("active");if(this.groups>1){$(this.sliderID+" .rarrow").addClass("active");}}
this.advance=function(){if(this.curGroup>=this.groups){return;}
$(this.sliderID+" .slide").stop(true,true);this.curGroup++;var slider=this;$(this.sliderID+" .slide").animate({"left":this.curPos-this.viewBoxWidth},this.interval,function(){slider.curPos-=slider.viewBoxWidth;if(slider.curGroup==slider.groups){$(slider.sliderID+" .rarrow").removeClass("active");}
if(slider.groups>1){$(slider.sliderID+" .larrow").addClass("active");}});};this.retreat=function(){if(this.curGroup<=1){return;}
$(this.sliderID+" .slide").stop(true,true);this.curGroup--;var slider=this;$(this.sliderID+" .slide").animate({"left":this.curPos+this.viewBoxWidth},this.interval,function(){slider.curPos+=slider.viewBoxWidth;if(slider.curGroup==1){$(slider.sliderID+" .larrow").removeClass("active");}
if(slider.groups>1){$(slider.sliderID+" .rarrow").addClass("active");}});}
this.init();}
new Slider({"sliderID":"#whats-new-slider","element":".new-media","viewBoxWidth":630,"elementsPerGroup":3,"interval":300});new Slider({"sliderID":"#twitvids-slider","element":".twitvid","viewBoxWidth":110,"elementsPerGroup":1,"interval":150});new Slider({"sliderID":".latest-videos-slider","element":".video-pane","viewBoxWidth":832,"elementsPerGroup":1,"interval":400});new Slider({"sliderID":".fofshow-slider","element":".video-pane","viewBoxWidth":832,"elementsPerGroup":1,"interval":400});new Slider({"sliderID":".foffyi-slider","element":".video-pane","viewBoxWidth":832,"elementsPerGroup":1,"interval":400});new Slider({"sliderID":".foftips-slider","element":".video-pane","viewBoxWidth":832,"elementsPerGroup":1,"interval":400});new Slider({"sliderID":".twitvids-slider","element":".video-pane","viewBoxWidth":832,"elementsPerGroup":1,"interval":400});new Slider({"sliderID":".fofextras-slider","element":".video-pane","viewBoxWidth":832,"elementsPerGroup":1,"interval":400});var gallerySlider=new Slider({"sliderID":"#gallery-player","element":".thb","viewBoxWidth":570,"elementsPerGroup":6,"interval":250});new Slider({"sliderID":"#gallery-archive","element":".gallery-pane","viewBoxWidth":832,"elementsPerGroup":1,"interval":400});var tabSwap={init:function(){$(".tabs li a").click(function(){tabSwap.swap($(this).parent());return false;});},swap:function(tab){tab.siblings().removeClass("active");tab.addClass("active");$(".tab-content").hide();$(tab.find("input[name='content']").val()).show();}}
tabSwap.init();var videoPlayer={init:function(){$("#whats-new .video").click(videoPlayer.swapVideo);},swapVideo:function(){shareBar.swapShare(this);var url=$(this).children("[name='url']").val();$(".player").html("<object type=\"application/x-shockwave-flash\" width=\"640\" height=\"385\" data=\""+url+"\">"+"<param name=\"movie\" value=\""+url+"\" />"+"<param name=\"allowFullScreen\" value=\"true\" />"+"<param name=\"allowscriptaccess\" value=\"always\" />"+"<param name=\"wmode\" value=\"transparent\" />"+"</object>");return false;}}
videoPlayer.init();var galleryPlayer={imgLoadCount:0,loadingGraphic:new Image(),init:function(){galleryPlayer.loadingGraphic.src="/wp-content/themes/factsoffishing/_common/images/loading.gif";$("#gallery-player .player .content").after("<img class=\"loading\" src=\""+galleryPlayer.loadingGraphic.src+"\" alt=\"Loading...\" width=\"32\" height=\"32\" />");$("#gallery-player .player .loading").hide();$("#gallery-player .thb").live("click",galleryPlayer.swapPhoto);},swapPhoto:function(){var src=$(this).children("[name='player']").val();var title=$(this).children("img").attr("alt");var addThisHTML=$(this).next(".share").html();$("#gallery-player .player .content").hide();$("#gallery-player .player .loading").show();var el=this;$(new Image()).load(function(){$("#gallery-player .player .loading").hide();$("#gallery-player .player .content").html("<img src=\""+src+"\" alt=\""+title+"\" />").show();shareBar.swapShare(el);}).attr("src",src);return false;}}
galleryPlayer.init();var sponsorsCycle={timer:false,sponsors:[],currentSponsorGroup:1,sponsorsPerGroup:5,init:function(){$("#sponsors-content .sponsor").each(function(){sponsorsCycle.sponsors.push("<li class=\"sponsor\">"+$(this).html()+"</li>");});if(this.sponsors.length>this.sponsorsPerGroup){this.timer=window.setInterval(this.cycle,14000);}},cycle:function(){var sponsors=[];if(sponsorsCycle.sponsors.length>sponsorsCycle.currentSponsorGroup*sponsorsCycle.sponsorsPerGroup){var start=sponsorsCycle.currentSponsorGroup*sponsorsCycle.sponsorsPerGroup;var end=start+sponsorsCycle.sponsorsPerGroup;sponsors=sponsorsCycle.sponsors.slice(start,end);sponsorsCycle.currentSponsorGroup++;}else{sponsors=sponsorsCycle.sponsors.slice(0,sponsorsCycle.sponsorsPerGroup);sponsorsCycle.currentSponsorGroup=1;}
$("#sponsors #sponsor-cycle").fadeOut("slow",function(){var html="";for(i in sponsors){html+=sponsors[i];}
$("#sponsors #sponsor-cycle").html(html);$("#sponsors #sponsor-cycle").fadeIn("slow");});}}
sponsorsCycle.init();