 (function($){
	$.fn.videoGallery = function(options){
	
		var defaults = {
            /*w: 425,
            h: 344,*/
			w: 480,
            h: 385,
			/*w: 320,
            h: 240,*/
            holderDiv: '#video-holder',
            src: 'rel',
			showTitle: true,
            title: 'title',
            titleLoc: '#video-title'
		};
		
		var options = $.extend(defaults, options);

		var element = this;
		
		return this.each(function(){
         src = $(options.holderDiv).attr(options.src);
		  //alert(src);
         title = $(options.holderDiv).attr(options.title);
         if (options.showTitle === true){
            $(options.titleLoc)
               .text(title);  
         }
         
         $(options.holderDiv)
            .html('<object width="'+options.w+'px" height="'+options.h+'px"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="'+src+'" /><embed src="'+src+'" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="'+options.w+'px" height="'+options.h+'px" wmode="transparent"></embed></object>');
                  
         $(this).
            click(
               function(){
                  src = $(this).attr(options.src);
				 // alert(src);
                  title = $(this).attr(options.title);
                  
                  $(options.holderDiv)
                     .html('<object width="'+options.w+'px" height="'+options.h+'px"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="'+src+'" /><embed src="'+src+'" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="'+options.w+'px" height="'+options.h+'px"></embed></object>');
                  
                  if (options.showTitle === true){
                     $(options.titleLoc)
                        .text(title);  
                  }
               }
            )
		}); // end this.each
	
	}; // end fn.videoGallery
	
})(jQuery);
