/**
 * Fichier  : /share/sdmc/interne/layoutftv/arches/common/javascripts/callbacksManager.js
 * Revision : 32789
 */
(function(window, undef) {
	window.functionsQueue = window.functionsQueue || function(caller) {
		var liste = []
		,pointeur = -1
		,depile = function() {
			var args = arguments,
			fct;
			pointeur++;
			if(liste.length === pointeur) {
				pointeur = -1;
				return;
			}

			if(liste[pointeur] instanceof Array) {
				liste[pointeur][1]--;
				fct = liste[pointeur][0];
				if(liste[pointeur][1] == 0) {
					remove(pointeur--);
				}
			}
			else {
				fct = liste[pointeur];
			}
			if(typeof fct === 'function') {
				// cette fonction depile devrait pouvoir être déclarée une fois pour toute pour
				// l'instance, car tant que l'on est en attente d'un retour, toute l'instance de file d'attente est bloqué.
				fct.continuer = (function() {
					var done = false;
					return function() {
						if(!done) {
							done = true;
							depile.apply(caller, args);
						}
					};
				})();
				if(fct.apply(caller, args) !== false) {
					depile.apply(caller, args);
				}
			} else {
				remove(pointeur--);
				depile.apply(caller, args);
			}
		}
		,remove = function(idx) {
			if(liste.length === 1) {
				liste = [];
			}
			else if(idx === liste.length -1) {
				liste.length = liste.length -1;
			}
			else {
				var i, copie = [];
				for(i = 0; i < liste.length; i++) {
					if(i !== idx) {
						copie[copie.length] = liste[i];
					}
				}
				liste = copie;
			}
		}
		,functionsQueue = function(fct, iterations) {
			if(arguments.length === 0) {
				if(pointeur !== -1) {
					return;
				}
				depile();
			}
			else if(fct !== undef) {
				if(fct instanceof Array) {
					if(fct.length <= 2 && typeof fct[0] === 'function' && (fct[1] === undef || typeof fct[1] === 'number')) {
						arguments.callee(fct[0], fct[1] || iterations);
					}
					else {
						for(var i = 0; i < fct.length; i++) {
							arguments.callee(fct[i], iterations);
						}
					}
				}
				else {
					if(typeof fct !== 'function') {
						throw new Error('Impossible de mettre en attente autre chose qu\'une fonction');
					}
					if(typeof iterations === 'number') {
						fct = [fct, iterations];
					}
					liste[liste.length] = fct;
				}
			}
		};

		functionsQueue.run = function() {
			if(pointeur !== -1) {
				return;
			}
			depile.apply(caller, arguments);
		};
		return functionsQueue;
	};

	window.callbacksManager = window.callbacksManager || function(caller) {
		var i, key, listes = []
		,cbm = function(liste) {
			if(arguments.length === 1) {
				if(typeof liste === 'object') {
					for(var key in liste) {
						cbm(key, liste[key]);
					}
				}
				else if(listes[liste] !== undef) {
					return listes[liste]();
				}
			}
			else if(arguments.length > 1) {
				if(listes[liste] === undef) {
					listes[liste] = window.functionsQueue(caller);
				}
				listes[liste].apply(caller, [].slice.call(arguments, 1));
			}
		}

		,methodHandler = function(methodName) {
			return function() {
				if(typeof this[methodName] === 'function')
					return this[methodName].apply(this, arguments);
			};
		};

		cbm.handleMethods = function(methodName, listeName) {
			if(typeof methodName === 'string') {
				cbm(listeName, methodHandler(methodName));
			}
			else if(typeof methodName === 'object') {
				for(var i in methodName) {
					arguments.callee(i, methodName[i]);
				}
			}
		};

		cbm.run = function(liste) {
			if(listes[liste] !== undef) {
				return listes[liste].run.apply(this, [].slice.call(arguments, 1));
			}
		};

		for(i = 1; i < arguments.length; i++) {
			if(typeof arguments[i] === 'object') {
				for(key in arguments[i]) {
					cbm(key, arguments[i][key]);
				}
			}
		}
		return cbm;
	};
})(this);
/**
 * Fichier  : /share/sdmc/interne/layoutftv/arches/common/javascripts/dynamicOptionsManager.js
 * Revision : 33232
 */
(function(window, undef) {
	// constantes servant à optimiser le code minimisé
	var PROTO = 'prototype',
	CONSTR = 'constructor',
	CALLEE = 'callee';

	window.dynamicOptionsManager = window.dynamicOptionsManager || function() {
		var i, args,

		$self = arguments[CALLEE],
		caller = this,
		defaultOptions = {},
		construct = function() {
			return function() {
				for(var i in this) {
					if(typeof this[i] === 'function') {
						this[i] = this[i].call(caller);
					}
				}
			};
		},
		opts = construct(),
		obj = function(property, value) {
			if(arguments.length === 0) {
				return new opts();
			}
			var args = arguments,
			values = [].slice.call(args, 1),
			ret, i;
			if (args.length === 1) {
				if(typeof property === 'string') {
					return args[CALLEE]([property])[property];
				}
				else if(typeof property === 'object') {
					if(property instanceof Array) {
						ret = construct();
						for(i = 0; i < property.length; i++) {
							if(opts[PROTO][property[i]] !== undef)
								ret[PROTO][property[i]] = opts[PROTO][property[i]];
						}
						return new ret();
					}
					else {
						for(i in property) {
							args[CALLEE](i, property[i]);
						}
					}
				}
				else if((property || {})[CONSTR] === $self) {
					args[CALLEE](property.raw());
				}
			}
			else if(typeof property === 'string') {
				if(value === undef) {
					if(defaultOptions[property] === undef) {
						delete(opts[PROTO][property]);
					}
					else {
						opts[PROTO][property] = defaultOptions[property];
					}
				}
				else if(value === null) {
					delete(opts[PROTO][property]);
				}
				else if((opts[PROTO][property] || {})[CONSTR] === $self) {
					return opts[PROTO][property].apply(caller, values);
				}
			// Bug potentiel ici : Si on fourni plusieurs valeurs, seule la première est controlée. Donc si on fourni un objet, et ensuite des objets jQuery ou des tableaux, ceux-ci seront concidérés comme des objets et donc ça merde.
				else if(typeof value === 'object' && !(value instanceof Array || (window.jQuery && value instanceof window.jQuery) || value.nodeType !== undef || (window.MediaInfos && value instanceof window.MediaInfos))) {
					opts[PROTO][property] = $self.apply(caller, values);
				}
				else {
					if(values.length > 1) {
						opts[PROTO][property] = $self.apply(caller)
						opts[PROTO][property].apply(caller, values);
					}
					else {
						opts[PROTO][property] = value;
					}
				}
			}
		};

		obj.defined = function(property) {
			var args = arguments;
			if(property instanceof Array) {
				for(var i = 0; i < property.length; i++) {
					if(!args[CALLEE](property[i])) {
						return false;
					}
				}
				return true;
			}
			if(args.length > 1) {
				if((opts[PROTO][property] || {})[CONSTR] === $self) {
					return opts[PROTO][property].defined.apply(caller, [].slice.call(args, 1));
				}
				return;
			}
			return opts[PROTO][property] !== undef;
		};

		obj.raw = function(property) {
			if(arguments.length === 0) {
				var i
				,ret
				,retClass = function() {};

				retClass[PROTO] = opts[PROTO];
				ret = new retClass();
				for(i in ret) {
					if(ret[i][CONSTR] === $self)
						ret[i] = ret[i].raw();
				}
				return ret;
			}
			if((opts[PROTO][property] || {})[CONSTR] === $self) {
				return opts[PROTO][property].raw.apply(caller, [].slice.call(arguments, 1));
			}
			return opts[PROTO][property];
		};

		obj.reset = function() {
			opts[PROTO] = {};
			for(var i in defaultOptions) {
				obj(i, defaultOptions[i]);
			}
		};

		obj[CONSTR] = $self;

		if(arguments.length) {
			args = $self();
			for(i = 0; i < arguments.length; i++) {
				args(arguments[i]);
			}
			defaultOptions = args.raw();
		}

		obj.reset();

		return obj;
	};
})(this);
/**
 * Fichier  : /share/sdmc/interne/layoutftv/arches/common/javascripts/queryStringValues.js
 * Revision : 30980
 */
