//#

function mimeTypeLib(sMimeType)
	{
	// la fonction reçoit l'URI du type mime en paramètre
	// puis boucle dans les tableaux pour savoir quelle image
	// afficher si elle en fait partie
		var MimeTypes = new Array('tcm:0-7-65544', 'tcm:0-16-65544', 'tcm:0-15-65544', 'tcm:0-4-65544', 'tcm:0-5-65544', 'tcm:0-6-65544', 'tcm:0-17-65544');
		var TypeIcons = new Array('<IMG tcmuri="tcm:117-3821" SRC="/img/mauk/pdf_tcm117-3821.gif" WIDTH="16" HEIGHT="22" "pdf document border="0">', '<IMG tcmuri="tcm:117-31198" SRC="/img/mauk/mp3_tcm117-31198.gif" WIDTH="16" HEIGHT="22" "mp3 border="0">', '<IMG tcmuri="tcm:117-32709" SRC="/img/mauk/mov_icon_tcm117-32709.gif" WIDTH="16" HEIGHT="16" "QuickTime border="0">', '<IMG tcmuri="tcm:117-33432" SRC="/img/mauk/iconword_tcm117-33432.gif" WIDTH="19" HEIGHT="22" "Word border="0">', '<IMG tcmuri="tcm:117-33433" SRC="/img/mauk/iconexcel_tcm117-33433.gif" WIDTH="19" HEIGHT="22" "Excel border="0">', '<IMG tcmuri="tcm:117-33434" SRC="/img/mauk/iconpowerpoint_tcm117-33434.gif" WIDTH="19" HEIGHT="22" " border="0">', '<IMG tcmuri="tcm:117-85847" SRC="/img/mauk/mplayer_tcm117-85847.gif" WIDTH="16" HEIGHT="16" "AVI border="0">');
		var TypeExtensions = new Array('pdf document', 'mp3', 'QuickTime', 'Word', 'Excel', '', 'AVI');
	
	for (x = 0 ; x < MimeTypes.length; x++)
		{
		if (MimeTypes[x] == sMimeType)
			{
			//document.write(TypeExtensions[x] + "&nbsp;" + TypeIcons[x]);
			document.write(TypeIcons[x]);
			break;
			}
		}
	
	}
	
/* 07/09/2005
	gestion des popups
	je mets la fonction ici car c'est le seul fichier JS commun à toutes les pages
  */
function newPopup(divid)
 { 
 	// l'enrobage de l'annonce
	
	newwindow = window.open('popupwindow.htm?' + divid, 'dialog','toolbar=no,location=no,directories=no,status=yes,menubar=yes,scrollbars=yes, resizable=yes,copyhistory=yes, width=500,height=500, left=100,top=100,screenX=100,screenY=100');
	newwindow.focus();
	
	dialog	= newwindow.document ;
	document.getElementById('content').innerHTML = divid;
 }
