$(function() { 
	if ((screen.width>=321) && (screen.height>=481)) {
		var video = document.getElementsByTagName("video")[0];
		var videoTag = $("video");
		var videoWidth = videoTag.attr('width');
		var videoHeight = videoTag.attr('height');
		var videoSrc = $('video source').attr('src');
		var poster = $('video').attr('poster');
		var flash = $('<embed type="application/x-shockwave-flash" src="/files/player.swf" width="'+videoWidth+'" height="'+videoHeight+'" allowscriptaccess="always" allowfullscreen="true" wmode="transparent"/>').attr('flashvars', 'file='+videoSrc+'&image='+poster+'&stretching=fill');
		
		if (video) {
			if ( !video.play ) { 
				$('video').replaceWith(flash); 
			}
			
			var quicktime = video.canPlayType("video/mp4");
			if (quicktime == "" in navigator.plugins){ 
				$('video').replaceWith(flash);
			}
			// if ( video.play ) { 
			// 	video.addEventListener("play", function() { video.play(); }, false);
			// 	video.addEventListener("pause", function() { video.pause(); }, false);
			// 	video.addEventListener("canplaythrough", function() { video.play(); }, false);		
			// }
		}
	}

});
