silas / FzzzSd

// ==UserScript==
// @name           FzzzSd
// @namespace      ici
// @include        http://*.fourmizzz.fr/*
// @include        http://*.antzzz.org/*
// @author         Sdamien
// @description    Sdamien script pour Fourmizzz.fr, antzzz.org
// @version        1.0.64
// @updateURL	   https://openuserjs.org/meta/silas/FzzzSd.meta.js
// @license MIT
// ==/UserScript==
var urlHost     = document.location.host;		// s2.fourmizzz.fr
var urlPathname = document.location.pathname;	// /messagerie.php
var urlSearch   = document.location.search;		// ?NouveauMess&t=m4lc

var cniveau= new Array();
var lniveau= new Array();

// GRAPH -------------------------------------------------------------------

// var div = document.createElement('div');
// div.setAttribute("id","chart_div")
// div.setAttribute("style","width: 900px; height: 500px;")
// div.innerHTML='hello chartxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
// document.getElementById('centre').appendChild(div);


// var script = document.createElement('script');
// script.type = 'text/javascript';
// script.innerHTML="\
// function gLoaded(){\
		// function drawChart() {\
		// var data = google.visualization.arrayToDataTable([\
		  // ['Task', 'Hours per Day'],\
		  // ['Work',     11],\
		  // ['Eat',      2],\
		  // ['Commute',  2],\
		  // ['Watch TV', 2],\
		  // ['Sleep',    7]\
		// ]);\
		// var options = {\
		  // title: 'My Daily Activities'\
		// };\
		// var chart = new google.visualization.PieChart(document.getElementById('chart_div'));\
		// chart.draw(data, options);\
	  // }\
	// google.load('visualization', '1', {packages:['corechart']});\
	// alert(google);\
	// google.setOnLoadCallback(drawChart);\
// }\
// "
// document.getElementsByTagName('head')[0].appendChild(script);

// var script = document.createElement('script');
// script.type = 'text/javascript';
// script.src = "http://www.google.com/jsapi?callback=gLoaded";
// document.getElementsByTagName('head')[0].appendChild(script);



// --------------------------------------------------------------------------

//----------------------------------------------------------------------------------------------------------
Sdversion='FzzzSd 1.0.63' //12-11-2017
//----------------------------------------------------------------------------------------------------------
comptePlus=false
var script = document.getElementsByTagName('script');
for (i=0; i<script.length; i++) {
	if (script[i].innerHTML.search("lancerCreerBoiteComptePlus")>0){
		comptePlus=true
		;break;
	}
}
cp='';if(comptePlus){cp='+'};
//----------------------------------------------------------------------------------------------------------
Sdversion+=cp;
if (document.getElementById('centre')){
	// sdtext = document.createTextNode(Sdversion);
	// div=document.createElement("a");
	// div.setAttribute("id","Sdversion")
	// div.innerHTML=Sdversion
	
var elem = document.createElement('a');
elem.setAttribute("id","Sdversion")
elem.setAttribute("href","#")
elem.innerHTML=Sdversion
elem.setAttribute("onclick",'alert("Merci utiliser FzzzSd, Il n\'y a pas option ici pour le moment")')
	
elemversion=elem	
	
	var centre = document.getElementById('centre');
	//centre.insertBefore(elem,centre.firstChild);
}
else {
	id='logo_fourmizzz'
	Sdversion='<span style="font-size:0.2em;">'+Sdversion+'</span>'
	document.getElementById(id).innerHTML =document.getElementById(id).innerHTML+Sdversion
}
//document.getElementById('centre').innerHTML ='<table align="right"><tr><td width="230">'+Sdversion+'</td></tr></table>'+document.getElementById('centre').innerHTML;
//----------------------------------------------------------------------------------------------------------
// modif theme
function MOD_theme(){
	pub_rectangle=document.getElementById('pub_rectangle');
	if(pub_rectangle){pub_rectangle.parentNode.removeChild(pub_rectangle);}
	
	gauche=document.getElementById('gauche');
	centre=document.getElementById('centre');
	droite=document.getElementById('droite');
	bcp=document.getElementById('boite_compte_plus');
	binfo=document.getElementById('boite_info');
	pub=document.getElementById('pub_rectangle');
	menuligne=document.getElementById('menu_ligne');

	if (pub){gauchew=330;}
	else    {gauchew=240;}
	if(gauche){gauche.setAttribute("style","width : "+gauchew+"px;")};
	
	if(centre){centre.setAttribute("style","left : "+gauchew+"px;")};
	if(centre){centre.style.left=gauchew+"px;"};
		
	if(droite){droite.setAttribute("style","width : 0px")};
	if (comptePlus){bcp.setAttribute("style","left : 5px");}
	if(binfo){binfo.setAttribute("style","left : 5px;");}
	if (pub){pub.setAttribute("style","left : 5px");}
	l=gauchew+10
	if(menuligne){menuligne.setAttribute("style","left : "+l+"px;");}

	switch(urlPathname){
	case "/Membre.php":
		// theme change
		var idtexte=document.getElementById('texte');
		var tables = idtexte.getElementsByTagName('table');
		var td = tables[0].getElementsByTagName('td');
		//tables[0].setAttribute('border','"1"')
		//tables[2].innerHTML=''
		for (i=0; i<td.length; i++) {
			img=td[i].getElementsByTagName('img')
			if (img.length>0){
				td[i].innerHTML='';
			}
		}
				TR = document.createElement ("tr");
				TD = document.createElement ("td");
				TD=tables[2];
			TR.appendChild(TD);

		  tables[0].appendChild(TR);
		// theme change
	break;
	}
}
//----------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------
function setserveur(){
	ar=document.getElementById('serveur')
	if (ar != null){
		for(i=0; i<ar.length; i++) {
			if (ar.options[i].value==urlHost){
				ar.options[i].selected = true;
			}
		}
	}
}
//----------------------------------------------------------------------------------------------------------
function setCookie(sName, sValue,iJour) {
	var today = new Date(), expires = new Date();
	expires.setTime(today.getTime() + (iJour*24*60*60*1000));
	document.cookie = sName + "=" +sValue + "; expires=" + expires.toUTCString();
}
//----------------------------------------------------------------------------------------------------------
function getCookie(name){
	if (document.cookie.length > 0){
	var texte=name+"=";
	var table=document.cookie.split(/;/);
	var valeur="";
		for (i=0;i<table.length;i++){
			if(table[i].indexOf(texte)!= -1){
			valeur = table[i].substring(Number(texte.length + table[i].indexOf( texte)), table[i].length);
			}
		}
	}
	return valeur;
}
//----------------------------------------------------------------------------------------------------------
function formatsep(nStr, outMil,inD, outD)
{
	inD=inD || '.';
	outD=outD || '.';
	sep=outMil || ' ';

	nStr += '';
	var dpos = nStr.indexOf(inD);
	var nStrEnd = '';
	if (dpos != -1) {
		nStrEnd = outD + nStr.substring(dpos + 1, nStr.length);
		nStr = nStr.substring(0, dpos);
	}
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(nStr)) {
		nStr = nStr.replace(rgx, '$1' + sep + '$2');
	}
	return nStr + nStrEnd;
}
//----------------------------------------------------------------------------------------------------------
function units (nbr,Deci)
{
	Deci=Deci || 0
	un= new Array();
	un[0]=1; un[1]=' ';
	if (nbr>100000) {un[0]=1000; un[1]=' K'};
	if (nbr>100000000) {un[0]=1000000; un[1]=' M'};
	if (nbr>100000000000) {un[0]=1000000000; un[1]=' G'};

	nbr=nbr/un[0];
	txt=formatsep(nbr.toFixed(Deci));
	txt+=un[1];
	return txt;
}
function units3 (nbr,Deci)
{
	Deci=Deci || 0;
	un= new Array();
	un[0]=1; un[1]=' ';
	if (nbr>1000) {un[0]=1000; un[1]=' K'};
	if (nbr>1000000) {un[0]=1000000; un[1]=' M'};
	if (nbr>1000000000) {un[0]=1000000000; un[1]=' G'};

	nbr=nbr/un[0];
	txt=formatsep(nbr.toFixed(Deci));
	txt+=un[1];
	return txt;
}
//----------------------------------------------------------------------------------------------------------
	function getparam(namep){
		var txt='&'+namep+'='
		var i = urlSearch.indexOf(txt);
		if(i>-1) {
			i += txt.length;
			var b = urlSearch.indexOf('&', i);
			if(b > -1) var valuep = urlSearch.substring(i, b);
			else       var valuep = urlSearch.substring(i);
			return valuep;
		}
	}
