/** 
* @alias publicite.js
* @projectDescription France 2 & France 3, versions 3.0
* @author	[FTVI] Nicolas Deveaud
*/

// évite que l'utilisation de document.write après le chargement du DOM efface la page
document.write = (function() {
	document._write = document.write;
	var action = false;
	var jqed = false;
	return function(content) {
		if(typeof jQuery == 'function' && !jqed) {
			jqed = true;
			jQuery(window).load(function() {
				action = function(ctnt) {
					jQuery('body').get(0).innerHTML+= ctnt;
				};
			});
		}
		if(typeof action == 'function')
			action(content);
		else
			document._write(content);
	};
})();

function OAS_AD(pos) {
	var reg = new RegExp(pos+'(,|$)');
	if(typeof OAS_RICH == 'function' &&
	  typeof OAS_listpos == 'string' &&
	  reg.test(OAS_listpos)) {
		try {
			OAS_RICH(pos);
		} catch(e) {}
		OAS_listpos = OAS_listpos.replace(reg, '');
	}
}

(function() {
	if(typeof OAS_sitepage != 'string' ||
	  typeof OAS_listpos != 'string')
		return;

	var OAS_url ='http://pub.ftv-publicite.fr/RealMedia/ads/'
		+'adstream_mjx.ads/'
		+ OAS_sitepage
		+'/1'
		+ (Math.random()+'').substring(2, 11)
		+'@'
		+ OAS_listpos;

	document.write('<script type="text/javascript" src="' + OAS_url + '"><\/script>');
})();