﻿$(document).ready(function () {

    if ($("#SubmitAQuestionEmailSubject").length > 0) {
        //fetch email group (subject) options
        $.get("/Main/Home/AskQuestionConfig", function (config) {

            $.each(config.Groups, function (index, value) {
                $('#SubmitAQuestionEmailSubject').append('<option value="' + index + '" >' + value + '</option>');
            });
            $("#SubmitAQuestionEmailSubject").removeAttr("disabled");
        });
    }

    //validation for ask question page
    $("form#question").validate();

});

function initializeHomeSlideshow() {

    //initialize the "home" page image rotator
    $('div.scrollable div#items1').each(function (i) {
        $(this).cycle({
            timeout: 9000,
            pause: 1,
            speedIn: 3000,
            speedOut: 3000,
            after: function () { setTimeout(function () { return; }, 3000); }
        });
    });
    setTimeout(function () {
        $('div.scrollable div#items2').each(function (i) {
            $(this).cycle({
                timeout: 9000,
                pause: 1,
                speedIn: 3000,
                speedOut: 3000,
                after: function () { setTimeout(function () { return; }, 3000); }
            });
        });
        return;
    }, 3000);
    setTimeout(function () {
        $('div.scrollable div#items3').each(function (i) {
            $(this).cycle({
                timeout: 9000,
                pause: 1,
                speedIn: 3000,
                speedOut: 3000,
                after: function () { setTimeout(function () { return; }, 3000); }
            });
        }); return;
    }, 6000);
}
