// ==UserScript==
// @name           InfoCompte
// @namespace      vulca
// @description    InfoCompte v2.4.3d
// @include http://*uni*.ogame.fr/game/index.php*
// @include       http://vulca.evoserv.net/infoCompte/index.php?page=signature*
// ==/UserScript==


/*=================================================================================================================
 DERNIERE MISE A JOUR : 20/07/2009
 TOPIC DU FORUM OFFICIEL : http://board.ogame.fr/thread.php?postid=8634035#post8634035
 SCRIPT POUR OGAME.FR v 0.83*/
 
 
/*=================================================================================================================*/

var url=location.href;
if ((url.indexOf('vulca',0))>=0)
{	
	GM_setValue( 'couleurSign'+parseInt(document.getElementById("univers").innerHTML) , document.getElementById("couleurFond").innerHTML+'-'+ document.getElementById("couleurText").innerHTML);
}
else if(!document.getElementById('playerName'))
{
/* ************************************* Librairie SSU************************************************/

var thisData = 
{
	namespace: 'infocompte', // Nom simplifié. Doit être unique. Eviter les espaces, majuscules & accentuations.
	name: 'InfoCompte', // Nom complet
	version: '2.4.3d', // Version du script
	scriptURL: 'http://vulca.evoserv.net/script/infocompte.user.js', // Lien pour installer le script (fichier hosté)
	options: showOptions // fonction lançant les options
}
var Version = thisData.version;
/*//		changelog::start
2.4.2	
Ajout du lien pour la MaJ du compte sur Alternative

2.4.1
Amélioration du BBcode
anticipation d'un bug avec la nouvelle version

2.4.0
Correction production

2.3.9
Ajout des points par planétes

2.3.7
ajout d'un export BBcode detaillé

2.3.5
Amélioration du systeme de signature

2.3.0
Ajout des signatures

2.2.2
Production calculé par SSU
Ajout de l'univers dans le BBcode

//		changelog::end*/


var declareFun = 
{
	fun: ['Bip', 'addElem', '$', '$A', '$C', '$E', 'id_', 'doTheBlack', 'findPath', 'isData', 'evalFunctions'], // Fonctions que l'on souhaite utiliser.
	proto: ['find'], // Prototypes que l'on souhaite utiliser.
	vari: ['URL', 'JSON', 'DATA', 'actualTime', 'page', 'session', 'server'] // Variables que l'on souhaite utiliser.
};
/**			Il faut modifier les variables qui sont ci-dessus selon les besoins de votre script			**/

// Seyguai's Script - SSU Method
switch (unsafeWindow.ssu) 
{ // Diverses erreurs du script librairie.
	case undefined:
		unsafeWindow.ssu = false;
		return alert("Ce script fait partie d'une suite créée par Seyguai.\nSon bon fonctionnement implique la présence du script \"Seyguai's Scripts Utilities\" fourni sur le site de l'auteur.\n\nSi toutefois ce script est déjà installé, veuillez le placer en première position de la liste des autres scripts GreaseMonkey.\n(Il n'altèrera en rien le fonctionnement des autres scripts)\n\nExécution des scripts SSU interrompue.");
	case false:
		return;
	case 'error':
		unsafeWindow.ssu = false;
		return alert("Une erreur s'est produite lors de l'exécution de la librairie \"Seyguai's Scripts Utilities\". Merci de contacter l'auteur.\n\nExécution des scripts SSU interrompue.");
}

eval(unsafeWindow.ssu.fun.evalFunctions(declareFun)); // Définition des fonctions/prototype/variables

if (unsafeWindow.ssu.fun.addScript(thisData)) // Référencement du script
	return; // false si script bloqué, true sinon.
}
else if(document.getElementById('playerName'))
{
// Détection OGame Redesign
	if(!GM_getValue('newVersionScript', false))
	{
		document.getElementById("inhalt").innerHTML += '<table style="width:650px; margin:auto; text-align:center;"><tr><th style="width:200px; font-weight: bold; color: white; font-size: 12px; border:2px solid black;">OGame Redesign detected</th><th style="width:200px; font-weight: bold; color: white; font-size: 12px; border:2px solid black;">You need this version of the script : <a id="urlNewScript" href="http://userscripts.org/scripts/source/54582.user.js">click there</a></th></tr></table><br/><br/><br/><br/><br/>';
	
		document.getElementById("urlNewScript").addEventListener("click", function(event) 
		{
			GM_setValue('newVersionScript', true);
		}, true);
	}
	
}


/* *******************************************************************************************************************************************************************************************/
/* ********************************************************************* Debut du script InfoCompte**************************************************************************************************/
/* *******************************************************************************************************************************************************************************************

/* ******************************Recuperation de ce qui est utile********************************/
/* ******************************Fonction********************************/
// Affichage du graphique
function draw_pie(data)
{
	var data_url = data.join(","); 
	if(mine)
		{var labels_url = "Mines|Batiments|Technos|Flottes|Defenses";}
	if(BatTotal)
		{var labels_url = "Batiments|Technos|Flotte|Defense";}
	var google_url = "http://chart.apis.google.com/chart?cht=p3&chf=bg,s,efefef00&chs=250x100&chld=M&&chtt=&chl=" + labels_url + "&chco="+CouleurGraph+"&chd=t:" + data_url;
	var img = document.createElement("img");
	img.setAttribute("src",google_url);
	img.setAttribute("align","top");
	if (!debugGraphique) {img.setAttribute("style", "margin-top:-30px");} 
	return img;
}

function calculDefLune(f)
{
	var nb_zero = 11;
	niveau = '';
	listeNiveau ='';
	totNiv =0;
	for (i=0 ; i<DATA.moon.length ; i++)
	{ 

		nb_zero = 7 - parseInt((addTrait(DATA.moon[i].defence[nom_def[f]])+'').length);
		if (nb_zero <0) nb_zero=0;
		
		for (var k=0; k< nb_zero; k++)
			{niveau +='_';}
		
		niveau += addTrait(DATA.moon[i].defence[nom_def[f]])+'';

	listeNiveau += '|'+niveau+'_';
	niveau='';
	totNiv += DATA.moon[i].defence[nom_def[f]];
	
	}
}


function addTrait(nombre)
{
	if (nombre<=0) {return '_____0';} 	
		var str = nombre.toString(), n = str.length;
		if (n <4) {return nombre;} 
		else 
		{
			return  (((n % 3) ? str.substr(0, n % 3) + '_' : '') + str.substr(n % 3).match(new RegExp('[0-9]{3}', 'g')).join('_'));
		}
}

function calculNiv(f)
{
	listeNiveau ='';
	totNiv =0;
	for (i=0 ; i<DATA.planet.length ; i++)
	{ 
		if(DATA.planet[i].building[nom_bat[f]]<0)
			niveau='00';
		else if(DATA.planet[i].building[nom_bat[f]]<10)
			niveau='_'+DATA.planet[i].building[nom_bat[f]];
		else 
			niveau=DATA.planet[i].building[nom_bat[f]];

	listeNiveau += '|_'+niveau+'_';
	totNiv += DATA.planet[i].building[nom_bat[f]];
	}
}

function calculNivLune(f)
{
	listeNiveau ='';
	totNiv =0;
	for (i=0 ; i<DATA.moon.length ; i++)
	{ 
		if(DATA.moon[i].building[nom_bat[f]]<0)
			niveau='00';
		else if(DATA.moon[i].building[nom_bat[f]]<10)
			niveau='_'+DATA.moon[i].building[nom_bat[f]];
		else 
			niveau=DATA.moon[i].building[nom_bat[f]];

	listeNiveau += '|_'+niveau+'_';
	totNiv += DATA.moon[i].building[nom_bat[f]];
	}
}

function calculPlanete()
{
	var nb_zero = 11;
	niveau = '';
	listeNiveau ='';
	totNivCase =0;
	totNivCaseMax = 0;
	listeNiveauUse='';
	listeNiveauMax='';
	listenom='';
	
	for (i=0 ; i<DATA.planet.length ; i++)
	{ 

		nb_zero = 4 - (DATA.planet[i].ceil.used+'').length;
		if (nb_zero <0) nb_zero=0;
		
		for (var k=0; k< nb_zero; k++)
			{niveau +='_';}
		
		niveau += DATA.planet[i].ceil.used;

		listeNiveauUse += '|'+niveau+'_';
		niveau='';
		totNivCase += DATA.planet[i].ceil.used;
	/* *********/
		nb_zero = 4 - (DATA.planet[i].ceil.max+'').length;
		if (nb_zero <0) nb_zero=0;
		
		for (var k=0; k< nb_zero; k++)
			{niveau +='_';}
		
		niveau += DATA.planet[i].ceil.max;

		listeNiveauMax += '|'+niveau+'_';
		niveau='';
		totNivCaseMax += DATA.planet[i].ceil.max;
	}
}


function calculDef(f)
{
	var nb_zero = 11;
	niveau = '';
	listeNiveau ='';
	totNiv =0;
	for (i=0 ; i<DATA.planet.length ; i++)
	{ 

		nb_zero = 7 - parseInt((addTrait(DATA.planet[i].defence[nom_def[f]])+'').length);
		if (nb_zero <0) nb_zero=0;
		
		for (var k=0; k< nb_zero; k++)
			{niveau +='_';
			
			}
		
		niveau += addTrait(DATA.planet[i].defence[nom_def[f]])+'';

	listeNiveau += '|'+niveau+'_';
	niveau='';
	totNiv += DATA.planet[i].defence[nom_def[f]];
	
	}
}

// separateur de milier
function addPoints(nombre)
{
	if (nombre==0) {return nombre;} 
	else 
	{
		var signe = '';
		if (nombre<0)
		{
			nombre = Math.abs(nombre);
			signe = '-';
		}
		var str = nombre.toString(), n = str.length;
		if (n <4) {return signe + nombre;} 
		else 
		{
			return  signe + (((n % 3) ? str.substr(0, n % 3) + '.' : '') + str.substr(n % 3).match(new RegExp('[0-9]{3}', 'g')).join('.'));
		}
	}
}

function pourcent(nombre,ref)
{
	if (ref == 0) 
		{return 0;}
	else
	{
		var pourcent = parseInt(nombre/ref*1000)/10;
		return pourcent;
	}
}

function oui_non_en_checked(oui_non) 
{
	if (oui_non == "true" || oui_non == true) {return "checked";} 
	else {return "unchecked";} 
}