//----------------------------------------------------------------------------------------------------------
function preRemplirConvois() {
	// var imat = urlSearch.indexOf('&mat=');
	// var inou = urlSearch.indexOf('&nou=');
	// var ix = urlSearch.indexOf('&x=');
	// var iy = urlSearch.indexOf('&y=');
	// var iname = urlSearch.indexOf('&name=');


	var mat=getparam('mat');
	var nou=getparam('nou');
	//var name=getparam('name');
	//var x=getparam('x');
	//var y=getparam('y');
	//var dx=document.getElementById('x').value;
	//var dy=document.getElementById('y').value;
	//var tname="Cible non valide"
//	if (dx==x && dy==y) {tname=name};

	
	//document.getElementById('y').parentNode.innerHTML += ' pour <b>'+tname+'</b>';
	document.getElementById('input_nbMateriaux').value = mat;
	document.getElementById      ('nbMateriaux').value=mat;
		
	
	document.getElementById('input_nbNourriture').value = nou;
	document.getElementById      ('nbNourriture').value=nou;
	//unsafeWindow.calculOuvriere(); // firefox only, Chrome ignored
			//document.getElementById('input_nbMateriaux').keyup()
		 //unsafeWindow.maj_input_convoi('Materiaux');

}
//----------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------
function preRemplirChasse() {
	document.getElementById('AcquerirTerrain').value=getparam('cm2');;
	for (i=0; i<15; i++) {
		if(document.getElementById('unite'+i))
		{
			document.getElementById('unite'+i).value = getparam('u'+i)||0;
		}
	}
}
//----------------------------------------------------------------------------------------------------------
function sd_membres(){
	var contenu=document.getElementById('centre');
	var tables = contenu.getElementsByTagName('table');
	var a = tables[0].getElementsByTagName('a');

	regxy=new RegExp('x=([0-9]*)[a-zA-Z ]*y=([0-9]*)');
	for (i=0; i<a.length; i++) {
		xy=regxy.exec(a[i].innerHTML);
		ok=xy || false;
		if(ok){break;};
	}
	if(ok)
	{
	vous=pseudo
	re=new RegExp('.*Pseudo=([a-zA-Z0-9_-]*)');
	cible=re.exec(urlSearch);
	cible=cible[1]

	if (vous==cible) {
		setCookie("Sd_vousX",xy[1],30);
		setCookie("Sd_vousY",xy[2],30);
		vousX=getCookie("Sd_vousX");
		vousY=getCookie("Sd_vousY");
	}
	else {
		vousX=getCookie("Sd_vousX");
		vousY=getCookie("Sd_vousY");			
		
		if(vousX==''){
			lien = 'http://'+urlHost+'/Membre.php?Pseudo='+vous
			lien +="&jump="+escape(urlPathname+urlSearch);
			location.href=lien;
			vousX=getCookie("Sd_vousX");
			vousY=getCookie("Sd_vousY");
		}
	}
	lniveau=getCookie("Sd_lniveau").split(",");
	if(lniveau==''){
		lien = 'http://'+urlHost+"/laboratoire.php?jump="+escape(urlPathname+urlSearch);
		location.href=lien;
		lniveau=getCookie("Sd_lniveau").split(",");
	}

	v=lniveau[7];
	x= Math.abs(vousX-xy[1]);
	x=x*x;
	y=Math.abs(vousY-xy[2]);
	y=y*y;
	
	d=Math.sqrt(x+y);
	
	t=((1-Math.exp(-d/350))*7.375*Math.pow(0.9,v));
	ttt=t;
	dd=Math.floor(t);
	t=t-dd;
	t=t*24;
	hh=Math.floor(t);
	t=t-hh;
	t=t*60;
	mm=Math.floor(t);
	t=t-mm;
	t=t*60;
	ss=Math.floor(t);
	tt="";
	
	if(hh < 10) hh="0"+hh;
	if(mm < 10) mm="0"+mm;
	if(ss < 10) ss="0"+ss;
	if(dd > 0) tt+=dd+"J_";
	if(dd >0 || hh>0) tt+=hh+"h ";
	if(dd >0 || hh>0 || mm>0)tt+=mm+"m ";
	tt+=ss+"s";
	var JourArrivee = new Date();
	JourArrivee.setTime(JourArrivee.getTime() + ttt*86400*1000);
	var Jour = JourArrivee.getDate();       // r?cup. du jour
	var Mois = JourArrivee.getMonth() + 1;  // calcul du mois
	var Annee = JourArrivee.getYear();        // r?cup. de l'ann?e
	Jour = ((Jour < 10) ? "0" :"") + Jour;
	Mois = ((Mois < 10) ? "0" : "") + Mois;
	if (Annee < 1900) Annee -= 100;
	Annee = ((Annee < 10) ? "0" : "") + Annee;
	var Heure = JourArrivee.getHours();     // r?cup. heure
	var Minute = JourArrivee.getMinutes();  // r?cup. minutes
	var Seconde = JourArrivee.getSeconds(); // r?cup. secondes
	Heure = ((Heure < 10) ? "0" : "") + Heure;
	Minute = ((Minute < 10) ? "0" : "") + Minute;
	Seconde = ((Seconde < 10) ? "0" : "") + Seconde;
	}
	
	function addtr(source,td1,td2){
		TR = document.createElement ("tr");
			TD = document.createElement ("td");
			TD.innerHTML=td1;
			TD.setAttribute("align","right")
		TR.appendChild(TD);
			TD = document.createElement ("td");
			TD.innerHTML=td2;
		TR.appendChild(TD);
	  source.appendChild(TR);
	}
	
	trajet=tt;
	
	arrivee=Jour + '-' + Mois + '-' + Annee + ' &agrave; ' + Heure + ':' + Minute + ':' + Seconde
	if (vousX==''){
		lien = 'http://'+urlHost+'/Membre.php?Pseudo='+vous
		monprofil='<a href="'+lien+'">Mon Profil</a>';
		trajet='cookie manquant aller sur : '+monprofil+' pour le mettre a jour.';
		arrivee="Reculer d'une page apres avoir cliquer sur le lien "+monprofil;
	}
	if(comptePlus==false){
		addtr(tables[0],'Distance : ',Math.floor(d));
		addtr(tables[0],'Temps de trajet : ',trajet);
	}
	addtr(tables[0],'Arriv&eacute;e le : ',arrivee);
}
//----------------------------------------------------------------------------------------------------------
function sd_reine(classe)
{

   var divs = document.getElementsByTagName('td');
   var resultats = new Array();
   al=0
   for(var i=0; i<divs.length; i++) //divs.length
		if(divs[i].className == 'cout_amelioration')
		{
			var div2 = divs[i].getElementsByTagName('span');
			if (div2[2]) {var div3 = div2[2].getElementsByTagName('span')}
			if (al==0) {
			//alert(div3[0].innerHTML)
			}
			al=1
			regms=new RegExp('(([0-9.]*)m )?([0-9.]*)s[^s]*$');
			t=regms.exec(div3[0].innerHTML);
			t
			ok=t || false
			if (ok)
			{
				m=t[2] || 0;
				s=t[3] || 0;
				s=parseFloat(s)+parseFloat(m)*60
				ph=86400/s
				ps=604800/s
				pj=2592000/s
				fh=formatsep(ph.toFixed(0))
				fs=formatsep(ps.toFixed(0))
				fj=formatsep(pj.toFixed(0))
				// txt=''
				// txt+=' '+fh+' /h<br>'
				// txt+=' '+fj+' /j'
				txt='<table border="0" align="right"><tr><td align="center" colspan="2"><b><u>Production</u></b></td></tr><tr>'
				//txt+='<td align="right" colspan="2">'+div2[0].innerHTML+'</td>'//<img src="http://img3.fourmizzz.fr/images/smiley/worker.gif"></img>
				//txt+='</tr><tr>'
				//txt+='<td align="right"colspan="2">'+div2[1].innerHTML+'</td>'
				//txt+='</tr><tr>'
				
				//<img src="http://img3.fourmizzz.fr/images/smiley/worker.gif"></img>
				txt+='<td align="right">'+fh+'</td><td align="">= 24H</td>'
				txt+='</tr><tr>'
				txt+='<td align="right">'+fs+'</img></td><td align="">= 7J</td>'
				txt+='</tr><tr>'
				txt+='<td align="right">'+fj+'</img></td><td>= 30J</td>'
				txt+='</tr><tr>'
				txt+='</tr></table>'
				divs[i].innerHTML =divs[i].innerHTML+txt
			}
		}
   return resultats;
}
//----------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------
function getcommerce(){

cniveau=getCookie("Sd_cniveau").split(",");
if (cniveau==''){
	lien = 'http://'+urlHost+"/construction.php?jump="+escape(urlPathname+urlSearch);
	//location.href=lien;
	cniveau=getCookie("Sd_cniveau").split(",");
}
nbPucerons=parseInt(cniveau[12]);
ouvlevel=10+(0.5*nbPucerons);
freeouv=nb_ouvrieres-quantite_tdc;
freeconv=freeouv*(ouvlevel);
fullconv=nb_ouvrieres*(ouvlevel);
var txt="";
//Alt-`   \340   E0   U+00E0   &agrave;   ?  small a, grave accent
//Alt-b   \342   E2   U+00E2   &acirc;    ?  small a, circumflex accent
//Alt-g   \347   E7   U+00E7   &ccedil;   ?  small c, cedilla
//Alt-h   \350   E8   U+00E8   &egrave;   ?  small e, grave accent
//Alt-i   \351   E9   U+00E9   &eacute;   ?  small e, acute accent
//Alt-j   \352   EA   U+00EA   &ecirc;    ?  small e, circumflex accent
//Alt-k   \353   EB   U+00EB   &euml;     ?  small e, umlaut mark
txt=txt+"L'Etable &agrave; pucerons Niv. <b>"+nbPucerons+"</b> permet de transporter <b>"+ouvlevel+"</b> ressources/ouvri&egrave;re.<br>";
txt=txt+"Il y a  <b>"+units(quantite_tdc)+"</b> de Terrain &agrave; recolter.<br>";
txt=txt+"Il y a  <b>"+units(nb_ouvrieres)+"</b> ouvri&egrave;res dont <b>"+units(freeouv)+"</b> en plus du Terrain.<br>";
txt=txt+"Il est possible de livrer <FONT COLOR='red'><b>"+units(fullconv)+"</b> </font>ressources ou <FONT COLOR='green'><b>"+units(freeconv)+" ressouces</b></FONT> en exploitant le terrain."
//txt=txt+"Pour continuer &agrave; exploiter le terrain il ne faut pas depasser pour les prochaines livraisons <FONT COLOR='green'><b>"+units(freeconv)+" ressouces</b></FONT><br>";
//txt=txt+"<br>";
document.getElementById('message_convoi').parentNode.innerHTML += txt;
if (urlSearch.indexOf('&mat=') > -1 || urlSearch.indexOf('&nou=') > -1) {
	preRemplirConvois();
}
// GRAPH -------------------------------------------------------------------
// var script = document.createElement('script');
// script.type = 'text/javascript';
// script.src = "https://www.google.com/jsapi";
// document.getElementsByTagName('head')[0].appendChild(script);
// --------------------------------------------------------------------------

// google.load('visualization', '1', {packages:['corechart']});\
      // google.setOnLoadCallback(drawChart);\

// var script = document.createElement('script');
// script.type = 'text/javascript';
// script.innerHTML="\
      // function drawChart() {\
        // var data = google.visualization.arrayToDataTable([\
          // ['Task', 'Hours per Day'],\
          // ['Work',     11],\
          // ['Eat',      2],\
          // ['Commute',  2],\
          // ['Watch TV', 2],\
          // ['Sleep',    7]\
        // ]);\
        // var options = {\
          // title: 'My Daily Activities'\
        // };\
        // var chart = new google.visualization.PieChart(document.getElementById('chart_div'));\
        // chart.draw(data, options);\
      // }\
// "
// document.getElementsByTagName('head')[0].appendChild(script);
// --------------------------------------------------------------------------
// var div = document.createElement('div');
// div.setAttribute("id","chart_div")
// div.setAttribute("style","width: 900px; height: 500px;")
// div.innerHTML='hello chartxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
// document.getElementById('centre').appendChild(div);

// GRAPH -------------------------------------------------------------------
	
	
img=document.getElementsByTagName('img');
//alert(img[0].src)
for(var i=0; i<img.length; i++){
	img[i].src=img[i].src.replace("images/icone/icone_pomme.png", "images/icone_pomme.gif");
	img[i].src=img[i].src.replace("images/icone/icone_bois.png", "images/icone_bois.gif");
	
	//	img[i].src=img[i].src.replace("images/icone/icone_pomme.png", "images/icone_bois.gif");
}
}
//----------------------------------------------------------------------------------------------------------
function sd_resources(){
	var oRegex = new RegExp('(consomme <strong>|consumes <strong>)([0-9 ]*)');
	rep=oRegex.exec(document.getElementById('nbMateriaux').parentNode.innerHTML);
	ArmeeConso=parseInt(rep[2].replace(new RegExp("[^0-9]","g"),"" ));
	tdc=document.getElementById('quantite_tdc').innerHTML;
	cniveau=getCookie("Sd_cniveau").split(",");
	tJmat=document.getElementById('nbMateriaux').innerHTML;
	Jmat=parseInt(tJmat.replace(new RegExp("[^0-9]","g"),"" ));
	tJnou=document.getElementById('nbNourriture').innerHTML;
	Jnou=parseInt(tJnou.replace(new RegExp("[^0-9]","g"),"" ));
	var tCapMat=	getCookie("Sd_CapMat");
	var CapMat=parseInt(tCapMat.replace(new RegExp("[^0-9]","g"),"" ));
	var tCapNou=	getCookie("Sd_CapNou");
	var CapNou=parseInt(tCapNou.replace(new RegExp("[^0-9]","g"),"" ));
	var tCapchamp=getCookie("Sd_Capchamp");
	var Capchamp=parseInt(tCapchamp.replace(new RegExp("[^0-9]","g"),"" ));
	// var tStkNou=get_info('nourriture');
	// var StkNou=parseInt(tStkNou.replace(new RegExp("[^0-9]","g"),"" ));
	var StkNou=document.getElementById('nb_nourriture').innerHTML;
	// var tStkMat=get_info('materiaux');
	// var StkMat=parseInt(tStkMat.replace(new RegExp("[^0-9]","g"),"" ));
	var StkMat=document.getElementById('nb_materiaux').innerHTML;
	
	if (document.getElementById('nbNourritureMaitre')) {
		var nbNourritureMaitre=document.getElementById('nbNourritureMaitre').innerHTML;
		var nbMateriauxMaitre=document.getElementById('nbMateriauxMaitre').innerHTML;
		nbNourritureMaitre=parseInt(nbNourritureMaitre.replace(new RegExp("[^0-9]","g"),"" ));
		nbMateriauxMaitre=parseInt(nbMateriauxMaitre.replace(new RegExp("[^0-9]","g"),"" ));
	}
	else {
		var nbNourritureMaitre=0
		var nbMateriauxMaitre=0
	}
	var full = new Date();
//--------------------------------------------------------------------------------------	
	var pleinMat=(CapMat-StkMat)/((Jmat-nbMateriauxMaitre)/24);
	txt="<br><br>Entrepot "
	txt+='<img width="18" height="17" src="http://img3.fourmizzz.fr/images/icone/icone_bois.gif"/>'
	txt+=' plein dans '
	mJJ=parseInt(pleinMat/24);
	mHH=parseInt(pleinMat-mJJ*24);
	m30=(pleinMat-mJJ*24)-mHH
	if(mJJ>0)txt+='<b>'+mJJ+'</b>J ';
	txt+='<b>'+mHH+'</b>h ' 
	if(m30>=0.5)txt+='<b> 30</b>m';
	txt=txt+=". "
	//txt+='<br>(perte colo comprise.Gain colo non compris)';
//--------------------------------------------------------------------------------------	
	var pleinMat=(CapMat)/((Jmat-nbMateriauxMaitre)/24);
	//txt+="<br><br>L\'entrepot de "
	//txt+='<img width="18" height="17" src="http://img3.fourmizzz.fr/images/icone/icone_bois.gif"/>'
	txt+=' (0% a 100% en '
	mJJ=parseInt(pleinMat/24);
	mHH=parseInt(pleinMat-mJJ*24);
	m30=(pleinMat-mJJ*24)-mHH
	if(mJJ>0)txt+='<b>'+mJJ+'</b>J ';
	txt+='<b>'+mHH+'</b>h ' 
	if(m30>=0.5)txt+='<b> 30</b>m';
	txt=txt+=")"
	txt+='<br>(perte colo comprise.Gain colo non compris)';	
//--------------------------------------------------------------------------------------
	var gain=Jnou+Capchamp-ArmeeConso-nbNourritureMaitre
	var pleinNou=(CapNou-StkNou)/((gain)/24);
	txt+="<br>Entrepot ";
	txt+='<img width="18" height="17" src="http://img3.fourmizzz.fr/images/icone/icone_pomme.gif"/>';
	if ((Jnou+Capchamp-ArmeeConso-nbNourritureMaitre)>0) {
		txt+=' plein dans ';
		nJJ=parseInt(pleinNou/24);
		nHH=parseInt(pleinNou-nJJ*24);
		if(nJJ>0)txt+='<b>'+nJJ+'</b> J ';
		txt+='<b>'+nHH+'</b> h ';
//--------------------------------------------------------------------------------------	
		txt+=' (0% a 100% en '
		var pleinNou=(CapNou)/((gain)/24);
		nJJ=parseInt(pleinNou/24);
		nHH=parseInt(pleinNou-nJJ*24);
		if(nJJ>0)txt+='<b>'+nJJ+'</b> J ';
		txt+='<b>'+nHH+'</b> h )';
//--------------------------------------------------------------------------------------
		txt+=" (+"+units3(gain)+"/J)";
//--------------------------------------------------------------------------------------	
		}
	if ((Jnou+Capchamp-ArmeeConso-nbNourritureMaitre)<0){
		var videNou=(-StkNou)/((gain)/24);
		txt+=' sera <font color ="red"><b>VIDE</b></font> dans ';
		nJJ=parseInt(videNou/24);
		nHH=parseInt(videNou-nJJ*24);
		if(nJJ>0)txt+='<b>'+nJJ+'</b> Jours et ';
		txt+='<b>'+nHH+'</b> heures';
		txt+=" (-"+units3(-1*(gain))+"/J)";
	}
	

	//table_conso=document.getElementById('tooltip_conso');	
	//txt+=table_conso.innerHTML;
	//txt+="coucou"
		
		//txt=''
		//alert(table_conso)
	document.getElementById('nbMateriaux').parentNode.innerHTML+=txt;
}
//----------------------------------------------------------------------------------------------------------
function sd_classementalliances(){
  var t,tech,four
   var m
   var divs = document.getElementsByTagName('table');
   for(var i=0; i<divs.length; i++)
		if(divs[i].className == 'tab_triable'){
			var trs = divs[i].getElementsByTagName('tr');
			var ths = divs[i].getElementsByTagName('th');

			var newth = document.createElement('th');
			newth.innerHTML="TDC Moyen";
			trs[0].appendChild(newth);

			for(var tri=0; tri<trs.length; tri++){
				 var tds = trs[tri].getElementsByTagName('td');
				if (tri>0){

				t=tds[3].innerHTML;
				m=tds[6].innerHTML;
				t=parseInt(t.replace(new RegExp("[^0-9]","g"),"" ));
				var newtd = document.createElement('td');
				newtd.innerHTML=units3(t/m,1);
				newtd.setAttribute("align","right");
				trs[tri].appendChild(newtd);
				//
				tech=tds[4].innerHTML;
				tds[4].setAttribute("align","right");
				tech=parseInt(tech.replace(new RegExp("[^0-9]","g"),"" ));
				four=tds[5].innerHTML;
				tds[5].setAttribute("align","right");
				four=parseInt(four.replace(new RegExp("[^0-9]","g"),"" ));

				var x=units3(tech/m,0);
				if (x<100) x='0'+x;
				if (x<10) x='0'+x;
				tds[4].innerHTML+=' ['+x+']';
				var x=units3(four/m,0);
				if (x<100) x='0'+x;
				if (x<10) x='0'+x;
				tds[5].innerHTML+=' ['+x+']';
				}
			}
		}
}
//----------------------------------------------------------------------------------------------------------
function ennemitemps(){
	var d,v,t;
	var dd,hh,mm,ss,tt;
	lniveau=getCookie("Sd_lniveau").split(",");
	v=lniveau[7];
	table=document.getElementById('tabEnnemie');
	var trs = table.getElementsByTagName('tr');
	var ths = table.getElementsByTagName('th');

	var newth = document.createElement('th');
	newth.innerHTML="VA="+v;
	trs[0].appendChild(newth);

	for(var tri=0; tri<trs.length; tri++){
		 var tds = trs[tri].getElementsByTagName('td');
		if (tri>0){
			d=tds[5].innerHTML
			var newtd = document.createElement('td');
			t=((1-Math.exp(-d/350))*7.375*Math.pow(0.9,v))
			dd=Math.floor(t);t=t-dd;t=t*24;
			hh=Math.floor(t);t=t-hh;t=t*60;
			mm=Math.floor(t);t=t-mm;t=t*60;
			ss=Math.floor(t);
			tt="";
			//if(dd < 10) dd="0"+dd
			if(hh < 10) hh="0"+hh;
			if(mm < 10) mm="0"+mm;
			if(ss < 10) ss="0"+ss;
			if(dd > 0) tt+=dd+"J_";
			if(dd >0 || hh>0) tt+=hh+":";
			if(dd >0 || hh>0 || mm>0)tt+=mm+":";
			tt+=ss+"s";
			newtd.innerHTML=tt;
			newtd.setAttribute("align","right");
			trs[tri].appendChild(newtd);
		}
	}
}
//----------------------------------------------------------------------------------------------------------
function MsgColorTitre(){
	tables = document.getElementsByTagName('table');
	
	// for(var i=0; i<tables.length; i++){
		// tables[i].setAttribute("border",'1'); 
	// }
	
	doc=document.getElementById('texte');
	tables = doc.getElementsByTagName('table');
	
	var trs = tables[0].getElementsByTagName('tr');
	var ths = tables[0].getElementsByTagName('th');
	
	for(var tri=0; tri<trs.length; tri++){
		var tds = trs[tri].getElementsByTagName('td');
		//if (tds[0].innerHTML==""){ bgcolor="OliveDrab";tds[0].setAttribute("bgcolor",bgcolor);tds[1].setAttribute("bgcolor",bgcolor); }
		
		if (tds.length>2){
			if (tds[1].innerHTML=="Fourmizzz" || tds[1].innerHTML=="Antzzz"){ 
				if (tds[3].innerHTML.search("Convoi arriv")>0)      	                         {color="Maroon ";bgcolor="	DarkSeaGreen"} 
				else if (tds[3].innerHTML.search("Convoi venant ")>0)                            {color="Maroon ";bgcolor="Gold "} 
				else if (tds[3].innerHTML.search("Terrain de chasse de|Hunting field of")>0)     {color="black";bgcolor="MediumPurple "}
				//
				else if (tds[3].innerHTML.search("Terrain de chasse vol|Hunting Field stolen")>0){color="black";bgcolor="DarkOrange"}
				else if (tds[3].innerHTML.search("Rapport de combat|Fight report")>0)            {color="black";bgcolor="	Peru "}
				else if (tds[3].innerHTML.search(" attacks your")>0)                             {color="black";bgcolor="#C962C7"}
				else if (tds[3].innerHTML.search("Nest has fallen")>0)                           {color="black";bgcolor="#C962C7"}
				//
				else if (tds[3].innerHTML.search("Rapport de chasse|Hunting Report")>0)          {color="green";bgcolor="	CadetBlue"}
				else                                                                             {color="green";bgcolor="OliveDrab"}
				//tds[3].innerHTML=tds[3].innerHTML.search("Convoi arriv")
				color=""
				
				
				for(d=1;d<4;d++){
					tds[d].setAttribute("bgcolor",bgcolor); 
				}
				// tds[1].setAttribute("style","color:"+color);
				// a=tds[2].getElementsByTagName('a')
				// a[0].setAttribute("style","color:"+color+"; "+a[0].getAttribute('style'));
				// a=tds[3].getElementsByTagName('a')
				// a[0].setAttribute("style","color:"+color+"; "+a[0].getAttribute('style'));
			}
		}
	}
}

