/*
 * jYoutube 1.0 - YouTube video image getter plugin for jQuery
 *
 * Copyright (c) 2009 jQuery Howto
 *
 * Licensed under the GPL license:
 *   http://www.gnu.org/licenses/gpl.html
 *
 * URL:
 *   http://jquery-howto.blogspot.com
 *
 * Author URL:
 *   http://me.boo.uz
 *
 */
$.extend({ 
 jYoutube: function( url, size ){ 
	 if(url === null){ return ""; }   
	 size = (size === null) ? "big" : size;    
	 
	 var vid;   
	 var results;    
	 
	 results = url.match("[\\?&]v=([^&#]*)");
	 
	 vid = ( results === null ) ? url : results[1];  
	 
	 if(size == "small"){      
		return "<a href=http://www.youtube.com/watch?v="+vid+" rel=prettyPhoto><img src=http://img.youtube.com/vi/"+vid+"/2.jpg></a> ";   
	 }
	 else  if(size == "big"){     
		return "<a href=http://www.youtube.com/watch?v="+vid+" rel=prettyPhoto><img src=http://img.youtube.com/vi/"+vid+"/0.jpg width=></a> ";   
	 }  
	 else {    
		return "<a href=http://www.youtube.com/watch?v="+vid+" rel=prettyPhoto><img src=http://img.youtube.com/vi/"+vid+"/0.jpg width=300></a> ";   
	 }  
 }});