$(document).ready(function(){

    /*This function is created for the calendar mouseover for juice channels*/
    $('#revamp-calendar-dates a').mouseover(function() {
        $("#revamp-calendar-details span").fadeOut("slow");
        var content_show = $(this).attr("class");
        $("#revamp-calendar-details span").fadeIn(400).html(content_show);
    });

    /*This function is created for the print options*/
    jQuery('#link-print').click(function(){
        jQuery.jPrintArea('.content')
    });

    /*This function is created for the next navigation*/
    $('#revamp-calendar-right a').click(function() { //start function when any link is clicked
        var last_day = $("#last_day").val();
        $.ajax({
            method: "POST",
            url: "/calendar_list/"+last_day+"/next/"+channel,
            beforeSend: function(){
                $("#revamp-calendar-dates ul").fadeOut("slow");
                $("#revamp-calendar-details span").fadeOut("slow");
                $("#calendar-loading").fadeIn(400);
            },
            complete: function(){
                $("#calendar-loading").hide();
            },
            success: function(html){
                $("#revamp-calendar-dates ul").fadeIn("slow");
                $("#revamp-calendar-dates ul").html(html);
                var content_show = $('#focus_day').attr("class");
                $("#revamp-calendar-details span").fadeIn(400).html(content_show);
            }
        });
    });

    /*This function is created for the previews navigation*/
    $('#revamp-calendar-left a').click(function() {
        var first_day = $("#first_day").val();
        $.ajax({
            method: "POST",
            url: "/calendar_list/"+first_day+"/prev/"+channel,
            beforeSend: function(){
                $("#revamp-calendar-dates ul").fadeOut("slow");
                $("#revamp-calendar-details span").fadeOut("slow");
                $("#calendar-loading").fadeIn(400);
            },
            complete: function(){
                $("#calendar-loading").hide();
            },
            success: function(html){
                $("#revamp-calendar-dates ul").fadeIn("slow");
                $("#revamp-calendar-dates ul").html(html);
                var content_show = $('#focus_day').attr("class");
                $("#revamp-calendar-details span").fadeIn(400).html(content_show);
            }
        });
    });

});