﻿function setEvents() {


    $('#_propertyImage').attr({ 'src': $(".PropertyThumbsDivClass").children().eq(0).attr("descriptionurl") });

    $("#_forwardSlide").click(function() {
        var currentIndex = $('#currentImage').val();
        if (currentIndex * 1 + 1 < $(".PropertyThumbsDivClass").children().length) {
            currentIndex = currentIndex * 1 + 1;
        }
        else {
            currentIndex = 0;
        }

        if ($(".PropertyThumbsDivClass").children().length > 0) {
            $('#currentImage').val(currentIndex);

            //Set the medium image to the current Index
            $('#_propertyImage').attr({ 'src': $(".PropertyThumbsDivClass").children().eq(currentIndex).attr("descriptionurl") });
        }
    });

    $(".DetailsThumbnail").click(function() {

        $('#_propertyImage').attr({ 'src': $(this).attr("descriptionurl") });
        $('#currentImage').val($(this).attr("id"));
    });


}
