// used to build a mini video player with no queue, no content container, and minimal flash controls
// relies on there being a Flash player and a location for the player HTML structure
var MiniPlayer = Class.create({
	
  initialize: function(player_container, clipautoplay, video_embed_field) {
		this.player_container = player_container;
		this.q_index = 0;
		this.clipautoplay = clipautoplay;
		if (video_embed_field) {
			this.video_embed_field = video_embed_field;
			$(this.video_embed_field).observe('focus', function () { this.select(); } );
		}
  },
	
	load_video: function(id, video_url, title) {
		var flashvars = {
			clipURL: video_url,
			clipinfo: title,
			clipautoplay: this.clipautoplay
		};
		var params = {
			allowFullScreen: "true",
			bgcolor: "#ffffff",
			wmode: "transparent"
		};
		swfobject.embedSWF("/flash/apt11_player_nocontrols.swf", this.player_container, "260", "200", "9.0.0", null, flashvars, params);
		if (this.video_embed_field) {
			$(this.video_embed_field).hide();
			$(this.video_embed_field).value = '<iframe src="http://' + document.domain + '/videos/embed/' + id + '" height="510" width="540" frameborder="0"></iframe>';
		}
	},
	
	show_embed: function() {
		$(this.video_embed_field).show();
	},
	
	hide_embed: function() {
		$(this.video_embed_field).hide();
	}
	
});