﻿$(function () {
    // Check if there's a print version of the current page.
    if ($("#pdflink").length == 0) {
        $("#addtopersonalreport").hide();
    }

    // Set FancyBox to show the personal report.
    // $("#fb-pr").fancybox({ width: 500 });
    // $("#fb-pr").prettyPhoto();

    // Initialise the DropDownMenu
    $("#mega-menu").dcMegaMenu({ rowItems: 3, speed: 'fast', effect: 'none' });

    // Hover a row in <tbody> 
    $(".report tbody tr").hover(
        function () {
            // This gets executed on mouse-over 
            $(this).addClass('hover');
        },
        function () {
            // This is the callback, so it gets executed on mouse-out 
            $(this).removeClass('hover');
        }
    );
});

// Add the current page to the personal report.
function addToPersonalReport() {

    var documentId;

    // var documentId = jQuery("#pdflink").val();
    if ($("#hdnDocumentIdNl").val().length > 0) {
        documentId = $("#hdnDocumentIdNl").val();
    }
    else {
        documentId = $("#hdnDocumentIdEn").val();
    }

    $.ajax({
        type: "POST",
        url: "/Services/PersonalReportService.asmx/AddToPersonalReport",
        data: "{ 'documentId':'" + documentId + "'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (msg) {
            $.fn.jQueryMsg({ msg: msg.d, msgClass: 'alert', fx: 'fade', speed: 1000 });
        }
    });
}

// Setup the carousel 
//if ($("#mygallery").length == 0) {
//    stepcarousel.setup({
//        galleryid: 'mygallery', //id of carousel DIV
//        beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
//        panelclass: 'panel', //class of panel DIVs each holding content
//        autostep: { enable: false, moveby: 1, pause: 3000 },
//        panelbehavior: { speed: 500, wraparound: false, wrapbehavior: 'slide', persist: true },
//        defaultbuttons: { enable: true, moveby: 2, leftnav: ['images/btn-carousel-left.png', -8, 60], rightnav: ['images/btn-carousel-right.png', -0, 60] },
//        statusvars: ['statusA', 'statusB', 'statusC'], //register 3 variables that contain current panel (start), current panel (last), and total panels
//        contenttype: ['inline'] //content setting ['inline'] or ['ajax', 'path_to_external_file']
//    })
//}
