/**
 * Fun times!  Debugging change.gov's menu-over-Flash-video problem.
 *
 * See the blog entry here: http://blog.helen-marie.com/index.php/2009/01/flash-and-html-layersflash-and-html-layers/
 *
 * @author Matt Holford <matt@helen-marie.com>
 */
var hmNavHandler = {
	contents: [],
	over: false,		// Are we over right now?
	
	setOut: function() {
		if (this.over) {
			me = this;
			$("#content .wrapper-video").each(function(i) {
				$(this).html(me.contents[i].html);
			});
		}
		this.over = false;
	},
	
	/**
	 * Here's the trickery.  When we mouse over the menu, find every video
	 * wrapper div.  For each one, determine the width and height, and set the
	 * background image to a still image of the video player.  When we mouse out,
	 * we can restore the original video player HTML.
	 */
	setOver: function() {
		if (!this.over) {
			me = this;
			$("#content .wrapper-video").each(function(i) {
				me.contents[i] = {
					height: $(this).height(),
					html: $(this).html(),
					width: $(this).width()
				}
				var w = me.contents[i].width;
				var h = me.contents[i].height;
				$(this).css("background", "#000 url(hide-" + w + "x" + h + ".png) no-repeat 0 0");
				$(this).css("width", w + "px");
				$(this).css("height", h + "px");
				$(this).html("");
			});
		}
		this.over = true;
	}
};
