/*

	Use video.js instead of slider.js to allow QT movie controls

*/

$(document).ready(function() {
	
	// Strip whitespace from between photos
	var stripped = $("#drag").html().replace(/>\s+</g,"><");
	$("#drag").html(stripped);
	
	var is_mobile = (navigator.userAgent.toLowerCase().indexOf('mobile') != -1);
	if (!is_mobile) {

		// Video still mouseovers
		$(".video")
		.hover(function () {
			$(this).addClass("opup");
		}, function () {
			$(this).removeClass("opup");
		});
		
		// Add video actions
		var vidwidth = 480;
		var vidheight = 286;
		$(".video a").click(function () {
			// Delete other players
			$(".videoplayer").remove();
			// Show other poster frames
			$(".video").show();
			// Hide this poster frame
			$(this).parent().hide();
			// Make this player
			var movieurl = $(this).attr("href");
			$(this).parent().after('<div class="videoplayer"><object width="' + vidwidth + '" height="' + vidheight + '" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab"><param name="src" value="' + movieurl + '"><param name="autoplay" value="true"><param name="controller" value="true"><embed src="' + movieurl + '" width="' + vidwidth + '" height="' + vidheight + '" autoplay="true" controller="true" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>');
			
			return false;
		});
		
		// Resize bg
		sizebg();
		$(window).bind("resize", sizebg);
		
		// Status
		//window.status = "Use arrows or the curser to move the Photography or Film content";
			
	}

});


// Resize bg
function sizebg() {
	var $winwidth = $(window).width();
	$winwidth = $winwidth <= 1250 ? 1250 : $winwidth;
	$("#bg").attr({
		width: $winwidth
	});
}