(function(window, undef) {

	var pattern = ['(\\?|&amp;|&)(', ')(=([^&#]*))?(?=(&amp;|&|#|$))'],

	getQueryStringValues = function(aNames, sUrl) {
		if(!(aNames instanceof Array))
			throw 'La liste de paramètre doit être un tableau';
		sUrl = (sUrl || window.location.toString());
		var match, results = {}
		,reg = new RegExp(pattern[0]+aNames.join('|')+pattern[1], 'g');
		while(match = reg.exec(sUrl)) {
			results[match[2]] = match[4] || '';
		}
		return results;
	},

	setQueryStringValue = function(sName, sValue, sUrl, bHtmlEntity) {
		sUrl = (sUrl+'' || window.location+'');
		var sParam
		,aMatches = sUrl.match(new RegExp('^(.*)'+pattern[0]+sName+pattern[1]+'(.*)$'))
		,bDelete = (sValue === null);

		if(!aMatches) {
			if(bDelete) {
				return sUrl;
			}
			sParam = ((sUrl.indexOf('?') != -1) ? (bHtmlEntity ? '&amp;' : '&') : '?')+sName+(sValue?'='+sValue:'');
			return sUrl.replace(/(#.*)?$/, sParam+'$1');
		}
		if(bDelete) {
			if(aMatches[7] === '') {
				return aMatches[1];
			}
			if(aMatches[6] === '#') {
				return aMatches[1] + aMatches[7];
			}
			return aMatches[1] + aMatches[2] + aMatches[7].substr(1);
		}
		return aMatches[1] + aMatches[2] + aMatches[3] + (sValue?'='+sValue:'') + aMatches[7];
	};

	String.prototype.getQueryStringValue = function(sName) {
		return getQueryStringValues([sName], this)[sName];
	};

	String.prototype.getQueryStringValues = function(aNames) {
		return getQueryStringValues(aNames, this);
	};

	String.prototype.setQueryStringValue = function(sName, sValue, bHtmlEntity) {
		return setQueryStringValue(sName, sValue, this+'', bHtmlEntity);
	};
})(this);
/**
 * Fichier  : /share/sdmc/interne/layoutftv/arches/common/javascripts/jquery.popin/libs/jquery.popin.js
 * Revision : 2
 */
(function($) {
	if(!$) {
		throw new Error('Dépendence non satisfaite : jQuery');
	}

// Esquive d'un bug de webkit avec les animation jQuery si le body est en position relative
	$(function() {
		if(navigator.userAgent.toLowerCase().indexOf('webkit') > -1) {
			$(document.body).css('position', 'static');
		}
	});

// Variables communes aux divers composants
	// Propriétés CSS pouvant être animées.
	$.animableProperties = ['top', 'left', 'width', 'height', 'marginLeft', 'marginTop'];
	for(var key in $.fx.step) {
		if(key !== '_default') {
			$.animableProperties.push(key);
		}
	}
})(this.jQuery);

(function(window, $, undef) {
	(function(dep) {
		for(var i in dep) {
			if(!dep[i]) {
				throw new Error('Dépendence non satisfaite : '+i);
			}
		}
	})({
		jQuery					: !!$,
		DynamicOptionsManager	: !!window.dynamicOptionsManager,
		CallbacksManager		: !!window.callbacksManager
	});

	window.masque = function(aArgs) {
		if(!(this instanceof arguments.callee)) {
			return new arguments.callee(aArgs);
		}

		var $this = this
		,overlay
		,content
		,visible = false
		,showing = false
		,hiding = false

		,init = function() {
			$(window)
				.unload(destroy);

			if(!currentMasque) {
				currentMasque = $this;
			}

			if(typeof aArgs === 'object') {
				$.each(['preShow', 'postInsert', 'postShow', 'preHide', 'postHide'], function(key, value) {
					if(aArgs[value] !== undef) {
						$this.callbacks(value, aArgs[value]);
					}
				});
				for(var key in aArgs) {
					if(window.masque.defaultOptions[key] !== undef) {
						$this.options(key, aArgs[key]);
					}
				}
				if(typeof aArgs['css'] === 'object') {
					$this.css(aArgs['css']);
				}
			}

			if($.browser.msie && $.browser.version < 7) {
				$(window)
					.resize(ie6RefreshAll)
					.scroll(ie6RefreshAll);
			}
		}

		,destroy = function() {
			overlay = undef;
			content = undef;
		}

		,ie6RefreshOverlay = function() {
			if(!$.browser.msie || $.browser.version > 7 || !visible) {
				return;
			}
			overlay
				.height($(document).height())
				.width($(document).width())
				.css({
					 top		: '-'+$(document.body).css('margin-top')
					,left		: '-'+$(document.body).css('margin-left')
				});
		}

		,ie6RefreshContent = function() {
			if(!$.browser.msie || $.browser.version > 7 || !visible) {
				return;
			}
			content
				.height(document.documentElement.clientHeight - parseInt($(document.body).css('margin-top')) - parseInt($(document.body).css('margin-bottom')))
				.width(document.documentElement.clientWidth - parseInt($(document.body).css('margin-left')) - parseInt($(document.body).css('margin-right')))
				.css({
					 top		: $(document).scrollTop()
					,left		: $(document).scrollLeft()
				});
		}

		,ie6RefreshAll = function() {
			overlay.trigger('refresh');
			content.trigger('refresh');
		}

		,contentClick = function(e) {
			if( $this.options('closeOnClick')
				&& ( e.target === this
				  || $(e.target).hasClass($this.options('closeCls'))
				  || $(e.target).parents('.'+$this.options('closeCls')).length)) {
				$this.hide();
			}
		}

		,doShow = function() {
			overlay = $('<div />')
				.css($.extend($this.css(), $this.options('cssPreShow')))
				.hide()
				.appendTo(document.body)
				.bind('close', $this.hide)
				.bind('click', $this.hide)
				.after(
					content = $('<div />')
						.css($this.cssContent())
						.bind('close', $this.hide)
						.bind('click', contentClick)
				)
				.animate(
					 $this.css($.animableProperties)
					,$this.options('showSpeed')
					,function() {
						visible = true;
						showing = false;
						if($.browser.msie && $.browser.version < 7) {
							$this.callbacks('postShow', ie6RefreshAll, 1);
						}
						$this.callbacks('postShow');
					}
				);

			if($.browser.msie && $.browser.version < 7) {
				$this.callbacks('postInsert', function() {
					overlay
						.bind('refresh', ie6RefreshOverlay);
					content
						.bind('refresh', ie6RefreshContent);
				}, 1);
			}
			$this.callbacks('postInsert');
		}

		,doHide = function() {
			if($.browser.msie && $.browser.version < 7) {
				overlay
					.css($this.css(['height', 'width', 'top', 'left']));
			}
			overlay
				.animate(
					 $this.options('cssPostHide')
					,$this.options('hideSpeed')
					,function() {
						content
							.remove();
						$(this)
							.remove();
						hiding = false;
						visible = false;
						$this.callbacks('postHide');
					}
				);
		};

		this.show = function(fnCallback) {
			if(currentMasque && currentMasque !== $this) {
				currentMasque.hide(function() {
					currentMasque = $this;
					$this.show(fnCallback);
				});
				return;
			}
			if(visible) {
				if(typeof fnCallback === 'function') {
					fnCallback.call($this);
				}
				return;
			}
			if(typeof fnCallback === 'function') {
				$this.callbacks('postShow', fnCallback, 1);
			}
			if(showing) {
				return;
			}
			showing = true;
			$(window).trigger('masqueShowing');
			$this.callbacks('preShow', doShow, 1);
			$this.callbacks('preShow');
		};

		this.hide = function(fnCallback) {
			if(showing) {
				$this.callbacks('postShow', function() {$this.hide(fnCallback)}, 1);
				return;
			}
			if(!visible) {
				if(typeof fnCallback === 'function') {
					fnCallback.call($this);
				}
				return;
			}
			if(typeof fnCallback === 'function') {
				$this.callbacks('postHide', fnCallback, 1);
			}
			if(hiding) {
				return;
			}
			hiding = true;
			$(window).trigger('masqueHiding');
			$this.callbacks('preHide', doHide, 1);
			$this.callbacks('preHide');
		};

		this.visible = function(bSet, fnCallback) {
			if(typeof bSet === 'boolean') {
				if(bSet) {
					$this.show(fnCallback);
				}
				else {
					$this.hide(fnCallback);
				}
			}
			return visible || showing;
		};


		this.hiding = function() {
			return hiding;
		};

		this.overlay = function() {
			return overlay;
		};

		this.content = function() {
			return content;
		};

		this.css		= window.dynamicOptionsManager.call(this, window.masque.defaultCss);
		this.cssContent	= window.dynamicOptionsManager.call(this, window.masque.defaultCssContent);
		this.options	= window.dynamicOptionsManager.call(this, window.masque.defaultOptions);
		this.callbacks	= window.callbacksManager(this, window.masque.defaultCallbacks);

		init();
	};

	window.masque.defaultCss = {
		 position			: ($.browser.msie && $.browser.version < 7) ? 'absolute' : 'fixed'
		,'z-index'			: 9000
		,top				: ($.browser.msie && $.browser.version < 7) ? function() { return $(document).scrollTop() - parseInt($(document.body).css('margin-top'));} : 0
		,left				: ($.browser.msie && $.browser.version < 7) ? function() { return $(document).scrollLeft() - parseInt($(document.body).css('margin-left'));} : 0
		,marginLeft			: 0
		,marginTop			: 0
		,background			: 'black url(/layoutftv/arches/common/images/pictos/loading_popin.gif) no-repeat center center'
		,opacity			: '0.8'
		,width				: ($.browser.msie && $.browser.version < 7) ? function() { return document.documentElement.clientWidth;} : '100%'
		,height				: ($.browser.msie && $.browser.version < 7) ? function() { return document.documentElement.clientHeight;} : '100%'
	};

	window.masque.defaultCssContent = {
		 position			: ($.browser.msie && $.browser.version < 7) ? 'absolute' : 'fixed'
		,'z-index'			: function() { return this.css('z-index') + 1;}
		,top				: ($.browser.msie && $.browser.version < 7) ? function() { return '-'+$(document.body).css('margin-top');} : 0
		,left				: ($.browser.msie && $.browser.version < 7) ? function() { return '-'+$(document.body).css('margin-left');} : 0
		,width				: '100%'
		,height				: ($.browser.msie && $.browser.version < 7) ? function() { return document.documentElement.clientHeight;} : '100%'
	};

	window.masque.defaultOptions = {
		 showSpeed		: 'normal'
		,hideSpeed		: 'normal'
		,closeCls		: 'closePopin'
		,closeOnClick	: true
		,cssPreShow		: { opacity : 0 }
		,cssPostHide	: { opacity : 0 }
	};

	window.masque.defaultCallbacks = {};

	var currentMasque = false,
	elementsBound = {},
	specialEventSetter = function(eventName) {
		var winEvent = eventName === 'masquecover' ? 'masqueShowing' : 'masqueHiding';
		elementsBound[eventName] = elementsBound[eventName] || [];
		return {
			setup: function(data, namespaces) {
				if($(this).length !== 0 && elementsBound[eventName].length === 0) {
					$(window)
						.bind(winEvent, function(e) {
							e.type = eventName;
							for(var i = 0; i < elementsBound[eventName].length; i++) {
								$.event.handle.call(elementsBound[eventName][i], e);
							}
						});
				}
				$(this)
					.each(function() {
						elementsBound[eventName].push(this);
					});
			},

			teardown: function(namespaces) {
				$(this)
					.each(function() {
						var newArray = [];
						for(var i = 0; i < elementsBound[eventName].length; i++) {
							if(elementsBound[eventName][i] !== this) {
								newArray.push(elementsBound[eventName][i]);
							}
						}
						elementsBound[eventName] = newArray;
					});
				if(elementsBound[eventName].length === 0) {
					$(window).unbind(winEvent);
				}
			}
		};
	};

	$.event = $.event || {};
	$.event.special = $.event.special || {};

	$.event.special.masquecover = specialEventSetter('masquecover');
	$.event.special.masqueuncover = specialEventSetter('masqueuncover');

	$(window)
		.bind(
			'keypress.masque',
			function(e) {
				if(e.keyCode === 27) {
					if(currentMasque) {
						currentMasque.hide();
					}
				}
			}
		)
		.bind(
			'masqueHide',
			function() {
				if(currentMasque) {
					currentMasque.hide();
				}
			}
		)
		.bind(
			'masqueShow',
			function() {
				if(currentMasque) {
					currentMasque.show();
				}
			}
		);

})(this, this.jQuery);

(function(window, $, undef) {
	(function(dep) {
		for(var i in dep) {
			if(!dep[i]) {
				throw new Error('Dépendence non satisfaite : '+i);
			}
		}
	})({
		jQuery					: !!$,
		DynamicOptionsManager	: !!window.dynamicOptionsManager,
		CallbacksManager		: !!window.callbacksManager,
		Masque					: !!window.masque
	});

	window.popin = function(mSelector, aArgs) {
		if(!(this instanceof window.popin)) {
			return new window.popin(mSelector, aArgs);
		}

		var $this = this
		,ctntSelector = mSelector
		,skinsLoaded = []
		,ctnr = $('<div />')
		,ctnt = $('<div />')
		,visible = false
		,initOk = false
		,size = {}
		,masque = window.masque(aArgs !== undef ? aArgs.masque : undef)

		,init = function() {
			if(typeof aArgs === 'object') {
				$.each(['postInsert', 'preShow', 'postShow', 'preHide', 'postHide'], function(key, value) {
					if(aArgs[value] !== undef) {
						$this.callbacks(value, aArgs[value]);
						delete(aArgs[value]);
					}
				});
				if(aArgs.skin !== undef) {
					$this.options('skin', [aArgs.skin, $this.options.raw('skin')]);
					delete(aArgs.skin);
				}
				if(aArgs.css !== undef) {
					$this.css(aArgs.css);
					delete(aArgs.css);
				}
				if(aArgs.cssContent !== undef) {
					$this.cssContent(aArgs.cssContent);
					delete(aArgs.cssContent);
				}
				delete(aArgs.masque);
				$this.options(aArgs);
			}

			masque.callbacks('preHide', hide);
			masque.callbacks($this.options('waitBeforeShowingPopin') ? 'postShow' : 'postInsert', show);
			$this.container($this.options('skin'));
			initOk = true;
			if(ctntSelector) {
				$this.content(ctntSelector);
			}
			if($this.options('autoShow')) {
				show();
			}
		}

		,show = function(fnCallback) {
			if(visible) {
				if(typeof fnCallback == 'function') {
					fnCallback.call($this);
				}
				return;
			}
			if(typeof fnCallback == 'function') {
				$this.callbacks('postShow', fnCallback, 1);
			}
			if(!masque.visible()) {
				masque.show();
				return;
			}
			$this.callbacks('preShow', doShow, 1);
			$this.callbacks('preShow');
		}

		,doShow = function() {
			window.popin.currentPopin = $this;
			var cssFull = $this.css()
			,cssPreShow = $.extend({}, cssFull, $this.options('cssPreShow'))
			,cssPostShow = {};
			$.each($.animableProperties, function(key, value) {
				if(cssFull[value] !== undef && cssFull[value] !== cssPreShow[value]) {
					cssPostShow[value] = cssFull[value];
				}
			});
			visible = true;
			ctnr
				.css(cssPreShow)
				.each(function() {
					if($this.options('hideChildren')) {
						ctnt
							.children()
								.hide()
					}
				})
				.appendTo(masque.content())
				.animate(
					 cssPostShow
					,$this.options('showSpeed')
					,function() {
						if($this.options('hideChildren')) {
							ctnt
								.children()
									.show()
						}
						if($.browser.msie) {
							$(this).children().each(function() {
								$(this).attr('style', ($(this).attr('style') || '').replace(/display\s*:\s*(inline)\s*;?/i, '') || false);
							});
							if($(this).css('opacity') == 1) {
								$(this).attr('style', ($(this).attr('style') || '').replace(/filter\s*:\s*alpha[^;]*(;|$)/i, '') || false);
							}
						}
						$this.callbacks('postShow', $this.refreshSize, 1);
						$this.callbacks('postShow');
					}
				);
		}

		,hide = function(fnCallback) {
			if(!visible) {
				if(typeof fnCallback == 'function') {
					fnCallback.call($this);
				}
				return;
			}
			if(typeof fnCallback == 'function') {
				$this.callbacks('postHide', fnCallback, 1);
			}
			if(!masque.hiding()) {
				masque.hide();
				return;
			}
			$this.callbacks('preHide', doHide, 1);
			$this.callbacks('preHide');
			if(typeof arguments.callee.continuer === 'function' && $this.options('waitBeforeHidingMasque')) {
				$this.callbacks('postHide', arguments.callee.continuer, 1);
				return false;
			}
		}

		,doHide = function() {
			visible = false;
			ctnr
				.each(function() {
					if($this.options('hideChildren')) {
						ctnt
							.children()
								.hide()
					}
				})
				.animate(
					 $this.options('cssPostHide')
					,$this.options('hideSpeed')
					,function() {
						$(this)
							.remove()
							.bind('popinShow', show);
						if($this.options('hideChildren')) {
							ctnt
								.children()
									.show()
						}
						window.popin.currentPopin = undef;
						$this.callbacks('postHide');
					}
				);
		}

		,loadSkin = function(skin) {
			if(!skin || skinsLoaded[skin] !== undef) {
				return;
			}
			else {
				skinsLoaded[skin] = true;
				if(typeof skin === 'string' && $this.skins.defined(skin)) {
					skin = $this.skins(skin) || ctnr;
				}
				if(skin instanceof Array) {
					for(var i in skin) {
						loadSkin(skin[i]);
					}
					return;
				}
				if(!(typeof skin === 'string' || skin.nodeType) || $(skin).length === 0) {
					return;
				}
				ctnr = $(skin);
			}
		};

		this.css		= window.dynamicOptionsManager.call(this, window.popin.defaultCss);
		this.cssContent	= window.dynamicOptionsManager.call(this, window.popin.defaultCssContent);
		this.skins		= window.dynamicOptionsManager.call(this, window.popin.skins);
		this.options	= window.dynamicOptionsManager.call(this, window.popin.defaultOptions);
		this.callbacks	= window.callbacksManager(this, window.popin.defaultCallbacks);

		this.show = masque.show;
		this.hide = masque.hide;

		this.container = function(skin) {
			if(arguments.length === 0) {
				return ctnr;
			}

			contentElements = $this.content();

			loadSkin(skin);

			ctnr
				.addClass($this.options('clsContainer'))
				.css($this.css(['position', 'overflow']))
				.unbind('refresh')
				.bind('refresh', $this.refreshSize)
				.each(function() {
					ctnt = $(this)
						.find('.'+$this.options('clsContent')+':first')
						.empty();
					if(ctnt.length === 0) {
						ctnt = $('<div class="'+$this.options('clsContent')+'" />')
							.appendTo(this);
					}
					ctnt
						.css($this.cssContent())
						.append(contentElements);
				});
		};

		this.content = function(mSelector, postInsert) {
			if(arguments.length === 0 || typeof mSelector === 'boolean') {
				return initOk ? ((mSelector === true) ? ctnt : ctnt.contents()) : ctntSelector;
			}
			if(!initOk) {
				ctntSelector = mSelector;
			}
			else {
				if(typeof postInsert === 'function')
					$this.callbacks('postInsert', postInsert, 1);
				ctnt
					.empty()
					.append(mSelector);
				$this.initSize();
				$this.callbacks('postInsert');
			}
		};

		this.initSize = function() {
			if(!visible) {
				ctnr
					.css({
						 top: '-200%'
						,left: '-200%'
						,opacity: 0
					})
					.appendTo('body');
				$this.refreshSize(false);
				ctnr
					.remove();
			}
			else {
				$this.refreshSize();
			}
		};

		this.refreshSize = function(autoRefreshPosition) {
			var oldSize = size;
			ctnr
				.css({
					 height: 'auto'
					,width: 'auto'
				});
			size = {
				  width: ctnr.width()
				 ,height: ctnr.height()
			};
			ctnr
				.css($this.css(['height', 'width']));
			if(autoRefreshPosition !== false) {
				if(oldSize.width != size.width || oldSize.height != size.height) {
					$this.refreshPosition();
				}
			}
		};

		this.refreshPosition = function() {
			ctnr
				.animate(
						 $this.css(['top', 'left', 'marginLeft', 'marginTop'])
						,$this.options('refreshPositionSpeed')
				);
		};

		this.size = function(newSize) {
			if(arguments.length === 0) {
				return size;
			}
			size = {
				  width: newSize.width
				 ,height: newSize.height
			};
		};

		this.masque = function() {
			return masque;
		};

		this.visible = function() {
			return visible;
		};

		init();
	};

	window.popin.skins = {
		 closeBtn		: function() {
							var cssPreShow = this.options('cssPreShow'),
							cssPostHide = this.options('cssPostHide'),
							closeCls = this.masque().options('closeCls');
							if(cssPreShow && (cssPreShow.height !== undef || cssPreShow.width !== undef)) {
								this.callbacks({
									 postShow	: function() {
													this.container()
														.children('.'+closeCls)
															.show();
												}
									,preShow	: function() {
													this.container()
														.children('.'+closeCls)
															.hide();
												}
								});
							}
							if(cssPostHide && (cssPostHide.height !== undef || cssPostHide.width !== undef)) {
								this.callbacks({
									 preHide	: function() {
													this.container()
														.children('.'+closeCls)
															.hide();
												}
								});
							}
							return this.container()
								.append(
									$('<div class="'+closeCls+'" />')
										.css({
											 position	: 'absolute'
											,top		: '-15px'
											,right		: '-15px'
											,'z-index'	: '2'
											,cursor		: 'pointer'
										})
										.append('<img src="/layoutftv/arches/common/stylesheets/img/buttons/closepopin.png" alt="Fermer" />')
								);
						}
	};

	window.popin.defaultCss = {
		 position		: 'absolute'
		,background		: 'white'
		,overflow		: 'visible'
		,left			: function() {return (this.size().width > this.masque().overlay().width()) ? '0' : '50%';}
		,top			: function() {return (this.size().height > this.masque().overlay().height()) ? '0' : '50%';}
		,height			: function() {return (this.masque().overlay() && (this.size().height > this.masque().overlay().height())) ? this.masque().overlay().height() * .95: this.size().height;}
		,width			: function() {return (this.masque().overlay() && (this.size().width > this.masque().overlay().width())) ? this.masque().overlay().width() * .95: this.size().width;}
		,marginTop		: function() {return (this.size().height > this.masque().overlay().height()) ? this.masque().overlay().height() * .025 : '-' + this.size().height / 2 + 'px';}
		,marginLeft		: function() {return (this.size().width > this.masque().overlay().width()) ? this.masque().overlay().width() * .025 : '-' + this.size().width / 2 + 'px';}
		,opacity		: 1
	};

	window.popin.defaultCssContent = {
		height		: ($.browser.msie && $.browser.version <= 7) ? 'auto' : '100%',
		width		: ($.browser.msie && $.browser.version <= 7) ? 'auto' : '100%',
		overflow	: 'auto'
	};

	window.popin.defaultOptions = {
		 autoShow				: true
		,waitBeforeHidingMasque	: true
		,waitBeforeShowingPopin	: true
		,hideChildren			: true
		,showSpeed				: 'slow'
		,hideSpeed				: 'slow'
		,refreshPositionSpeed	: 'slow'
		,clsContainer			: 'popinContainer'
		,clsContent				: 'popinContent'
		,skin					: 'closeBtn'
		,cssPreShow				: {
									opacity			: 0
									,height			: 0
									,width			: 0
									,marginTop		: 0
									,marginLeft		: 0
								}
		,cssPostHide			: {
									 opacity		: 0
								}
	};

	window.popin.defaultCallbacks = {};

	$.fn.popin = function(oCible, aArgs) {
		if(oCible === undef || !(oCible instanceof String || oCible instanceof $ || oCible.nodeType !== undef)) {
			aArgs = oCible;
			oCible = !!$(this).parents('body').length ? $(this).clone() : $(this);
		}
		return this.bind('popinShow', (new window.popin(oCible, aArgs)).show);
	};

	$.fn.popinTrigger = function(oContent, aArgs, sEvent) {
		if(arguments.length === 2 && typeof aArgs === 'string') {
			sEvent = aArgs;
			aArgs = {};
		}

		sEvent = sEvent || 'click';
		aArgs = aArgs || {};

		aArgs.autoShow = false;

		return this
			.each(function() {
				var myPopin,
				options = $.extend({}, aArgs),
				ret = ((sEvent.indexOf('click') !== -1) && this.tagName === 'A') ? false : undef;

				options.trigger = $(this);

				myPopin = window.popin((typeof oContent === 'function') ? oContent.call(options.trigger) : oContent, options);

				options.trigger
					.bind(sEvent, function() {
						myPopin.options('trigger', this);
						myPopin.show();
						return ret;
					});

				if(parseFloat($.fn.jquery) >= 1.3) {
					options.trigger.data('popinTrigger', {instance: myPopin});
				}
			});
	};

	var ajaxContentGetter = function($this, callback) {
		var contentUrl = $this.options('nextContentUrl'),
		cibleSelector = $this.options('cibleSelector') || '';
		$this.content(true).animate({opacity:0},'fast');
		$.ajax({
			url			: contentUrl.setQueryStringValue('ajax', encodeURIComponent(cibleSelector)),
			type		: 'GET',
			dataType	: 'text',
			success		: function(data) {
							$this.options({
								contentUrl		: contentUrl,
								nextContentUrl	: undef
							});

							var patternCyberMonitor = /var ftvi_(portail|section|rubrique)\s+=('|")(.*?)('|");/,
							cyberMonitorData = {
								client	: window.ftvi_portail,
								section	: window.ftvi_section,
								rubrique: window.ftvi_rubrique
							},
							matches;

							while(matches = patternCyberMonitor.exec(data)) {
								var property = (matches[1] === 'portail') ? 'client' : matches[1];
								cyberMonitorData[property] = matches[3];
							}

							data = data
								.replace(/<script(.|\s)*?\/script>/ig, '');

							var idxBody = data.indexOf('<body');
							if(idxBody !== -1) {
								data = data.slice(idxBody).replace(/^<body[^>]*>/, '');
								idxBody = data.indexOf('</body>');
								if(idxBody !== -1) {
									data = data.slice(0, idxBody);
								}
							}

							if(cibleSelector !== undef) {
								$('<div />')
									.html(data)
									.find(cibleSelector)
										.each(function() {
											if(!(data instanceof $)) {
												data = $([]);
											}
											data = data.add(this);
										});
							}
							$this.content(data);

							if(typeof window.callCybermonitor === 'function') {
								window.callCybermonitor(cyberMonitorData);
							}
						},
			error		: function() {
							var prev = $this.options('contentUrl');
							if(prev !== undef) {
								$this.content('Erreur de chargement.<br /><a href="'+$this.options('contentUrl')+'">Retour</a>');
							} else {
								$this.content('Erreur de chargement.');
							}
						},
			complete	: function() {
							$this.content(true)
								.stop()
								.animate({opacity:$this.cssContent('opacity') || 1}, 'fast');
							if(typeof callback === 'function') {
								callback();
							}
						}
		});
	};

	$.fn.popinAjaxTrigger = function(contentUrl, aArgs, sEvent) {
		if(!/^(string|function)$/.test(typeof contentUrl)) {
			sEvent = aArgs;
			aArgs = typeof contentUrl === 'object' ? contentUrl : {};
			contentUrl = function() {
				if(!this.options.defined('trigger')) {
					return '';
				}
				return $(this.options('trigger')).attr('href');
			};
		}
		else if(typeof aArgs === 'string') {
			var e = sEvent;
			sEvent = aArgs;
			aArgs = typeof e === 'object' ? e : {};
		}
		else {
			aArgs = aArgs || {};
		}

		aArgs.nextContentUrl = contentUrl;
		aArgs.preShow = [
			[
				function() {
					var $this = this,
					containerId = this.container().attr('id');

					if(!containerId) {
						containerId = 'popin'+(+new Date);
						this.container().attr('id', containerId);
					}

					if(aArgs.handleLinks !== false && $.fn.live) {
						$('#'+containerId+' .'+this.options('clsContent')+' a:not(.noajax)')
							.live('click', function() {
								$this.options('nextContentUrl', this.href);
								ajaxContentGetter($this);
								return false;
							});
					}

					ajaxContentGetter(this, arguments.callee.continuer);
					return false;
				},
				1
			],
			aArgs.preShow
		];

		if(aArgs.handleLinks !== false && !$.fn.live) {
			var initPopinContent = function() {
				var $this = this;
				$('a:not(.noajax)', this.content(true))
					.click(function() {
						$this.options('nextContentUrl', this.href);
						ajaxContentGetter($this);
						return false;
					});
			};
			aArgs.postInsert = [
				function() {
					if(this.visible()) {
						initPopinContent.call(this);
					}
					else {
						this.callbacks('postShow', initPopinContent, 1);
					}
				},
				aArgs.postInsert
			];
		}

		return this.popinTrigger('', aArgs, sEvent);
	};
})(this, this.jQuery); 
(function(window, $, undef) {
	(function(dep) {
		for(var i in dep) {
			if(dep[i] === undef || dep[i] === false) {
				throw new Error('Dépendence non satisfaite : '+i);
			}
		}
	})({
		jQuery					: $
	});

	/**
	 * Plug-in jQuery manageFilInfoPage
	 * 
	 * @return {jQuery}				Selection jQuery d'origine après transformation
	 */
	$.fn.manageFilInfoPage = function() {

		window.callCybermonitor();

		return this.find('.listeDerniereMinute .newsLkIt a')
			.click( function() {
				var objectToCopy = $(this).parents('.newsLkIt');
				
                objectToCopy
					.addClass('active')
						.siblings()
							.removeClass('active');

                var objectTarget = $('.detailsDerniereMinute .ctnt .dataBlk');

				objectTarget
					.empty()
						.hide();

				var objectClone = objectToCopy.clone();

				objectClone 
					.find('.dataBlk .itemTitleBlk')
						.appendTo(objectTarget);

                objectClone
					.find('.hiddenDetails p')
						.appendTo(objectTarget);

				objectTarget
					.fadeIn();     

				window.callCybermonitor();

				return false;
			});
	};
})(this, this.jQuery); 
(function(window, undef) {

	var pattern = ['(\\?|&amp;|&)(', ')(=([^&#]*))?(?=(&amp;|&|#|$))'],

	/**
	 * Récupère des valeurs de la query string d'une URL
	 *
	 * @param	{Array}		aNames		Liste des paramètres à récupérer
	 * @param	{String}	sUrl		URL à traiter (optionel)
	 *
	 * @return	{Object}				Liste des valeurs pour les paramètre trouvés
	 *
	 * Récupère les valeurs d'une liste de paramètres de l'URL fournie (ou de celle courante)
	 */
	getQueryStringValues = function(aNames, sUrl) {
		if(!(aNames instanceof Array))
			throw 'La liste de paramètre doit être un tableau';
		sUrl = (sUrl || window.location.toString());
		var match, results = {}
		,reg = new RegExp(pattern[0]+aNames.join('|')+pattern[1], 'g');
		while(match = reg.exec(sUrl)) {
			results[match[2]] = match[4] || '';
		}
		return results;
	},

	/**
	 * Ajoute une valeur à la query string d'une URL
	 *
	 * @param	{String}				sName			Nom du paramètre à ajouter
	 * @param	{String|undefined|null}	sValue			Valeur du paramètre à ajouter (Suppression du paramètre si undefined ou null)
	 * @param	{String}				sUrl			URL à traiter (optionel)
	 * @param	{String}				bHtmlEntity		utilisation ou non de l'entité HTML &amp; pour le & (optionel)
	 *
	 * @return	{String}								l'URL modifiée
	 *
	 * Récupère les valeurs d'une liste de paramètres de l'URL fournie (ou de celle courante)
	 */
	setQueryStringValue = function(sName, sValue, sUrl, bHtmlEntity) {
		sUrl = (sUrl+'' || window.location+'');
		var sParam
		,aMatches = sUrl.match(new RegExp('^(.*)'+pattern[0]+sName+pattern[1]+'(.*)$'))
		,bDelete = (sValue === null);

		if(!aMatches) {
			if(bDelete) {
				return sUrl;
			}
			sParam = ((sUrl.indexOf('?') != -1) ? (bHtmlEntity ? '&amp;' : '&') : '?')+sName+(sValue?'='+sValue:'');
			return sUrl.replace(/(#.*)?$/, sParam+'$1');
		}
		if(bDelete) {
			if(aMatches[7] === '') {
				return aMatches[1];
			}
			if(aMatches[6] === '#') {
				return aMatches[1] + aMatches[7];
			}
			return aMatches[1] + aMatches[2] + aMatches[7].substr(1);
		}
		return aMatches[1] + aMatches[2] + aMatches[3] + (sValue?'='+sValue:'') + aMatches[7];
	};

	String.prototype.getQueryStringValue = function(sName) {
		return getQueryStringValues([sName], this)[sName];
	};

	String.prototype.getQueryStringValues = function(aNames) {
		return getQueryStringValues(aNames, this);
	};

	String.prototype.setQueryStringValue = function(sName, sValue, bHtmlEntity) {
		return setQueryStringValue(sName, sValue, this+'', bHtmlEntity);
	};
})(this); 
(function(window, undef) {
	window.functionsQueue = window.functionsQueue || function(caller) {
		var liste = []
		,pointeur = -1
		,depile = function() {
			var args = arguments,
			fct;
			pointeur++;
			if(liste.length === pointeur) {
				pointeur = -1;
				return;
			}

			if(liste[pointeur] instanceof Array) {
				liste[pointeur][1]--;
				fct = liste[pointeur][0];
				if(liste[pointeur][1] == 0) {
					remove(pointeur--);
				}
			}
			else {
				fct = liste[pointeur];
			}
			if(typeof fct === 'function') {
				// cette fonction depile devrait pouvoir être déclarée une fois pour toute pour
				// l'instance, car tant que l'on est en attente d'un retour, toute l'instance de file d'attente est bloqué.
				fct.continuer = (function() {
					var done = false;
					return function() {
						if(!done) {
							done = true;
							depile.apply(caller, args);
						}
					};
				})();
				if(fct.apply(caller, args) !== false) {
					depile.apply(caller, args);
				}
			} else {
				remove(pointeur--);
				depile.apply(caller, args);
			}
		}
		,remove = function(idx) {
			if(liste.length === 1) {
				liste = [];
			}
			else if(idx === liste.length -1) {
				liste.length = liste.length -1;
			}
			else {
				var i, copie = [];
				for(i = 0; i < liste.length; i++) {
					if(i !== idx) {
						copie[copie.length] = liste[i];
					}
				}
				liste = copie;
			}
		}
		,functionsQueue = function(fct, iterations) {
			if(arguments.length === 0) {
				if(pointeur !== -1) {
					return;
				}
				depile();
			}
			else if(fct !== undef) {
				if(fct instanceof Array) {
					if(fct.length <= 2 && typeof fct[0] === 'function' && (fct[1] === undef || typeof fct[1] === 'number')) {
						arguments.callee(fct[0], fct[1] || iterations);
					}
					else {
						for(var i = 0; i < fct.length; i++) {
							arguments.callee(fct[i], iterations);
						}
					}
				}
				else {
					if(typeof fct !== 'function') {
						throw new Error('Impossible de mettre en attente autre chose qu\'une fonction');
					}
					if(typeof iterations === 'number') {
						fct = [fct, iterations];
					}
					liste[liste.length] = fct;
				}
			}
		};

		functionsQueue.run = function() {
			if(pointeur !== -1) {
				return;
			}
			depile.apply(caller, arguments);
		};
		return functionsQueue;
	};

	window.callbacksManager = window.callbacksManager || function(caller) {
		var i, key, listes = []
		,cbm = function(liste) {
			if(arguments.length === 1) {
				if(typeof liste === 'object') {
					for(var key in liste) {
						cbm(key, liste[key]);
					}
				}
				else if(listes[liste] !== undef) {
					return listes[liste]();
				}
			}
			else if(arguments.length > 1) {
				if(listes[liste] === undef) {
					listes[liste] = window.functionsQueue(caller);
				}
				listes[liste].apply(caller, [].slice.call(arguments, 1));
			}
		}

		,methodHandler = function(methodName) {
			return function() {
				if(typeof this[methodName] === 'function')
					return this[methodName].apply(this, arguments);
			};
		};

		cbm.handleMethods = function(methodName, listeName) {
			if(typeof methodName === 'string') {
				cbm(listeName, methodHandler(methodName));
			}
			else if(typeof methodName === 'object') {
				for(var i in methodName) {
					arguments.callee(i, methodName[i]);
				}
			}
		};

		cbm.run = function(liste) {
			if(listes[liste] !== undef) {
				return listes[liste].run.apply(this, [].slice.call(arguments, 1));
			}
		};

		for(i = 1; i < arguments.length; i++) {
			if(typeof arguments[i] === 'object') {
				for(key in arguments[i]) {
					cbm(key, arguments[i][key]);
				}
			}
		}
		return cbm;
	};
})(this); 
(function(window, $, undef) {
	(function(dep) {
		for(var i in dep) {
			if(dep[i] === undef || dep[i] === false) {
				throw new Error('Dépendence non satisfaite : '+i);
			}
		}
	})({
		jQuery							: $
		,callbacksManager				: window.callbacksManager
	});

	var FilInfoScroller = function(mSelector, oOptions) {
		var iWidth
		,routine = function() {
			stop()
				.animate(
					 {scrollLeft: iWidth}
					,oOpt.timeScroll
					,function() {
						next.call(this);
						pTimeout = window.setTimeout(routine, oOpt.timeWait);
					}
				);
		}

		,next = function() {
			$(this)
				.scrollLeft(0)
				.children('ul')
					.children('li:first')
						.appendTo($(this).children('ul'));
		}

		,stop = function(bAnimate) {
			window.clearTimeout(pTimeout);
			if (!oOpt.scrollBackOnStop)
				return $(mSelector).stop();
			if (!bAnimate)
				return $(mSelector)
						.stop()
						.scrollLeft(0);
			$(mSelector)
				.stop()
				.animate(
					 {scrollLeft: 0}
					,oOpt.timeScrollBack
				);
		}

		,destroy = function() {
			$(mSelector).unbind();
			mSelector = null;
			oOpt = null;
			window.clearTimeout(pTimeout);
		}

		,pTimeout

		,oOpt = $.extend({}, $.fn.FilInfo.defaults, oOptions)
		
		,callbacks	= window.callbacksManager(this, { postShow: oOpt.postShow })

		,init = function() {
			
			var fil_link = new String( $(mSelector).children('a').attr('href') );
			fil_link = fil_link.replace("?","&");
			fil_link = encodeURI(fil_link);
			fil_more_category = '?site='+fil_link+'&'+Math.ceil((new Date()).getTime()/60000);
			
			mSelector = $('<div class="'+oOpt.clsWrapper+'" />')
							.appendTo(							
								$(mSelector)
									.empty()
									.prependTo(
										$(mSelector).parent()
									)
							)
							.hover(
								 function() {
									stop(true);
								}
								,routine
							);
			
			$.getJSON(
				 oOpt.urlJson+fil_more_category
				,function(oData) {
				
					if ( oData.filinfo instanceof Array ){
						
						iWidth = $(mSelector).width();
						
						var oContentList = $('<ul />')
												.width(iWidth * oData.filinfo.length)
												.height(1);
						
						$.each(oData.filinfo, function(iKey, sValue) {
							$('<li />')
								.html(sValue)
								.width(iWidth - oOpt.itemPaddingRight)
								.appendTo(oContentList);
						});
					}
					else if ( oData.filbreak instanceof Array ){
						
						$(mSelector)
							.parent()
								.parent()
									.addClass('breakingNews');
									
						iWidth = $(mSelector).width();
						
						var oContentList = $('<ul />')
												.width(iWidth * oData.filbreak.length)
												.height(1);
						
						$.each(oData.filbreak, function(iKey, sValue) {
							$('<li />')
								.html(sValue)
								.width(iWidth - oOpt.itemPaddingRight)
								.appendTo(oContentList);
						});
					}
					else	
						throw 'Le format de données JSON pour le Fil est incorrect';
					
					$(mSelector)
						.append(oContentList)
						.scrollLeft(0)
						.children()
							.hide()
							.height('auto')
							.show(1000);					
					
					oContentList = null;
					pTimeout = window.setTimeout(routine, oOpt.timeWait);
					
					callbacks('postShow');
				}
			);
					
			$(window).unload(destroy);
		};
		
		this.root = function() {
			return mSelector;
		}
		
		init();
	};


	/**
	 * Plug-in jQuery FilInfo
	 * 
	 * @param {Object} oOptions		Options du flashInfo tournant
	 * 
	 * @return {jQuery}				Selection jQuery d'origine après transformation
	 */
	$.fn.FilInfo = function(oOptions) {
		return this.each(function() {
			new FilInfoScroller(this, oOptions);
		});
	};

	$.fn.FilInfo.defaults = {
		 timeScroll			: 3000
		,timeScrollBack		: 'slow'
		,timeWait			: 8000
		,scrollBackOnStop	: false
		,clsWrapper			: 'wrapper'
		,clsMore			: 'more'
		,txtMore			: 'Tous les flashs &gt;&gt;'
		,insertMode			: 'prependTo'
		,itemPaddingRight	: 10
		,urlJson			: '/appftv/filinfo/getFilJson.php'
		,postShow			: undefined
	};

})(this, this.jQuery); 
(function(window, $, undef) {
	(function(dep) {
		for(var i in dep) {
			if(dep[i] === undef || dep[i] === false) {
				throw 'Dépendance non satisfaite : '+i;
			}
		}
	})({
		jQuery							: $
		,jQueryManageFilinfoPage		: $.fn.manageFilInfoPage
		,jQueryPopin					: window.popin
		,jQueryFilInfo					: $.fn.FilInfo
	});

	/**
	 * Plug-in jQuery FilInfo, reunion de tous les fils pour gestion de liens fil-info tournants 
	 * s'ouvrant en popin et gerant la gestion dynamique du contenu de celle-ci
	 */
	
	$.fn.CreateFilPopinLinks = function(options) {
		
		var oOpt = $.extend({}, $.fn.FilInfoPopin.defaults, options);
		
		this.find('a')
			.each( function() {
				var url_get = new String( $(this).attr('href') );
				$(this).popinAjaxTrigger(
					function()
					{
						// Changement des liens pour récupérer le flux en popin
						var fil_link = oOpt.urlHTML;				
						
						var query_position = url_get.indexOf('?');
						if ( query_position != -1 ) {
							fil_link = fil_link + url_get.substr(query_position);
						}
						
						return encodeURI(fil_link);
					},
					{
						clsContent 	: 	oOpt.clsContent
						,skin 		: 	oOpt.skin
						,handleLinks:	false
						,css 		:	{ background: 'transparent' }
						,postShow	: 	function() {
							// Gestion dynamique de la popin une fois ouverte
							this.content(true).manageFilInfoPage();
						}
					}
				);
			})
	};
	 
	$.fn.FilInfoPopin = function(options) {	

		var oOpt = $.extend({}, $.fn.FilInfoPopin.defaults, options);
		
		if ( oOpt.ajaxGet === true )
		{
			// Gestion de l'ouverture en popin sur les liens du fil
			oOpt.postShow = [oOpt.postShow, function() {
				this.root()
					.parent()
						.parent()
							.CreateFilPopinLinks(oOpt);
			}];
			
			return this.FilInfo(oOpt);
		}
		else
			this.CreateFilPopinLinks(oOpt);
	};
	
	$.fn.FilInfoPopin.defaults = {
		urlHTML				: '/appftv/filinfo/getFilHTML.php'
		,skin				: 'closeBtn'
		,clsContent			: 'filinfoPopinContent'		
		,ajaxGet			: true
		,autoScroll			: true
	};

})(this, this.jQuery);
