/*
/*  video.js
*/

$(document).ready(function () {
  $(".video").each(function (index) {
    var flvPath = $(this).find("a[rel]").attr("href");
    var player  = $(this).attr("id") + "-video";
    $f(player, "swf/flowplayer.swf", {
      key: "#$1ed31bd77af45113bad",
      clip: {
        url: flvPath,
        scaling: "fit"
      },
      logo: {
        url: "images/logo.png",
        right: 10, bottom: 10,
        fullscreenOnly: false
      },
      plugins: {
        controls: {
          backgroundColor: "transparent",
          backgroundGradient: "none",
          width: 492, height: 32,
          left:  10,  right:  10, bottom: 10,
          autoHide: "always",
          all: false, play: true, scrubber: true
        }
      }
    });
  });
  $(".video a[rel]").each(function (index) {
    var id = $(this).parents("li").attr("id");
    $(this).overlay({
      onLoad: function () {
        $f(id + "-video").load();
        $("#tint").css("height", $(document).height());
        $("#tint").fadeIn(2000);
      },
      onClose: function () {
        $("#tint").fadeOut(250);
        $f("*").each(function () {
          this.unload();
        });
      }
    });
  });
});
