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