function formatText(index, panel) {
    return index + "";
}

$(function() {

    $('.anythingSlider').anythingSlider({
        easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
        autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
        delay: 12000,                   // How long between slide transitions in AutoPlay mode
        startStopped: false,            // If autoPlay is on, this can force it to start stopped
        animationTime: 900,             // How long the slide transition takes
        hashTags: true,                 // Should links change the hashtag in the URL?
        buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
        pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
        startText: "Go",                // Start text
        stopText: "X"                // Stop text
    });

}); 

$(document).ready(function() {
    // Replace Text Header
    $(".image-replace").each(function() {
        string = $(this).text();
        filename = string.toLowerCase().replace(/ /g, '-').replace(/([^0-9a-z-])/g, '');
        filelocation = ""
        $(this).html('<img src="' + filelocation + 'graphics/' + filename + '.gif" alt="' + string + '" title="' + string + '" />');
    });    
    
    // Entire Block Clickable
    $(".article-summary").click(function() {
        window.location = $(this).find("a").attr("href"); return false;
    });
    $(".promo-product-list").click(function() {
        window.location = $(this).find("a").attr("href"); return false;

    });

    // Slide labels into inputs
    $('.slider-label label').each(function() {
        var labelColor = '#999';
        var restingPosition = '5px';

        // style the label with JS for progressive enhancement
        $(this).css({
            'color': labelColor,
            'position': 'absolute',
            'top': '6px',
            'left': restingPosition,
            'display': 'inline',
            'z-index': '99'
        });

        var inputval = $(this).next().val();

        // grab the label height, then add 5 pixels to it
        var labelheight = $(this).height();
        var labelmove = labelheight + 5 + 'px';

        // onload, check if a field is filled out, if so, move the label out of the way
        if (inputval !== '') {
            $(this).stop().animate({ 'top': '-' + labelmove }, 1);
        }

        // if the input is empty on focus move the label to the left
        // if it's empty on blur, move it back
        $('input, textarea').focus(function() {
            var label = $(this).prev('label');
            var height = $(label).height();
            var adjust = height + 5 + 'px';
            var value = $(this).val();

            if (value == '') {
                label.stop().animate({ 'top': '-' + adjust }, 'fast');
                label.css({ 'color': '#000' });
            } else {
                label.css({ 'top': '-' + adjust });
                label.css({ 'color': '#000' });
            }
        }).blur(function() {
            var label = $(this).prev('label');
            var value = $(this).val();

            if (value == '') {
                label.stop().animate({ 'top': restingPosition }, 'fast');
                label.css({ 'color': labelColor });
            }

        });
    }); // End "each" statement

    // Top Navigation Drop Down
    
    //Remove Links and use drop down instead

    $("a.no-link").attr("href", "#");

    $(".panel-login").click(function() {
        $("#panel-login").toggle();
        $(".panel-login").toggleClass("menu-open");
    });

    $(".panel-currency-chooser").click(function() {
        $("#panel-currency-chooser").toggle();
        $(".panel-currency-chooser").toggleClass("menu-open");
    });

    $("#panel-login").mouseup(function() {
        return false
    });
    $("#panel-currency-chooser").mouseup(function() {
        return false
    });
    $(document).mouseup(function(e) {
        if ($(e.target).parent("a.panel-login").length == 0) {
            $(".panel-login").removeClass("menu-open");
            $("#panel-login").hide();
        }
    });
    $(document).mouseup(function(e) {
        if ($(e.target).parent("a.panel-currency-chooser").length == 0) {
            $(".panel-currency-chooser").removeClass("menu-open");
            $("#panel-currency-chooser").hide();
        }
    });


});   // End loaded jQuery