//----------------------------------------------------------------------------------------------------------
setserveur();
// MOD_theme();

boite_info=document.getElementById("boite_info");
boiteInfo=document.getElementById("boiteInfo");
if(boite_info || boiteInfo){
	pseudo=document.getElementById("pseudo").innerHTML;
	nb_ouvrieres=document.getElementById("nb_ouvrieres").innerHTML;
	nb_materiaux=document.getElementById("nb_materiaux").innerHTML;
	nb_nourriture=document.getElementById("nb_nourriture").innerHTML;
	quantite_tdc=document.getElementById("quantite_tdc").innerHTML;
	tag_alliance=document.getElementById("tag_alliance").innerHTML;
//}
switch(urlPathname){
//----------------------------------------------------------------------------------------------------------
case "/AcquerirTerrain.php":
if (urlSearch.indexOf('&chasse=') > -1 || urlSearch.indexOf('?chasse=') > -1) {
	preRemplirChasse();
}
break;
//----------------------------------------------------------------------------------------------------------
case "/Membre.php":
	sd_membres();
break;
//----------------------------------------------------------------------------------------------------------
case "/Reine.php":
	//sd_reine('temps'); // design 2012
	sd_reine('temps_unite'); //design 2013
break;
//----------------------------------------------------------------------------------------------------------
case "/laboratoire.php":
	lname=new Array();
	lniveau[0]="lniveau"
	var oRegex = new RegExp('(niveau|level)([0-9 ]*)');
	var divs = document.getElementsByTagName('td');
	f=0
	for(var i=0; i<divs.length; i++){
		if(divs[i].className == 'desciption_amelioration'){
			f=f+1
			h2=divs[i].getElementsByTagName('h2');
			lname[f]=h2[0].innerHTML
			span=divs[i].getElementsByTagName('span');
			rep=oRegex.exec(span[0].innerHTML)
			lniveau[f]=rep[2]
		}
	}
   // lname=new Array();
   // var divs = document.getElementsByTagName('h2');
   // var resultats = new Array();
   // var oRegex = new RegExp('(niveau|level)([0-9 ]*)');
	// lniveau[0]="lniveau";
   
   // for(var i=0; i<divs.length; i++)
		// if(divs[i].className == 'titre'){
			// rep=oRegex.exec(divs[i].parentNode.innerHTML);
			// lniveau[i]=rep[2];
			// lname[i]=divs[i].innerHTML
		// }
	// texte=document.getElementById('texte');
	// strong=texte.getElementsByTagName('strong');
	
	// cons=new Array();
	// var oRegex = new RegExp('\-(.*)(termi|over in).*');
	// ic=0;
	// cons[1]="0";
	// cons[2]="0";
	// for (i=0;i<strong.length;i++){
		// rep=oRegex.exec(strong[i].innerHTML);
		// if (rep.length>1){ic=ic+1;cons[ic]=rep[1]}
	// }
	 // cons[1]=cons[1].replace(/^\s+|\s+$/g, '') ;
	 // cons[2]=cons[2].replace(/^\s+|\s+$/g, '') ;
	// lniveau[11]=0;
	// lniveau[12]=0;
	// for (i=1;i<=13;i++) {
		// if (lname[i]==cons[1]) {lniveau[11]=i}
		// if (lname[i]==cons[2]) {lniveau[12]=i}
	// }
	setCookie("Sd_lniveau",lniveau.join(","),7)
	//alert(lniveau.join(","))
break;
//----------------------------------------------------------------------------------------------------------
case "/construction.php":
	Bname=new Array();
	cniveau[0]="cniveau"
	var oRegex = new RegExp('(niveau|level)([0-9 ]*)');
	var divs = document.getElementsByTagName('td');
	f=0
	for(var i=0; i<divs.length; i++){
		if(divs[i].className == 'desciption_amelioration'){
			f=f+1
			h2=divs[i].getElementsByTagName('h2');
			Bname[f]=h2[0].innerHTML
			span=divs[i].getElementsByTagName('span');
			rep=oRegex.exec(span[0].innerHTML)
			cniveau[f]=rep[2]
			if (f==1){
				var reg2 = new RegExp('(actuelle:|capacity :|production :)([0-9 ]*)');
				rep=reg2.exec(divs[i].innerHTML)
				setCookie("Sd_Capchamp",rep[2],7);
			}
			if (f==2){
				var reg2 = new RegExp('(actuelle:|capacity :|production :)([0-9 ]*)');
				rep=reg2.exec(divs[i].innerHTML)
				setCookie("Sd_CapNou",rep[2],7);
			}
			if (f==3){
				var reg2 = new RegExp('(actuelle:|capacity :|production :)([0-9 ]*)');
				rep=reg2.exec(divs[i].innerHTML)
				setCookie("Sd_CapMat",rep[2],7);
			}			
			
		}
	}
	// mat=3, nounou=2, champ=1
	// var oRegex = new RegExp('(actuelle:|capacity :|production :)([0-9 ]*)');
	// rep=oRegex.exec(document.getElementById('batiment'+10).innerHTML);
	// setCookie("Sd_CapMat",rep[2],7);
	// rep=oRegex.exec(document.getElementById('batiment'+9).innerHTML);
	// setCookie("Sd_CapNou",rep[2],7);
	// rep=oRegex.exec(document.getElementById('batiment'+3).innerHTML);
	// setCookie("Sd_Capchamp",rep[2],7);

	// texte=document.getElementById('texte');
	// strong=texte.getElementsByTagName('strong');
	
	// cons=new Array();
	// var oRegex = new RegExp('\-(.*)(se termine dans|is complete in).*');
	// ic=0;
	// cons[1]="0";
	// cons[2]="0";
	// for (i=0;i<strong.length;i++){
		// rep=oRegex.exec(strong[i].innerHTML);
		// if (rep.length>1){ic=ic+1;cons[ic]=rep[1]}
	// }
	 // cons[1]=cons[1].replace(/^\s+|\s+$/g, '') ;
	 // cons[2]=cons[2].replace(/^\s+|\s+$/g, '') ;
	// cniveau[14]=0;
	// cniveau[15]=0;
	// for (i=1;i<=13;i++) {
		// if (Bname[i]==cons[1]) {cniveau[14]=i}
		// if (Bname[i]==cons[2]) {cniveau[15]=i}
	// }
	//alert(cniveau.join(","))
	setCookie("Sd_cniveau",cniveau.join(","),7);
	//alert(cniveau.join(","))
break;
//----------------------------------------------------------------------------------------------------------

case "/commerce.php":
	getcommerce();
break;
//----------------------------------------------------------------------------------------------------------
case "/Ressources.php":
	sd_resources()
break;
//----------------------------------------------------------------------------------------------------------
case "/classementAlliance.php":
	sd_classementalliances()
break;
//----------------------------------------------------------------------------------------------------------
case "/ennemie.php":
	ennemitemps(); 
break;
//----------------------------------------------------------------------------------------------------------
case "/fourmiliere.php":

	// var contenu=document.getElementById('texte');
	// orihtml=contenu.innerHTML;

	// contenu.innerHTML=newtxt+orihtml;
break;
//----------------------------------------------------------------------------------------------------------
function getrang(){





}
//----------------------------------------------------------------------------------------------------------
case "/alliance.php":
//pseudo="silas88"
function colorMyally(){
	if(urlSearch.indexOf('?Membres')==0)
		{

		ColorRed  ="color:#FF0000; " // interdit ou hors portee
		ColorGreen="color:#0D7405; " // a portee ou autoriser
		ColorBleu ="color:#0000FF; " //vous
		ColorWhite="color:#FFFFFF; " //meme rang

		tag=document.getElementById("tag_alliance").innerHTML;
		Rx=0
		Rx2=0
		bx=0
		if (tag=="CDF" ||tag=="-CDC-"||tag=="-W-") {Rx=1}
		if (tag=="-CDC-"||tag=="-W-"){Rx2=1}
		if (tag=="-SPA-"){Rx=-1}
		if (tag=="ZEN"){bx=1;Rx=1}
		if (Rx!=0){
			// 2=rang, 3=pseudo, 4=terrain
			var table = document.getElementById("tabMembresAlliance")	
			for (var r=1;r<table.rows.length;r++)
			{
				td=table.rows[r].getElementsByTagName('td');
				a=td[3].getElementsByTagName('a')[0];
				if (a.innerHTML==pseudo){
					a.setAttribute("style",ColorBleu)
					moiTdc=parseInt(td[4].innerHTML.replace(new RegExp("[^0-9]","g"),"" ));
					
					if (bx==0){regrang=new RegExp('([0-9]{1,2}[.]?[0-9]{0,2})[ ]?$')}
					if (bx==1){regrang=new RegExp('^([0-9]{1,2}[.]?[0-9]{0,2})')}
					t=regrang.exec(td[2].innerHTML);

					if (t){var moiRang=parseFloat(t[1])} else {if (Rx==1){moiRang=9999} else {moiRang=-9999}}
					 
					if (Rx2==1){
						moiRang=9999
						regrang=new RegExp('G([0-9]{1,2}[.]?[0-9]{0,2})$');
						t=regrang.exec(td[2].innerHTML);
						if (t) {moiRang=parseFloat(t[1])}
						regrang=new RegExp('P([0-9]{1,2}[.]?[0-9]{0,2})$');
						t=regrang.exec(td[2].innerHTML);
						if (t) {moiRang=parseFloat(t[1])+100}
						regrang=new RegExp('[cC]([0-9]{1,2}[.]?[0-9]{0,2})$');
						t=regrang.exec(td[2].innerHTML);
						if (t) {moiRang=parseFloat(t[1])+200}
					}
				}
			}
		
			for (var r=1;r<table.rows.length;r++)
			{
				td=table.rows[r].getElementsByTagName('td');
				a=td[3].getElementsByTagName('a')[0];
				if (bx==0){regrang=new RegExp('([0-9]{1,2}[.]?[0-9]{0,2})[ ]?$')}
				if (bx==1){regrang=new RegExp('^([0-9]{1,2}[.]?[0-9]{0,2})')}
				t=regrang.exec(td[2].innerHTML);
//-------------------------------------------------------------------------------
				if (t){
					var curRang=parseFloat(t[1])
					//alert(t[1])
					if (Rx2==1){
						curRang=9999
						regrang=new RegExp('G([0-9]{1,2}[.]?[0-9]{0,2})$');
						t=regrang.exec(td[2].innerHTML);
						if (t) {curRang=parseFloat(t[1])}
						regrang=new RegExp('P([0-9]{1,2}[.]?[0-9]{0,2})$');
						t=regrang.exec(td[2].innerHTML);
						if (t) {curRang=parseFloat(t[1])+100}
						regrang=new RegExp('[cC]([0-9]{1,2}[.]?[0-9]{0,2})$');
						t=regrang.exec(td[2].innerHTML);
						if (t) {curRang=parseFloat(t[1])+200}
						// regrang=new RegExp('C');
						// t=regrang.exec(td[2].innerHTML);
						// if (t!=null) {curRang=200}					
					}
					if (Rx==1){var inR=moiRang<=curRang} else {var inR=moiRang>=curRang}
					//alert(moiRang)
					if (inR){td[2].setAttribute("style",ColorGreen)}
					else    {td[2].setAttribute("style",ColorRed)}
				}
				else {
					if (Rx==1){curRang=9999} else {curRang=-9999}
					inR=false
				}
//-------------------------------------------------------------------------------
				curTdc=parseInt(td[4].innerHTML.replace(new RegExp("[^0-9]","g"),"" ));
				var inTdc=((moiTdc>curTdc)&&(moiTdc<curTdc*2)||(moiTdc<curTdc)&&moiTdc*3>curTdc)
				if(inTdc){td[4].setAttribute("style",ColorGreen)} 
				else     {td[4].setAttribute("style",ColorRed)} 
				if (inR && inTdc){
					a.setAttribute("style",ColorGreen)
				}
					if (moiRang==curRang && inTdc){
					a.setAttribute("style",ColorWhite)
				}
			}	
		}	
	}
}
window.addEventListener ("load", colorMyally, false);

break;
//----------------------------------------------------------------------------------------------------------
case "/messagerie.php":
	//MsgColorTitre();
break;
//----------------------------------------------------------------------------------------------------------
case "/Armee.php":
	var Ordername= new Array('xxx','JSN','SN','NE','JS', 'S', 'C', 'A','AE','SE','Tank','Tu','TuE','TankE','CE');
	var sname    = new Array('xxx','jsn','sn','ne','js', 's', 'c','ce', 'a','ae','se','ta','tae','tu','tue');
	var orderid  = new Array(    0,    1,   2,   3,   4,   5,   6,  14,   7,   8,   9,  10,   13,  11,   12);
	var army     = new Array()
	for (id=1;id<=14;id++){army[id]=0}
	centre=document.getElementById('centre');
	tables = centre.getElementsByTagName('table');
	for(var i=0; i<tables.length; i++){
		if(tables[i].className == 'simulateur'){
			for (id=1;id<=14;id++){
				for (pos=1;pos<=3;pos++){
					var oRegex = new RegExp("[(]([0-9]*),\'unite"+id+"\',"+pos);
					rep=oRegex.exec(tables[i].innerHTML);
					
					if(rep){army[id] += parseInt(rep[1]);}
				}
			
			}
		break;
		}
	}
	//alert(army.join(","))
	setCookie('Sd_army',army.join(","),1);
	// text = "<table border='1'><tr><td>COPY</td></tr></table>"
	// sd=document.getElementById('Sdversion')
	// sd.innerHTML+=text

var centre = document.getElementById('centre');
t1='<table border="0" class="simulateur">'

f1=''
f2=' class="ligne_paire"'
for (id=1;id<=14;id++){
	f= (id%2 == 0) ? f2 : f1;
	t1+="<tr"+f+"><td>"+sname[id]+"</td><td>"+army[orderid[id]]+"</td></tr>"
}
t1+='</table>'
// t1t= 'Ordre des fourmis fourmizzz theme jeu 03/2013'
// t2t= 'Ordre des fourmis fichier chasse Ver 3.xx(Tank Elite a la fin)'

t2='<table border="0" class="simulateur">'
id=1 ;t2+="<tr"+f1+"><td>"+Ordername[id]+"</td><td>"+army[id]+"</td></tr>"
id=2 ;t2+="<tr"+f2+"><td>"+Ordername[id]+"</td><td>"+army[id]+"</td></tr>"
id=3 ;t2+="<tr"+f1+"><td>"+Ordername[id]+"</td><td>"+army[id]+"</td></tr>"
id=4 ;t2+="<tr"+f2+"><td>"+Ordername[id]+"</td><td>"+army[id]+"</td></tr>"
id=5 ;t2+="<tr"+f1+"><td>"+Ordername[id]+"</td><td>"+army[id]+"</td></tr>"
id=6 ;t2+="<tr"+f2+"><td>"+Ordername[id]+"</td><td>"+army[id]+"</td></tr>"
id=14;t2+="<tr"+f1+"><td>"+Ordername[id]+"</td><td>"+army[id]+"</td></tr>"
id=7 ;t2+="<tr"+f2+"><td>"+Ordername[id]+"</td><td>"+army[id]+"</td></tr>"
id=8 ;t2+="<tr"+f1+"><td>"+Ordername[id]+"</td><td>"+army[id]+"</td></tr>"
id=9 ;t2+="<tr"+f2+"><td>"+Ordername[id]+"</td><td>"+army[id]+"</td></tr>"
id=10;t2+="<tr"+f1+"><td>"+Ordername[id]+"</td><td>"+army[id]+"</td></tr>"
id=11;t2+="<tr"+f2+"><td>"+Ordername[id]+"</td><td>"+army[id]+"</td></tr>"
id=12;t2+="<tr"+f1+"><td>"+Ordername[id]+"</td><td>"+army[id]+"</td></tr>"
id=13;t2+="<tr"+f2+"><td>"+Ordername[id]+"</td><td>"+army[id]+"</td></tr>"
t2+='</table>'

t21='<table border="0" class="simulateur">'
id=1 ;t21+="<tr"+f1+"><td>"+army[id]+"</td></tr>"
id=2 ;t21+="<tr"+f2+"><td>"+army[id]+"</td></tr>"
id=3 ;t21+="<tr"+f1+"><td>"+army[id	]+"</td></tr>"
id=4 ;t21+="<tr"+f2+"><td>"+army[id]+"</td></tr>"
id=5 ;t21+="<tr"+f1+"><td>"+army[id]+"</td></tr>"
id=6 ;t21+="<tr"+f2+"><td>"+army[id]+"</td></tr>"
id=14;t21+="<tr"+f1+"><td>"+army[id]+"</td></tr>"
id=7 ;t21+="<tr"+f2+"><td>"+army[id]+"</td></tr>"
id=8 ;t21+="<tr"+f1+"><td>"+army[id]+"</td></tr>"
id=9 ;t21+="<tr"+f2+"><td>"+army[id]+"</td></tr>"
id=10;t21+="<tr"+f1+"><td>"+army[id]+"</td></tr>"
id=11;t21+="<tr"+f2+"><td>"+army[id]+"</td></tr>"
id=12;t21+="<tr"+f1+"><td>"+army[id]+"</td></tr>"
id=13;t21+="<tr"+f2+"><td>"+army[id]+"</td></tr>"
t21+='</table>'

ts='<table border="0">'
	ts+='<tr><td align="center" colspan="4"> Ordre des fourmis suivent:</td></tr>'
	ts+='<tr>'
	ts+='<td >theme actuel au (03/2013)</td>'
	ts+='<td></td>'
	ts+='<td colspan="2">fichier chasse Ver 3.xx(TankE a la fin)</td>'
	ts+='</tr>'
	ts+='<tr>'
		ts+='<td align="center">'+t1+'</td>'
		ts+='<td width="40"></td>'
		ts+='<td align="center">'+t2+'</td>'
		ts+='<td align="center">'+t21+'</td>'
	ts+='</tr>'
ts+='</table>'

// var table = document.createElement('table');
// table.innerHTML=ts
// centre.appendChild(table)

var div = document.createElement('div');
div.setAttribute("id","sd_tablecopy")
div.setAttribute("style","display:none")
div.innerHTML='<center>'+ts+'<center>'

var elem = document.createElement('a');
elem.setAttribute("id","sd_showhidecopy")
elem.setAttribute("href","#")
elem.innerHTML="<center><u>Afficher les tableaux pour copie armee<u></center>"
elem.setAttribute("onclick",'ShowHideById("sd_tablecopy","sd_showhidecopy")')
 centre.appendChild(elem)
 centre.appendChild(div)


var script = document.createElement('script');
script.type = 'text/javascript';
// script.src = url;
script.innerHTML='\
function ShowHideById(texte,lien) { \
	var test = document.getElementById(texte).style.display; \
	if (test == "block") {\
	document.getElementById(texte).style.display = "none";\
	txt=document.getElementById(lien).innerHTML;\
	txt=txt.replace("Masquer","Afficher");\
	document.getElementById(lien).innerHTML=txt;\
	} \
	else {\
	document.getElementById(texte).style.display = "block";\
	txt=document.getElementById(lien).innerHTML;\
	txt=txt.replace("Afficher","Masquer");\
	document.getElementById(lien).innerHTML=txt;\
	} \
} \
'
document.getElementsByTagName('head')[0].appendChild(script);




//centre.insertBefore(div,centre.firstChild);
//centre.insertBefore(elem,centre.firstChild);
	
	
break;
//----------------------------------------------------------------------------------------------------------
}
}
	var centre = document.getElementById('centre');
	centre.insertBefore(elemversion,centre.firstChild);
