﻿/// <reference path="jquery-vsdoc.js" />
//*************************************************************************************
// File     : foxb-functions.js
// Requires : jquery.js (version 1.4.4+) 
// Author   : Janae Wiedmaier (jlw)
// Origin   : mindfly.com
// Created  : Nov 24, 2010
// Modified : Nov 24, 2010
//*************************************************************************************
var bannerTimer = null;

$(document).ready(function() {
    bannerRotator();
});

function bannerRotator() {
    if ($('#feature').length > 0) {
        $('#feature').after('<ul class="buttons"></ul>');
        for (i = 0; i < $('#feature li').length; i++) {
            $('.buttons').append('<li>&nbsp;</li>');
        }
        $('#feature li:last-child, .buttons li:first-child').addClass('current');
        bannerTimer = setTimeout('bannerFade();', 3000);
    }
}

function bannerFade() {
    var i = $('#feature li').index($('#feature .current'));
    if (i == 0) {
        $('#feature li:last-child').css({ display: 'block' });
        $('#feature li:last-child').animate({ opacity: 1 }, 1000, function() {
            $('#feature li').attr('style', '');
            $('#feature .current, .buttons .current').removeClass('current');
            $('#feature li:last-child, .buttons li:first-child').addClass('current');
            bannerTimer = setTimeout('bannerFade();', 3000);
        });
    } else {
        $('#feature .current').animate({ opacity: 0 }, 1000, function() {
            $('#feature .current').css({ display: 'none' });
            var i = $('#feature li').index($('#feature .current'));
            var c = i - 1;
            var b = $('#feature li').length - i;
            $('#feature .current, .buttons .current').removeClass('current');
            $('#feature li:eq(' + c + '), .buttons li:eq(' + b + ')').addClass('current');
            bannerTimer = setTimeout('bannerFade();', 3000);
        });
    }
}

$(document).ready(function() {
    bg.Flickr.getPhotos(".flickr", "57424396@N04", 1, true);
});
