$(document).ready(function () {
    //for each anchor tag in panel class in carousel
    $(".panel a").each(function () {
        //execute colorbox function, passing attribute rel as param
        colorboxSetup($(this).attr("rel"));
    });

    //colorbox function
    function colorboxSetup(colorRel) {
        //create and instantiate variable for class
        var infoBox = "." + colorRel + "Info";
        //initiate colorbox functionality
        $(".belt .panel a[rel=" + colorRel + "]").colorbox({
            transition: "fade",
            speed: 750,
            previous: "",
            next: "",
            close: "",
            //append created class to part of colorbox when colorbox initiated
            onLoad: function () {
                $("#cboxOverlay").append($(infoBox));
            },
            //when completed, class becomes visible to user
            onComplete: function () {
                $(infoBox).css("visibility", "visible");
            },
            //when colorbox close, page reloads to restart carousel functionality
            onClosed: function () {
                window.location.reload();
            }
        });
    }
});

$(document).ready(function () {
    $(".info div a").click(function () {
        window.open($(this).attr("href"));
    });
});

$(document).ready(function () {
    $("a[rel=colorBox]").colorbox({
        transition: "fade",
        speed: 750,
        previous: "",
        next: "",
        close: ""
    });
});