function showvideo(newbutton, playerid, ytid) {
    src = "http://www.youtube.com/v/" + ytid + "&amp;rel=1&amp;color1=d6d6d6&amp;color2=f0f0f0&amp;border=0&amp;fs=1&amp;hl=en&amp;autoplay=1&amp;showinfo=1&amp;iv_load_policy=3&amp;showsearch=0&amp;ap=%2526fmt%3D18";
    document.getElementById(playerid).innerHTML =
        '<object type="application/x-shockwave-flash" width="500" height="306" data="' + src + '">' +
        '<param name="movie" value="' + src + '" />' +
        '<param name="allowFullScreen" value="true" />' +
        '<param name="wmode" value="transparent" /></object>';
    oldbutton = document.getElementById(playerid + '-current');
    newbutton.setAttribute('id', playerid + '-current');
    oldbutton.setAttribute('id', '');
}

/* to use normal jQuery syntax, even though WordPress uses JQuery.noConflict */
jQuery(document).ready(function($){
    $('a[href$=".jpg"]').fancybox();
    $('a[href$=".jpeg"]').fancybox();
    $('a[href$=".png"]').fancybox();
    $('a[href$=".gif"]').fancybox();
});