<?php

/**
 * include some common code (like we did in the 90s)
 * People still do this? ;)
 */
include_once 'config.php';

// todo : 
// - gestion du parent.document.location mediafragment
// - limite taille vertical embed 
// - ajouter la polemic timline en dessous de la video 

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>RSLN  - Polemic player embed page</title>
	
	<!-- JAVASCRIPT --> 
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>		
	<script type="text/javascript">	
		$.noConflict();
	</script>
	<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js"></script>
	<script type="text/javascript" src="../res/raphael/raphael-min.js"></script>
	<script type='text/javascript' src='../res/metadataplayer/src/js/LdtPlayer.js'></script>
	
	<!-- FONT -->
	<link href='http://fonts.googleapis.com/css?family=PT+Sans+Narrow&subset=latin' rel='stylesheet' type='text/css'>
	<link href='http://fonts.googleapis.com/css?family=PT+Sans&subset=latin' rel='stylesheet' type='text/css'>
	<link href='http://fonts.googleapis.com/css?family=Geo&subset=latin' rel='stylesheet' type='text/css'>
	<style type="text/css"> 
		body{
			padding:0px;
			margin:0px;
		}
		.tooltip{
			 z-index: 10000000000;
		}
		#tip{
			 position : absolute;
			 padding : 3px;
			 z-index: 10000000000;
			 max-width: 200px;
		}	
		#tip {
			display: none;
			background: transparent url("../images/white_arrow_long.png");
			font-size: 12px;
			height: 125px;
			width: 180px;
			padding: 10px;
			padding-left: 15px;
			padding-top: 15px;
			padding-right: 15px;
			color: black;
			z-index: 10000000000;
			font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif";
			overflow:hidden;
		}
		#chartTimeline{
			z-index: 9;
			position : absolute;
		}

	</style>
	<script type="text/javascript">
	    // Configuration Polemical Timeline	  		
  		<?php
  		if(is_array($config['metadata'])) {
  			$metadata_key = $_GET["metadata"];
  		    if(!$metadata_key) {
  		    	reset($config['metadata']);
  		    	$metadata_key = key($config['metadata']);
  		    }
  		    
  		    $duration = $config['metadata'][$metadata_key]['duration'];
  		    $url = $config['metadata'][$metadata_key]['url'];
  		}
  		else {
  			$duration = $config['duration'];
  		    $url = $config['metadata'];  		    
  		}
  		?>
  		
		var config = {
					target:"chartTimeline",
					x:8,
					y:418,
					width:<?php echo($player_width); ?>,
					height:<?php echo($player_height); ?>,
					heightmax:<?php echo($player_height); ?>,
					duration:<?php echo($duration); ?>,
					metadata:"<?php echo($url); ?>"
					};
	</script>
	
  	<script type='text/javascript' src='../res/metadataplayer.polemic/src/js/polemic.js'></script>
  	<script type="text/javascript">
  		jQuery.extend(__IriSP.lib,{jQueryToolTip:"../res/metadataplayer/res/js/jquery.tools.min.js"});
	</script>
  	
	<script type="text/javascript">
	
	  var _gaq = _gaq || [];
	  _gaq.push(['_setAccount', 'UA-23581291-1']);
	  _gaq.push(['_trackPageview']);
	
	  (function() {
	    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
	  })();
	
	</script>
  </head>  
  <body>
  <!-- tooltip --> 
  <div id="tip">
  <div id="tipcolor" style="height:10px;width:10px"></div>
  <div id="tiptext"></div>
  </div>
  
	  <div class="root" >
		<div class="videoLivePlayer">
		<div id="chartTimeline"> </div>	
		<script type="text/javascript">
			var paper = Raphael(document.getElementById("chartTimeline"),config.width, config.height);
		</script>
		<script type='text/javascript' src='../res/metadataplayer/src/js/LdtPlayer.js'></script>
		<div id="player_project_embed" class="iri_player_embed"> </div>
		
			<script type="text/javascript">
				var configMP = {
						metadata:{
							format:'cinelab',
							src:config.metadata,
							load:'jsonp'},
						gui:{
							width:config.width,
							height:config.height,
							mode:'video',
							container:'player_project_embed',
							debug:false,
							css:'../res/css/LdtPlayer.css'},
	
						player:{
							type:'jwplayer',
							src:'../res/metadataplayer/res/swf/player.swf'}
					};
				__IriSP.init(configMP);     
			</script>
		</div>	
	  </div>	
  </body>
</html>
