$(document).ready(function () {
  $("ul.vlog").find("li a").each(function (count) {
    var href = $(this).attr("href");
    $(this).attr("href", href);
    $(this).attr("rel", "shadowbox;width=480;height=360;");
	
  });
  /*
  $("ul.vlog").find("li").each(function(count) {
  $(this).find("a[href^='/media']").attr("rel", "shadowbox;width=480;height=360;");
  });
  $("ul.vlog").find("li a").click(function(){
  var href = $(this).attr("href");
  $(this).attr("href", "/media/"+href+".m4v");
  });
  */
  Shadowbox.init({
    players: ["flv", "wmp", "html"],
    ext: {
      flv: ["m4v", "mp4"],
      wmp: ["wmv", "m1v"]
    },
    flashParams: {
      menu: false,
      wmode: "opaque",
      allowScriptAccess: "always",
      allowFullScreen: true
    },
    flashVars: {
      menu: false,
      skin: "/media/frankly-player.swf",
      type: "video",
      provider: "http",
      backcolor: "dddddd",
      frontcolor: "0076BF",
      lightcolor: "ffa02f",
      screencolor: "000000",
      autostart: true
    },
    autoplayMovies: true
  });
  
  $("ul.vlog li a").live("click", function () {
    $("#sb-wrapper").append("<p>Frankly.net is sponsored by Bayer HealthCare, which has also provided some support to Eviatar Weizman for production of his video logs. The views and opinions presented in this video located at Frankly.net are solely those of the author and do not necessarily represent those of Bayer HealthCare. Always seek the advice of your physician, or other qualified health provider with any questions you may have regarding a medical condition. Never disregard professional medical advice or delay in seeking it because of content found in this video.</p>");
  });
  
  $("ul.vlogc li a").live("click", function () {
    $("#sb-wrapper").append("<p>Frankly.net is sponsored by Bayer HealthCare, which has also provided some support to Eviatar Weizman for production of his video logs. The views and opinions presented in this video located at Frankly.net are solely those of the author and do not necessarily represent those of Bayer HealthCare. Always seek the advice of your physician, or other qualified health provider with any questions you may have regarding a medical condition. Never disregard professional medical advice or delay in seeking it because of content found in this video.</p>");
  });
  $(("a#sb-nav-close") || ("#sb-overlay")).live("click", function () {
    $("#sb-wrapper p").remove();
  });
  
  // limit media downloads
  $('a[href*="vlog"]').bind("contextmenu", function (e) {
    e.preventDefault();
  });
});


