$(function () {

    $('.nav a').each(function () {
        var index = $('.nav a').index($(this));
        var p = -index * 102;
        $(this).css({ 'background-position': p + 'px 0px' });
    });

    //Box javascript
    $('.box').each(function () { $(this).prepend('<h1><span>' + $(this).attr('title') + '</span></h1>'); });
    $('.box h1 span').each(function () {
        var index = $('.box h1 span').index($(this)) * 20;        
        $(this).css({ 'background-position': '195px -' + index + 'px' });
    });
    if($(".txtField").size()>0){
        $(".txtField").labelify({ labelledClass: 'txtLabel' });
        $(".searchField").labelify({ labelledClass: 'googleSearch' });
        }
    $('.quickLinks li:last a').css({ 'border-bottom': 'none' });

    //Any thing slider javascript
    if($('.slider').size()>0){
    $('.slider').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: 6000,                    // How long between slide transitions in AutoPlay mode
        startStopped: false,            // If autoPlay is on, this can force it to start stopped
        animationTime: 800,             // 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: "Stop",               // Stop text
        navigationFormatter: formatText // Details at the top of the file on this use (advanced use)
    });
    }
    if (($.browser.msie && $.browser.version.substr(0, 1) >= 7) || !$.browser.msie)
        animateBG();
    function animateBG() {
        /*$('body').animate({
            backgroundPosition: "-1000000px 0px"
        }, 70000000, 'linear');*/
    }
});

function formatText(index, panel) {
    return index + "";
};
