var groupId = Math.floor(Math.random()*1000000000);var error_message = "Une erreur est survenue !!\n\nRaffraichissez votre navigateur...";var block1_content = '';////////////////////////////////////////////////////////////////////////////////////////////////////////////////////function findObj(theObj, theDoc){  var p, i, foundObj;    if(!theDoc) theDoc = document;  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)  {    theDoc = parent.frames[theObj.substring(p+1)].document;    theObj = theObj.substring(0,p);  }  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];  for (i=0; !foundObj && i < theDoc.forms.length; i++)     foundObj = theDoc.forms[i][theObj];  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++)     foundObj = findObj(theObj,theDoc.layers[i].document);  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);  return foundObj;}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////function myCallBackOnFinishUp(obj){ 	document.getElementById('block1').innerHTML = block1_content; 	//Cookie.set('ma_une_perso_active',1);	//initBlock();	//new Effect.BlindDown(obj.element.id,{duration:3,afterFinish: myCallBackOnFinishDown}); 			}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////function myCallBackOnFinishDown(obj){	//alert(block1_content);	}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////function active_votre_une(){			var opt = {		method: 'get',		onSuccess: function(t) {			block1_content = t.responseText;			//new Effect.BlindUp('block_votre_une',{duration:3,afterFinish: myCallBackOnFinishUp});			document.getElementById('block_votre_une').innerHTML = block1_content;		 	Cookie.set('ma_une_perso_active',1);			initBlock();					},		// Handle 404		on404: function(t) {			alert(error_message);		},		// Handle other errors		onFailure: function(t) {			alert(error_message);		}	}	new Ajax.Request('/static/your_block.php', opt);	}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////function desactive_votre_une(){		var opt = {		method: 'get',		// Handle successful response		onSuccess: function(t) {			block1_content = t.responseText;			//new Effect.BlindUp('block_votre_une',{duration:3,afterFinish: myCallBackOnFinishUp});				Sortable.destroy('thelist');				Cookie.set('ma_une_perso_active',0);			document.getElementById('block_votre_une').innerHTML = block1_content;							},		// Handle 404		on404: function(t) {			alert(error_message);		},		// Handle other errors		onFailure: function(t) {			alert(error_message);		}	}		new Ajax.Request('/shared/your_block_news_default.shtml', opt);	}var configAllOpened = false;////////////////////////////////////////////////////////////////////////////////function openConfigAll(){	var opt = {		method: 'get',		// Handle successful response		onSuccess: function(t) {			document.getElementById('config_all').innerHTML = t.responseText;			if(!forConfig)				new Effect.BlindDown('config_all');							configAllOpened = true;			forConfig = 0;						document.getElementById("block_list").innerHTML = "";			for(var i=0;i<tabBlocks.length;i++)			{				document.getElementById("block_list").innerHTML += "<li id='config_your_block_"+i+"' style='zoom:1;'><div style='float:left;zoom:1;'>"+tabBlocks[i]['title']+" ("+tabBlocks[i]['limit']+" article)</div> <div style='float:right;'><a href='javascript://' onclick='delBlock("+i+");' align='right'>X</a></div><span style='clear:both;'></span><div class='clear'></div></li>";			}						Sortable.create('block_list',{onUpdate:getNewConfig});		},		// Handle 404		on404: function(t) {			alert(error_message);		},		// Handle other errors		onFailure: function(t) {			alert(error_message);		}	}		if(!configAllOpened)		new Ajax.Request('/static/your_block_config.php', opt);		else		close_config_all();		}////////////////////////////////////////////////////////////////////////////////function delBlock(id){	var tmpData = new Array();	for(var i=0;i<tabBlocks.length;i++)	{		if(id != i)		{			if(tabBlocks[i] != 'undefined' && tabBlocks[i].id != 'undefined')			{				tmpData.push(tabBlocks[i]);			}		}	}	tabBlocks = tmpData;		var str_serialize = serialize_tabBlocks(tabBlocks);	Cookie.set('ma_une_perso',str_serialize);	Cookie.set('ma_une_perso_active',1);		setTimeout('reloadConfigAll()',100);}////////////////////////////////////////////////////////////////////////////////function reloadConfigAll(){	if(document.getElementById("block_list"))	{		document.getElementById("block_list").innerHTML = "";		for(var i=0;i<tabBlocks.length;i++)		{			document.getElementById("block_list").innerHTML += "<li id='config_your_block_"+i+"' style='zoom:1;'><div style='float:left;zoom:1;'>"+tabBlocks[i]['title']+" ("+tabBlocks[i]['limit']+" article)</div> <div style='float:right;'><a href='javascript://' onclick='delBlock("+i+");' align='right'>X</a></div><span style='clear:both;'></span><div class='clear'></div></li>";				}				Sortable.create('block_list',{onUpdate:getNewConfig});	}	if(!reloadNotAllblock)		initBlock();	reloadNotAllblock = 0;}////////////////////////////////////////////////////////////////////////////////function close_config_all(){	configAllOpened = false;	new Effect.BlindUp('config_all');}////////////////////////////////////////////////////////////////////////////////function serialize_tabBlocks(data){var str_serialize = '';	for(var i=0;i<data.length;i++)	{		if(i>0)			str_serialize+='|NEWLINE|';		str_serialize+=escape(data[i]['id'])+'|SEPARATOR|';		str_serialize+=escape(data[i]['title'])+'|SEPARATOR|';		str_serialize+=escape(data[i]['collection'])+'|SEPARATOR|';		str_serialize+=escape(data[i]['limit']);	}	return str_serialize;}//////////////////////////////////////function unserialize_tabBlocks(str){	var str = new String(str);	var data = new Array();	var data_0 = str.split('|NEWLINE|');	for(var i=0;i<data_0.length;i++)	{		var data_1 = data_0[i].split('|SEPARATOR|');		data[i] = new Array();		data[i]['id'] = unescape(data_1[0]);		data[i]['title'] = unescape(data_1[1]);		data[i]['collection'] = unescape(data_1[2]);		data[i]['limit'] = unescape(data_1[3]);	}	return data;}//////////////////////////////////////function submit_config_all(){	var str_serialize = serialize_tabBlocks(tabBlocks);	Cookie.set('ma_une_perso',str_serialize);	Cookie.set('ma_une_perso_active',1);	new Effect.BlindUp('config_all');	}////////////////////////////////////////////////////////////////////////////////function openConfig(id){	var opt = {		method: 'get',		// Handle successful response		onSuccess: function(t) {			document.getElementById('config_'+id).innerHTML = t.responseText;                   new Effect.BlindDown('config_'+id);		},		// Handle 404		on404: function(t) {			alert(error_message);		},		// Handle other errors		onFailure: function(t) {			alert(error_message);		}	}		new Ajax.Request('/static/your_block_config_2.php?id='+id+'&id_collection='+tabBlocks[(id-1)]['collection']+'&nb='+tabBlocks[(id-1)]['limit'], opt);	}////////////////////////////////////////////////////////////////////////////////function close_config(id){	new Effect.BlindUp('config_'+id);	/*document.getElementById('config_'+id).innerHTML = "";	*/}////////////////////////////////////////////////////////////////////////////////function submit_config(id){	var nb = document.getElementById('nb_article_'+id).value;	var id_collection = document.getElementById('id_collection_'+id).value;	var title = document.getElementById('id_collection_'+id).options[document.getElementById('id_collection_'+id).selectedIndex].firstChild.nodeValue;	tabBlocks[(id-1)]['title'] = title;	tabBlocks[(id-1)]['collection'] = id_collection;	tabBlocks[(id-1)]['limit'] = nb;	var str_serialize = serialize_tabBlocks(tabBlocks);	Cookie.set('ma_une_perso',str_serialize);	Cookie.set('ma_une_perso_active',1);	if(document.getElementById('config_all').style.display != 'none')	{		close_config_all();	}	initBlock();}////////////////////////////////////////////////////////////////////////////////function OpenFilInfo(url){window.open(url,'popupFI','toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=1, copyhistory=0, menuBar=0, width=767, height=570');}//////////////////////////////////////function hover(obj){		UL = obj.getElementsByTagName('ul');		if(UL.length > 0)		{			sousMenu = UL[0].style;	 			if(sousMenu.display == 'none' || sousMenu.display == '')			{				sousMenu.display = 'block';			}			else			{				sousMenu.display = 'none';			}		}}//////////////////////////////////////function init(){	if(document.getElementById('block_votre_une'))		setTimeout('init2()',100);}//window.onload=init;//////////////////////////////////////function init_menu(){	var objs = document.getElementsByClassName('btWithSubMenu');	objs.each(function(ob){		ob.onmouseover=function(){hover(this);};		ob.onmouseout=function(){hover(this);};	});}//////////////////////////////////////function init2(){	var myCookie = Cookie.get('ma_une_perso_active');	if(myCookie)	{		var myCookie = Cookie.get('ma_une_perso');		if(myCookie != undefined && myCookie  != "")			tabBlocks = unserialize_tabBlocks(myCookie);	}	if(tabBlocks.length == 0)	{		tabBlocks[0] = new Array();		tabBlocks[0]['id'] = 1;		tabBlocks[0]['title'] = 'Ligue 1';		tabBlocks[0]['collection'] = 2555;		tabBlocks[0]['limit'] = 2;				tabBlocks[1] = new Array();		tabBlocks[1]['id'] = 2;		tabBlocks[1]['title'] = 'Ligue 2';		tabBlocks[1]['collection'] = 2477;		tabBlocks[1]['limit'] = 2;			}	active_votre_une();}//////////////////////////////////////var tabBlocks = new Array();function initBlock(){		document.getElementById("thelist").innerHTML = "";	Position.includeScrollOffsets = true;    for(var i=0;i<tabBlocks.length;i++)	{				var li_Obj = Builder.node("li",{id:'your_block_'+(i+1),'class':'liBlockCss'});		document.getElementById("thelist").appendChild(li_Obj);				loadBlock((i+1),tabBlocks[i]['collection'],tabBlocks[i]['limit'],tabBlocks[i]['title']);	}}//////////////////////////////////////function loadBlock(id,collection,limit,title){document.getElementById('your_block_'+id).innerHTML = "<div style='text-align:center;'><img src='http://www.mercato365.fr/mediastore/images/design/loading.gif'> Chargement...</div>";	var opt = {		method: 'get',		// Handle successful response		onSuccess: function(t) {			document.getElementById('your_block_'+id).innerHTML = t.responseText;			Sortable.create('thelist',{onUpdate:getBlockConfig});					},		// Handle 404		on404: function(t) {			alert(error_message);		},		// Handle other errors		onFailure: function(t) {			alert(error_message);		}	}		new Ajax.Request('/shared/your_block_news_content.shtml?num='+id+'&collection='+collection+'&limit='+limit+'&title='+escape(title), opt);}//////////////////////////////////////// Config des blockvar forConfig = 0;var reloadNotAllblock = 0;//////////////////////////////////////var getNewConfig = function(obj){	var noueudAtraiter = obj.childNodes;	var tmpData = new Array();	for(var i=0;i<noueudAtraiter.length;i++)	{		if(noueudAtraiter[i] != 'undefined' && noueudAtraiter[i].id != 'undefined')		{			var str = new String(noueudAtraiter[i].id); 			var id = str.substr(18,3);			tmpData.push(tabBlocks[id]);		}	}	tabBlocks = tmpData;	var str_serialize = serialize_tabBlocks(tabBlocks);	Cookie.set('ma_une_perso',str_serialize);		forConfig = 1;	setTimeout('reloadConfigAll()',100);};//////////////////////////////////////var getBlockConfig = function(obj){	var noueudAtraiter = obj.childNodes;	var tmpData = new Array();	for(var i=0;i<noueudAtraiter.length;i++)	{		if(noueudAtraiter[i] != 'undefined' && noueudAtraiter[i].id != 'undefined')		{			var str = new String(noueudAtraiter[i].id); 					var id = str.substr(11,3);			tmpData.push(tabBlocks[(id-1)]);		}	}	tabBlocks = tmpData;	reloadNotAllblock = 1;	var str_serialize = serialize_tabBlocks(tabBlocks);	Cookie.set('ma_une_perso',str_serialize);	setTimeout('reloadConfigAll()',100);};//////////////////////////////////////var add_block = function(){	var nb = document.getElementById('nb_article_config').value;	var id_collection = document.getElementById('id_collection_config').value;	var title = document.getElementById('id_collection_config').options[document.getElementById('id_collection_config').selectedIndex].firstChild.nodeValue;		var id = tabBlocks.length;	var tmpData = new Array();	tmpData['id']=id;	tmpData['title'] = title;	tmpData['collection'] = id_collection;	tmpData['limit'] = nb;			tabBlocks.push(tmpData);	var str_serialize = serialize_tabBlocks(tabBlocks);	Cookie.set('ma_une_perso',str_serialize);	Cookie.set('ma_une_perso_active',1);		setTimeout('reloadConfigAll()',100);};//////////////////////////////////////var Cookie = {  set: function(name, value, daysToExpire) {    var expire = '';    daysToExpire = 9999;    if (daysToExpire != undefined) {      var d = new Date();      d.setTime(d.getTime() + (86400000 * parseFloat(daysToExpire)));      expire = '; expires=' + d.toGMTString();    }    return (document.cookie = escape(name) + '=' + escape(value || '') + expire);  },  get: function(name) {    var cookie = document.cookie.match(new RegExp('(^|;)\\s*' + escape(name) + '=([^;\\s]*)'));    return (cookie ? unescape(cookie[2]) : null);  },  erase: function(name) {    var cookie = Cookie.get(name) || true;    Cookie.set(name, '', -1);    return cookie;  },  accept: function() {    if (typeof navigator.cookieEnabled == 'boolean') {      return navigator.cookieEnabled;    }    Cookie.set('_test', '1');    return (Cookie.erase('_test') === '1');  }};function OpenAgentDeJoueurs(){window.open("/interactif/agent_de_joueurs.shtml",'popupMax','toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=0, copyhistory=0, menuBar=0, width=830, height=605');}	