﻿/** Andreas Js
*/
$(function () {

    $('.showMultiVoteboximg').live('click', function () {
        $('.votetextbox').show();
    });

    $('.first-and-second-carousel').jcarousel({
        wrap: 'last',
        vertical: true,
        initCallback: mycarousel_initCallback
    });


    function mycarousel_initCallback(carousel) {
        // Disable autoscrolling if the user clicks the prev or next button.
        carousel.buttonNext.bind('click', function () {
            carousel.startAuto(0);
        });

        carousel.buttonPrev.bind('click', function () {
            carousel.startAuto(0);
        });

        // Pause autoscrolling if the user moves with the cursor over the clip.
        carousel.clip.hover(function () {
            carousel.stopAuto();
        }, function () {
            carousel.startAuto();
        });
    };

    var bookid = $('.hiddenBookid').text();
    var userid = $('.hiddenUserId').text();

    $('.UpdMybooks').live('click', function () {
        sendval(bookid, userid);

    });

    function sendval(bookid, userid) {

        $.ajax({
            type: "GET",
            url: "/desktopmodules/ajbarnbokskatalog/controls/updatemybook.aspx",
            data: ({ devkey: 'alf', id: userid, bid: bookid }),
            async: false,   
            success: function (data) {
                //alert("inne XML= " + data);
                if (data > 0) {
                    $('.UpdMybooks').checked == true;

                } else {
                    $('.UpdMybooks').checked == false;

                };

                // alert("inne" + refinedlist[0] + " 1:" + refinedlist[1]);
                flag = true;
            },
            error: function (xhr, ajaxOptions, thrownError) {
                alert("inne i getuserDatafromWeb Error " + xhr + ajaxOptions + thrownError);
            }
        });
    };


   
});
