﻿
$(document).ready(function () {
    $('.member-login').animate({ backgroundColor: '#FF6600' }, 1000).animate({ backgroundColor: '#FFF6D7' }, 1000);

    $('.edmonds-map-link').click(function () {
        relocate(this.className);
    });

    $('.marysville-map-link').click(function () {
        relocate(this.className);
    });

    $('.snohomish-map-link').click(function () {
        relocate(this.className);
    });

    $('.woodinville-map-link').click(function () {
        relocate(this.className);
    });

    function relocate(link) {
        var url = window.location.toString();

        if (url.indexOf("/Map.aspx") < 0) {
            window.location = "/Map.aspx#" + link;
            return true;
        }
        return false;
    }

});

function slideSwitch() {
    var $active = $('.header-left IMG.active');

    if ($active.length == 0) $active = $('.header-left IMG:last');

    // If we want them to appear in the markup order
    //var $next = $active.next().length ? $active.next() : $('.header-left IMG:first');

    // If we want them to appear in random order
    var $sibs = $active.siblings();
    var rndNum = Math.floor(Math.random() * $sibs.length);
    var $next = $($sibs[rndNum]);

    $active.addClass('last-active');

    $next.css({ opacity: 0.0 })
        .addClass('active')
        .animate({ opacity: 1.0 }, 1000, function () {
            $active.removeClass('active last-active');
        });
}

$(function () {
    setInterval("slideSwitch()", 10000);
});

