$(document).ready(function() {

	// If not mobile
	var is_mobile = (navigator.userAgent.toLowerCase().indexOf('mobile') != -1);
	if (!is_mobile) {

		// Add video actions
		$("a.video").click(function () {
			// Delete other players
			$(".quicktimeplayer").remove();
			// Show other poster frames
			$("a.video img").show();
			// Get posterframe info
			var posterframe = $(this).children()[0];
			var vidwidth = posterframe.width;
			var vidheight = posterframe.height+16;
			// Hide this poster frame
			//??? posterframe.hide();
			posterframe.style.display = "none";
			// Make this player
			var movieurl = $(this).attr("href");
			$(this).before('<span class="quicktimeplayer"><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></span>');
			
			// Don't follow link
			return false;
		});

		// Resize bg
		sizebg();
		$(window).bind("resize", sizebg);
	}
});

// Resize bg
function sizebg() {
	var $winheight = $(window).height();
	//$winheight = $winheight <= 900 ? 900 : $winheight;
	$("#bgimage").attr({
		height: $winheight
	});
}
