jQuery.fn.ytplaylist=function(a){var a=jQuery.extend({holderId:"ytvideo",playerHeight:"300",playerWidth:"450",addThumbs:false,thumbSize:"small",showInline:false,autoPlay:true,showRelated:true,allowFullScreen:false},a);return this.each(function(){var f=$(this),e="",c="&rel=0",d="";if(a.autoPlay)e="&autoplay=1";if(a.showRelated)c="&rel=1";if(a.allowFullScreen)d="&fs=1";function g(f){var b="";b+='<object height="'+a.playerHeight+'" width="'+a.playerWidth+'">';b+='<param name="movie" value="http://www.youtube.com/v/'+f+e+c+d+'"> </param>';b+='<param name="wmode" value="transparent"> </param>';if(a.allowFullScreen)b+='<param name="allowfullscreen" value="true"> </param>';b+='<embed src="http://www.youtube.com/v/'+f+e+c+d+'"';if(a.allowFullScreen)b+=' allowfullscreen="true" ';b+='type="application/x-shockwave-flash" wmode="transparent"  height="'+a.playerHeight+'" width="'+a.playerWidth+'"></embed>';b+="</object>";return b}function b(b){var a=b.match("[\\?&]v=([^&#]*)");a=a[1];return a}var h=f.children("li:first-child").addClass("currentvideo").children("a").attr("href");$("#"+a.holderId+"").html(g(b(h)));f.children("li").children("a").click(function(){if(a.showInline){$("li.currentvideo").removeClass("currentvideo");$(this).parent("li").addClass("currentvideo").html(g(b($(this).attr("href"))))}else{$("#"+a.holderId+"").html(g(b($(this).attr("href"))));$(this).parent().parent("ul").find("li.currentvideo").removeClass("currentvideo");$(this).parent("li").addClass("currentvideo")}return false});a.addThumbs&&f.children().each(function(){var c=$(this).text();if(a.thumbSize=="small")var d="http://img.youtube.com/vi/"+b($(this).children("a").attr("href"))+"/2.jpg";else var d="http://img.youtube.com/vi/"+b($(this).children("a").attr("href"))+"/0.jpg";$(this).children("a").empty().html("<img src='"+d+"' alt='"+c+"' />"+c).attr("title",c)})})}