function showOptions() 
{
	var content = doTheBlack(thisData.namespace); // En rapport avec la version 1.1.0 de la librairie, maj du code.
	
	var couleur = new Array('','','','','');
	var listeCouleur = new Array();
	listeCouleur = option[0].split(/,/);

	for (var i=0 ; i< listeCouleur.length ; i++)
		{couleur[i] = listeCouleur[i];}

	for(var i=1 ; i<option.length -1 ; i++)
		{option[i] = oui_non_en_checked(option[i]);}

	var content = doTheBlack(thisData.namespace, true);
		content.addElem('b', {}, thisData.name + ' - Options');
		content.addElem('br');
		var table = content.addElem('table');
			var tr = table.addElem('tr');
				tr.addElem('td', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;'});
			
		tr.addElem('td', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;'});
		tr.addElem('td', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;'});
		
		tr.addElem('tr', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;', align: 'center', colspan: 2}, '<th>Couleurs du graphique (remplissez le nombre de case que vous voulez)</th> <th><input class="couleur" name="couleur" maxlength="6" value="'+couleur[0]+'" type="text" size="8" style="text-align:center;">  <input class="couleur" name="couleur" maxlength="6" value="'+couleur[1]+'" type="text" size="8" style="text-align:center;">  <input class="couleur" name="couleur" maxlength="6" value="'+couleur[2]+'" type="text" size="8" style="text-align:center;">  <input class="couleur" name="couleur" maxlength="6" value="'+couleur[3]+'" type="text" size="8" style="text-align:center;"> <input class="couleur" name="couleur" maxlength="6" value="'+couleur[4]+'" type="text" size="8" style="text-align:center;"></th>');			
		tr.addElem('tr', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;', align: 'center', colspan: 2}, '<th >Afficher les points b'+aaccent+'timents total</th> 					<th><input class="InfoOptions" '+option[1]+' name="batTotal" type="checkbox"></th>');
		tr.addElem('tr', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;', align: 'center', colspan: 2},  '<th>Afficher les points Indestructibles</th> 								<th><input class="InfoOptions" '+option[2]+' name="indestructible" type="checkbox"></th>');
		tr.addElem('tr', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;', align: 'center', colspan: 2}, '<th>Afficher les points Technologie</th> 									<th><input class="InfoOptions" '+option[3]+' name="Techno" type="checkbox"></th>');
		tr.addElem('tr', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;', align: 'center', colspan: 2},  '<th>Afficher les points Flotte</th> 										<th><input class="InfoOptions" '+option[4]+' name="Flotte" type="checkbox"></th>');
		tr.addElem('tr', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;', align: 'center', colspan: 2},  '<th>Afficher les points D'+eaigu+'fense</th> 								<th><input class="InfoOptions" '+option[5]+' name="Defense" type="checkbox"></th>');
		tr.addElem('tr', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;', align: 'center', colspan: 2}, '<th>Afficher le pourcentage des vaisseaux en vol</th> 							<th><input class="InfoOptions" '+option[6]+' name="vol" type="checkbox"></th>');
		tr.addElem('tr', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;', align: 'center', colspan: 2}, '<th>Afficher les points lune</th> 											<th><input class="InfoOptions" '+option[7]+' name="lune" type="checkbox"></th>');
		tr.addElem('tr', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;', align: 'center', colspan: 2}, '<th>Tout afficher sur la m'+echap+'me ligne (pour flotte en vol et points lune)</th> <th><input class="InfoOptions" '+option[8]+' name="br" type="checkbox"></th>');
		tr.addElem('tr', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;', align: 'center', colspan: 2},  '<th>Afficher la progression</th> 											<th><input class="InfoOptions" '+option[9]+' name="prog" type="checkbox"></th>');
		tr.addElem('tr', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;', align: 'center', colspan: 2},  '<th>Cochez si vous '+echap+'tes plusieur sur le m'+echap+'me ordi et m'+echap+'me univers</th><th><input class="InfoOptions" '+option[10]+' name="plein" type="checkbox"></th>');
		tr.addElem('tr', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;', align: 'center', colspan: 2},  '<th>Afficher en couleur en fonction de la progression</th>					<th><input class="InfoOptions" '+option[11]+' name="couleurProg" type="checkbox"></th>');
		tr.addElem('tr', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;', align: 'center', colspan: 2},  '<th>Afficher la progression par jours</th>									<th><input class="InfoOptions" '+option[12]+' name="progJours" type="checkbox"></th>');
		tr.addElem('tr', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;', align: 'center', colspan: 2}, '<th>Afficher la production des mines par jours </th> <th><input class="InfoOptions" '+option[13]+' name="ProdJours" type="checkbox"></th>');
		tr.addElem('tr', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;', align: 'center', colspan: 2}, '<th>Afficher les points par planètes </th> <th><input class="pointPlanete" '+oui_non_en_checked(Point_planete)+' name="pointPlanete" type="checkbox"></th>');
		tr.addElem('tr', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;', align: 'center', colspan: 2}, '<th>BBcode pour les forums types phpbb (size=200%) </th> <th><input class="phpbb" '+oui_non_en_checked(phpbbforum)+' name="ProdJours" type="checkbox"></th>');
		
		
		
		
		
		tr.addElem('tr', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;', align: 'center', colspan: 2}, '<th>Nombre de jours pour la remise à automatique (mettez 0 pour ne pas avoir de remise à 0 automatique)</th> <th><input class="raz" name="raz" maxlength="6" value="'+option[14]+'" type="text" size="8" style="text-align:center;">');
	
	tr.addElem('tr', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;', align: 'center', colspan: 2}, '<th>Couleurs des titres du BBcode </th> <th><input class="colBBcode" name="couleur" maxlength="6" value="'+CoulBBcode+'" type="text" size="8" style="text-align:center;"><input class="colBBcode" name="couleur" maxlength="6" value="'+CoulBBcode2+'" type="text" size="8" style="text-align:center;">  </th>');
	
	
	tr.addElem('tr', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;', align: 'center', colspan: 2}, '<th>Couleurs du fond des signatures </th> <th><input class="couleurSign" name="couleur" maxlength="6" value="'+SignfondR+'" type="text" size="8" style="text-align:center;">  <input class="couleurSign" name="couleur" maxlength="3" value="'+SignfondV+'" type="text" size="8" style="text-align:center;">  <input class="couleurSign" name="couleur" maxlength="3" value="'+SignfondB+'" type="text" size="8" style="text-align:center;"></th>');
	tr.addElem('tr', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;', align: 'center', colspan: 2}, '<th>Couleurs du texte des signatures </th> <th><input class="couleurSign" name="couleur" maxlength="6" value="'+SigntextR+'" type="text" size="8" style="text-align:center;">  <input class="couleurSign" name="couleur" maxlength="3" value="'+SigntextV+'" type="text" size="8" style="text-align:center;">  <input class="couleurSign" name="couleur" maxlength="3" value="'+SigntextB+'" type="text" size="8" style="text-align:center;"></th>');
//	tr.addElem('tr', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;', align: 'center', colspan: 2}, '<th>Couleurs du text des signatures </th> <th><input class="couleurSign" name="couleur" maxlength="6" value="'+SigntextR+'" type="text" size="8" style="text-align:center;">  <input class="couleurSign" name="couleur" maxlength="3" value="'+SigntextV+'" type="text" size="8" style="text-align:center;">  <input class="couleurSign" name="couleur" maxlength="3" value="'+SigntextB+'" type="text" size="8" style="text-align:center;"></th>');

	
	
		
		tr.addElem('tr', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;', align: 'center', colspan: 2},  '<td class="c" colspan="2">Annuler / Enregistrer les modifications :</td>');
		tr.addElem('tr', {class: 'header', style: 'border: 0px none; background-color: transparent; height: 100%;', align: 'center', colspan: 2},  '<th class="boutton_VG"><input title="Utiliser les valeurs de base" value="Valeurs par d'+eaigu+'faut" type="submit" class="Reset_VG"></th><th class="boutton_VG"><input title="Enregistrer les modifications apport'+eaigu+'es" value="Sauver les Options du Script" type="submit" class="Sauver_VG"></th>');
	
			// Definition du code du bouton de reset :
		var Boutton = document.getElementsByClassName("Reset_VG");
		if (Boutton[0]) 
		{
			Boutton[0].addEventListener("click", function() 
			{
				if(confirm("Voulez-vous vraiment utiliser les valeurs par d"+eaigu+"faut ?")) 
				{
					GM_setValue("options"+uni+pseudo, "3333ff;false;false;true;true;true;true;false;false;true;false;true;true;false;0");
					GM_setValue("optionspointplanete"+uni+pseudo, 'true');

					BOUTTON = document.getElementsByClassName("boutton_VG");
					BOUTTON[0].innerHTML = '<a href="http://uni'+uni+'.ogame.fr/game/index.php?page=overview&session='+session+'">Enregistr'+eaigu+' ! Actualisez la page !</a>';
				}
				else 
				{
					alert ("Annulation...");
				}
			}, true);
		}
		// Definition du code du bouton de sauvegarde :
		var Boutton = document.getElementsByClassName("Sauver_VG");
				
		if (Boutton[0]) 
		{
			Boutton[0].addEventListener("click", function() 
			{
			var listecolSign = document.getElementsByClassName('couleurSign');
			if (listecolSign[0].value) 
			{
				var colorsign = listecolSign[0].value+';'+listecolSign[1].value+';'+listecolSign[2].value+'-'+listecolSign[3].value+';'+listecolSign[4].value+';'+listecolSign[5].value;
				
				GM_setValue( 'couleurSign'+uni+coordPM, colorsign);
			}
			
				var Block1 = document.getElementsByClassName('couleur');
				if (Block1[0].value) 
				{
					CouleurGraph='';
					for (var i =0 ; i< Block1.length; i++)
					{
						if (Block1[i].value.length == 6)
						{
							CouleurGraph += Block1[i].value + ',';
						}
					}
				}
				CouleurGraph = CouleurGraph.substring(0, CouleurGraph.length-1)
				
				if(document.getElementsByClassName('pointPlanete')[0].checked)
				{
					GM_setValue("optionspointplanete"+uni+pseudo, 'true');
				}
				else GM_setValue("optionspointplanete"+uni+pseudo, 'false');
				
				var Block1 = document.getElementsByClassName('colBBcode');
				if (Block1[0].value) 
				{
					CouleurBBcode=Block1[0].value+';'+Block1[1].value;				
				}
				
				GM_setValue("colBBcode"+uni+pseudo, CouleurBBcode);
				
				var SOptions = CouleurGraph+';';
				var Block = document.getElementsByClassName('InfoOptions');
				for (var f=0 ; f < Block.length ; f++ )
				{
					if (Block[f].checked) 
						{SOptions += "true;";} 
					else 
						{SOptions += "false;";}
				}
				
				GM_setValue("phpbbforum"+uni+pseudo,document.getElementsByClassName('phpbb')[0].checked);
				
				var Block2 = document.getElementsByClassName('raz');
				if (Block2[0].value) 
					{var nbJours = parseInt(Block2[0].value);}
				
				SOptions += nbJours;
				
				GM_setValue("options"+uni+pseudo, SOptions);
				
				BOUTTON = document.getElementsByClassName("boutton_VG");
				BOUTTON[1].innerHTML = '<a href="http://uni'+uni+'.ogame.fr/game/index.php?page=overview&session='+session+'">Enregistr'+eaigu+' ! Actualisez la page !</a>';
			}, true);
		}
}

if ((!url.indexOf('vulca',0))>=0 && (!document.getElementById('playerName')))
{
	var uni = server.match(/uni(\d+)\.ogame\.fr/)[1];
	var url=location.href;
	var eaigu = String.fromCharCode(233);
	var egrave = String.fromCharCode(232);
	var agrave = String.fromCharCode(224);
	var aaccent = String.fromCharCode(226);
	var et = String.fromCharCode(38);
	var ptvirg = String.fromCharCode(59);
	var apos = String.fromCharCode(39);
	var emaj = String.fromCharCode(201);
	var echap = String.fromCharCode(234);
		
	var codeImg = 'R0lGODlhEAAQAPUAAChsKDA8EdrtwXvEApjWAYnNAur13EZRKoPJAidsJ8PjmJPTAcTxAIzDSJ3ZAbjJmqPdAZPKTJrVGozMHKfgAbvsALXoAHWRCXTAAqviAa/YepnMRFxlQ73hipSahLrgfJTQJ6ncN63If7PbfKPYOMHhl7HmALbch5+lkXS2BIekB4mtBni3BJTLRGu6AnmTCYzHPpS2Sc7t3AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAADIALAAAAAAQABAAAAaOQJlwSCwaE4Bk0igERAzQaARQBDQE2Cy2kSA2FJ3OY1xSmGFDp2b0EXk8qI/m1KLKAK4BiBQKxTgcIAMYdgAYKQEBB4sHiQgDhQMsiZSUBQiRBQsEGSYqiQQFkE0IBQQQK5QUDguYQxOmEBcXLwyrBRNEABsLDhUMwBALG3ZpEpwWFRYEEsVFSEpdTNNFQQA7';

	/* ******************************Option********************************/
	var OptionSauvegarde = GM_getValue("options"+uni+pseudo,"3333ff;false;false;true;true;true;true;false;false;true;false;true;true;0");
	var option = new Array();
	option = OptionSauvegarde.split(/;/);
	
	var CoulBBcode = GM_getValue("colBBcode"+uni+pseudo, '0000FF;ff9933').split(';')[0];
	var CoulBBcode2 = GM_getValue("colBBcode"+uni+pseudo, '0000FF;ff9933').split(';')[1];
	
	if ( CoulBBcode2 == undefined) { CoulBBcode2 = 'ff9933'; GM_setValue("colBBcode"+uni+pseudo, CoulBBcode+';'+CoulBBcode2) }
	
	var phpbbforum = GM_getValue("phpbbforum"+uni+pseudo, false);
	var CouleurGraph = option[0];

	
	
	var BatTotal = false; 
	var indestructible = false; 
	var techno = false; 
	var flottes = false; 
	var Def = false; 
	var VaisseauxVol  = false; 
	var pointLune = false; 
	var sauterLignePourPourcentageFlotteVol = false; 
	var progression = false; 
	var PlusieurSurMemeUni  = false;
	var debugGraphique = false;
	var couleurPoint = false ;
	var ProgJours = true;
	var ProdJours = true;
	var Point_planete = true;

	if (option[1] == 'true')
		{BatTotal = true;} 
	if (option[2] == 'true')
		{indestructible = true;}
	if (option[3] == 'true')
		{techno = true; }
	if (option[4] == 'true')
		{flottes = true; }
	if (option[5] == 'true')
		{Def = true; }
	if (option[6] == 'true')
		{VaisseauxVol  = true;}
	if (option[7] == 'true')
		{pointLune = true;}
	if (option[8] == 'true')
		{sauterLignePourPourcentageFlotteVol = true;}
	if (option[9] == 'true')
		{progression = true;}
	if (option[10] == 'true')
		{PlusieurSurMemeUni  = true; }
	if (option[11] == 'true')
		{couleurPoint = true; }
	if (option[12] == 'false')
		{ProgJours = false; }
	if (option[13] == 'false')
		{ProdJours = false; }
	if (GM_getValue("optionspointplanete"+uni+pseudo, 'true') == 'false')
		{Point_planete = false; }
	
	
	var coordPM = DATA.planet[0].posi ;
	var idPM = DATA.planet[0].id;
	for (var f=0; f<DATA.planet.length ; f++)
	{
		/* ******************************coord PM ********************************/
		if (DATA.planet[f].id < idPM)
		{
			idPM=DATA.planet[f].id ;
			coordPM = DATA.planet[f].posi;
		}
	}
	var CoordPM=coordPM.replace('[','').replace(']','');
	coordPM = coordPM.replace(':','0').replace(':','0').replace('[','').replace(']','');
	
var couleurFT = GM_getValue('couleurSign'+uni +coordPM , '0;0;0-255;255;255').split('-');

	var couleurT =  couleurFT[1].split(';');
	var couleurF =  couleurFT[0].split(';');
			
	SignfondR = couleurF[0].replace(' ','');
	SignfondV =couleurF[1].replace(' ', '');
	SignfondB =couleurF[2].replace(' ', '');
			
	SigntextR = couleurT[0].replace(' ', '');
	SigntextV = couleurT[1].replace(' ', '');
	SigntextB = couleurT[2].replace(' ', '');	
	
	
	
if (page == 'overview')
{ 	
	if(BatTotal)
	{
		var AutreBat = false;
		var mine = false; 
	}
	else
	{
		var AutreBat = true;
		var mine = true; 
	}
		
	if (PlusieurSurMemeUni)
		{GM_setValue("pseudo"+uni,DATA.player.name);}
		
		
		if (PlusieurSurMemeUni)
		{var pseudo = GM_getValue("pseudo"+uni,'');}
	else
		{var pseudo ='';}
	
	var nom_def = new Array('lm', 'lle', 'llo', 'gauss', 'ion', 'pla', 'pb', 'gb', 'mic', 'mip');
	var prixInitial_def = new Array(2,2,8,37,8,130,20,100,10,25);

	
	var nom_techno = new Array('espi', 'ordi', 'arme', 'bouc', 'prot', 'ener', 'hype', 'comb', 'impu', 'phyp', 'lase', 'ions', 'plas', 'rese', 'expe');
	var prixInitial_techno = new Array(1.4,1,1,0.8,1,1.2,6,1,6.6,36,0.3,1.3,7,800,16);

	
	var nom_bat = new Array('mmet', 'mcri' , 'mdet', 'ces', 'cef', 'nan', 'lab', 'ter', 'silo', 'depo', 'cspa','rob', 'hmet', 'hcri', 'hdet', 'base', 'phal', 'port');
	var prixInitial_bat = new Array(0.075,0.072,0.3,0.105,1.44,1600,0.8,150,41,60,0.7,0.720,2,3,4,80,80,8000);
	var exposant = new Array(1.5,1.6,1.5,1.5,1.8,2,2,2,2,2,2,2,2,2,2,2,2,2)
	
	
	var PointsBatimentsTotal =0;
	var PointsMinesTotal=0;
	var PointsDefTotal=0;
	var pointLuneTotal = 0;
	var PointsTechno= 0;
	var PointsDefTotal=0;
	
	var info_bat = true;
	var info_tech = true;
	var info_def = true;
	var prodm = 0;
	var prodc = 0;
	var prodd = 0;
	
	for (var f=0; f<DATA.planet.length ; f++)
	{
	
		/* ******************************Production********************************/
		prodm+= Math.floor(30*DATA.planet[f].building.mmet*Math.pow(1.1,DATA.planet[f].building.mmet) +20); 
		prodc+= Math.floor(20*DATA.planet[f].building.mcri*Math.pow(1.1,DATA.planet[f].building.mcri) +10); 
		prodd+= Math.floor(10*DATA.planet[f].building.mdet*Math.pow(1.1,DATA.planet[f].building.mdet)*(-0.002*DATA.planet[f].maxtemp+1.28));
		
		/* ******************************Batiment********************************/
		for (var i = 0 ; i<nom_bat.length ; i++)
		{		
			if (DATA.planet[f].building[nom_bat[i]] < 0) info_bat = false;
			if (i<3)
			{
				PointsMinesTotal+=Math.floor(prixInitial_bat[i]*(Math.pow(exposant[i],DATA.planet[f].building[nom_bat[i]])-1)/(exposant[i]-1)*1000)/1000;
		//	if(f==0) alert(Math.floor(prixInitial_bat[i]*(Math.pow(exposant[i],DATA.planet[f].building[nom_bat[i]])-1)/(exposant[i]-1)*1000)/1000);
			
			}
			else
			{
				if (i<15) 
					{PointsBatimentsTotal += Math.floor(prixInitial_bat[i] *(Math.pow(exposant[i],DATA.planet[f].building[nom_bat[i]])-1)/(exposant[i]-1)*1000)/1000;}
				if (i>9 && f<DATA.moon.length)
				{
					if (DATA.moon[f].building[nom_bat[i]] < 0) info_bat = false;
					pointLuneTotal += Math.floor(prixInitial_bat[i] *(Math.pow(exposant[i],DATA.moon[f].building[nom_bat[i]])-1)/(exposant[i]-1)*1000)/1000;
				}
			}
	
			/* ******************************Defense********************************/
			if ( i< nom_def.length)
			{
			
			//alert('planet number '+parseInt(f+1)+' : '+nom_def[i]+' nombre : '+DATA.planet[f].defence[nom_def[i]]);
			
				if (DATA.planet[f].defence[nom_def[i]] < 0) info_def = false;
				PointsDefTotal += prixInitial_def[i] * DATA.planet[f].defence[nom_def[i]];
				
				
				if( f < DATA.moon.length )
				{
					if (DATA.moon[f].defence[nom_def[i]] < 0) info_def = false;
					PointsDefTotal += prixInitial_def[i] * DATA.moon[f].defence[nom_def[i]];
				//	alert('moon number '+parseInt(f+1)+' : '+nom_def[i]+' nombre : '+DATA.planet[f].defence[nom_def[i]]);
				}
			}
			
			/* ******************************Techno********************************/
			if (i<nom_techno.length && f==0)
			{
				if (DATA.techno[nom_techno[i]] < 0) info_tech = false;
				PointsTechno += Math.floor(prixInitial_techno[i] *(Math.pow(2,DATA.techno[nom_techno[i]])-1)*1000)/1000;
			}
		}
	}

	
	if(document.getElementsByTagName('body')[0].innerHTML.indexOf('src="img/geologe_ikon.gif"') != -1) // Si géologue
	{
		prodm *= 1.1;
		prodc *= 1.1;
		prodd *= 1.1;
	}
	
	if(url.indexOf('uni40.ogame.fr',0)>=0 || url.indexOf('uni50.ogame.fr',0)>=0 || url.indexOf('uni60.ogame.fr',0)>=0) // Si géologue
	{
		prodm *= 2;
		prodc *= 2;
		prodd *= 2;
	}
	
	prod = parseInt((prodm+prodc+prodd)*24/1000);
	
	var nbJoueur = '';
	var thnode = document.getElementsByTagName('th');
	for (var i=0; i< thnode.length; i++)
	{
		if (thnode[i].innerHTML.indexOf('(Place')>0 )
			nbJoueur = (thnode[i].innerHTML.split(/[^0-9\.]/)[thnode[i].innerHTML.split(/[^0-9\.]/).length-2].replace( /[^0-9-]/g, ""));
	}
	
	
	PointsBatimentsTotal=PointsBatimentsTotal+pointLuneTotal;
	pointLuneTotal=parseInt(pointLuneTotal);
	PointsBatimentsTotal=parseInt(PointsBatimentsTotal);
	PointsMinesTotal=parseInt(PointsMinesTotal);
	PointsTechno=parseInt(PointsTechno);
	PointsDefTotal=parseInt(PointsDefTotal);

	var PointsTotal = DATA.player.stats.player.ressources.value;
	var PointsFlotteTotal = PointsTotal-PointsTechno-PointsMinesTotal-PointsBatimentsTotal-PointsDefTotal;
	
	var prixVaisseauxVol =0;
	var nom_flotte = new Array('pt', 'gt', 'cle', 'clo', 'crois', 'vb', 'vc', 'rec', 'esp', 'bomb', 'dest','edlm','traq');
	var prixInitial_flotte = new Array(4,12,4,10,29,60,40,18,1,90,125,10000,85);
	
	/* ******************************Point planete********************************/	
	var numeroplaneteSelect = -1;
	var numeroluneSelect = -1;
	
	var numeroplanete = -1;
	var numerolune = -1;
	
	var listePlanete = document.getElementsByTagName("option");
	
	for (var i=0 ; i<listePlanete.length ; i++)
	{
		
		if (listePlanete[i].innerHTML.indexOf('Lune')!= -1 || listePlanete[i].innerHTML.indexOf('lune')!= -1) 
		{
			numerolune++;
			if(listePlanete[i].selected) numeroluneSelect = numerolune;	
		}
		else if (listePlanete[i].innerHTML.indexOf('[')!= -1 && listePlanete[i].innerHTML.indexOf(']')!= -1)
		{
			numeroplanete ++;
			if(listePlanete[i].selected) numeroplaneteSelect = numeroplanete;	
		}
	}

	
	var PointPlanete =0;
	
	if (numeroplaneteSelect != -1) // si planete
	{
		var f = numeroplaneteSelect;
		if( f < DATA.planet.length )
		{
			for (var i = 0 ; i<nom_bat.length -3; i++)
			{		
				PointPlanete += parseInt(Math.floor(prixInitial_bat[i] *(Math.pow(exposant[i],DATA.planet[f].building[nom_bat[i]])-1)/(exposant[i]-1)*1000)/1000);

				if ( i< nom_def.length)
				{
					PointPlanete += parseInt(prixInitial_def[i] * DATA.planet[f].defence[nom_def[i]]);				
				}
			}	
		}
		
	}
	if (numeroluneSelect != -1) // Si lune
	{
		
		var f = numeroluneSelect;
		if( f < DATA.moon.length )
		{
			for (var i = 10 ; i<nom_bat.length ; i++)
			{		
				PointPlanete += parseInt(Math.floor(prixInitial_bat[i] *(Math.pow(exposant[i],DATA.moon[f].building[nom_bat[i]])-1)/(exposant[i]-1)*1000)/1000);
				if ( i< nom_def.length)
				{
					PointPlanete += parseInt(prixInitial_def[i] * DATA.moon[f].defence[nom_def[i]]);				
				}
			}	
		}
	}

	var nbDeVaisseau = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
	/* ******************************Flotte en vol********************************/	
	for (var i=0 ; i<DATA.fleet.length ; i++)
	{
		if (DATA.fleet[i].mission.way == 'return' || DATA.fleet[i].mission.type == 'owndeploy' ) // Si flotte est sur le retour ou en stationné
		{
			for (var f=0 ; f<nom_flotte.length ; f++)
			{
				prixVaisseauxVol+= DATA.fleet[i].ships[nom_flotte[f]]*prixInitial_flotte[f];
				nbDeVaisseau[f]+= DATA.fleet[i].ships[nom_flotte[f]];
			}
					
	} 
	}

	/* ******************************recuperation des points de reference********************************/
	var dateComplete = new Date()+ '';

	var timetemp = actualTime-2 ;
	var PointRef = GM_getValue("PointRef"+uni+pseudo,PointsTotal+';'+dateComplete+';'+PointsMinesTotal+';'+PointsBatimentsTotal+';'+PointsTechno+';'+PointsFlotteTotal+';'+PointsDefTotal+';true;'+PointsTotal+';'+timetemp+'').split(/;/);
	
	var dates = new Array();
	
	dates = PointRef[1].split(/ /);
	dateRef = dates[2] +' '+dates[1];

	if(PointRef[7]== 'true' && info_def && info_tech && info_bat) // Si y'avais rien d'enregistré on enregistre
	{
		GM_setValue("PointRef"+uni+pseudo,PointsTotal+';'+dateComplete+';'+PointsMinesTotal+';'+PointsBatimentsTotal+';'+PointsTechno+';'+PointsFlotteTotal+';'+PointsDefTotal+';false;'+PointsTotal+';'+actualTime);
	}


	/* ******************************RaZ Auto********************************/	
	var RaZAuto = false;
	var nbjours=0;

	if (option[13]> 0)
	{
		RaZAuto = true;
		nbjours = (actualTime-Date.parse(PointRef[1])/1000)/(3600*24);
	}

	if ( RaZAuto && nbjours> option[13]  )
	{
		GM_setValue("PointRef"+uni+pseudo,PointsTotal+';'+dateComplete+';'+PointsMinesTotal+';'+PointsBatimentsTotal+';'+PointsTechno+';'+PointsFlotteTotal+';'+PointsDefTotal+';false;'+PointRef[8]+';'+PointRef[9]);
		alert('Remise à 0% de la progression effectuée');
	}
	
	/* ******************************BBcode********************************/	
	var code= '';
	var listeNiveau ='';
	var totNiv =0;

		var size1 = '14';
		var size2 = '18';
	var size3='10';
	
		if(phpbbforum) 
		{
			 size1 = '120';
			 size2 = '150';
			size3='60';
		}

	
	
	code+= '[center][u][size='+size2+'] Rapport du compte de '+DATA.player.name+' uni'+uni+'[/size]\n';
	code+= 'généré le [color=#'+CoulBBcode+']'+dateComplete.split(' ')[0]+' '+dateComplete.split(' ')[2]+' '+dateComplete.split(' ')[1]+' '+dateComplete.split(' ')[3]+' [/color] par [url=http://vulca.evoserv.net/][color=#'+CoulBBcode+']InfoCompte[/color][/url] [color=#'+CoulBBcode+']v'+Version+'[/color][/u][/center]\n\n';
//[img]http://www.noelshack.com/up/aaa/point054557.png[/img]
	code+= ' [u][color=#'+CoulBBcode2+'][size='+size2+'][img]http://www.noelshack.com/up/aaa/point054557.png[/img][/size][/color][/u]\n';
	code+= '- Points des mines  [color=#'+CoulBBcode+']'+addPoints(PointsMinesTotal)+' ( '+pourcent(PointsMinesTotal,PointsTotal)+' % )[/color]\n';
	code+= '- Points des autres bâtiments  [color=#'+CoulBBcode+']'+addPoints(PointsBatimentsTotal)+' ( '+pourcent(PointsBatimentsTotal,PointsTotal)+' % )[/color]\n';
	code+= '- Points des défenses  [color=#'+CoulBBcode+']'+addPoints(PointsDefTotal)+' ( '+pourcent(PointsDefTotal,PointsTotal)+' % )[/color]\n';
	code+= '- Points des recherches  [color=#'+CoulBBcode+']'+addPoints(PointsTechno)+' ( '+pourcent(PointsTechno,PointsTotal)+' %)[/color]\n';
	code+= '- Points de la flotte  [color=#'+CoulBBcode+']'+addPoints(PointsFlotteTotal) + ' ( '+pourcent(PointsFlotteTotal,PointsTotal)+' %)[/color]\n';
	code+= '[b]Total   [color=#'+CoulBBcode+']'+addPoints(PointsTotal)+'[/color][/b] [size='+size3+'](dont '+pourcent(PointsMinesTotal+PointsBatimentsTotal+PointsTechno,PointsTotal)+'% indestructible)[/size] \n\n\n';

	var niveau ='';
	code+= '[u][color=#'+CoulBBcode2+'][size='+size2+'][img]http://vulca.evoserv.net/infoCompte/image/prod.png[/img][/size][/color][/u]\n';
	code+= ' [list][*]Métal     : [color=#'+CoulBBcode+'] [b]'+addPoints(parseInt(prodm*24))+'[/b][/color]\n';
	code+= '[*]Cristal   : [color=#'+CoulBBcode+'][b]'+addPoints(parseInt(prodc*24))+'[/b][/color]\n';
	code+= ' [*]Deuterium : [color=#'+CoulBBcode+'][b]'+addPoints(parseInt(prodd*24))+'[/b][/color][/list]\n\n\n';

	code+= '[u][size='+size2+'][color=#'+CoulBBcode2+'][img]http://vulca.evoserv.net/infoCompte/image/planet.png[/img][/color][/size][/u]\n';

	calculPlanete();
	//code+= listenom+'| [b]Nom[/b] \n';
	code+= listeNiveauUse+'| [b]Cases utilisées[/b] => Moyenne = '+parseInt(totNivCase/DATA.planet.length)+'\n';
	code+= listeNiveauMax+'| [b]Cases totales[/b] => Moyenne = '+parseInt(totNivCaseMax/DATA.planet.length)+'\n\n\n';
	
	code+= '[u][color=#'+CoulBBcode2+'][size='+size2+'][img]http://vulca.evoserv.net/infoCompte/image/batiment.png[/img] [/color][/size][/u]\n';
	code+= '[center][i][color=#'+CoulBBcode+'][size='+size1+'] Planétaires [/size][/color][/i][/center]\n';
	code+= '[color=#'+CoulBBcode+'][b][u]Mines[/u][/b][/color]\n';
	
	calculNiv(0);
	code+= listeNiveau+'| [b]Mine de métal[/b] => Total = '+totNiv+'\n';
	calculNiv(1);
	code+= listeNiveau+'| [b]Mine de cristal[/b] => Total = '+totNiv+'\n';
	calculNiv(2);
	code+= listeNiveau+'| [b]Synthétiseur de deutérium[/b] => Total = '+totNiv+'\n\n';

	code+= '[color=#'+CoulBBcode+'][b][u]Stockage[/u][/b][/color]\n';
	calculNiv(12);
	code+= listeNiveau+'| [b]Hangar de métal[/b] => Total = '+totNiv+'\n';
	calculNiv(13);
	code+= listeNiveau+'| [b]Hangar de cristal[/b] => Total = '+totNiv+'\n';
	calculNiv(14);
	code+= listeNiveau+'| [b]Réservoir de deutérium[/b] => Total = '+totNiv+'\n\n';

	code+= '[color=#'+CoulBBcode+'][b][u]Energie[/u][/b][/color]\n';
	calculNiv(4);
	code+= listeNiveau+'| [b]Centrale électrique de fusion[/b] => Total = '+totNiv+'\n';
	calculNiv(3);
	code+= listeNiveau+'| [b]Centrale électrique solaire[/b] => Total = '+totNiv+'\n\n';

	code+= '[color=#'+CoulBBcode+'][b][u]Construction[/u][/b][/color]\n';
	calculNiv(11);
	code+= listeNiveau+'| [b]Usine de robots[/b] => Total = '+totNiv+'\n';
	calculNiv(5);
	code+= listeNiveau+'| [b]Usine de nanites[/b] => Total = '+totNiv+'\n';
	calculNiv(7);
	code+= listeNiveau+'| [b]Terraformeur[/b] => Total = '+totNiv+'\n\n';

	code+= '[color=#'+CoulBBcode+'][b][u]Militaire[/u][/b][/color]\n';
	calculNiv(10);
	code+= listeNiveau+'| [b]Chantier spatial[/b] => Total = '+totNiv+'\n';
	calculNiv(9);
	code+= listeNiveau+'| [b]Dépôt de ravitaillement[/b] => Total = '+totNiv+'\n';
	calculNiv(8);
	code+= listeNiveau+'| [b]Silo de missiles[/b] => Total = '+totNiv+'\n\n';

	code+= '[color=#'+CoulBBcode+'][b][u]Scientifique[/u][/b][/color]\n';
	calculNiv(6);
	code+= listeNiveau+'| [b]Laboratoire de recherche[/b] => Total = '+totNiv+'\n\n\n';


	code+= '[center][i][color=#'+CoulBBcode+'][size='+size1+'] Lunaire [/size][/color][/i][/center]\n\n';

	code+= '[color=#'+CoulBBcode+'][b][u]Stockage[/u][/b][/color]\n';
	calculNivLune(12);
	code+= listeNiveau+'| [b]Hangar de métal[/b] => Total = '+totNiv+'\n';
	calculNivLune(13);
	code+= listeNiveau+'| [b]Hangar de cristal[/b] => Total = '+totNiv+'\n';
	calculNivLune(14);
	code+= listeNiveau+'| [b]Réservoir de deutérium[/b] => Total = '+totNiv+'\n\n';

	code+= '[color=#'+CoulBBcode+'][b][u]Construction[/u][/b][/color]\n';
	calculNivLune(11);
	code+= listeNiveau+'| [b]Usine de robots[/b] => Total = '+totNiv+'\n';
	calculNivLune(15);
	code+= listeNiveau+'| [b]Base lunaire[/b] => Total = '+totNiv+'\n\n';

	code+= '[color=#'+CoulBBcode+'][b][u]Militaire[/u][/b][/color]\n';
	calculNivLune(10);
	code+= listeNiveau+'| [b]Chantier spatial[/b] => Total = '+totNiv+'\n';
	calculNivLune(16);
	code+= listeNiveau+'| [b]Phalange de capteur[/b] => Total = '+totNiv+'\n';
	calculNivLune(17);
	code+= listeNiveau+'| [b]Porte de saut spatial[/b] => Total = '+totNiv+'\n\n\n';

		
	code+= '[u][color=#'+CoulBBcode2+'][size='+size2+'][img]http://vulca.evoserv.net/infoCompte/image/labo.png[/img][/size][/color][/u]\n';
	code+= '[u][b][color=#'+CoulBBcode+']Technologies de combat [/color][/b][/u] \n';
	code+= '[b]Technologie Armes[/b]:  [color=#'+CoulBBcode+']'+DATA.techno.arme+'[/color]\n';
	code+= '[b]Technologie Bouclier[/b]:  [color=#'+CoulBBcode+']'+DATA.techno.bouc+'[/color]\n';
	code+= '[b]Technologie Protection[/b]:  [color=#'+CoulBBcode+']'+DATA.techno.prot+'[/color]\n';
	code+= '[b]Technologie Espionnage[/b]:  [color=#'+CoulBBcode+']'+DATA.techno.espi+'[/color]\n\n';

	code+= '[u][b][color=#'+CoulBBcode+']Technologies de vaisseaux [/color][/b][/u] \n';
	code+= '[b]Technologie Ordinateur[/b]:  [color=#'+CoulBBcode+']'+DATA.techno.ordi+'[/color]\n';
	code+= '[b]Réacteur à combustion[/b]:  [color=#'+CoulBBcode+']'+DATA.techno.comb+'[/color]\n';
	code+= '[b]Réacteur à impulsion[/b]:  [color=#'+CoulBBcode+']'+DATA.techno.impu+'[/color]\n';
	code+= '[b]Propulsion hyperespace[/b]:  [color=#'+CoulBBcode+']'+DATA.techno.phyp+'[/color]\n\n';

	code+= '[u][b][color=#'+CoulBBcode+']Technologies annexes [/color][/b][/u]\n'; 
	code+= '[b]Technologie Energie[/b]:  [color=#'+CoulBBcode+']'+DATA.techno.ener+'[/color]\n';
	code+= '[b]Technologie Hyperespace[/b]:  [color=#'+CoulBBcode+']'+DATA.techno.hype+'[/color]\n';
	code+= '[b]Technologie Ions[/b]:  [color=#'+CoulBBcode+']'+DATA.techno.ions+'[/color]\n';
	code+= '[b]Technologie Laser[/b]:  [color=#'+CoulBBcode+']'+DATA.techno.lase+'[/color]\n';
	code+= '[b]Technologie Plasma[/b]:  [color=#'+CoulBBcode+']'+DATA.techno.plas+'[/color]\n';
	code+= '[b]Réseau de recherche intergalactique[/b]:  [color=#'+CoulBBcode+']'+DATA.techno.rese+'[/color]\n';
	code+= '[b]Technologie Graviton[/b]:  [color=#'+CoulBBcode+']'+DATA.techno.grav+'[/color]\n\n\n';

	
	code+= '[u][size='+size2+'][color=#'+CoulBBcode2+'][img]http://vulca.evoserv.net/infoCompte/image/flotte.jpg[/img][/color][/size][/u]\n\n';
				
				var nbDeVaisseauQ = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0);
				for (var i = 0 ; i<nbDeVaisseauQ.length;i++) nbDeVaisseauQ[i]=nbDeVaisseau[i];
				
				for (var i =0 ; i<DATA.planet.length ; i++)
				{
					
					for (var j =0; j< nom_flotte.length; j++)
					{
						nbDeVaisseauQ[j] += parseInt(DATA.planet[i].fleet[nom_flotte[j]]);
					}
					if (!isNaN(DATA.planet[i].fleet.ss)) 
					{
						nbDeVaisseauQ[13] += DATA.planet[i].fleet.ss;
					}
					
				}
				for (var i =0 ; i<DATA.moon.length ; i++)
				{
					for (var j =0; j< nom_flotte.length; j++)
					{	
						nbDeVaisseauQ[j] += parseInt(DATA.moon[i].fleet[nom_flotte[j]]); 
					}
					if (!isNaN(DATA.moon[i].fleet.ss)) 
					{
						nbDeVaisseauQ[13] += DATA.moon[i].fleet.ss ;
					}
				}
				
	code+='[u][b][color=#'+CoulBBcode+']Vaisseaux civils [/color][/b][/u] \n';
	code+= '[b]Petit transporteur[/b]: [color=#'+CoulBBcode+']'+addPoints(nbDeVaisseauQ[0])+'[/color]\n';
	code+= '[b]Grand transporteur[/b]: [color=#'+CoulBBcode+']'+addPoints(nbDeVaisseauQ[1])+'[/color]\n';
	code+= '[b]Vaisseau de colonisation[/b]: [color=#'+CoulBBcode+']'+addPoints(nbDeVaisseauQ[6])+'[/color]\n';
	code+= '[b]Recycleur[/b]: [color=#'+CoulBBcode+']'+addPoints(nbDeVaisseauQ[7])+'[/color]\n';
	code+= '[b]Sonde espionnage[/b]: [color=#'+CoulBBcode+']'+addPoints(nbDeVaisseauQ[8])+'[/color]\n';
	code+= '[b]Satellite solaire[/b]: [color=#'+CoulBBcode+']'+addPoints(nbDeVaisseauQ[13])+'[/color]\n\n';
				
	code+='[u][b][color=#'+CoulBBcode+']Vaisseaux de combat [/color][/b][/u] \n';
	code+= '[b]Chasseur léger[/b]: [color=#'+CoulBBcode+']'+addPoints(nbDeVaisseauQ[2])+'[/color]\n';
	code+= '[b]Chasseur lourd[/b]: [color=#'+CoulBBcode+']'+addPoints(nbDeVaisseauQ[3])+'[/color]\n';
	code+= '[b]Croiseur[/b]: [color=#'+CoulBBcode+']'+addPoints(nbDeVaisseauQ[4])+'[/color]\n';
	code+= '[b]Vaisseau de bataille[/b]: [color=#'+CoulBBcode+']'+addPoints(nbDeVaisseauQ[5])+'[/color]\n';
	code+= '[b]Traqueur[/b]: [color=#'+CoulBBcode+']'+addPoints(nbDeVaisseauQ[12])+'[/color]\n';
	code+= '[b]Bombardier[/b]: [color=#'+CoulBBcode+']'+addPoints(nbDeVaisseauQ[9])+'[/color]\n';
	code+= '[b]Destructeur[/b]: [color=#'+CoulBBcode+']'+addPoints(nbDeVaisseauQ[10])+'[/color]\n';
	code+= '[b]Étoile de la mort[/b]: [color=#'+CoulBBcode+']'+addPoints(nbDeVaisseauQ[11])+'[/color]\n\n\n\n';
							
	code+= '[u][color=#'+CoulBBcode2+'][size='+size2+'][img]http://vulca.evoserv.net/infoCompte/image/def.png[/img][/size][/color][/u]\n';
	code+= '[center][i][color=#'+CoulBBcode+'][size='+size1+'] Planétaires [/size][/color][/i][/center]\n\n';
	

	calculDef(0);
	code+= listeNiveau+'| [b]Lanceur de missiles[/b] => Total = '+addPoints(totNiv)+'\n';
	calculDef(1);
	code+= listeNiveau+'| [b]Artillerie laser légère[/b] => Total = '+addPoints(totNiv)+'\n';
	calculDef(2);
	code+= listeNiveau+'| [b]Artillerie laser lourde[/b] => Total = '+addPoints(totNiv)+'\n';
	calculDef(4);
	code+= listeNiveau+'| [b]Artillerie à ion[/b] => Total = '+addPoints(totNiv)+'\n';
	calculDef(3);
	code+= listeNiveau+'| [b]Canon de Gauss[/b] => Total = '+addPoints(totNiv)+'\n';
	calculDef(5);
	code+= listeNiveau+'| [b]Lanceur de plasma[/b] => Total = '+addPoints(totNiv)+'\n';
	calculDef(6);
	code+= listeNiveau+'| [b]Petit bouclier[/b] => Total = '+addPoints(totNiv)+'\n';
	calculDef(7);
	code+= listeNiveau+'| [b]Grand bouclier[/b] => Total = '+addPoints(totNiv)+'\n';
	calculDef(8);
	code+= listeNiveau+'| [b]Missile Interception[/b] => Total = '+addPoints(totNiv)+'\n';
	calculDef(9);
	code+= listeNiveau+'| [b]Missile Interplanétaire [/b] => Total = '+addPoints(totNiv)+'\n\n';

	code+= '[center][i][color=#'+CoulBBcode+'][size='+size1+'] Lunaire [/size][/color][/i][/center]\n\n';

	calculDefLune(0);
	code+= listeNiveau+'| [b]Lanceur de missiles[/b] => Total = '+addPoints(totNiv)+'\n';
	calculDefLune(1);
	code+= listeNiveau+'| [b]Artillerie laser légère[/b] => Total = '+addPoints(totNiv)+'\n';
	calculDefLune(2);
	code+= listeNiveau+'| [b]Artillerie laser lourde[/b] => Total = '+addPoints(totNiv)+'\n';
	calculDefLune(4);
	code+= listeNiveau+'| [b]Artillerie à ion[/b] => Total = '+addPoints(totNiv)+'\n';
	calculDefLune(3);
	code+= listeNiveau+'| [b]Canon de Gauss[/b] => Total = '+addPoints(totNiv)+'\n';
	calculDefLune(5);
	code+= listeNiveau+'| [b]Lanceur de plasma[/b] => Total = '+addPoints(totNiv)+'\n';
	calculDefLune(6);
	code+= listeNiveau+'| [b]Petit bouclier[/b] => Total = '+addPoints(totNiv)+'\n';
	calculDefLune(7);
	code+= listeNiveau+'| [b]Grand bouclier[/b] => Total = '+addPoints(totNiv)+'\n';
	
	
	var BBcode="[quote][center][size="+size2+"][b]D"+eaigu+"tail de l'investissement des points[/b][/size]\n\n";
	BBcode+="[size="+size2+"]Points Total : [b][color=#ff0000]"+addPoints(PointsTotal)+"[/color][/b][/size]\n";

	var nbAfficher=0; // Nombre de colone a afficher (pour graphique)
	if(mine) 
	{
		nbAfficher++;
		BBcode+="Points Mines :	[b][color=#ff0000]"+addPoints(PointsMinesTotal)+"[/color][/b] soit  [b][color=#ff0000]"+pourcent(PointsMinesTotal,PointsTotal)+"[/color][/b] % \n";
	}
	if(AutreBat) 
	{
		nbAfficher++;
		BBcode+="Points Autres B"+aaccent+"timents :	[b][color=#ff0000]"+addPoints(PointsBatimentsTotal)+"[/color][/b] soit [b][color=#ff0000]"+pourcent(PointsBatimentsTotal,PointsTotal)+"[/color][/b] % \n";
	}
	if(BatTotal) 
	{
		nbAfficher++;
		BBcode+="Points B"+aaccent+"timents : [b][color=#ff0000]"+addPoints(PointsMinesTotal+PointsBatimentsTotal)+"[/color][/b] soit  [b][color=#ff0000]"+pourcent(PointsMinesTotal+PointsBatimentsTotal,PointsTotal)+"[/color][/b] % \n";
	}
	if(techno) nbAfficher++;
	if(flottes) nbAfficher++;
	if(Def) nbAfficher++;
	if(indestructible) nbAfficher++;
	if(Point_planete) nbAfficher++;
	
	BBcode+="Points Technologies :	[b][color=#ff0000]"+addPoints(PointsTechno)+"[/color][/b] soit [b][color=#ff0000]"+pourcent(PointsTechno,PointsTotal)+"[/color][/b] %\n";
	BBcode+="Points Flotte :	[b][color=#ff0000]"+addPoints(PointsFlotteTotal)+"[/color][/b]  soit [b][color=#ff0000]"+pourcent(PointsFlotteTotal,PointsTotal)+"[/color][/b] % \n";
	BBcode+="Points D"+eaigu+"fense :	[b][color=#fF0000]"+addPoints(PointsDefTotal)+"[/color][/b] soit [b][color=#ff0000]"+pourcent(PointsDefTotal,PointsTotal)+"[/color][/b] % \n\n";
	BBcode+="Votre compte poss"+egrave+"de donc [b][color=#ff0000]"+addPoints(PointsMinesTotal+PointsBatimentsTotal+PointsTechno)+"[/color][/b] soit [b][color=#ff0000]"+pourcent(PointsMinesTotal+PointsBatimentsTotal+PointsTechno,PointsTotal)+"[/color][/b] % de points indestructibles\n";	
	BBcode+='Progression moyenne : [b][color=#ff0000]'+addPoints(Math.round((PointsTotal- PointRef[8])/((actualTime-PointRef[9])/(3600*24))))+ ' [/color][/b]Points par jour\n';
	BBcode+='Production : [b][color=#ff0000]'+addPoints(Math.round(prod))+ ' [/color][/b]Points par jour\n';
	BBcode+="Uni : [b][color=#ff0000]"+ uni +"[/color][/b][/center][/quote]"
	
	/* ******************************Etablissement des couleurs********************************/
	var Color_mine= '';
	var Color_autreBat= '';
	var Color_batTotal= '';
	var Color_techno= '';
	var Color_flotte= '';
	var Color_def= '';
	var Color_indestr= '';
	var Color_prog= '';
	
	if	(couleurPoint)
	{
		if(PointsMinesTotal>parseInt(PointRef[2])+1) 			{Color_mine= 'style="color: #00FF00;"';}
		else if (PointsMinesTotal<parseInt(PointRef[2]) -1) 	{Color_mine= 'style="color: #FF0000;"';}
		
		if( PointsBatimentsTotal>parseInt(PointRef[3])+1) 		{Color_autreBat= 'style="color: #00FF00;"';}
		else if (PointsBatimentsTotal<parseInt(PointRef[3])-1) 	{Color_autreBat= 'style="color: #FF0000;"';}
		
		if((PointsMinesTotal+PointsBatimentsTotal)>(parseInt(PointRef[2])+parseInt(PointRef[3])+1)) 			{Color_batTotal= 'style="color: #00FF00;"';}
		else if ((PointsMinesTotal+PointsBatimentsTotal)<(parseInt(PointRef[2])+parseInt(PointRef[3])) -1)  	{Color_batTotal= 'style="color: #FF0000;"';}
		
		if( PointsTechno>parseInt(PointRef[4])+1) 			{Color_techno= 'style="color: #00FF00;"';}
		else if (PointsTechno<parseInt(PointRef[4]) -1) 		{Color_techno= 'style="color: #FF0000;"';}
		
		if( PointsFlotteTotal>parseInt(PointRef[5])+1) 		{Color_flotte= 'style="color: #00FF00;"';}
		else if (PointsFlotteTotal<parseInt(PointRef[5]) -1) 	{Color_flotte= 'style="color: #FF0000;"';}
		
		if( PointsDefTotal>parseInt(PointRef[6])+1)			{Color_def= 'style="color: #00FF00;"';}
		else if (PointsDefTotal<parseInt(PointRef[6]) -1) 		{Color_def= 'style="color: #FF0000;"';}
		
		if((PointsMinesTotal+PointsBatimentsTotal+PointsTechno)>(parseInt(PointRef[2])+parseInt(PointRef[3])+parseInt(PointRef[4])+1)) 			{Color_indestr= 'style="color: #00FF00;"';}
		else if((PointsMinesTotal+PointsBatimentsTotal+PointsTechno)<(parseInt(PointRef[2])+parseInt(PointRef[3])+parseInt(PointRef[4]) -1)) 	{Color_indestr= 'style="color: #FF0000;"';}

		if( PointsTotal>parseInt(PointRef[0])+1) 				{Color_prog= 'style="color: #00FF00;"';}
		else if (PointsTotal<parseInt(PointRef[0]) -1) 		{Color_prog= 'style="color: #FF0000;"';}
	}	

	
	
	
	/* ******************************option affichage********************************/
	var br = '';
	if (!sauterLignePourPourcentageFlotteVol)
		{br ='<br/>';}
	
	var flottesEnVol = '';
	if(VaisseauxVol && PointsFlotteTotal>0) 
		{flottesEnVol = ' '+br+pourcent(prixVaisseauxVol,PointsFlotteTotal)+' % en vol';}
		
	var affichePointLune ='';
	if (pointLune && AutreBat)
		{affichePointLune = ' '+br+pourcent(pointLuneTotal,PointsBatimentsTotal)+' % sur lune';}
	else if (pointLune && BatTotal)
		{affichePointLune = ' '+br+pourcent(pointLuneTotal,(PointsMinesTotal+PointsBatimentsTotal))+' % sur lune';}

		
/* *******************************************************************************************************************************************************************************************/
/* ***************************************************************************Affichage ********************************************************************************************************/
/* *******************************************************************************************************************************************************************************************/	
		var styleBB = 'none';
		var styleBB2 = 'none';
		var AJours = GM_getValue("aJours",true);
		
	var tr = addElem(findPath('//tbody')[5], 'tr');
	tr.addElem('td', {class: 'c', width: '60px', colspan: 4}, 'D'+eaigu+'tail de l\'investissement des points');
	
	var a = tr.addElem('td', {style: 'background-color: transparent;'}).addElem('a', {title: 'Cliquez pour afficher le BBcode (pour forum)'})
	var img = a.addElem('img', {id: 'pointRef', style: 'margin-left:-20px; position: relative;', src: 'data:image/gif;base64,'+codeImg});
	img.$E(
	{
		click: function (event) // Affiche si clique si clique
		{

			var cellule = id_('zonecode');
			if (styleBB == 'none') 
			{
				cellule.style.display = '';
				styleBB= '';
			}
			else 
			{
				cellule.style.display = 'none';
				styleBB= 'none';
			}
		}
	});
	var img2 = a.addElem('img', {id: 'pointRef', style: 'margin-left:-30px; position: relative;', src: 'data:image/gif;base64,'+codeImg});
	img2.$E(
	{
		click: function (event) // Affiche si clique si clique
		{
			var cellule = id_('zonecode2');
			if (styleBB2 == 'none') 
			{
				cellule.style.display = '';
				styleBB2= '';
			}
			else 
			{
				cellule.style.display = 'none';
				styleBB2= 'none';
			}
		}
	});
	

	var tr = addElem(findPath('//tbody')[5], 'tr', {id: 'zonecode2', style:'display:'+styleBB2+';'}); // Contient BBcode, invisible par defaut
	tr.addElem('td', {colspan: 4},'<textarea cols="40" onClick="javascript:this.select();">'+code+'</textarea>');
	
	var tr = addElem(findPath('//tbody')[5], 'tr', {id: 'zonecode', style:'display:'+styleBB+';'}); // Contient BBcode, invisible par defaut
	tr.addElem('td', {colspan: 4},'<textarea cols="20" onClick="javascript:this.select();">'+BBcode+'</textarea>');
	
	
	if(mine)
	{
		var tr = addElem(findPath('//tbody')[5], 'tr');
		tr.addElem('th', { width: '60px', colspan:1}, 'Mines');
		
		
			tr.addElem('th', { width: '60px', colspan:2},'<a '+Color_mine+' TITLE="'+addPoints(Math.round(PointsMinesTotal-parseInt(PointRef[2])))+' Points ('+pourcent(PointsMinesTotal-parseInt(PointRef[2]),PointsMinesTotal)+' %)";>'+addPoints(PointsMinesTotal)+' ( '+pourcent(PointsMinesTotal,PointsTotal)+' % ) </a>');
			tr.addElem('th', { id:'piebox', rowspan:nbAfficher },'');
		
		if(!info_bat) tr.addElem('th', { width: '60px', colspan:2},'Vous devez visiter toutes vos pages bâtiments');
			
	}
	if(AutreBat)
	{
		var tr = addElem(findPath('//tbody')[5], 'tr');
		tr.addElem('th', { width: '60px', colspan:1}, 'Autres B'+aaccent+'ti');
	
		
		tr.addElem('th', { width: '60px', colspan:2},'<a '+Color_autreBat+' TITLE="'+addPoints(Math.round(PointsBatimentsTotal-parseInt(PointRef[3])))+' Points  ('+pourcent(PointsBatimentsTotal-parseInt(PointRef[3]),PointsBatimentsTotal)+' %)";>'+addPoints(PointsBatimentsTotal)+' ( '+pourcent(PointsBatimentsTotal,PointsTotal)+' % )  </a>'+affichePointLune+'</th>');
		
		if(!info_bat) tr.addElem('th', { width: '60px', colspan:2},'Vous devez visiter toutes vos pages bâtiments');

	}
	if(BatTotal)
	{
		var tr = addElem(findPath('//tbody')[5], 'tr');
		tr.addElem('th', { width: '60px', colspan:1}, 'B'+aaccent+'timents');
		
		
			tr.addElem('th', { width: '60px', colspan:2},'<a '+Color_batTotal+' TITLE="'+addPoints(Math.round((PointsMinesTotal+PointsBatimentsTotal)-(parseInt(PointRef[2])+parseInt(PointRef[3]))))+' Points ('+pourcent((PointsMinesTotal+PointsBatimentsTotal)-(parseInt(PointRef[2])+parseInt(PointRef[3])),PointsMinesTotal+PointsBatimentsTotal)+' %)";>'+addPoints(PointsMinesTotal+PointsBatimentsTotal)+' ( '+pourcent(PointsMinesTotal+PointsBatimentsTotal,PointsTotal)+' % )  </a>'+affichePointLune);
			tr.addElem('th', { id:'piebox', rowspan:nbAfficher },'');	
		
		if(!info_bat) tr.addElem('th', { width: '60px', colspan:2},'Vous devez visiter toutes vos pages bâtiments');
	}
	if(techno)
	{
		var tr = addElem(findPath('//tbody')[5], 'tr');
		 tr.addElem('th', { width: '60px', colspan:1}, '<a href="http://uni'+uni+'.ogame.fr/game/index.php?page=statistics&session='+session+'&who=player&type=research&start=-1&sort_per_member=0">Technologies</a>');
		if(!info_tech) tr.addElem('th', { width: '60px', colspan:2},'Vous devez visiter une page de laboratoire');
		tr.addElem('th', { width: '60px', colspan:2},'<a '+Color_techno+' TITLE="'+addPoints(Math.round(PointsTechno-parseInt(PointRef[4])))+' Points ('+pourcent(PointsTechno-parseInt(PointRef[4]),PointsTechno)+' %)";>'+addPoints(PointsTechno)+' ( '+pourcent(PointsTechno,PointsTotal)+' % ) </a>');
	}
	if(flottes)
	{
		var tr = addElem(findPath('//tbody')[5], 'tr');
		tr.addElem('th', { width: '60px', colspan:1}, '<a href="http://uni'+uni+'.ogame.fr/game/index.php?page=statistics&session='+session+'&who=player&type=fleet&start=-1&sort_per_member=0">Flotte</a>');
		tr.addElem('th', { width: '60px', colspan:2},'<a '+Color_flotte+' TITLE="'+addPoints(Math.round(PointsFlotteTotal-parseInt(PointRef[5])))+' Points ('+pourcent(PointsFlotteTotal-parseInt(PointRef[5]),PointsFlotteTotal)+' %)";>'+addPoints(PointsFlotteTotal) + ' ( '+pourcent(PointsFlotteTotal,PointsTotal)+' % ) </a>'+flottesEnVol);
	}
	if(Def)
	{
		var tr = addElem(findPath('//tbody')[5], 'tr');
		tr.addElem('th', { width: '60px', colspan:1}, 'D'+eaigu+'fense');
		 tr.addElem('th', { width: '60px', colspan:2},'<a '+Color_def+' TITLE="'+addPoints(Math.round(PointsDefTotal-parseInt(PointRef[6])))+' Points ('+pourcent(PointsDefTotal-parseInt(PointRef[6]),PointsDefTotal)+' %)";>'+addPoints(PointsDefTotal)+' ( '+pourcent(PointsDefTotal,PointsTotal)+' % ) </a>');
		if(!info_def) tr.addElem('th', { width: '60px', colspan:2},'Vous devez visiter toutes vos pages defense');	}
	
	if(Point_planete && numeroplaneteSelect != -1 && numeroplaneteSelect < DATA.planet.length)
	{
		var tr = addElem(findPath('//tbody')[5], 'tr');
		tr.addElem('th', { width: '60px', colspan:1}, DATA.planet[numeroplaneteSelect].name+' '+DATA.planet[numeroplaneteSelect].posi);
		tr.addElem('th', { width: '60px', colspan:2}, addPoints(PointPlanete) +' Points ('+pourcent(PointPlanete,PointsTotal)+' %)');
	}

	if(Point_planete && numeroluneSelect != -1 && numeroluneSelect < DATA.moon.length)
	{
		var tr = addElem(findPath('//tbody')[5], 'tr');
		tr.addElem('th', { width: '60px', colspan:1}, DATA.moon[numeroluneSelect].name+' '+DATA.moon[numeroluneSelect].posi);
		tr.addElem('th', { width: '60px', colspan:2}, addPoints(PointPlanete) +' Points ('+pourcent(PointPlanete,PointsTotal)+' %)');
	}
	
	
	if(indestructible)
	{
		var tr = addElem(findPath('//tbody')[5], 'tr');
		tr.addElem('th', { width: '60px', colspan:1}, 'Indestructible');
		tr.addElem('th', { width: '60px', colspan:2},'<a '+Color_indestr+' TITLE="'+addPoints(Math.round((PointsMinesTotal+PointsBatimentsTotal+PointsTechno)-(parseInt(PointRef[2])+parseInt(PointRef[3])+parseInt(PointRef[4]))))+' Points ('+pourcent((PointsMinesTotal+PointsBatimentsTotal+PointsTechno)-(parseInt(PointRef[2])+parseInt(PointRef[3])+parseInt(PointRef[4])),PointsMinesTotal+PointsBatimentsTotal+PointsTechno)+' %)";>'+addPoints(PointsMinesTotal+PointsBatimentsTotal+PointsTechno)+' ( '+pourcent(PointsMinesTotal+PointsBatimentsTotal+PointsTechno,PointsTotal)+' % ) </a>');
	}
	
	if (progression)
	{
		var tr = addElem(findPath('//tbody')[5], 'tr');
		tr.addElem('th', {width: '60px', colspan: 1}, 'Progression');
		tr.addElem('th', {colspan: 3}, '<span '+Color_prog+'>'+addPoints(Math.round(PointsTotal-parseInt(PointRef[0])))+' points (soit ' +Math.round((PointsTotal-PointRef[0])/PointRef[0]*1000)/10 +' %) depuis le '+dateRef+'</span>');
		var a = tr.addElem('td', {style: 'background-color: transparent;'}).addElem('a', {title: 'Cliquez pour remettre votre progression à 0'})
			var img = a.addElem('img', {id: 'pointRef', style: 'margin-left:-20px; position: relative;', src: 'data:image/gif;base64,'+codeImg});
			img.$E(
			{
				click: function (event) // RAZ si clique
				{
					if(confirm('Etes vous sur de vouloir r'+eaigu+'initialiser votre progression ?')) 
					{	
						GM_setValue("PointRef"+uni+pseudo,PointsTotal+';'+dateComplete+';'+PointsMinesTotal+';'+PointsBatimentsTotal+';'+PointsTechno+';'+PointsFlotteTotal+';'+PointsDefTotal+';false;'+PointRef[8]+';'+PointRef[9]);
						alert('Remise à 0% effectuée');
					}	
				}
			});
	}
	if(ProgJours)
	{
		var tr = addElem(findPath('//tbody')[5], 'tr');
		tr.addElem('th', { width: '60px', colspan:1}, 'Moyenne');
		tr.addElem('th', { width: '60px', colspan:3},addPoints(Math.round((PointsTotal- PointRef[8])/((actualTime-PointRef[9])/(3600*24))))+ ' Points par jour    (' +addPoints(7*(Math.round((PointsTotal- PointRef[8])/((actualTime-PointRef[9])/(3600*24)))))+ ' par semaine )');
	}
	
	if(ProdJours)
	{
		var tr = addElem(findPath('//tbody')[5], 'tr');
		tr.addElem('th', { width: '60px', colspan:1}, 'Production');
		tr.addElem('th', { width: '60px', colspan:3},addPoints(prod)+ ' Points par jour     (' +addPoints(7*prod)+ ' par semaine )');
	}
	
	if ( !AJours )
	{
	var caution = "R0lGODlhEAAQAJEAAFx2i2+Jnf///////yH5BAEAAAMALAAAAAAQABAAAAIrHI6Zpu0PkRBRTloxhvN0rm1HQAYXeZZqmqrmBU/uK9PCbMP4zvfk4CsNCgA7";
			
		var tr = addElem(findPath('//tbody')[5], 'tr');
		tr.addElem('th', { width: '60px', colspan:1}, '<img src="data:image/gif;base64,'+caution+'" /><img src="data:image/gif;base64,'+caution+'" /><img src="data:image/gif;base64,'+caution+'" /><img src="data:image/gif;base64,'+caution+'" />');
		tr.addElem('th', { width: '60px', colspan:3},'le script n\'est plus à jours, <a id="MaJ" href="http://userscripts.org/scripts/source/62585.user.js">cliquez ici pour avoir la derniere version</a>');
	
	}
	
	var langSign = 'fr';
				
	var pseudosign = DATA.player.name;
	

	var signature ='<form action="http://vulca.evoserv.net/infoCompte/index.php?page=signature&langue='+langSign+'"  target="_blank" method="post">';	
	
	signature+=	'<textarea name="pseudo" style="display:none;">'+pseudosign+'</textarea>';
	signature+=	'<textarea name="uni" style="display:none;">'+uni+'</textarea>';
	signature+=	'<textarea name="langue" style="display:none;">'+langSign+'</textarea>';
	signature+=	'<textarea name="coordPM" style="display:none;">'+coordPM+'</textarea>';
				
	signature+=	'<textarea name="total" style="display:none;">'+addPoints(PointsTotal)+'</textarea>';
	signature+=	'<textarea name="mine" style="display:none;">'+addPoints(PointsMinesTotal)+' points ( '+pourcent(PointsMinesTotal,PointsTotal)+' % )</textarea>';
	signature+=	'<textarea name="bat" style="display:none;">'+addPoints(PointsBatimentsTotal)+' points ( '+pourcent(PointsBatimentsTotal,PointsTotal)+' % )</textarea>';
	signature+=	'<textarea name="techno" style="display:none;">'+addPoints(PointsTechno)+' points ( '+pourcent(PointsTechno,PointsTotal)+' % )</textarea>';
	signature+=	'<textarea name="flotte" style="display:none;">'+addPoints(PointsFlotteTotal) + ' points ( '+pourcent(PointsFlotteTotal,PointsTotal)+' % )</textarea>';
	signature+=	'<textarea name="def" style="display:none;">'+addPoints(PointsDefTotal)+' points ( '+pourcent(PointsDefTotal,PointsTotal)+' % ) </textarea>';
	
	signature+=	'<textarea name="totalt" style="display:none;">Points total :</textarea>';
	signature+=	'<textarea name="minet" style="display:none;">Mines</textarea>';
	signature+=	'<textarea name="batt" style="display:none;">Autres bâti</textarea>';
	signature+=	'<textarea name="technot" style="display:none;">Technologies</textarea>';
	signature+=	'<textarea name="flottet" style="display:none;">Flotte</textarea>';
	signature+=	'<textarea name="deft" style="display:none;">Défense</textarea>';

	signature+=	'<input style="display:none; type="text" size="1" maxlength="3" name="colfondR" value="'+SignfondR+'" />';
	signature+=	'<input style="display:none; size="1" maxlength="3" type="text" name="colfondV" value="'+SignfondV+'" />';
	signature+=	'<input style="display:none; type="text" name="colfondB" size="1" maxlength="3" value="'+SignfondB+'" />';
	signature+=	'<input style="display:none; type="text" size="1" maxlength="3" name="coltextR" value="'+SigntextR+'" />';
	signature+=	'<input style="display:none; type="text" name="coltextV" size="1" maxlength="3" value="'+SigntextV+'" />';
	signature+=	'<input style="display:none; type="text"  size="1" maxlength="3" name="coltextB" value="'+SigntextB+'" />';

	signature+='<input type="submit" value="Créer une signature InfoCompte" /></form>';
	
			if(true)
			{
				
				var email= GM_getValue("email"+coordPM+uni,'');

				var Atlerna ='<form action="http://projet-alternative.fr/infoscompte/index.php"  target="_blank" method="post">';
				Atlerna+=	'<textarea style="display:none;"  name="pseudo" >'+DATA.player.name+'</textarea>';
				Atlerna+=	'<textarea style="display:none;" id="email" name="email">'+email+'</textarea>';
				Atlerna+=	'<textarea style="display:none;"  name="coord" >'+CoordPM.replace('[', '').replace(']', '')+'</textarea>';
				Atlerna+=	'<textarea style="display:none;"  name="uni" >uni'+uni+'.fr</textarea>';
		
				var listeNom = '';
				var listeTemperature = '';
				var listeTaille = '';
				var listeVaisseaux = nbDeVaisseau[2]+'|'+nbDeVaisseau[3]+'|'+nbDeVaisseau[4]+'|'+nbDeVaisseau[5]+'|'+nbDeVaisseau[12]+'|'+nbDeVaisseau[9]+'|'+nbDeVaisseau[10]+'|'+nbDeVaisseau[11]+'|'+nbDeVaisseau[0]+'|'+nbDeVaisseau[1]+'|'+nbDeVaisseau[6]+'|'+nbDeVaisseau[7]+'|'+nbDeVaisseau[8]+'|0';
			
				var listeVaisseauxAquai = '';
				
				var Techno = DATA.techno['ener']+'|'+DATA.techno['lase']+'|'+DATA.techno['ions']+'|'+DATA.techno['hype']+'|'+DATA.techno['plas']+'|'+DATA.techno['comb']+'|'+DATA.techno['impu']+'|'+DATA.techno['phyp']+'|'+DATA.techno['espi']+'|'+DATA.techno['ordi']+'|'+DATA.techno['expe']+'|'+DATA.techno['rese']+'|'+DATA.techno['grav']+'|'+DATA.techno['prot']+'|'+DATA.techno['arme']+'|'+DATA.techno['bouc']+'|';
				
				var BatRes= '';
				var BatSta= '';
				var DefPla= '';
				var listelune= '';
				var pointsFlotteCalc=0;
				var listeTemperaturemin = '';
				
				for (var i =0 ; i<DATA.planet.length ; i++)
				{
					listeNom+= DATA.planet[i].name+' '+DATA.planet[i].posi+';';
					listeTemperature+= DATA.planet[i].maxtemp+';';
					listeTaille += DATA.planet[i].ceil.max+';';
					
					BatRes+= DATA.planet[i].building['mmet']+'|'+ DATA.planet[i].building['mcri']+'|'+ DATA.planet[i].building['mdet']+'|'+ DATA.planet[i].building['ces']+'|'+ DATA.planet[i].building['cef']+'|0|'+ DATA.planet[i].building['hmet']+'|'+ DATA.planet[i].building['hcri']+'|'+ DATA.planet[i].building['hdet']+'|;';
					
					BatSta+= DATA.planet[i].building['rob']+'|'+ DATA.planet[i].building['cspa']+'|'+ DATA.planet[i].building['lab']+'|'+ DATA.planet[i].building['depo']+'|'+ DATA.planet[i].building['silo']+'|'+ DATA.planet[i].building['nan']+'|'+ DATA.planet[i].building['ter']+'|0|0|0|;';
					DefPla += DATA.planet[i].defence['lm']+'|'+DATA.planet[i].defence['lle']+'|'+DATA.planet[i].defence['llo']+'|'+DATA.planet[i].defence['gauss']+'|'+DATA.planet[i].defence['ion']+'|'+DATA.planet[i].defence['pla']+'|'+DATA.planet[i].defence['pb']+'|'+DATA.planet[i].defence['gb']+'|'+DATA.planet[i].defence['mic']+'|'+DATA.planet[i].defence['mip']+'|;';
					listelune+='false;';
					listeTemperaturemin += '0;';
					
					listeVaisseauxAquai += DATA.planet[i].fleet[nom_flotte[2]]+'|'+DATA.planet[i].fleet[nom_flotte[3]]+'|'+DATA.planet[i].fleet[nom_flotte[4]]+'|'+DATA.planet[i].fleet[nom_flotte[5]]+'|'+DATA.planet[i].fleet[nom_flotte[12]]+'|'+DATA.planet[i].fleet[nom_flotte[9]]+'|'+DATA.planet[i].fleet[nom_flotte[10]]+'|'+DATA.planet[i].fleet[nom_flotte[11]]+'|'+DATA.planet[i].fleet[nom_flotte[0]]+'|'+DATA.planet[i].fleet[nom_flotte[1]]+'|'+DATA.planet[i].fleet[nom_flotte[6]]+'|'+DATA.planet[i].fleet[nom_flotte[7]]+'|'+DATA.planet[i].fleet[nom_flotte[8]]+'|'+DATA.planet[i].fleet.ss+'|;';
				}
				for (var i =0 ; i<DATA.moon.length ; i++)
				{
					listeNom+= DATA.moon[i].name+' '+DATA.planet[i].posi+';';
					listeTemperature+= DATA.moon[i].maxtemp+';';
					listeTaille += DATA.moon[i].ceil.max+';';
					
					BatRes+= '0|0|0|0|0|'+ DATA.moon[i].building['hmet']+'|'+ DATA.moon[i].building['hcri']+'|'+ DATA.moon[i].building['hdet']+'|;';
					
					BatSta+= DATA.moon[i].building['rob']+'|'+ DATA.planet[i].building['cspa']+'|0|0|0|0|0|'+ DATA.moon[i].building['base']+'|'+ DATA.moon[i].building['phal']+'|'+ DATA.moon[i].building['port']+'|;';
					
					DefPla += DATA.planet[i].defence['lm']+'|'+DATA.planet[i].defence['lle']+'|'+DATA.planet[i].defence['llo']+'|'+DATA.planet[i].defence['gauss']+'|'+DATA.planet[i].defence['ion']+'|'+DATA.planet[i].defence['pla']+'|'+DATA.planet[i].defence['pb']+'|'+DATA.planet[i].defence['gb']+'|'+DATA.planet[i].defence['mic']+'|'+DATA.planet[i].defence['mip']+'|;';
					listelune+='true;';
					listeTemperaturemin += '0;';
					
					listeVaisseauxAquai += DATA.moon[i].fleet[nom_flotte[2]]+'|'+DATA.moon[i].fleet[nom_flotte[3]]+'|'+DATA.moon[i].fleet[nom_flotte[4]]+'|'+DATA.moon[i].fleet[nom_flotte[5]]+'|'+DATA.moon[i].fleet[nom_flotte[12]]+'|'+DATA.moon[i].fleet[nom_flotte[9]]+'|'+DATA.moon[i].fleet[nom_flotte[10]]+'|'+DATA.moon[i].fleet[nom_flotte[11]]+'|'+DATA.moon[i].fleet[nom_flotte[0]]+'|'+DATA.moon[i].fleet[nom_flotte[1]]+'|'+DATA.moon[i].fleet[nom_flotte[6]]+'|'+DATA.moon[i].fleet[nom_flotte[7]]+'|'+DATA.moon[i].fleet[nom_flotte[8]]+'|'+DATA.moon[i].fleet.ss+'|;';
					
				}

				for (var j =0; j< nom_flotte.length; j++)
				{	
					pointsFlotteCalc += nbDeVaisseauQ[j]*prixInitial_flotte[j];
				}
				pointsFlotteCalc += nbDeVaisseauQ[13] * 2.5;

				if ( Math.abs(PointsFlotteTotal-pointsFlotteCalc)/PointsFlotteTotal> 0.05 && Math.abs(PointsFlotteTotal-pointsFlotteCalc) > 10 ) 
					{listeVaisseauxAquai='PROBLEME';}
				
				//alert(GM_getValue("pointUni"+coordPM+uni,'0|0')+'\n'+GM_getValue("timeUni"+coordPM+uni,'0|0'));
				
				Atlerna+=	'<textarea style="display:none;"  name="statUni" >'+GM_getValue("pointUni"+coordPM+uni,'0|0')+'</textarea>';
				Atlerna+=	'<textarea style="display:none;"  name="timeStatUni" >'+GM_getValue("timeUni"+coordPM+uni,'0|0')+'</textarea>';

				
				Atlerna+=	'<textarea style="display:none;"  name="nomPlanete" >'+listeNom+'</textarea>';
				Atlerna+=	'<textarea style="display:none;"  name="lune" >'+listelune+'</textarea>';
				Atlerna+=	'<textarea style="display:none;"  name="taille" >'+listeTaille+'</textarea>';
				Atlerna+=	'<textarea style="display:none;"  name="temperature" >'+listeTemperature+'</textarea>';
				Atlerna+=	'<textarea style="display:none;"  name="BatRes" >'+BatRes+'</textarea>';
				Atlerna+=	'<textarea style="display:none;"  name="BatSta" >'+BatSta+'</textarea>';
				Atlerna+=	'<textarea style="display:none;"  name="DefPla" >'+DefPla+'</textarea>';
				Atlerna+=	'<textarea style="display:none;"  name="nbjoueur" >'+nbJoueur +'</textarea>';	
				Atlerna+=	'<textarea style="display:none;"  name="temperatureMini" >'+listeTemperaturemin+'</textarea>';
				Atlerna+=	'<textarea  style="display:none;" name="Techno" >'+Techno+'</textarea>';
				Atlerna+=	'<textarea  style="display:none;" name="flotte" >'+listeVaisseaux+'</textarea>';
				Atlerna+=	'<textarea style="display:none;"  name="points" >'+PointsTotal+'</textarea>';
				Atlerna+=	'<textarea  style="display:none;" name="flotteAquai" >'+listeVaisseauxAquai+'</textarea>';
		
				// ****************************************************************************************************************************/
				Atlerna +='<input title="C\'est un site permetant de participer aux records globaux ou d\'alliance, de voir ses statistiques personnelles, l\'évolution de son compte, de son alliance etc" id="alternativeBouton" type="submit" value="envoyer les infos vers Alternative" style="size:100px; background-color:transparent; border: solid black 1px; color:#CCCCCC;" /></form>';
				// ****************************************************************************************************************************/
			}
	
			var tr = addElem(findPath('//tbody')[5], 'tr');
			tr.addElem('td', {class: 'c', width: '60px', colspan: 4}, signature+Atlerna+'<sub><a style="font-style: italic;" href="http://vulca.evoserv.net/" target="_blank">InfoCompte '+Version+' </a> </sub>');


			/* ****************************** Demande Email Alternative ********************************/
			if(document.getElementById("alternativeBouton"))
			{
				document.getElementById("alternativeBouton").addEventListener("click", function(event) 
				{		
					document.getElementById("email").innerHTML = prompt('Quelle adresse email voulez vous utiliser pour le site Alternative ?',GM_getValue("email"+coordPM+uni, '' ) );
					if (document.getElementById("email").innerHTML != '') GM_setValue("email"+coordPM+uni,document.getElementById("email").innerHTML );
					if(listeVaisseauxAquai == 'PROBLEME') alert('Il y a un problème avec vos vaisseaux, ils ne seront pas enregistrés sur Alternative \n\n Visitez toutes vos pages flottes et/ou defense pour résoudre le problème \n(Si cela ne change rien, allez voir les pages batiments/technologies) \n\n Si vous êtes sûr d\'être passé sur toutes les pages nécessaires, merci de reporter le problème ici : http://board.ogame.fr/index.php?page=Thread&threadID=850132');
				
				
				}, true);
			}

	/* ******************************Graphique ********************************/
	if (mine)
		{var pie = draw_pie([pourcent(PointsMinesTotal,PointsTotal),pourcent(PointsBatimentsTotal,PointsTotal),pourcent(PointsTechno,PointsTotal),pourcent(PointsFlotteTotal,PointsTotal),pourcent(PointsDefTotal,PointsTotal)]);}
	else if(BatTotal)
		{var pie = draw_pie([pourcent(PointsMinesTotal+PointsBatimentsTotal,PointsTotal),pourcent(PointsTechno,PointsTotal),pourcent(PointsFlotteTotal,PointsTotal),pourcent(PointsDefTotal,PointsTotal)]);}
	var piebox = id_('piebox');		
	if (piebox) {piebox.appendChild(pie);}

	// RECHERCHE DES MAJ
			if (!AJours)
			{
				/* ******************************A Jours apres clique ********************************/
				document.getElementById("MaJ").addEventListener("click", function(event) 
				{
					GM_setValue("aJours",true);
					GM_setValue("dateMaJ",Date.parse(new Date()) / 1000)
				}, true);
			}
			/* ******************************Recherche des MaJ ********************************/
			if (parseInt(GM_getValue("dateMaJ",0))+23*3600 < Date.parse(new Date()) / 1000 ) 
			{
				GM_xmlhttpRequest(
				{
					method: 'GET',
					url: 'http://vulca.evoserv.net/script/versionfr.txt',
					
					onload: function(response) 
					{
						var Derniere_Version = response.responseText;

						Derniere_Version=Derniere_Version+'';
						Version=Version+'';
						if (Derniere_Version != Version && Derniere_Version.length < 10 && Derniere_Version.length > 4) 
						{
							GM_setValue("aJours",false);
							GM_setValue("dateMaJ",Date.parse(new Date()) / 1000)
						}
						else 
						{
							GM_setValue("aJours",true);
							GM_setValue("dateMaJ",Date.parse(new Date()) / 1000)
						}
					}
				});		
			}
	
	}	
	
	
if (page == 'statistics')
{	
	var thnode = document.getElementsByTagName('th');
	var numStat =Math.ceil(parseInt(thnode[thnode.length-5].innerHTML.split('&')[0])/100-1);

	var pointsUni = GM_getValue("pointUni"+coordPM+uni,'0|0').split('|');
	var timeUniEnr = GM_getValue("timeUni"+coordPM+uni,'0|0').split('|');
				
	pointsUni[numStat]=0;
					
	for (var i=5; i<thnode.length ; i=i+5)
	{
		pointsUni[numStat] += parseInt(thnode[i].innerHTML.replace( /[^0-9-]/g, ""));	
	}
					
	timeUniEnr[numStat] = (new Date()).getTime();
	
	GM_setValue("pointUni"+coordPM+uni,pointsUni.join('|'));
	GM_setValue("timeUni"+coordPM+uni,timeUniEnr.join('|'));

	

	var Joueur = document.getElementById('content').getElementsByTagName('table')[1].getElementsByTagName('tr');
	var f = 1;
	while (f < Joueur.length) {
		if (Joueur[f].innerHTML.indexOf("page=writemessages") == -1) { 
			N = f-10; if (N < 0) {N = 1;}
			Joueur[N].getElementsByTagName('a')[0].name = 'Player';
			Joueur[f].getElementsByTagName('th')[0].style.backgroundColor = '#000000';
			location.href = location.href + "#Player";
			f = Joueur.length;
		}
		f++;
	}
		
}


/* *******************************************************************************************************************************************************************************************/
/* *********************************************************************Fin du script InfoCompte****************************************************************************************************/

unsafeWindow.ssu.fun.updateStatus(thisData.namespace, 'activ');

}
