﻿/// <reference path="jquery-1.4.1-vsdoc.js" />

// turns all flipbook links into actual embedded flipbooks
$(function () {

    if (!flashembed.isSupported([9, 0]))
        return;

    $(".jFlipbook").each(function (index, item) {
        // determine flashbook 
        var bookName = $(this).attr("href").replace(/^.*#/, "");

        // replace content
        var container = $("<div class='FlashBookContainer'></div>");
        var basePath = "/Shared/Flipbooks/" + bookName;
        
        container.flashembed({
            base: basePath,
            src: basePath + "/flippingbook.swf",
            expressInstall: "/Content/Flash/expressinstall.swf",
            wmode: "opaque"
        });

        $(this).replaceWith(container);
    });
});