function addLoadEvent (func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function () {
      if (oldonload) {
        oldonload ();
      }
      func ();
    }
  }
}
/**
	playVideo ()
	By nwo 2oo7
*/
function playVideo (_vid, _flv, _skin, _width, _height, _closeIcon, _expressInstall, _pluginMsg) {
	if (typeof _expressInstall == "undefined") _expressInstall = "";
	if (typeof _pluginMsg == "undefined") _pluginMsg = "You need Flash Player to see this video.";
	
	if (document.all) var cs = new Array (document.body.clientWidth, document.body.clientHeight);
	else var cs = new Array (window.innerWidth, window.innerHeight);
	
	var _BG = document.createElement ('div');
	//if (!(typeof document.body.style.maxHeight != "undefined"))  _BG.style.position = "absolute";
	if (document.all)  _BG.style.position = "absolute";
	else _BG.style.position = "fixed";
	_BG.style.top = "0";
	_BG.style.left = "0";
	_BG.style.padding = "0";
	_BG.style.margin = "0";
	_BG.style.width = "100%";
	_BG.style.height = "100%";
	_BG.style.backgroundColor = "#000";
	_BG.style.opacity = "0.8";
	_BG.style.filter = "alpha(opacity=80)";
	document.body.appendChild (_BG);
	
	/* Create the main container */
	var _CONT = document.createElement ('div');
	_CONT.style.position = "absolute";
	var _margin = (document.all) ? 6 : 1;
	_CONT.style.width = Math.round (_width + _margin) + "px";
	_CONT.style.height = Math.round (_height + 18) + "px";
	_CONT.style.backgroundColor = "#fff";
	_CONT.style.padding = "3px";
	_CONT.style.margin = "0";
	document.body.appendChild (_CONT);
	
	/* Create the close button */
	var _CLOSE = document.createElement ('div');
	//_CLOSE.style.width = "100%";
	_CLOSE.style.textAlign = "right";
	_CLOSE.style.height = "13px";
	_CLOSE.style.padding = "0";
	_CLOSE.style.margin = "0";
	_CLOSE.style.paddingBottom = "2px";
	
	var _ClOSE_ICON = new Image ();	//Create a text that will close the window
	if (typeof _closeIcon == "undefined") _closeIcon = '/img/mauk/close_icon.gif';	//Default icon
	_ClOSE_ICON.src = _closeIcon;
	_ClOSE_ICON.style.cursor = 'pointer';
	_CLOSE.appendChild (_ClOSE_ICON);
	
	_CONT.appendChild (_CLOSE);
	
	/* Create the big picture container, will be contained by the main container */
	var _BIGM = document.createElement ('div');
	_BIGM.setAttribute ('id', "flvcontent");
	_BIGM.style.width = _width + "px";
	_BIGM.style.height = _height + "px";
	_BIGM.style.border = "1px solid #aaa";
	_BIGM.style.textAlign = "center";
	_BIGM.style.padding = "0";
	_BIGM.style.margin = "0";
	_BIGM.zIndex = "900";
	_CONT.appendChild (_BIGM);
	
	/**
	 *	Gestion des flash
	*/
	//Plugin missing text
	_BIGM.innerHTML = _pluginMsg + "<p><a href='http://www.adobe.com/go/getflashplayer'><img src='http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' border='0'/></a></p>";
	
	var _so = new FlashObject (_vid, "flvplayer", _width, _height, "8", "#ffffff");
	//_so.useExpressInstall(_expressInstall);
	_so.addParam ("salign", "t");
	_so.addParam ("wmode", "transparent");
	_so.addParam ("allowFullScreen", "true");
	_so.addVariable ("streamName", _flv);
	_so.addVariable ("skinName", _skin);
	_so.write (_BIGM);
	
	_ClOSE_ICON.onclick = function () {
		_CONT.removeChild (_BIGM);
		_CONT.removeChild (_CLOSE);
		document.body.removeChild (_CONT);
		document.body.removeChild (_BG);
		window.onresize = function () { return false; }
	}

	/* Centerize */
	if (_width > cs [0]) _CONT.style.left = "0";
	else  _CONT.style.left = Math.round ((cs [0] - _width) / 2) + "px"; 
	if (_height > cs [1]) _CONT.style.top = "0";
	else _CONT.style.top = Math.round ((cs [1] - Math.round (_height + 12)) / 2) + "px"; 

	window.onresize = function () {
		if (document.all) var cs = new Array (document.body.clientWidth, document.body.clientHeight);
		else var cs = new Array (window.innerWidth, window.innerHeight);
		if (_width > cs [0]) _CONT.style.left = "0";
		else  _CONT.style.left = Math.round ((cs [0] - _width) / 2) + "px"; 
		if (Math.round (_height + 12) > cs [1]) _CONT.style.top = "0";
		else _CONT.style.top = Math.round ((cs [1] - Math.round (_height + 12)) / 2) + "px"; 
	}
	/* Fixes the background for IE6 */
	onscroll = function () {
		//if (!(typeof document.body.style.maxHeight != "undefined"))
		if (document.all)
			_BG.style.top = document.body.scrollTop + 'px';
	}
	
	/**
	 *	Statistics
	 */
	stats.video (_flv);
}

/**
 *	showVideo ()
 *	Show the video within the page
*/
function showVideo (_vid, _flv, _skin, _width, _height, _expressInstall, _pluginMsg) {
	if (typeof _expressInstall == "undefined") _expressInstall = "";
	if (typeof _pluginMsg == "undefined") _pluginMsg = "You need Flash Player to see this video.";
	
	document.write ("<div id='flvplayer' class='flvplayer'>" + _pluginMsg + "<p><a href='http://www.adobe.com/go/getflashplayer'><img src='http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' border='0'/></a></p></div>");
	/**
	 *	Gestion des flash
	*/
	var _so = new FlashObject (_vid, "flvplayer", _width, _height, "8", "#ffffff");	
	//_so.useExpressInstall(_expressInstall);
	_so.addParam ("salign", "t");
	_so.addParam ("wmode", "transparent");
	_so.addParam ("allowFullScreen", "true");
	_so.addVariable ("streamName", _flv);
	_so.addVariable ("skinName", _skin);
	_so.write ("flvplayer");
}