function fixVimeo() {
    /*
        Better Vimeo Embeds 2.1 by Matthew Buchanan
        Modelled on the Vimeo Embedinator Script
        http://mattbu.ch/tumblr/vimeo-embeds/

        Released under a Creative Commons attribution license:
        http://creativecommons.org/licenses/by/3.0/nz/
    */
    var opts = "title=0&byline=0&portrait=0";
    $("iframe[src^='http://player.vimeo.com']").each(function() {
        var src = $(this).attr("src");
        var w = $(this).attr("width");
        var h = $(this).attr("height");
        if (src.indexOf("?") == -1) {
            $(this).replaceWith(
                "<iframe src='"+src+"?"+opts+"&color="+
                color+"' width='"+w+"' height='"+h+
                "' frameborder='0'></iframe>"
            );
        }
    });
    $("object[data^='http://vimeo.com']").each(function() {
        var $obj = $(this);
        var data = $obj.attr("data");
        var temp = data.split("clip_id=")[1];
        var id = temp.split("&")[0];
        var server = temp.split("&")[1];
        var w = $obj.attr("width");
        var h = $obj.attr("height");
        $obj.replaceWith(
            "<iframe src='http://player.vimeo.com/video/"
            +id+"?"+server+"&"+opts+"&color="+color+
            "' width='"+w+"' height='"+h+
            "' frameborder='0'></iframe>"
        );
    });
}
function fixYouTube() {
  /* hastily done for YouTube too. */
    $("object").each(function() {
      if ($(this).find("embed[src^='http://www.youtube.com']").length != 0) {
        var $obj = $(this);
        var embed = $(this).find("embed[src^='http://www.youtube.com']");
        var w = embed.attr("width");
        var h = embed.attr("height");
        var video_id = embed.attr("src").split("/")[4].split("&")[0];
        $obj.replaceWith('<iframe class="youtube-player" type="text/html" width="' + w + '" height="' + h
          + '" src="http://www.youtube.com/embed/' + video_id + '" frameborder="0"></iframe>');
      }
    });
}

