(function() { /** @id _FC */ var _FC = (function() { var initializing = 0, fnTest = /xyz/.test(function() { xyz; }) ? /\b_super\b/ : /.*/; // create private static attributes and methods here var _isIE = /*@cc_on!@*/0; var _xhr = window.XMLHttpRequest ? 1 : 0; var _isSelectorAble = (document.querySelectorAll) ? 1 : 0; var _isGetClassAble = (document.getElementsByClassName) ? 1 : 0; var _isLteIE6 = /*@cc_on@*//*@if (@_jscript_version <= 5.6)1; /*@end@*/0; var _isIE6 = /*@cc_on@*//*@if (@_jscript_version == 5.6)1; /*@end@*/0; var _isLteIE7 = /*@cc_on@*//*@if (@_jscript_version <= 5.7)1; /*@end@*/0; var _isIE7 = (_isLteIE7 && window.XMLHttpRequest) ? 1 : 0; _isIE6 = (_isLteIE7 && !window.XMLHttpRequest) ? 1 : _isIE6; _isLteIE6 = (_isLteIE7 && !window.XMLHttpRequest) ? 1 : _isLteIE6; var _appName = navigator.appName.toLowerCase(); var _isIPad = (navigator.platform.indexOf("iPad") != -1) ? 1 : 0; var _isIFrame = (window.location != window.parent.location) ? 1 : 0; var _name = 'FC JavaScript Library.\n\nv. 0.3.7\n\n\u00A9 2010 Fortune Cookie UK'; if (_isLteIE7) {// ie7 and below flicker fix try { document.execCommand('BackgroundImageCache', false, true); } catch (e) { } } return function() { // create private privileged properties and methods with 'this.' // create private private properties and methods with 'var' and 'function' /** @id hasQuerySelector */ this.hasHasQuerySelector = (function() { return _isSelectorAble; })(); /** @id hasIE */ this.hasIE = (function() { return _isIE; })(); /** @id hasLteIE6 */ this.hasLteIE6 = (function() { return _isLteIE6 })(); /** @id hasIE6 */ this.hasIE6 = (function() { return _isIE6 })(); /** @id hasLteIE7 */ this.hasLteIE7 = (function() { return _isLteIE7 })(); /** @id hasIE7 */ this.hasIE7 = (function() { return _isIE7 })(); /** @id isIPad */ this.isIPad = (function() { return _isIPad })(); /** @id FC */ this.FC = (function() { return _name })(); /** @id setCookie */ this.setCookie = function(name, value, expires, path, domain, secure) { var today = new Date(); today.setTime(today.getTime()); /* if the expires variable is set, make the correct expires time, the current script below will set it for x number of days, to make it for hours, delete * 24, for minutes, delete * 60 * 24 */ if (expires) { expires = expires * 1000 * 60 * 60 * 24; } var expires_date = new Date(today.getTime() + (expires)); document.cookie = name + "=" + escape(value) + ((expires) ? ";expires=" + expires_date.toGMTString() : "") + ((path) ? ";path=" + path : "") + ((domain) ? ";domain=" + domain : "") + ((secure) ? ";secure" : ""); }; /** @id getCookie */ this.getCookie = function(name) { if (document.cookie.length > 0) { c_start = document.cookie.indexOf(name + "="); if (c_start != -1) { c_start = c_start + name.length + 1; c_end = document.cookie.indexOf(";", c_start); if (c_end == -1) { c_end = document.cookie.length; } return unescape(document.cookie.substring(c_start, c_end)); } } return ""; }; }; })(); window.FC = new _FC(); })(); // Detect jQuery - set to noConflict if (typeof jQuery == "undefined") { var $j = jQuery.noConflict(); } else { var $j = jQuery; } // FC Vars & Constants FC.vars = { selectors: { NAV_HOVER: ".lta-header-nav ul li a", HOME_CONTENT: ".lta-minitennis-home", COMPONENTS: "#lta-page", MEDIA_PROMO_BUTTON: ".lta-media-promo", GALLERY: 'div.lta-gallery', GALLERY_SCROLLER: 'div.lta-thumbnail-container', GALLERY_CAPTION: 'div.lta-gallery div.lta-caption', SHOW_IMAGE: 'a.lta-main-img', SELECTED: '.lta-selected', MEDIA_PLAYER: ".lta-media-promo" }, current: 0, currentT: 0, strings: { HIDE: "lta-hide", READER: "lta-reader", ACTIVE: "lta-active", SELECTED: "lta-selected" } } FC.navHover = function() { $j('.lta-header-nav ul li a').each(function() { if ($j(this).parent().hasClass('lta-selected')) { } else { $j(this).hover( function() { $j(this).parent().addClass('lta-selected'); }, function() { $j(this).parent().removeClass('lta-selected'); } ); } }); } FC.homeContent = function() { $j('.content').delay(1390).slideDown(450); } FC.components = function() { $j('.lta-media-promo').parents('.lta-box').removeClass('lta-box1').addClass('lta-box4'); $j('.lta-large-story').parents('.lta-box').removeClass('lta-box1').removeClass('lta-box'); $j('.lta-already-a-coach').parents('.lta-box').removeClass('lta-box26').addClass('lta-box5a'); $j('.lta-already-a-coach').each(function() { $j(this).find('.lta-btn-alt').insertAfter(this).find('p'); }); $j('.lta-about-component-alt').each(function() { if ($j('.lta-image a img').attr('style') == "float: left;") { $j('.lta-info', this).css('width', 'auto'); $j('.lta-image', this).css('float', 'none'); } else { $j('.lta-info', this).css('width', '450px'); $j('.lta-image', this).css('float', 'right'); } }); setTimeout(function() { $j('.lta-more-videos-gallery .lta-box4').parent().removeClass(); }, 200); $j('.lta-more-videos-gallery ul').each(function(){ $j('li', this).last().addClass('last'); }); } FC.Tabs = function() { $j(".lta-tabs").each(function(intIndex) { $j(this).parent() .append('
') .parent() .removeClass('lta-box1') .addClass('lta-box4'); //add check for alltc var $alltc = $j(".lta-tab-content", this); var $tabs = $j(".lta-toggle-alt li a", this); if ($tabs.length == 0) { $j(".lta-tab-content-" + (intIndex + 1)).css({ "display": "block" }); } else { $j($tabs).each(function(intIndex) { var $parTabs = $j(this).parents('.lta-tabs'); var selectedIndex = $parTabs.attr("rel"); if (intIndex == selectedIndex) { $j(".lta-tab-content-" + (intIndex + 1), $parTabs).css({ "display": "block" }); $j(this).addClass("lta-selected"); } $j(this).bind("click", function() { var $parTabs = $j(this).parents('.lta-tabs'); $alltc.css({ "display": "none" }); $j($tabs).removeClass("lta-selected"); $j(".lta-tab-content-" + (intIndex + 1), $parTabs).css({ "display": "block" }); $j(this).addClass("lta-selected"); return false; }) }); } }) } FC.mediaPromoButton = function() { $j(".lta-media-promo").each(function() { var $btn = $j('li a', this).text(); $j('li a', this).addClass("lta-btn lta-btn-alt"); $j('li a', this).text("").append("" + $btn + ""); }); } FC.galleryScroller = function($container) { var scrollAmount = 8, current = 0, axis = { axis: 'y' }; var scrolls = $j("div.lta-scroll-control")[0]; var $container = $container, $down, $up; $down = $j("a.lta-next-img", scrolls[1]); $up = $j("a.lta-prev-img", scrolls[0]); $container.css('overflow-y', 'hidden'); $down[0].style.display = $up[0].style.display = "block"; var $contentBoxes = $j("li", $container[0]); var length = $contentBoxes.length; var max = scrollAmount * Math.ceil(length / scrollAmount); //if the number of boxes is the same as the scroll amount - then hide the 'next' arrow - it's not needed if (length <= scrollAmount) { $down.hide(); } //Make sure the scroller is at the start $container.scrollTo('li:eq(0)', 200, axis); // show/hide the prev/next buttons $up.hide(); $up.bind("click", function(e) {//Left scroller button if (current > 0) { current = current - scrollAmount; $container.scrollTo('li:eq(' + current + ')', 500, axis); $down.show(); if (current === 0) { $up.hide(); } } //instead of return false - click bubbles up to body element and that handles the event $j.data(e.target, 'return', false); }); $down.bind("click", function(e) { //Right scroller button if (current < max) { current = current + scrollAmount; $container.scrollTo('li:eq(' + current + ')', 500, axis); $up.show(); if ((current + scrollAmount) >= max) { $down.hide(); } } //instead of return false - click bubbles up to body element and that handles the event //$j.data(e.target, 'return', false); return false; }); }; // Show image function for images on Article page FC.showImage = function($main) { var counter = 0, image = [], SEL = FC.vars.selectors, PTH = FC.vars.paths, STR = FC.vars.strings, caption; var $container = $j(SEL.GALLERY_SCROLLER); var $mainImage = $j('img', $main[0]), $anchors = $j("a", $container[0]), $caption = $j(SEL.GALLERY_CAPTION); $anchors .each(function(i) { // preload images image[i] = new Image(); image[i].src = this.href; }); $container .unbind() .bind("click", function(e) { var tag = e.target.tagName, $a; if (tag == "A") { $a = $j(e.target); } else if (tag == "IMG") { $a = $j(e.target.parentNode); } else { return } var imgPath = $a.attr('href'); if (imgPath != '#') { //set the caption from the alt text caption = $j("img", $a[0]).attr('alt'); // cease all current animations $caption.stop(true, true); $mainImage.stop(true, true); $caption.slideUp(200, function() { $mainImage.fadeOut(250, function() { $mainImage .attr('src', imgPath) .fadeIn(250, function() { $j('p', $caption[0]).text(caption); $caption.slideDown(400); //FC.pngFix(PTH.GIF, $j(SEL.GALLERY)[0]); }); }); }); // remove selected class $j('li', this).each(function() { if (this.className.indexOf(STR.SELECTED) != -1) { this.className = ''; } }); // add new selected class $a[0].parentNode.className = STR.SELECTED; } return false; }); } // javascript commands for keyboard accessibility with jwPlayer var $toggle, $currentVolume = 80; FC.mediaPlayer = function(par) { $j(par).each(function() { var $setmute = 0, $playback = 0; $j('.playback', this).click(function() { if ($playback == 0) { $toggle = true; $playback = 1; $j(this).attr('title', 'Pause video').text('Pause'); } else { $toggle = false; $playback = 0; $j(this).attr('title', 'Play video').text('Play'); } }); $j('.mute', this).click(function() { if ($setmute == 0) { $toggle = true; $setmute = 1; $j(this).attr('title', 'Unmute video').text('Unmute'); } else { $toggle = false; $setmute = 0; $j(this).attr('title', 'Mute video').text('Mute'); } }); $j('.volume', this).click(function() { if ($currentVolume > 100) $currentVolume = 100 if ($currentVolume < 0) $currentVolume = 0 }); }); $j('.lta-media-promo .lta-jwcontrols a').focus(function() { $j(this).parent().removeClass('lta-reader'); }).blur(function() { $j(this).parent().addClass('lta-reader'); }); } // DOM Ready function calls $j(function() { // Load scripts var SEL = FC.vars.selectors, $tmp; (function(arg) { for (var i = 0, j = arg.length, o; i < j; i++) { o = arg[i]; (function() { $tmp = $j(o.test); return $tmp.length })() ? o.func($tmp, o.args || null) : null; } })([ { func: FC.navHover, test: SEL.NAV_HOVER }, { func: FC.homeContent, test: SEL.HOME_CONTENT }, { func: FC.components, test: SEL.COMPONENTS }, { func: FC.mediaPromoButton, test: SEL.MEDIA_PROMO_BUTTON }, { func: FC.galleryScroller, test: SEL.GALLERY_SCROLLER }, { func: FC.showImage, test: SEL.SHOW_IMAGE }, { func: FC.Tabs, test: '.lta-tabs' }, { func: FC.mediaPlayer, test: SEL.MEDIA_PLAYER } ]); });