<div id="module_<?php echo($module_instance_id); ?>" class="module video-module <?php echo($module_class); ?>">
	<?php
	if($title && $title_heading_level)
	{
		?><<?php echo($title_heading_level); ?> class="module-title"><?php echo($title); ?></<?php echo($title_heading_level); ?>><?php
	}
	?>
	<script>
    var ie8 = 0;
    </script>

    <!--[if lt IE 9]>
    <script>
    ie8 = 1;
  	</script>
    <![endif]-->

	<video id="html5video_<?php echo($module_instance_id); ?>" volume="<?php echo($volume) ?>" controls="controls" height="<?php echo($max_height) ?>" width="<?php echo($max_width) ?>" poster="<?php echo($poster) ?>">
		<?php
		if(file_exists(ABSOLUTE_PATH . "/videos/$video.mp4"))
		{
			?><source src="/videos/<?php echo("$video") ?>.mp4" type='video/mp4; codecs="avc1.42E01E,mp4a.40.2"' /><?php
		}
		if(file_exists(ABSOLUTE_PATH . "/videos/$video.webm"))
		{
			?><source src="/videos/<?php echo("$video") ?>.webm" type='video/webm; codecs="vp8,vorbis"' /><?php
		}
		if(file_exists(ABSOLUTE_PATH . "/videos/$video.ogv"))
		{
			?><source src="/videos/<?php echo("$video") ?>.ogv" type='video/ogg; codecs="theora,vorbis"' /><?php
		}
		?>

		<a href="/videos/<?php echo("$video") ?>.mp4" id="html5video_flash_<?php echo($module_instance_id); ?>" class="html5video" style="display: block; width: <?php echo($max_width) ?>px; height: <?php echo($max_height) ?>px;"> </a> <!-- this will install flowplayer inside previous A- tag. -->
		<script>
			jQuery(window).on("load", function()
			{
				if(ie8)
				{
					flowplayer("html5video_flash_<?php echo($module_instance_id); ?>", "/modules/video/flowplayer-3.2.7.swf",
						{
							onLoad: function()
							{	// called when player has finished loading
								this.setVolume(<?php echo($volume*10); ?>);	// set volume property
							},
							plugins:
							{
								controls:
								{
									// location of the controlbar plugin
									url: '/modules/video/flowplayer.controls-3.2.5.swf'
								}
							},
							clip:
							{
								// these two configuration variables does the trick
								autoPlay: <?php echo($autoplay ? "true" : "false"); ?>,
								autoBuffering: true
							}
						});
				}

				var player_<?php echo($module_instance_id); ?> = document.getElementById("html5video_<?php echo($module_instance_id); ?>");

				if(player_<?php echo($module_instance_id); ?>)
				{
					player_<?php echo($module_instance_id); ?>.volume = <?php echo($volume); ?>;

					<?php
					if($autoplay)
					{
						?>player_<?php echo($module_instance_id); ?>.play();<?php
					}
					?>
				}
			});
		</script>
	</video>
</div>