//----------------------------------------------------------------------------------------------------------
thisjump='';
futurjump='';
fulljum='';
a= urlSearch.indexOf('?jump=');
if(a==-1){a= urlSearch.indexOf('&jump=');}
if (a>-1){
	b=urlSearch.indexOf(',',a);
	fulljump=urlSearch.substring(a+6);
	tjump=fulljump.split(',')
	thisjump=unescape(tjump.splice(-1,1))
	qm=thisjump.indexOf('?');
	if (qm==-1){jp='?jump='} else {jp='&jump='}
	url='http://'+urlHost +thisjump;
	if (tjump.length>0){
		url+=jp+tjump.join(',');	 
	}
	location.href = url;
 }

if (urlSearch=='?clr'){
	setCookie('Sd_vousX'   ,'',-1);
	setCookie('Sd_vousY'   ,'',-1);
	setCookie('Sd_lniveau' ,'',-1);
	setCookie('Sd_cniveau' ,'',-1);
	setCookie('Sd_CapMat'  ,'',-1);
	setCookie('Sd_CapNou'  ,'',-1);
	setCookie('Sd_Capchamp','',-1);
	setCookie('Sd_army'    ,'',-1);
	alert('Fzzzsd Cookies effacer')
}
// alert("fin");
//----------------------------------------------------------------------------------------------------------