function hideImages(e) {
	$("div#img-container p").fadeOut(500, showMovie);
	e.preventDefault();
}

function showMovie() {
	if ($("#mov-container").length < 1)  {
		// create movie viewer
		var src = $("a[href$=mov]").attr("href");
		var movieViewer = QT_GenerateOBJECTText_XHTML (
		  src, 512, 288, null,
		  "autoplay","true",
		  'EnableJavaScript', 'True', 'emb#NAME' , 'movie1' , 'obj#id' , 'movie1'
		);
	
		$("div#img-container").append("<div id='mov-container'>"+movieViewer+"</div>");
	} else { // show movie viewer
		$("#mov-container").css("display", "block");
		// $("#mov-container").fadeIn(500); // fading doesn't work
	}
	
	$("a[href$=mov]").text("Show Images").unbind().bind("click", hideMovie);
}

function hideMovie(e) {
	document.movie1.Stop(); // stop movie from playing
	$("#mov-container").css("display", "none");
	showImages();
	// $("#mov-container").fadeOut(500, showImages); // fading doesn't work
	e.preventDefault();
}

function showImages() {
	$("div#img-container p").fadeIn(500);
	$("a[href$=mov]").text("Play Movie").unbind().bind("click", hideImages);
}

$(document).ready(function() {
	$("a[href$=mov]").bind("click", hideImages);
});