');
var __$left = $j('li.lta-prev', __rec);
var __$right = $j('li.lta-next', __rec);
var __$container = $j('div.lta-records-container', __rec);
var __$contentBoxes = $j('li.lta-records-set', __rec);
var __scrollAmount = 1;
var __current = 0;
var __max = __$contentBoxes.length;
//Make sure the scroller is at the start
__$container.scrollTo( 'li:eq('+0+')', 200, __axis);
if(__max===__$contentBoxes.length){
__max=__max - __scrollAmount;
}
// show/hide the prev/next buttons
__$left.hide();
//Left scroller button
__$left.bind("click", function(e){
if(__current>0){
__current -= __scrollAmount;
__$container.scrollTo( 'li.lta-records-set:eq('+__current+')', 500, __axis);
__$right.show();
if(__current === 0){
__$left.hide();
}
}
//instead of return false - click bubbles up to body element and that handles the event
$j.data(e.target, 'return', false);
});
//Right scroller button
__$right.bind("click", function(e){
if(__current<__max){
__current += __scrollAmount;
__$container.scrollTo( 'li.lta-records-set:eq('+__current+')', 500, __axis);
__$left.show();
if(__current === __max){
__$right.hide();
}
}
//instead of return false - click bubbles up to body element and that handles the event
$j.data(e.target, 'return', false);
});
}
// vertical scroller function */
FC.verticalScroll = function(container){
var __axis = {axis:'y'}, __$divs = container.find("div.lta-tab-content"), __$ul, __j = __$divs.length;
while (__j--) {
var __$this = $j(__$divs[__j]), __$contentBoxes, __scrollAmount = 5, __current = 0, height = 0;
__$ul = __$this.find(">ul.lta-listing");
__$contentBoxes = __$ul.find(">li");
if (__$contentBoxes.length < 5) continue;
for (i=0;i<=4;i++) {
height += __$contentBoxes.eq(i).height();
}
__$ul.height(height);
//add controls
__$ul.before('Previous');
__$ul.after('More');
var __$right = $j("a.lta-next", __$divs[__j]), __$left = $j("a.lta-prev", __$divs[__j])
__$ul[0].style.overflow = 'hidden';
var __max = __$contentBoxes.length//*__scrollAmount;
//Make sure the scroller is at the start
__$this.scrollTo(__$contentBoxes[0], 200, __axis);
if(__max==__$contentBoxes.length){
__max=__max-1;
}
// show/hide the prev/next buttons
__$left.hide();
//Left scroller button
__$left.bind("click", function(e){
if(__current>0){
__current = __current-__scrollAmount;
__$ul.scrollTo('>li:eq('+__current+')', 500, __axis);
__$right.show();
if(__current == 0){
__$left.hide();
}
}
//instead of return false - click bubbles up to body element and that handles the event
$j.data(e.target, 'return', false);
});
//Right scroller button
__$right.bind("click", function(e){
if(__current<__max){
__current = __current+__scrollAmount;
__$ul.scrollTo( '>li:eq('+__current+')', 500, __axis);
__$left.show();
if((__max - __current) <= __scrollAmount){
__$right.hide();
}
}
//instead of return false - click bubbles up to body element and that handles the event
$j.data(e.target, 'return', false);
});
}
}
// scroller function for sample menu/hospitality component */
FC.panelScroller = function(container){
var __axis = {axis:'x'};
container.each(function(){
var __scrollAmount = 1, __current = 0, __hasPNG;
var __$this = $j(this), __$container = $j("div.lta-cf-pane", this),__$contentBoxes = $j("div.lta-cf-item", this),
__$right = $j("a.lta-next", this), __$left = $j("a.lta-prev", this), __$link = $j("div.lta-cf-item a", this);
var __container = __$container[0];
__container.style.overflow = 'hidden';
__$contentBoxes.css("float","left");
$j("ul.lta-img-nav", this).show();
var __max = __$contentBoxes.length*__scrollAmount;
//Make sure the scroller is at the start
__$container.scrollTo('div.lta-cf-item:eq('+0+')', 200, __axis);
if(__max==__$contentBoxes.length){
__max=__max-1;
}
// show/hide the prev/next buttons
__$left.hide();
// handle links inside the boxes
// explicity exclude those coverflows that don't have transparencies
//__hasPNG =(this.className.indexOf('lta-winners-scroll') > 0 || this.className.indexOf('lta-sample-menu') > 0) ? true : false;
//Link
__$link.bind("focus", function(){
// need to detect which image the link being focussed is on, and then scroll to that lta-cf-item
__$container.scrollTo($j(this).parents('div.lta-cf-item'), 500, __axis);
var __current = $j('div.lta-cf-item').index($j(this).parents('div.lta-cf-item'));
//var listItem = document.getElementById('bar');
//$j('li').index(listItem))
});
//Left scroller button
__$left.bind("click", function(e){
if(__current>0){
__current = __current-__scrollAmount;
__$container.scrollTo('div.lta-cf-item:eq('+__current+')', 500, __axis);
__$right.show();
if(__current == 0){
__$left.hide();
}
}
//instead of return false - click bubbles up to body element and that handles the event
$j.data(e.target, 'return', false);
});
//Right scroller button
__$right.bind("click", function(e){
if(__current<__max){
__current = __current+__scrollAmount;
__$container.scrollTo( 'div.lta-cf-item:eq('+__current+')', 500, __axis);
__$left.show();
if(__current == __max){
__$right.hide();
}
}
//instead of return false - click bubbles up to body element and that handles the event
$j.data(e.target, 'return', false);
});
});// end 'each' statement
}
// scroller function for images on About Us page */
FC.galleryScroller = function($container) {
var __scrollAmount = 8, __current = 0, __axis = { axis: 'y' };
//var __scrolls = (FC.hasLteIE7) ? (function() { var __$tmp = $j("div.lta-scroll-control"); return [__$tmp[0], __$tmp[1]] })() : document.body.querySelector("div.lta-scroll-control");
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);
});
};
// scroller function for images on Photogallery- details page */
FC.galleryDetailScroller = function($container) {
var __scrollAmount = 6, __scrollIndex = 0, __axis = { axis: 'x' };
//var __controls = (FC.hasLteIE7) ? (function() { var __$tmp = $j("div.lta-tn-nav"); return __$tmp[0] })() : document.body.querySelector("div.lta-tn-nav");
var __controls = $j("div.lta-tn-nav")[0];
var __$container = $container, __$down, __$up, __$mDown, __$mUp;
var __$mainImage = $j('img', FC.vars.selectors.GALLERY_DETAIL_MAIN_IMG);
var __STR = FC.vars.strings;
var __$caption = $j(FC.vars.selectors.GALLERY_DETAIL_CAPTION);
__$down = $j("div.lta-next-image a", __controls);
__$up = $j("div.lta-prev-image a", __controls);
//main image controls
__$mDown = $j("div.lta-m-nav.lta-next-image a");
__$mUp = $j("div.lta-m-nav.lta-prev-image a");
__$container.css('overflow-y', 'hidden');
__$down[0].style.display = __$up[0].style.display = __$mDown[0].style.display = "block";
var __$contentBoxes = $j("li", __$container[0]);
var __length = (__$contentBoxes.length - 1);
var __max = __scrollAmount * Math.ceil(__length / __scrollAmount);
var __lastScroll = Math.floor(__length / __scrollAmount) * __scrollAmount;
//if the number of boxes is the same as the scroll amount - then hide the 'next' arrow - it's not needed
if ((__length + 1) <= __scrollAmount) {
__$down.hide();
}
//Make sure the scroller is at the start
__$container.scrollTo('li:eq(0)', 200, __axis);
// show/hide the prev buttons
__$up.hide();
__$mUp.hide();
__$up.bind("click", function(e) {//Left scroller button
if (FC.vars.currentT > 0) {
__scrollIndex = __scrollIndex - __scrollAmount;
FC.vars.currentT = __scrollIndex + __scrollAmount - 1;
__$container.scrollTo('li:eq(' + __scrollIndex + ')', 500, __axis);
__$down.show();
if ((FC.vars.currentT === 0) || (__scrollIndex == 0)) {
__$up.hide();
}
if (FC.vars.currentT < __length) {
//__$mDown.show();
}
}
//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 (FC.vars.currentT < __max) {
__scrollIndex = __scrollIndex + __scrollAmount;
FC.vars.currentT = __scrollIndex;
__$container.scrollTo('li:eq(' + __scrollIndex + ')', 500, __axis);
__$up.show();
//__$mUp.show();
if ((FC.vars.currentT + __scrollAmount) >= __max) {
__$down.hide();
}
//calculate if main image previous button needs to show
if (FC.vars.currentT == __length) {
__$mDown.hide();
}
}
//instead of return false - click bubbles up to body element and that handles the event
$j.data(e.target, 'return', false);
});
__$mUp.bind("click", function(e) {//Main image Left button
if (FC.vars.current > 0) {
__previousItem = FC.vars.current;
__previousItem--;
__$previousEl = __$container.find('li:eq(' + __previousItem + ') a')
__caption = $j("img", __$previousEl).attr('alt');
__imgPath = __$previousEl.attr('href');
__$mainImage.fadeOut(250, function() {
__$mainImage
.attr('src', __imgPath)
.fadeIn(250, function() {
$j(__$caption).text(__caption);
});
});
//if FC.vars.current is a multiple of 6, then scroll
//Work out which set of 6 to scroll to
var __reset = FC.vars.current - 1;
__reset = Math.floor(__reset / __scrollAmount)
__reset = __reset * __scrollAmount;
__scrollIndex = __reset;
__$container.scrollTo('li:eq(' + __reset + ')', 500, __axis);
__$mDown.show();
if (__reset < __lastScroll) {
__$down.show();
}
//if the previousItem is zero, hide the main image previous button
if (__previousItem == 0) {
__$mUp.hide();
}
//if the first set of 6 thumbs is displayed, hide the previous button
if (FC.vars.current <= __scrollAmount) {
__$up.hide();
}
}
// remove selected class
$j('li', $container).each(function() {
if (this.className.indexOf(__STR.SELECTED) != -1) {
this.className = '';
}
});
// add new selected class
__$previousEl[0].parentNode.className = __STR.SELECTED;
FC.vars.current--;
//instead of return false - click bubbles up to body element and that handles the event
$j.data(e.target, 'return', false);
});
__$mDown.bind("click", function(e) { //Main image right scroller button
if (FC.vars.current < __length) {
__nextItem = FC.vars.current;
__nextItem++;
__$nextEl = __$container.find('li:eq(' + __nextItem + ') a');
__caption = $j("img", __$nextEl).attr('alt');
__imgPath = __$nextEl.attr('href');
__$mainImage.fadeOut(250, function() {
__$mainImage
.attr('src', __imgPath)
.fadeIn(250, function() {
$j(__$caption).text(__caption);
});
});
//calculate if scrolling is required
//if __nextItem is a multiple of 6, then scroll
if ((__nextItem % __scrollAmount == 0) && (FC.vars.current != 0)) {
__scrollIndex = __scrollIndex + __scrollAmount;
__$container.scrollTo('li:eq(' + __scrollIndex + ')', 500, __axis);
FC.vars.currentT = __scrollIndex;
__$up.show();
//calculate if scroll section is displayed. if so, hide the next button
if ((__nextItem + __scrollAmount) >= __max) {
__$down.hide();
}
}
else if (FC.vars.current < __scrollIndex) {
__scrollIndex = __scrollIndex - __scrollAmount;
FC.vars.currentT = __scrollIndex + __scrollAmount - 1;
__$container.scrollTo('li:eq(' + __scrollIndex + ')', 500, __axis);
__$down.show();
}
//calculate if last item is displayed. if so, hide the next buttons
if (__nextItem >= __length) {
__$mDown.hide();
}
//calculate if main image previous button needs to show
if (__nextItem != 0) {
__$mUp.show();
}
FC.vars.scrollInitialised = true;
}
// remove selected class
$j('li', $container).each(function() {
if (this.className.indexOf(__STR.SELECTED) != -1) {
this.className = '';
}
});
// add new selected class
__$nextEl[0].parentNode.className = __STR.SELECTED;
FC.vars.current++;
//instead of return false - click bubbles up to body element and that handles the event
$j.data(e.target, 'return', false);
});
}
// Show image function for images on Photo Gallery page
FC.showGalleryDetailImage = function($main) {
var counter = 0, __image = [], __SEL = FC.vars.selectors, __PTH = FC.vars.paths, __STR = FC.vars.strings, __caption;
var __$container = $j(__SEL.GALLERY_DETAIL_THUMB_CONTAINER);
var __$mainImage = $j('img', $main[0]), __$anchors = $j("a", __$container[0]), __$caption = $j(__SEL.GALLERY_DETAIL_CAPTION);
var __$mDown = $j("div.lta-m-nav.lta-next-image a");
var __$mUp = $j("div.lta-m-nav.lta-prev-image a");
__$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.parentNode);
} else if(__tag == "SPAN"){
__$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);
__$mainImage.fadeOut(250, function() {
__$mainImage
.attr('src', __imgPath)
.fadeIn(250, function() {
$j(__$caption).text(__caption);
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;
var __par = __$a.parent();
var index = $j('li', __$container).index(__par);
FC.vars.current = index;
if (FC.vars.current != 0) {
__$mUp.show();
}
else {
__$mUp.hide();
}
//If it's the last image, hide the main image right button
if(FC.vars.current == __$anchors.length-1){
__$mDown.hide();
}
else {
__$mDown.show();
}
}
//instead of return false - click bubbles up to body element and that handles the event
$j.data(e.target, 'return', false);
});
}
// Show image function for images on About Us 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.THUMB_CONTAINER);
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;
}
//instead of return false - click bubbles up to body element and that handles the event
$j.data(e.target, 'return', false);
});
FC.pngFix(__PTH.GIF, $j(__SEL.GALLERY)[0]);
}
FC.hospSlideshow = function($img) {
var __i = 1, __images = [], __imageCount = 0, __src = $img[0].src;
var __srcSplit = __src.substring(0, __src.length-5);
//try to preload up to 10 images and count how many exist
for(__j = 1; __j < 10; __j++){
__images[__j] = new Image();
__images[__j].onload = function(){
__imageCount++;
}
__images[__j].src = __srcSplit + __j + ".jpg";
}
//fade between images
setInterval(function () {
$img.fadeOut(400,function(){
__i++;
if(__i > __imageCount) {
__i = 1;
}
this.onload = function(){
$img.fadeIn(400);
}
this.src = __srcSplit + __i + ".jpg";
})
},6000)
}
FC.setupToggle = function($par){
var __STR = FC.vars.strings, __par = $par[0];
var __$togSing = $j('a.lta-singles', __par),
__$togDoub = $j('a.lta-doubles', __par),
__$divSing = $j('div.lta-singles', __par),
__$divDoub = $j('div.lta-doubles', __par);
__$divDoub.hide();
__$togDoub.bind("click",function(e){
__$togSing.removeClass(__STR.SELECTED);
__$togDoub.addClass(__STR.SELECTED);
__$divSing.hide();
__$divDoub.show();
//instead of return false - click bubbles up to body element and that handles the event
$j.data(e.target, 'return', false);
});
__$togSing.bind("click",function(e){
__$togDoub.removeClass(__STR.SELECTED);
__$togSing.addClass(__STR.SELECTED);
__$divDoub.hide();
__$divSing.show();
//instead of return false - click bubbles up to body element and that handles the event
$j.data(e.target, 'return', false);
});
FC.panelScroller(__$divSing);
FC.panelScroller(__$divDoub);
}
var sponsorcounter = 1;
var intervalID;
FC.sponsorSlideshow = function(m) {
var __sponsorImage = ".lta-sponsors-widget .lta-s" + sponsorcounter;
$j(__sponsorImage).fadeOut(350,function(){
sponsorcounter++;
if(sponsorcounter==(m + 1)){sponsorcounter=1;}
__sponsorImage = ".lta-sponsors-widget .lta-s" + sponsorcounter;
$j(__sponsorImage).fadeIn(350);
});
}
// count element c = class, e = element type
FC.countElement = function(c, e){
var __elementNum = $j(c + " > " + e).size();
return __elementNum;
}
// f = function name to pause
FC.pauseBtn = function(){
//Switch the "Open" and "Close" state per click
$j(".lta-pausePlay a").toggle(function(e){
$j(this).addClass("lta-play");
clearInterval(intervalID);
//instead of return false - click bubbles up to body element and that handles the event
$j.data(e.target, 'return', false);
}, function () {
$j(this).removeClass("lta-play");
FC.initSlideshow(sponsorcounter);
//instead of return false - click bubbles up to body element and that handles the event
$j.data(e.target, 'return', false);
});
}
// sc = sponsor counter
FC.initSlideshow = function(sc) {
var maxSponsors = FC.countElement('.lta-sponsors-widget', 'a');
//console.log(maxSponsors);
//hide all
for (i = 1; i < (maxSponsors + 1); i++) {
var sponsorImage = ".lta-sponsors-widget .lta-s" + i;
$j(sponsorImage).hide();
}
// use the sponsorcounter to figure out what we're up to, and go show it
var sponsorImage = ".lta-sponsors-widget .lta-s" + sc;
$j(sponsorImage).show();
intervalID = setInterval("FC.sponsorSlideshow(" + maxSponsors + ")", 4000);
return false;
},
FC.countCharacters = function() {
var _$textarea = $j(".lta-limitchar");
$j(".lta-char-count").html("You have " + "500" + " characters remaining");
var _$counter = $j(".lta-char-count strong"), _max = Number(500), _loadLength;
var _textarea = _$textarea[0];
_loadLength = (_textarea.value.length) ? _max - _textarea.value.length : _max;
if (_loadLength == 0) {
_$counter.addClass(FC.vars.strings.LIMIT_REACHED);
}
_$counter.text(_loadLength);
var _textCalc = function(e) {
var __length = _textarea.value.length;
if (e.keyCode != 46 && e.keyCode != 8) {
if (__length >= _max) { // if too long...trim it!
_$counter.addClass(FC.vars.strings.LIMIT_REACHED);
_textarea.value = _textarea.value.substring(0, _max);
_$counter.text(_max - __length);
return false
} else {
_$counter.removeClass(FC.vars.strings.LIMIT_REACHED);
_$counter.text(_max - __length);
}
} else {
_$counter.removeClass(FC.vars.strings.LIMIT_REACHED);
_$counter.text(_max - __length);
}
};
_$textarea
.bind('keydown', _textCalc)
.bind('keyup', _textCalc)
.bind('change', _textCalc);
},
FC.helpButton = function() {
$j("a.lta-helpbutton").tooltip({
track: true,
delay: 0,
showURL: false,
extraClass: "lta-tooltip",
showBody: " - ",
top: -40,
left: 30
});
$j("a.lta-helpbutton").bind('click', function(e) {
//instead of return false - click bubbles up to body element and that handles the event
$j.data(e.target, 'return', false);
});
}
FC.Tabs = function() {
$j(".lta-tabs").each(function(intIndex) {
//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.PhotoGalleryScroll = function() {
$j('.lta-box').each(function() {
var __this = $j(this);
var __header = $j(".gallery-frame", __this).siblings(".lta-header");
var __navcontainer = $j(".lta-title-nav", __this);
var __photonav = ("
1 of
");
var __pagecount = 0;
__navcontainer.append(__photonav);
if ($j(FC.vars.selectors.LATEST_PHOTO_GALLERY_PANELS, __this).length == 1) {
$j(FC.vars.selectors.LATEST_PHOTO_GALLERY_PAGES, __this).css({ 'display': 'none' });
}
$j(FC.vars.selectors.LATEST_PHOTO_GALLERY_PANELS + ":first", __this).css({ "display": "block" });
$j(FC.vars.selectors.LATEST_PHOTO_GALLERY_PANELS, __this).each(function() {
__pagecount = __pagecount + 1;
$j(this).addClass("lta-latest-gallery-" + __pagecount);
});
$j(FC.vars.selectors.LATEST_PHOTO_GALLERY_PAGES + ' .lta-total', __this).text(__pagecount);
if ($j(FC.vars.selectors.LATEST_PHOTO_GALLERY_PANELS, __this).length > 1) {
AppendBack();
AppendNext();
}
function AppendBack() {
if (parseInt($j(FC.vars.selectors.LATEST_PHOTO_GALLERY_PAGES + ' .lta-current', __this).text()) == 1) {
$j(".nav-back", __this).remove();
$j(FC.vars.selectors.LATEST_PHOTO_GALLERY_PAGES, __this).before("Back - disabled");
}
else {
$j(".nav-back", __this).remove();
$j(FC.vars.selectors.LATEST_PHOTO_GALLERY_PAGES, __this).before("Back");
$j("a.nav-back", __this).bind("click", function(e) {
$j(FC.vars.selectors.LATEST_PHOTO_GALLERY_PANELS, __this).css({ "display": "none" });
var currentEq = parseInt($j(this).siblings(FC.vars.selectors.LATEST_PHOTO_GALLERY_PAGES).find('.lta-current').text()) - 1;
var previousEq = currentEq - 1;
$j(FC.vars.selectors.LATEST_PHOTO_GALLERY_PANELS, __this).eq(previousEq).css({ "display": "block" });
$j(this).siblings(FC.vars.selectors.LATEST_PHOTO_GALLERY_PAGES, __this).find('.lta-current').text(previousEq + 1);
AppendBack();
AppendNext();
//instead of return false - click bubbles up to body element and that handles the event
$j.data(e.target, 'return', false);
});
}
}
function AppendNext() {
if (parseInt($j(FC.vars.selectors.LATEST_PHOTO_GALLERY_PAGES + ' .lta-current', __this).text()) == parseInt($j(FC.vars.selectors.LATEST_PHOTO_GALLERY_PAGES + ' .lta-total', __this).text())) {
$j(".nav-next", __this).remove();
$j(FC.vars.selectors.LATEST_PHOTO_GALLERY_PAGES, __this).after("Next - disabled");
}
else {
$j(".nav-next", __this).remove();
$j(FC.vars.selectors.LATEST_PHOTO_GALLERY_PAGES, __this).after("Next");
$j("a.nav-next", __this).bind("click", function(e) {
$j(FC.vars.selectors.LATEST_PHOTO_GALLERY_PANELS, __this).css({ "display": "none" });
var currentEq = parseInt($j(this).siblings(FC.vars.selectors.LATEST_PHOTO_GALLERY_PAGES, __this).find('.lta-current').text()) - 1;
var nextEq = currentEq + 1;
$j(FC.vars.selectors.LATEST_PHOTO_GALLERY_PANELS, __this).eq(nextEq).css({ "display": "block" });
$j(this).siblings(FC.vars.selectors.LATEST_PHOTO_GALLERY_PAGES, __this).find('.lta-current').text(nextEq + 1);
AppendBack();
AppendNext();
//instead of return false - click bubbles up to body element and that handles the event
$j.data(e.target, 'return', false);
});
}
}
});
}
FC.search = function(el){
searchModule = function(el){
this.form = $j(el);
this.basicSearch = this.form.find('.lta-search-basic');
this.advancedSearch = this.form.find('.lta-search-advanced');
ToggleSearchOptions(this.form.find('.lta-radio-location').children(1).is(':checked'));
this.toggleBtn = this.form.find('.lta-btn-toggle');
this.buttonStatus = function(){
if (this.advancedSearch.css('display') == 'none') {
this.toggleBtn.html('More options');
this.toggleBtn.removeClass('less').addClass('more');
}
else {
this.toggleBtn.html('Less options');
this.toggleBtn.removeClass('more').addClass('less');
}
}
var that = this;
this.toggleBtn.bind('click', function(e){
that.advancedSearch.slideToggle(function(){
that.buttonStatus();
});
//instead of return false - click bubbles up to body element and that handles the event
$j.data(e.target, 'return', false);
})
}
$j('div.lta-search').each(function(){
new searchModule(this);
})
}
FC.listHover = function() {
var __$lists = $j(FC.vars.selectors.LIST_HOVER);
if (__$lists.length == 0) {
return;
}
__$lists.bind('mouseenter', function() {
//console.log('listhover over');
$j(this).addClass('hovering');
});
__$lists.bind('mouseleave', function() {
$j(this).removeClass('hovering');
});
__$lists.bind('click', function() {
__a = $j('a', this)[0];
window.open(__a.href, __a.target ? __a.target : '_self');
return false;
});
__$lists.find('a').bind('click', function() {
window.open(this.href, this.target ? this.target : '_self');
return false;
});
}
function loadXMLString(txt)
{
if (window.DOMParser){
parser = new DOMParser();
xmlDoc = parser.parseFromString(txt, "text/xml");
}
else{ // Internet Explorer
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = "false";
xmlDoc.loadXML(txt);
}
return xmlDoc;
}
//scores and draws XML feed
FC.liveFeed = function(x, tbl){
//tbl = FC.vars.selectors.TABLE_CONTAINER_SM;
var __doublesMatch = false;
var __lta_fin = false;
var __i = 0;
var __tableID = "";
var __lta_fin_all = 0;
var __lta_fin = 0;
var __matchID = []; //**************************************** new variable
function openFeed(first){
$j.getJSON(liveScoresXmlFeedUrl + "?callback=?",
function(data){
if(data.results[0]){
var xml = loadXMLString(data.results[0]);
// for each court, run the functions
// if it's the first run through, set up all the tables etc. Otherwise, just update the scores.
if(first==1){
// **************************** RESET FOR SUBSEQUENT RUNS ************
__i = 0;
// clear the DIV out
$j(FC.vars.selectors.TABLE_CONTAINER).empty();
// *******************************************************************
//handleData($j(this));
$j("court", xml).each(function() {
// Test for Match ID here
if($j(this).find('match_id').text() != ""){
__tableID = getTableID(__i);
createTable(); // create a table for the data to into
init($j(this));//initialise the players
updateScores($j(this));//get the scores
//****************** ADDED ********************
// store the initial match ids - we'll test against this in iterations
__matchID[__i] = $j(this).find('match_id').text();
//**************************************
// test if the match is finished
__lta_fin = $j(this).find('finished').text();
// if finished is true for this match, then announce winner
if(__lta_fin == "1"){
announceWinner($j(this));
__lta_fin_all++;
}
__i++; // ********************** MOVED inside the frunction
}
})
// if all matches aren't finished, start the timer
if (__lta_fin_all != __i){
var times = 0;
$j(document).everyTime(15000, function(i) {
openFeed(0);
}, times);
}
}else{
__i = 0
$j("court", xml).each(function() {
//****************** FUNCTION REWRITTEN ********************
var m1 = $j(this).find('match_id').text();
// Test for Match ID here
if(m1 != ""){
__tableID = getTableID(__i);
var hasMatch = 0;
var x = 0;
// check and see if the match id exists - if it doesn't, it's a new item
for(x=0;x <__matchID.length;x++){
if (__matchID[x] == m1){
hasMatch++;
}
}
// if it's a new item, stop the time and reopen the feed to refresh all the tables
if (hasMatch == 0){
$j(document).stopTime();
openFeed(1);
}
//**************************************************
// test if the match is finished
__lta_fin = $j(this).find('finished').text();
if(__lta_fin == "1"){
announceWinner($j(this));
}else{
updateScores($j(this));
}
__i++; // ********************** MOVED inside the frunction
}
})
}
}
}
);
return false;
}
function getTableID(i){
// figure out what's calling the function and set the table id accordingly - this is because different formats go into the different types of tables
var tabID;
if(tbl == FC.vars.selectors.TABLE_CONTAINER_SM){
tabID = "#smlVer" + __i;
smllVer = true;
}else{
tabID = "#regVer" + __i;
}
return tabID;
}
function createTable(){
if(__tableID.indexOf("smlVer") != -1){
$j(FC.vars.selectors.TABLE_CONTAINER_SM).append('
');
}
}
function init(r){
//initial set up
// COURT
$j(__tableID + ' span.lta-court').append($j(r).find("court_name").text());
// check to see if doubles match names are in
var fn1_2 = $j(r).find('firstname1_2').text();
var fn2_2 = $j(r).find('firstname2_2').text();
// check if it has a child node, and if it does, then use it
if ((fn1_2 != "") && (fn2_2 != "")){__doublesMatch = true;} else {__doublesMatch = false;} //********************************************
// Check to see if the small version exists on the page
// not sure if the small and big versions will ever be on the same page, but coded just in case they are
if($j(FC.vars.selectors.TABLE_CONTAINER_SM).length){var smllVer = true}
//Seeding
var seed1 = $j(r).find("seed1").text();
var isSeed1 = (seed1 != "");
// TEAM ONE PLAYER ONE
if(smllVer){
// display the shorter name if it's in the smaller side module
var ln1_1sv = changeCase($j(r).find("name1_1").text()).substring(0, 3);
if(isSeed1) ln1_1sv = ln1_1sv.toUpperCase();
$j(__tableID + " strong.lta-name-1_1").append(ln1_1sv);
}else{
var ln1_1fv0 = $j(r).find("firstname1_1").text().charAt(0);
var ln1_1fv1 = changeCase($j(r).find("name1_1").text());
if(isSeed1) ln1_1fv1 = ln1_1fv1.toUpperCase();
$j(__tableID + " strong.lta-name-1_1").append(ln1_1fv0 + " " + ln1_1fv1);
}
//nationality
var nat1_1 = $j(r).find("nat1_1").text();
$j(__tableID + " span.lta-nat-1_1").append(nat1_1);
//seeding
if(isSeed1 && !__doublesMatch){
$j(__tableID + " span.lta-nat-1_1").append(" (" + seed1 + ")");
}
// TEAM ONE PLAYER TWO
if(__doublesMatch){
if(smllVer){
// display the shorter name if it's in the smaller side module
var ln1_2sv = changeCase($j(r).find("name1_2").text()).substring(0, 3);
if(isSeed1) ln1_2sv = ln1_2sv.toUpperCase();
$j(__tableID + " strong.lta-name-1_2").append("/ " + ln1_2sv);
}else{
var ln1_2fv0 = $j(r).find("firstname1_2").text().charAt(0);
var ln1_2fv1 = changeCase($j(r).find("name1_2").text());
if(isSeed1) ln1_2fv1 = ln1_2fv1.toUpperCase();
$j(__tableID + " strong.lta-name-1_2").append("/ " + ln1_2fv0 + " " + ln1_2fv1);
}
//nationality
var nat1_2 = $j(r).find("nat1_2").text(); // add seeding info here
$j(__tableID + " span.lta-nat-1_2").append(nat1_2);
if(isSeed1){
$j(__tableID + " span.lta-nat-1_2").append(" (" + seed1 + ")");
}
}
//Seeding
var seed2 = $j(r).find("seed2").text();
var isSeed2 = (seed2 != "");
// TEAM TWO PLAYER ONE
if(smllVer){
// display the shorter name if it's in the smaller side module
var ln2_1sv = changeCase($j(r).find("name2_1").text()).substring(0, 3);
if(isSeed2) ln2_1sv = ln2_1sv.toUpperCase();
$j(__tableID + " strong.lta-name-2_1").append(ln2_1sv);
}else{
var ln2_1fv0 = $j(r).find("firstname2_1").text().charAt(0);
var ln2_1fv1 = changeCase($j(r).find("name2_1").text());
if(isSeed2) ln2_1fv1 = ln2_1fv1.toUpperCase();
$j(__tableID + " strong.lta-name-2_1").append(ln2_1fv0 + " " + ln2_1fv1);
}
//nationality
var nat2_1 = $j(r).find("nat2_1").text();
$j(__tableID + " span.lta-nat-2_1").append(nat2_1);
//seeding
if(isSeed2 && !__doublesMatch){
$j(__tableID + " span.lta-nat-2_1").append(" (" + seed2 + ")");
}
//TEAM TWO PLAYER TWO
if(__doublesMatch){
if(smllVer){
// display the shorter name if it's in the smaller side module
var ln2_2sv = changeCase($j(r).find("name2_2").text()).substring(0, 3);
if(isSeed2) ln2_2sv = ln2_2sv.toUpperCase();
$j(__tableID + " strong.lta-name-2_2").append("/ " + ln2_2sv);
}else{
var ln2_2fv0 = $j(r).find("firstname2_2").text().charAt(0);
var ln2_2fv1 = changeCase($j(r).find("name2_2").text());
if(isSeed2) ln2_2fv1 = ln2_2fv1.toUpperCase();
$j(__tableID + " strong.lta-name-2_2").append("/ " + ln2_2fv0 + " " + ln2_2fv1);
}
//nationality
var nat2_2 = $j(r).find("nat2_2").text(); // add seeding info here
$j(__tableID + " span.lta-nat-2_2").append(nat2_2);
if(isSeed2){
$j(__tableID + " span.lta-nat-2_2").append(" (" + seed2 + ")");
}
}
}
function updateScores(r){
var smllVer = (tbl == FC.vars.selectors.TABLE_CONTAINER_SM);
// MATCH TIME
//.lta-matchTime
var matchTime = $j(r).find("time").text();
$j(__tableID + ' span.lta-matchTime').text('').html(matchTime);
// POINTS
var pts1 = $j(r).find("pts1").text();
$j(__tableID + ' td.lta_points_1').text('').html(pts1);
var pts2 = $j(r).find("pts2").text();
$j(__tableID + ' td.lta_points_2').text('').html(pts2);
// FIGURE WHICH SET IS CURRENT
var s1_1 = $j(r).find('set1_1').text();
var s1_2 = $j(r).find('set1_2').text();
var s2_1 = $j(r).find('set2_1').text();
var s2_2 = $j(r).find('set2_2').text();
var s3_1 = $j(r).find('set3_1').text();
var s3_2 = $j(r).find('set3_2').text();
var s4_1 = $j(r).find('set4_1').text();
var s4_2 = $j(r).find('set4_2').text();
var s5_1 = $j(r).find('set5_1').text();
var s5_2 = $j(r).find('set5_2').text();
var currentSet = 0;
if(s1_1 != "" || s1_2 != ""){
// set 1 is current
currentSet = 1
//set column header
if(!smllVer)$j(__tableID + ' td.lta-set-1').text('').html('1').attr('width','17').removeClass('lta-inactive');
//set values
s1_1!=""?$j(__tableID + ' td.lta-set-1_1').text('').html(s1_1).removeClass('lta-inactive'):'';
s1_2!=""?$j(__tableID + ' td.lta-set-1_2').text('').html(s1_2).removeClass('lta-inactive'):'';
}
if(s2_1 != "" || s2_2 != ""){
// set 2 is current
currentSet = 2;
if(!smllVer)$j(__tableID + ' td.lta-set-2').text('').html('2').attr('width','17').removeClass('lta-inactive');
s2_1!=""?$j(__tableID + ' td.lta-set-2_1').text('').html(s2_1).removeClass('lta-inactive'):'';
s2_2!=""?$j(__tableID + ' td.lta-set-2_2').text('').html(s2_2).removeClass('lta-inactive'):'';
}
if(s3_1 != "" || s3_2 != ""){
// set 3 is current
currentSet = 3;
if(!smllVer)$j(__tableID + ' td.lta-set-3').text('').html('3').attr('width','17').removeClass('lta-inactive');
s3_1!=""?$j(__tableID + ' td.lta-set-3_1').text('').html(s3_1).removeClass('lta-inactive'):'';
s3_2!=""?$j(__tableID + ' td.lta-set-3_2').text('').html(s3_2).removeClass('lta-inactive'):'';
}
if(s4_1 != "" || s4_2 != ""){
// set 4 is current
currentSet = 4;
if(!smllVer)$j(__tableID + ' td.lta-set-4').text('').html('4').attr('width','17').removeClass('lta-inactive');
s4_1!=""?$j(__tableID + ' td.lta-set-4_1').text('').html(s4_1).removeClass('lta-inactive'):'';
s4_2!=""?$j(__tableID + ' td.lta-set-4_2').text('').html(s4_2).removeClass('lta-inactive'):'';
}
if(s5_1 != "" || s5_2 != ""){
// set 5 is current
currentSet = 5;
if(!smllVer)$j(__tableID + ' td.lta-set-5').text('').html('5').attr('width','17').removeClass('lta-inactive');
s5_1!=""?$j(__tableID + ' td.lta-set-5_1').text('').html(s5_1).removeClass('lta-inactive'):'';
s5_2!=""?$j(__tableID + ' td.lta-set-5_2').text('').html(s5_2).removeClass('lta-inactive'):'';
}
//run through all .lta-set-score and remove class lta-currentSet
$j(__tableID + ' td.lta-set-score').each(function(index) {
$j(this).removeClass('lta-currentSet');
});
// mark up the current set
switch (currentSet) {
case 5:
$j(__tableID + ' td.lta-set-5_1').addClass('lta-currentSet');
$j(__tableID + ' td.lta-set-5_2').addClass('lta-currentSet');
break;
case 4:
$j(__tableID + ' td.lta-set-4_1').addClass('lta-currentSet');
$j(__tableID + ' td.lta-set-4_2').addClass('lta-currentSet');
break;
case 3:
$j(__tableID + ' td.lta-set-3_1').addClass('lta-currentSet');
$j(__tableID + ' td.lta-set-3_2').addClass('lta-currentSet');
break;
case 2:
$j(__tableID + ' td.lta-set-2_1').addClass('lta-currentSet');
$j(__tableID + ' td.lta-set-2_2').addClass('lta-currentSet');
break;
case 1:
$j(__tableID + ' td.lta-set-1_1').addClass('lta-currentSet');
$j(__tableID + ' td.lta-set-1_2').addClass('lta-currentSet');
break;
}
// server
//lta-serving-1_1
//
Serving
//run through all and clear the text
$j(__tableID + ' td.lta-serving').each(function(index) {
$j(this).html('');
});
//var lta-server-num = 1;
var __currServer = $j(r).find('serv').text();
switch(__currServer){
case '1':
$j(__tableID + ' td.lta-serving-1_1').html('
Serving
');
break;
case '2':
$j(__tableID + ' td.lta-serving-2_1').html('
Serving
');
break;
case '3':
$j(__tableID + ' td.lta-serving-1_1').html('
Serving
');
break;
case '4':
$j(__tableID + ' td.lta-serving-2_1').html('
Serving
');
break;
}
}
function announceWinner(r){
// clear the server
$j(__tableID + ' td.lta-serving').each(function(index) {
$j(this).html('');
});
// show the winner
var __winner = $j(r).find('winner').text();
switch(__winner){
case '1':
$j(__tableID + ' td.lta-serving-1_1').html('
WIN
');
break;
case '2':
$j(__tableID + ' td.lta-serving-2_1').html('
WIN
');
break;
}
//stop the timer
//$j(document).stopTime();
}
function handleData(r){
}
openFeed(1);
}
function changeCase(addrline) {
var tmpStr = addrline.toLowerCase();
tmpStr = tmpStr.replace (/(\d+)([a-z]{3,})/gi, "$1 $2"); // add space after numbers when 3+ alphachars follow
tmpStr = tmpStr.replace (/\,/g, " "); // delete commas - replace by space (essential!)
tmpStr = tmpStr.replace (/(\d+)([.{2,}$])/gi, " $1$2"); // add 4 spaces before numbers not at end of string
tmpStr = tmpStr.replace (/(\S*)\"(\D+)\"(\S*)/g, '$1 "$2" $3'); // put spaces around "string" (force uppercase)
tmpStr = tmpStr.replace (/o\'/gi, "O' "); // change o' to O'+space (O' Reilly) (force uppercase)
tmpStr = tmpStr.replace (/(\s|\.)(mc)([a-z])/g, "$1mc $3"); // add space after Mc (force uppercase)
tmpStr = tmpStr.replace (/(\D)\./g, "$1. "); // add space after literal . (B. M. Smith > uppercase)
tmpStr = tmpStr.replace (/\-([a-z])/g, " - $1"); // add spaces around hyphens (force uppercase)
tmpStr = tmpStr.replace (/(^\s+)/, ""); // remove spaces at start of string
tmpStr = tmpStr.replace (/\s{4,}/g, " "); // remove excessive spaces > 4
if ((/fpo\b/.test(tmpStr)) || (/fpo\d/.test(tmpStr))) {
tmpStr = tmpStr.toUpperCase();
tmpStr = tmpStr.replace (/([A-Z])(\s{2,})/g, "$1 "); // remove spaces >1 between A-Z and A-Z/0-9 (not converse)
}
var SplitStuff = tmpStr.split(" ");
var ArrLen = SplitStuff.length;
for (var k=0; k B.M.Smith
newline = newline.replace (/Mc\s/,"Mc"); // reformat McXxxx
newline = newline.replace (" - ","-"); // reformat McXxxx
addrline = newline;
return addrline;
}
FC.LiveTicker = function() {
try {
var ticker_holder = $j(FC.vars.selectors.LIVETICKER).get(0);
var ticker_pos = ticker_holder.parentNode.offsetWidth;
var ticker_data = $j(ticker_holder).html();
$j(ticker_holder).html('');
$j(ticker_holder).hover
(
function() { $j('marquee', this).get(0).stop(); },
function() { $j('marquee', this).get(0).start(); }
);
//finds the width of each item and creates and overall width for the UL
var __li = $j(FC.vars.selectors.LIVETICKER).find("li");
var __width = 0;
for(i=0;i<__li.length;i++){
__width = __width+$j(__li[i]).width();
__width = __width+30;
}
var __ul = $j(FC.vars.selectors.LIVETICKER).find("ul");
__ul.css({"width":__width+"px"});
}
catch (o) { }
}
FC.matchTabs = function() {
var __matchContent = $j("div.lta-match-content");
var __tabs = $j(FC.vars.selectors.MATCH_TABS).find("div.lta-toggle-alt ul li");
var __containers = $j(FC.vars.selectors.MATCH_TABS).find("div.order-container");
__matchContent.hide();
for(var i = 0; i < __containers.length; i++)
$j(__containers[i]).addClass("lta-match-content-" + (i + 1));
$j(".lta-match-content-1").show();
__tabs.bind("click",function(e){
var __index =__tabs.index(this);
__tabs.find("a").removeClass("lta-selected");
$j(__tabs[__index]).find("a").addClass("lta-selected");
__index = __index+1;
__matchContent.hide();
$j(".lta-match-content-"+__index).show();
//instead of return false - click bubbles up to body element and that handles the event
$j.data(e.target, 'return', false);
});
}
FC.rowHighlight = function() {
var __$rows = $j('.ranking tr'),
__a;
if (__$rows.length == 0) {
return;
}
__$rows.bind('mouseenter', function() {
__a = $j('a', this)[0];
__a && $j(this).addClass('current');
});
__$rows.bind('mouseleave', function() {
__a = $j('a', this)[0];
__a && $j(this).removeClass('current');
});
__$rows.bind('click keypress', function() {
__a = $j('a', this)[0];
__a && window.open(__a.href, __a.target ? __a.target : '_self');
return false;
});
__$rows.find('a').bind('click keypress', function() {
window.open(this.href, this.target ? this.target : '_self');
return false;
});
}
FC.flyoutNavigation = function($els) {
$els.each(function() {
var _TIME = FC.vars.timeouts,
_$this = $j(this),
_$li = _$this.parent(),
_$a = _$this.prev(),
_$links = _$this.find('a');
_$li.addClass('has-flyout');
_$a.bind('focus', function() {
_$a.addClass('hovered');
$els.hide();
_$this.show();
});
_$a.bind('blur', function() {
_$a.removeClass('hovered');
});
_$links.bind('focus', function() {
_$a.addClass('hovered');
});
_$links.bind('blur', function() {
_$a.removeClass('hovered');
});
_$li.bind('mouseenter', function() {
_showFlyout = function() { _$this.show(); }
_$a.addClass('hovered');
_TIME.SHOW_FLYOUT_NAV = setTimeout("_showFlyout()", 400);
});
_$li.bind('mouseleave', function() {
_$a.removeClass('hovered');
clearTimeout(_TIME.SHOW_FLYOUT_NAV);
_$this.hide();
});
});
$j('.lta-anon a, .lta-member a, li.lta-nav a').bind('focus', function() {
$els.hide();
})
function Flyout(flyout) {
this.root = flyout.parentNode;
this.rootLink = $j(this.root).find('>a');
this.flyout = $j(flyout);
}
$j('.lta-navigation-flyout').each(function() {
new Flyout(this);
});
};
FC.placeholderText = function() {
function PlaceholderText(root) {
this.defaultText = root.value;
this.root = root;
this.$root = $j(root);
this.$root.addClass('contains-default-text');
var placeholderText = this;
this.root.onfocus = function() {
placeholderText.remove();
}
this.root.onblur = function() {
placeholderText.replace();
}
}
PlaceholderText.prototype.remove = function() {
if (this.root.value == this.defaultText) {
this.root.value = '';
this.$root.removeClass('contains-default-text');
}
}
PlaceholderText.prototype.replace = function() {
if (this.root.value == '') {
this.root.value = this.defaultText;
this.$root.addClass('contains-default-text');
}
}
$j(FC.vars.selectors.PLACEHOLDER_TEXT).each(function() {
new PlaceholderText(this);
});
}
FC.placeholderTitleText = function() {
var $placeholder = $j('.lta-placeholder-text');
$placeholder.each(function() {
$j(this).val($j(this).attr('title'));
});
$placeholder.focus(function() {
if ($j(this).val() == $j(this).attr('title')) {
$j(this).val('');
}
}).blur(function() {
if ($j(this).val() == "") {
$j(this).val($j(this).attr('title'));
}
});
}
//RANKING LISTING
FC.rankingListing = function(listing) {
var __listing = $j(listing);
var __groups = $j(FC.vars.selectors.RANKING_GROUP);
__groups.hide();
if (__groups.length) { __groups[0].style.display = "block"};
//Create drop down and insert before first group
if(__groups.length > 1)
{
var __switcher = "";
if (__groups.length) { $j(__groups[0]).before(__switcher); }
var __select = $j("#player-switcher");
__select.bind("change", function() {
__groups.hide();
$j("#" + $j(this).val()).show();
});
}
}
//RANKING LISTING LEGACY
FC.rankingListingLegacy = function(listing) {
var __listing = $j(listing);
var __groups = $j(FC.vars.selectors.RANKING_GROUP);
__groups.hide();
__groups[0].style.display = "block";
var __select = $j(".player-switcher");
__select.bind("change", function() {
__groups.hide();
$j("#" + $j(this).val()).show();
});
}
// 12.0 HERO, 12.1 HERO WITH PANEL
FC.heroSlideshow = function() {
var $heros = $j('.lta-hero');
function HeroSlideshow(root) {
var that = this;
this.root = root;
this.$root = $j(root);
this.heroHeight = this.$root.innerHeight();
this.items = [];
$heros.find('.lta-hero-item').each(function(index) {
var item = new HeroSlideshowItem(that, this, index)
that.items.push(item);
index > 0 && item.hide();
});
this.currentItem = this.items[0];
this.currentItem.show();
this.$corners = this.$root.find('.lta-hero-corners');
this.setMouseoverAnimation();
if (this.items.length > 1) {
this.SLIDEINTERVAL = 5000;
this.PLAY_TEXT = 'Play'
this.PAUSE_TEXT = 'Pause'
this.NEXT_TEXT = 'Next'
this.PREVIOUS_TEXT = 'Previous'
this.playing = false;
this.isGoingToPlay = false;
this.setCornersLink();
this.addCountControls();
this.play();
}
}
HeroSlideshow.prototype.addCountControls = function() {
// Add controls container
this.$countControls = $j('
');
this.$controlsList = this.$countControls.find('ul');
this.$countCurrent = this.$countControls.find('.lta-current');
this.$root.append(this.$countControls);
// Add controls
this.previousControl = new HeroSlideshowNextPreviousControl(this, 'previous');
this.playPauseControl = new HeroSlideshowPlayPauseControl(this);
this.nextControl = new HeroSlideshowNextPreviousControl(this, 'next');
this.$controlsList.append(this.previousControl.$html);
this.$controlsList.append(this.playPauseControl.$html);
this.$controlsList.append(this.nextControl.$html);
}
HeroSlideshow.prototype.setCornersLink = function() {
var $cornersLink = this.$corners.find('a');
if ($cornersLink.length == 0) {
this.$corners.append('');
var $cornersLink = this.$corners.find('a');
}
$cornersLink.attr('href', this.currentItem.url);
$cornersLink.attr('target', this.currentItem.target);
$cornersLink.text(this.currentItem.linkText);
}
HeroSlideshow.prototype.setMouseoverAnimation = function() {
for (var i in this.items) {
if (!this.items[i].$panel.length || this.items[i].$panel.length > 0) {
return;
}
}
var that = this;
this.$corners.mouseover(function() {
var item = that.currentItem;
if (item.$paragraph.text() != '') {
item.$text.animate({ 'top': item.textOpenPosition + 'px' });
}
});
this.$corners.mouseout(function() {
var item = that.currentItem;
item.$text.animate({ 'top': item.textClosedPosition + 'px' });
});
}
HeroSlideshow.prototype.next = function() {
if (this.currentItem.itemIndex == this.items.length - 1) {
this.switchTo(this.items[0]);
}
else {
this.switchTo(this.items[this.currentItem.itemIndex + 1]);
}
}
HeroSlideshow.prototype.previous = function() {
if (this.currentItem.itemIndex == 0) {
this.switchTo(this.items[this.items.length - 1]);
}
else {
this.switchTo(this.items[this.currentItem.itemIndex - 1]);
}
}
HeroSlideshow.prototype.switchTo = function(item) {
var that = this;
var item = item;
// Make the current item invisible
this.currentItem.hide();
// Update the current item
that.currentItem = item;
that.setCornersLink();
// Make the current item visible
that.currentItem.show();
// Update pagination
that.$countCurrent.text(that.currentItem.itemIndex + 1);
}
HeroSlideshow.prototype.play = function() {
var that = this;
var next = function() { that.next(); }
this.playing = window.setInterval(next, this.SLIDEINTERVAL);
}
HeroSlideshow.prototype.pause = function() {
window.clearInterval(this.playing);
this.playing = false;
}
function HeroSlideshowItem(slideshow, root, index) {
this.slideshow = slideshow;
this.$root = $j(root);
this.$text = this.$root.find('.lta-hero-item-text');
this.$paragraph = this.$root.find('.lta-hero-item-text p');
this.itemIndex = index;
this.$panel = this.$root.find('.lta-hero-item-panel');
if (this.$panel.length > 0) {
this.$button = this.$panel.find('a.lta-btn');
this.linkText = this.$button.find('span').text();
this.url = this.$button.attr('href');
this.target = this.$button.attr('target');
}
else {
this.linkText = this.$root.find('h2').text();
this.url = this.$root.find('h2 a').attr('href');
this.target = this.$root.find('h2 a').attr('target');
}
this.configureMouseoverAnimation();
}
HeroSlideshowItem.prototype.hide = function(callback) {
var that = this;
this.$root.fadeOut(function() {
that.$root.css({ 'z-index': '0' });
that.$root.find('img').css({ 'visibility': 'hidden' });
if (callback) {
callback();
}
});
}
HeroSlideshowItem.prototype.show = function() {
this.$root.css({ 'z-index': '5' });
this.$root.find('img').css({ 'visibility': 'visible' });
this.$root.fadeIn();
}
HeroSlideshowItem.prototype.configureMouseoverAnimation = function() {
// Figure out the full height of
, and subtract that from the height of the hero to get the “open�? vertical position
var heroHeight = this.slideshow.heroHeight;
var textHeight = this.$text.innerHeight();
this.textOpenPosition = heroHeight - textHeight;
// Figure out the height of the paragraph in
, subtract that from its full height, subtract the result from the height of the hero, then add 4 to get the “closed�? vertical position. (Adding 4 is a bit of an arbitrary tweak to get the paragraph to fully disappear.)
var paragraphHeight = this.$text.find('p').innerHeight();
this.textClosedPosition = heroHeight - (textHeight - paragraphHeight) + 4;
// Set the vertical position of
to the “closed�? vertical position
this.$text.css('top', this.textClosedPosition + 'px');
}
function HeroSlideshowPlayPauseControl(slideshow) {
this.slideshow = slideshow;
this.$link = $j('' + this.slideshow.PAUSE_TEXT + '');
this.$html = $j('').append(this.$link);
var that = this;
this.$link.bind('click', function(e) {
that.playPause();
//instead of return false - click bubbles up to body element and that handles the event
$j.data(e.target, 'return', false);
});
}
HeroSlideshowPlayPauseControl.prototype.playPause = function() {
if (this.$link.hasClass('pause')) {
this.slideshow.pause();
this.$link.removeClass('pause');
this.$link.addClass('play');
this.$link.attr('href', '#play');
this.$link.attr('title', 'play');
this.$link.text(this.slideshow.PLAY_TEXT);
}
else {
this.slideshow.play();
this.$link.removeClass('play');
this.$link.addClass('pause');
this.$link.attr('href', '#pause');
this.$link.attr('title', 'pause');
this.$link.text(this.slideshow.PAUSE_TEXT);
}
}
function HeroSlideshowNextPreviousControl(slideshow, nextPrevious) {
this.slideshow = slideshow;
this.nextPrevious = nextPrevious;
this.$link = $j('' + this.nextPrevious + '');
this.$html = $j('').append(this.$link);
var that = this;
this.$link.bind('click', function(e) {
var wasPlaying = false;
if (that.slideshow.playing) {
var wasPlaying = true;
that.slideshow.pause();
}
that.slideshow[that.nextPrevious]();
if (wasPlaying) {
that.slideshow.play();
}
//instead of return false - click bubbles up to body element and that handles the event
$j.data(e.target, 'return', false);
});
}
$heros.each(function() {
new HeroSlideshow(this);
// $heros.find('.lta-hero-item').fadeOut('slow');
});
}
// 18.0 SEARCH
FC.siteSearch = function() {
function SiteSearch() {
this.PLACEHOLDER_TEXTS = {
'Competition': 'Enter a Postcode',
'Player': 'Enter a Players name',
'Court': 'Enter a Postcode',
'Coach': 'Enter a Postcode',
'Website': 'What are you looking for?'
}
this.ADVANCED_SEARCH_URLS = {};
this.$html = $j(FC.vars.selectors.SITE_SEARCH);
this.$select = this.$html.find('select.lta-search-extent');
this.select = this.$select.get(0);
this.$options = this.$select.find('option');
this.$text = this.$html.find('.lta-search-text');
this.$advancedSearchLinks = this.$html.find('.lta-advanced-search-links');
this.$moreOptionsInner = this.$html.find('.lta-more-options-inner');
this.$moreOptionsLink = null;
this.replaceSelect();
this.setAdvancedSearchUrls();
this.updatePlaceholderText();
var that = this;
$j('body').bind('click', function(e) {
var __isReturn = $j.data(e.target, 'return'),
__ul = that.$searchUL[0],
rOpen = /\blta-open\b/;
__ul.className = __ul.className.replace(rOpen, "")
that.$selectedSearchText.css('display', 'inline');
if (__isReturn === false) {
return false;
}
})
}
SiteSearch.prototype.replaceSelect = function() {
that = this;
this.$select.after('
');
this.$searchUL = this.$html.find('ul.lta-search-extent');
this.$searchUL.before('' + this.$options.get(0).text + ' click this to change the search context');
that.$selectedSearch = this.$html.find('a.lta-selected-search span.lta-selected-search-span');
that.$selectedSearchText = this.$html.find('a.lta-selected-search span.lta-selected-search-span span');
that.$selectedSearchHeight = that.$selectedSearch.height();
var onClickHandler = function(e) {
var __ul = that.$searchUL[0],
rOpen = /\blta-open\b/;
if (!rOpen.test(__ul.className)) __ul.className += " lta-open";
else __ul.className = __ul.className.replace(rOpen, "");
//that.$selectedSearch.text('');
that.$selectedSearchText.css('display', 'none');
that.$selectedSearch.height(that.$selectedSearchHeight);
return false;
};
that.$selectedSearch.parent().bind('click', onClickHandler);
for (i = 0, j = this.$options.length, arr = []; i < j; i++) {
arr[i] = '
';
}
this.$searchUL.append(arr.join(""));
//set the width of the selected search item to the width of the UL minus 20px (the UL has 20px padding);
that.$selectedSearch.width(this.$searchUL.width())
$allA = this.$searchUL.find('a');
$allA.bind('click', function(e) {
var __ul = that.$searchUL[0],
rOpen = /\blta-open\b/;
that.$select[0].selectedIndex = $allA.index(this);
that.$selectedSearchText[0].innerHTML = $j(this).text();
that.$selectedSearchText.css('display', 'inline');
__ul.className = __ul.className.replace(rOpen, "")
that.updatePlaceholderText();
//instead of return false - click bubbles up to body element and that handles the event
$j.data(e.target, 'return', false);
});
}
SiteSearch.prototype.setAdvancedSearchUrls = function() {
var that = this;
this.$advancedSearchLinks.find('a').each(function(i) {
var optionText = that.$options.eq(i).text();
that.ADVANCED_SEARCH_URLS[optionText] = this.href;
});
}
SiteSearch.prototype.updatePlaceholderText = function() {
this.$text.attr({ 'value': this.PLACEHOLDER_TEXTS[$j(this.select.options[this.select.selectedIndex]).text()] });
FC.placeholderText();
}
new SiteSearch();
}
FC.mapToggle = function(__par){
var __onClickKeypressHandler = function(e){
var $$this = $j(this);
switch (e.keyCode) {
case 13: // enter key
case 32: // space bar
case undefined: //mouse click
case 0: //mouse click in IE
if ($$this.hasClass('lta-showhide-hide')) {
$j('a', $$this).html('Show map');
this.className = this.className.replace(/lta-showhide-hide/g, "lta-showhide-show");
__par.slideUp();
} else {
$j('a', $$this).html('Hide map');
this.className = this.className.replace(/lta-showhide-show/g, "lta-showhide-hide");
__par.slideDown();
}
//instead of return false - click bubbles up to body element and that handles the event
$j.data(e.target, 'return', false);
default:
return;
}
}
if($j(__par).hasClass("lta-pre")){
$j(__par).prev().append('
');
} //this if should be removed once we decide if the controls go before or after the map
$j('.lta-showhide-button').bind('click keydown', __onClickKeypressHandler);
}
FC.boxHover = function(__el){
__$el = $j(__el);
__$el.bind('mouseover', function() {
$j(this).removeClass('lta-box35').addClass('lta-box36');
});
__$el.bind('mouseout', function() {
$j(this).removeClass('lta-box36').addClass('lta-box35');
});
}
FC.boxLink = function() {
$j('.lta-create-goal li').each(function() {
var $href = $j('a', this).attr('href');
$j(this).click(function() {
window.location = $href;
});
});
}
FC.goalExpander = function(__el){
// This is a modification of the lta-expander component
// This version looks for an anchor with class "lta-btn-add" and binds a click event to it.
__$buttons= $j(__el);
__$buttons.bind('click', function(e) {
var __$this= $j(this);
var __$buttonContent= __$this.find('span');
var __$expandContent= $j(this).parent().next(), __$existingGoalIntro = __$expandContent.next('div.lta-goal-intro');
__$expandContent.toggleClass('lta-expander-open');
if(__$expandContent.hasClass('lta-expander-open')) {
__$existingGoalIntro.css('position', 'static');
__$expandContent.slideDown('fast', function() {
__$existingGoalIntro.css('position', 'relative');
});
if(!FC.hasIE) {
__$this.animate({'opacity': 0}, 'fast', function() {
__$this.addClass('lta-btn-hide');
__$buttonContent.text('Hide goals');
__$this.animate({'opacity': 1}, 'fast');
});
}
else {
__$this.hide();
__$this.addClass('lta-btn-hide');
__$buttonContent.text('Hide goals');
__$this.show();
}
}
else {
__$existingGoalIntro.css('position', 'static');
__$expandContent.slideUp('fast', function() {
__$existingGoalIntro.css('position', 'relative');
});
if(!FC.hasIE) {
__$this.fadeOut('fast', function() {
__$this.removeClass('lta-btn-hide');
__$buttonContent.text('Add new goal');
__$this.fadeIn('slow');
});
}
else {
__$this.hide();
__$this.removeClass('lta-btn-hide');
__$buttonContent.text('Add new goal');
__$this.show();
}
}
//instead of return false - click bubbles up to body element and that handles the event
$j.data(e.target, 'return', false);
//return false;
});
};
FC.expander = function($expander){
//each expander item is made up of 2 elements
// -the lta-expander-header which is clicked to expand/contract content
// -the lta-expander-content
$headings= $expander.find('div.lta-expander-header h3');
$headings.wrapInner('');
$headings.find('a').bind('click', function() {
var $header= $j(this).parents('div.lta-expander-header');
$header.toggleClass('lta-expander-open');
if($header.hasClass('lta-expander-open')) {
$header.next('.lta-expander-content').slideDown('fast');
}
else {
$header.next('.lta-expander-content').slideUp('fast');
}
return false;
});
};
FC.vertNavScroll = function(){
var __SEL = FC.vars.selectors;
var __axis = {axis:'x'};
$j(__SEL.VERTICAL_NAV_SCROLL).each(function(){
var __$this = $j(this);
var __scrollAmount=1, __$contentBoxes = $j(".lta-nav-item", __$this);
var __$container = $j("div.lta-nav-container", __$this);
//add controls
__$container.before('
';
$tipInner.empty().append(content);
},
complete: function() {
displayTip()
}
});
lastID = userID;
}
if (!inProgress) {
if (lastID != userID) {
// Delay tooltip to prevent sticking when user drags mouse quickly
timeout = setTimeout(getProfileInfo, 250);
} else {
displayTip();
}
}
type = "profile";
break;
default:
}
})
// Mouseout handler for hiding and clearing the tooltip
.bind("mouseout mouseleave blur", function(e) {
$tooltip.css("display", "none");
$tipArrow.css("width", "0");
if (FC.hasIE) {
$tipTopRight.css("width", "0");
}
if (type == "image" || type == "inline") $tipInner.html("");
clearTimeout(timeout);
inProgress = false;
});
}
// jQuery Colorbox plugin - used for inline content displays
FC.overlay = function(el) {
var $el = $j(el),
SEL = FC.vars.selectors,
tag = el.tagName,
$overlay = $j("#lta-overlay-content"),
$link = $overlay.find(".lta-btn"),
closeStr = "Close ";
$el.bind("click", function(e) {
e.preventDefault();
// If the element is a label, we're removing a profile photo
if (e.target.tagName == "LABEL") {
$link.unbind().bind("click", function(e) {
// Trigger photo removal script & close colorbox
FC.removeProfilePhoto(SEL.REMOVE_PHOTO, true);
$j.colorbox.close();
});
}
// otherwise it's a link so we grab the href
else {
$link.attr("href", e.target.href);
}
$j.colorbox({
inline: true,
href: "#lta-overlay-content",
opacity: .55,
close: closeStr
});
});
}
// 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-jwcontrols a').focus(function() {
$j(this).parent().removeClass('lta-reader');
}).blur(function() {
$j(this).parent().addClass('lta-reader');
});
}
// Toggle function for player ability level
FC.levelTabs = function(el) {
var STR = FC.vars.strings,
$el = $j(el),
$radio = $el.parent().find('input[type=radio]'),
$content = $j(".lta-level-content").find("div");
function showAbility(e) {
var $this = $j(this),
$par = $this.parent(),
i = $par.index(),
$active;
if (!$par.is(STR.SELECTED)) {
$par.find('input[type=radio]').attr('checked', 'checked');
$par.addClass(STR.SELECTED).siblings().removeClass(STR.SELECTED);
$active = $content.not(".lta-reader");
$active.addClass(STR.READER);
$content.eq(i).removeClass(STR.READER);
}
}
$radio = $radio.filter(":checked");
$radio.parents("li").addClass(STR.SELECTED);
cIndex = $radio.parent().index();
$content.filter(":not(:eq(" + cIndex + "))").addClass(STR.READER);
$el.bind("click", showAbility);
}
// START OF HIGH VISIBILITY CSS
FC.highVisCss = function(elem) {
if (window.location.href.indexOf('/Tennis-Foundation/') >= 1) {
$j('.lta-alt-stylesheet').show();
}
var $highVisFunctions = function() {
// show or hide advanced searches
$j('.lta-advanced-search-links h3').toggle(function() {
$j('.lta-advanced-search-links ul').show();
}, function() {
$j('.lta-advanced-search-links ul').hide();
});
$j('.lta-hero-slideshow-count-controls li a.pause').trigger('click'); //Pause hero slideshow
$j('p').filter(function() {
return $j.trim($j(this).text()) == ''
}).remove();
var $btnToMove = $j('.lta-already-a-coach .lta-btn');
}
if ($j(elem).is(':visible')) { $highVisFunctions(); }
$j('.lta-alt-stylesheet').click(function() { $highVisFunctions() });
}
var c = readCookie('style');
if (c) switchStylestyle(c);
function switchStylestyle(styleName) {
$j('link[rel*=style][title]').each(function(i) {
this.disabled = true;
if (this.getAttribute('title') == styleName) this.disabled = false;
});
createCookie('style', styleName, 365);
}
function createCookie(name, value, days) {
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
var expires = "; expires=" + date.toGMTString();
}
else var expires = "";
document.cookie = name + "=" + value + expires + "; path=/";
}
function readCookie(name) {
if (window.location.href.indexOf('/Tennis-Foundation/') >= 1) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return null;
}
}
function eraseCookie(name) {
createCookie(name, "", -1);
}
// END OF VISIBILITY CSS
FC.majorEvents = function() {
$j('body').addClass('lta-major-event');
$j('body').addClass('hide-header');
$j('.lta-box3, .lta-box6, .lta-box9, .lta-box18, .lta-box7').addClass('lta-box1');
$j('.lta-event-box').removeClass('lta-box1');
$j('.lta-box1').each(function() {
var $boxHeader = $j('.lta-header, h2', this);
if ($boxHeader.html() != "") {
$j('.lta-box-top-right', this).append('
' + $boxHeader.html() + '
');
$boxHeader.remove();
}
});
// Remove "null" headers
$j('.lta-header').each(function() {
if ($j(this).text() == "null")
$j(this).text('');
});
$j('.lta-box1').each(function() {
var $thisBoxWidth = $j('.lta-box-middle', this).width();
if ($thisBoxWidth > 340) {
$j('.lta-box-middle', this).addClass('shadow-wide');
}
$thisBoxWidth = 0;
});
setTimeout(function() {
var $objectShadow = $j('.lta-media-promo object').addClass('object-shadow');
$j('.lta-google-map').prepend('');
}, 200);
$j('.lta-page-nav ul li a').text('');
$j('.lta-box .lta-stay-informed li').hover(function() { $j('a span', this).addClass('major-event-box'); });
$j('.lta-box-champs .lta-stay-informed li').hover(function() { $j('a span', this).addClass('champs-box'); });
$j('').insertAfter('.lta-more-photos ul li a img,.lta-more-videos ul li a img, .lta-news-item img, .lta-latest-news ul li a img, .latest-gallery ul li a img, .lta-photogallery ul li a img');
$j('').insertAfter('.lta-photogallery div > a img');
/*var $subnav = $j('.lta-subnav').html(),
$navWidth = 0;
$j('.lta-subnav').remove();
$j('