﻿
$(document).ready(function() {


    LoadRecentEvents();

});


$(function() {
    var galleries = $('.ad-gallery').adGallery({

        loader_image: '/includes/js/loader.gif',
        thumb_opacity: 1.0,
        animation_speed: 700,
        slideshow: {
            enable: true,
            autostart: true,
            speed: 3500,
            start_label: "<img alt='play images' src='/images/play.gif' /> play",
            stop_label: " <img alt='stop images' src='/images/pause.gif' /> stop",
            stop_on_scroll: true, // Should the slideshow stop if the user scrolls the thumb list?
            countdown_prefix: '(', // Wrap around the countdown
            countdown_sufix: ')',
            onStart: function() {
                // Do something wild when the slideshow starts
            },
            onStop: function() {
                // Do something wild when the slideshow stops
            }
        },
        callbacks: {
            init: false,
            afterImageVisible: function() {
                // For example, preload the next image
                $(".ad-slideshow-countdown").css("display", "none");
                $(".ad-prev-image").css("display", "block");
                $(".ad-prev-image").css("opacity", "0.4");
                $(".ad-next-image").css("display", "block");
                $(".ad-next-image").css("opacity", "0.4");
            }
        }




    });

});
$(document).ready(function() {
    $(".ad-prev").hover(
            function() {
                $(".ad-prev-image").css("display", "block");
                $(".ad-prev-image").css("opacity", "1.0");

            },
            function() {
                $(".ad-prev-image").css("display", "block");
                $(".ad-prev-image").css("opacity", "0.4");

            }
        );
    $(".ad-next").hover(
            function() {

                $(".ad-next-image").css("display", "block");
                $(".ad-next-image").css("opacity", "1.0");
            },
            function() {

                $(".ad-next-image").css("display", "block");
                $(".ad-next-image").css("opacity", "0.4");
            }
        );



        });



        function LoadRecentEvents() {


            $.ajax({
                type: "POST",
                url: "/webservices/Trails.asmx/LoadRecentEvents",
                data: "{'NumberItems':'3'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function(msg) {
                    $(".homeList").html("");
                    var data = (typeof msg.d) == 'string' ? eval('(' + msg.d + ')') : msg.d;


                    for (var i = 0; i < data.length; i++) {
                        var event = data[i];

                        if (event.Summary == "") {
                            $(".homeList").html($(".homeList").html() + "<h3><a href='" + event.FullPath + "' >" + event.Name + "</a></h3>");
                        }
                        else {
                            $(".homeList").html($(".homeList").html() + "<h3><a target='_blank' href='" + event.Summary + "' >" + event.Name + "</a></h3>");
                        }
                    }


                },
                error: function(msg) {
                    // alert(msg);
                }
            });
        };
