$(document).ready(function() {
    // scroll to top
    $('a.topOfPage').click(function() {
        $.scrollTo(0, 1000);
        return false;
    });

    $('a.bottom').click(function() {
        $('.showbands').click();
        $.scrollTo({ top: '2000px' }, 1000);
        return false;
    });

    $(".read-more").click(function () {

        var hiddentext = $('.hidden');
        hiddentext.css('width', '690px');

        hiddentext.animate(
        {
            height: 'toggle'
        }, 500, function() { });

        $(this).text($(this).text() == 'Show less' ? 'Find out more' : 'Show less');

    });
});

$(document).ready(function() {
    $(".menuoverstate").each(function(i) {

        preload_image = new Image();
        preload_image.src = this.src.replace(".jpg", "_o.jpg");

        $(this).hover(
            function() {
                if (this.src.indexOf("_s.jpg") == -1) 
                {
                    if (this.src.indexOf("_o.jpg") == -1) {
                    this.src = this.src.replace(".jpg", "_o.jpg");
                    }
                }
            },

            function() {
                this.src = this.src.replace("_o.jpg", ".jpg");

            });

    }
        );
});

$(document).ready(function() {
    $(".menuoverstategif").each(function(i) {

        preload_image = new Image();
        preload_image.src = this.src.replace(".gif", "_o.gif");

        $(this).hover(
            function() {
        if (this.src.indexOf("_s.gif") == -1) {
            if (this.src.indexOf("_o.gif") == -1) {
                this.src = this.src.replace(".gif", "_o.gif");
                    }
                }
            },

            function() {
            this.src = this.src.replace("_o.gif", ".gif");

            });

    }
        );
});





colourtabs = new Array();
colourtext = new Array();

$(document).ready(function() {
    //$(".band-colour-wrapper").tabs("div.bands-text", { event: 'mouseover' });
    $(".bands-text").each(function(i) {
        $(this).hide();
        colourtext[i] = this;
    });

    $(".band-colour").each(function(i) {
        colourtabs[i] = this;
        $(this).hover(function() {
            $(".bands-text").fadeOut(0);
            $(colourtext[i]).fadeIn(0);
        },
                function() {
                    $(".bands-text").fadeOut(0);
                }

                );

    });
        });



        testtab = new Array();
        testtext = new Array();

        $(document).ready(function () {
            //$(".band-colour-wrapper").tabs("div.bands-text", { event: 'mouseover' });
            $(".bands-colours").each(function (i) {
                $(this).hide();
                testtext[i] = this;
               
            });

            $(".big-band").each(function (i) {
                testtab[i] = this;
                $(this).click(function () {
                    $(".bands-colours").fadeOut(0);

                    $(testtext[i]).fadeIn(0);
                },
                function () {
                    $(".bands-colours").fadeOut(0);
                }

                );

            });
        });



// panel changes for bands and descriptions //

$(function() {
    $(".big-band img").click(function() {

        $(".big-band img").each(function() {
            this.src = this.src.replace("_o.jpg", ".jpg");
        });

        if (this.src.indexOf("_o.jpg") == -1) {
            this.src = this.src.replace(".jpg", "_o.jpg");
        }

    });
});

$(function() {
    jQuery(".bands-wrapper").tabs("div.bands-colours", { event: 'mousedown' });
});

// EF additional JQuery //

$(function() {
jQuery("#mainnav").tabs("div.home-tabs", { event: 'mousedown' });
});


$(function() {
$("img.adviceimg").click(function() {

        if (this.src.indexOf("_s.jpg") > 0) {
            this.src = this.src.replace("_s.jpg", ".jpg");
        }
    /*
        if (this.src.indexOf("_s.jpg") == -1) {
            this.src = this.src.replace("_o.jpg", "_s.jpg");
        }
      */  
    });

});

$(document).ready(function() {

    $(".totoggle").hide();

    $("div.toggletrigger").toggle(function() {
        $(this).addClass("active");
    }, function() {
        $(this).removeClass("active");
    });

    $("div.toggletrigger").click(function() {
        $(this).next(".totoggle").slideToggle("700");
        
    });

});

$(document).ready(function() {



    $("div.totoggleFAQ").each(function() {
        $(this).css("height", $(this).height() + "px");
        $(this).hide();
    });

    $(".totoggleFAQ").hide();

    $("div.toggletriggerFAQ").toggle(function() {
        $(this).addClass("active");
    }, function() {
        $(this).removeClass("active");
    });

    $("div.toggletriggerFAQ").click(function() {
        $(".totoggleFAQ").slideUp(700);
        $(this).next(".totoggleFAQ").slideToggle("700");

    });

});


$(function() {
    $(".home-menu img").click(function() {

        $(".home-menu img").each(function() {
            this.src = this.src.replace("_s.jpg", ".jpg");
        });

        if (this.src.indexOf("_s.jpg") == -1) {
            this.src = this.src.replace("_o.jpg", "_s.jpg");
        }
    });

});
