<?php
include ('logue.php'); 
include ('entete2.php');
include ('ressource.php');
include ('centredefcalcul.php');
include ('siege.php');
include ('entete.php');
echo "<body onload=\"reloaded()\">";
global $definition;
$sql = "SELECT labo_lvl,defense_lvl,postav_lvl,hangarfer_lvl,hangarfer_evolution,hangaror_lvl,hangaror_evolution,hangarada_lvl,hangarada_evolution,hangaror_lvl,hangarura_lvl,hangarura_evolution,deflasersimple,deflaserdouble,defelec,defions,defplasma,defnaqua,defanciens,defdrone,defense_lvl,defense_evolution,defcombat,robo_lvl,labo_lvl,labo_evolution,fer_energie,or_energie,ada_energie,ura_energie,exfer_energie,exor_energie,central_energie,eppz  FROM matgraph_users WHERE id='$planete' ";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$row = mysql_fetch_array($res); 

$sql2 = "SELECT pts,techenergie_lvl,techenergie_evolution,techlaser_lvl,techlaser_evolution,techions_lvl,techions_evolution,techplasma_lvl,techplasma_evolution,techordi_lvl,techordi_evolution,techcombustion_lvl,techcombustion_evolution,techAsgaards_lvl,techAsgaards_evolution,techhyperespace_lvl,techhyperespace_evolution,techespio1_lvl,techespio1_evolution,techespio2_lvl,techespio2_evolution,techArmement_lvl,techArmement_evolution,techBouclier_lvl,techBouclier_evolution,techcoque_lvl,techcoque_evolution,robo_lvl,labo_lvl,labo_evolution,fer_energie,or_energie,ada_energie,ura_energie,exfer_energie,exor_energie,central_energie,techproAsgaard_lvl,techproAsgaard_evolution,techproAncien_lvl,techproAncien_evolution,techinfra_lvl,techinfra_evolution,technaqua_lvl,technaqua_evolution  FROM matgraph_users WHERE id='$dataid[id]' ";
$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
$row2 = mysql_fetch_array($res2); 

// defense
if ($row[defense_lvl] =="0") {
$defense_lvl = "0";
}
else {
$defense_lvl = $row[defense_lvl];
}
// posta avancé des anciens
if ($row[postav_lvl] =="0") {
	$postav_lvl = "0";
}else{
	$postav_lvl = $row[postav_lvl];
}
// techenergie
if ($row2[techenergie_lvl] =="0") {
$techenergie_lvl = "0";
}
else {
$techenergie_lvl = $row2[techenergie_lvl];
}
// techlaser
if ($row2[techlaser_lvl] =="0") {
$techlaser_lvl = "0";
}
else {
$techlaser_lvl = $row2[techlaser_lvl];
}
// techions
if ($row2[techions_lvl] =="0") {
$techions_lvl = "0";
}
else {
$techions_lvl = $row2[techions_lvl];
}
// techplasma
if ($row2[techplasma_lvl] =="0") {
$techplasma_lvl = "0";
}
else {
$techplasma_lvl = $row2[techplasma_lvl];
}
// techordi
if ($row2[techordi_lvl] =="0") {
$techordi_lvl = "0";
}
else {
$techordi_lvl = $row2[techordi_lvl];
}
// techcombustion
if ($row2[techcombustion_lvl] =="0") {
$techcombustion_lvl = "0";
}
else {
$techcombustion_lvl = $row2[techcombustion_lvl];
}
// techAsgaards
if ($row2[techAsgaards_lvl] =="0") {
$techAsgaards_lvl = "0";
}
else {
$techAsgaards_lvl = $row2[techAsgaards_lvl];
}
// techhyperespace
if ($row2[techhyperespace_lvl] =="0") {
$techhyperespace_lvl = "0";
}
else {
$techhyperespace_lvl = $row2[techhyperespace_lvl];
}
// techespio1
if ($row2[techespio1_lvl] =="0") {
$techespio1_lvl = "0";
}
else {
$techespio1_lvl = $row2[techespio1_lvl];
}
// techespio2
if ($row2[techespio2_lvl] =="0") {
$techespio2_lvl = "0";
}
else {
$techespio2_lvl = $row2[techespio2_lvl];
}
// techArmement
if ($row2[techArmement_lvl] =="0") {
$techArmement_lvl = "0";
}
else {
$techArmement_lvl = $row2[techArmement_lvl];
}
// techBouclier
if ($row2[techBouclier_lvl] =="0") {
$techBouclier_lvl = "0";
}
else {
$techBouclier_lvl = $row2[techBouclier_lvl];
}
// techcoque
if ($row2[techcoque_lvl] =="0") {
$techcoque_lvl = "0";
}
else {
$techcoque_lvl = $row2[techcoque_lvl];
}
// techproAsgaard
if ($row2[techproAsgaard_lvl] =="0") {
$techproAsgaard_lvl = "0";
}
else {
$techproAsgaard_lvl = $row2[techproAsgaard_lvl];
}
// techproAncien
if ($row2[techproAncien_lvl] =="0") {
$techproAncien_lvl = "0";
}
else {
$techproAncien_lvl = $row2[techproAncien_lvl];
}
// techinfra
if ($row2[techinfra_lvl] =="0") {
$techinfra_lvl = "0";
}
else {
$techinfra_lvl = $row2[techinfra_lvl];
}
// technaqua
if ($row2[technaqua_lvl] =="0") {
$technaqua_lvl = "0";
}
else {
$technaqua_lvl = $row2[technaqua_lvl];
}
////// cout ////////////
//combat
$fer_necessaire_combat = number_format($definition[$univers]['defenses']['cout']['defcombat']['fer'], 0, ',', ' ');
$or_necessaire_combat = "0";
$ada_necessaire_combat = "0";
$ura_necessaire_combat = "0";
//lasersimple
$fer_necessaire_lasersimple = number_format($definition[$univers]['defenses']['cout']['deflasersimple']['fer'], 0, ',', ' ');
$or_necessaire_lasersimple = $definition[$univers]['defenses']['cout']['deflasersimple']['or'];
$ada_necessaire_lasersimple = $definition[$univers]['defenses']['cout']['deflasersimple']['crystal'];
$ura_necessaire_lasersimple = "0";
//laserdouble
$fer_necessaire_laserdouble = number_format($definition[$univers]['defenses']['cout']['deflaserdouble']['fer'], 0, ',', ' ');
$or_necessaire_laserdouble = $definition[$univers]['defenses']['cout']['deflaserdouble']['or'];
$ada_necessaire_laserdouble = $definition[$univers]['defenses']['cout']['deflaserdouble']['crystal'];
$ura_necessaire_laserdouble = "0";
//elec
$fer_necessaire_elec = number_format($definition[$univers]['defenses']['cout']['defelec']['fer'], 0, ',', ' ');
$or_necessaire_elec = number_format($definition[$univers]['defenses']['cout']['defelec']['or'], 0, ',', ' ');
$ada_necessaire_elec = number_format($definition[$univers]['defenses']['cout']['defelec']['crystal'], 0, ',', ' ');
$ura_necessaire_elec = "0";
//ions
$fer_necessaire_ions = number_format($definition[$univers]['defenses']['cout']['defions']['fer'], 0, ',', ' ');
$or_necessaire_ions = number_format($definition[$univers]['defenses']['cout']['defions']['or'], 0, ',', ' ');
$ada_necessaire_ions = number_format($definition[$univers]['defenses']['cout']['defions']['crystal'], 0, ',', ' ');
$ura_necessaire_ions = "0";
//plasma
$fer_necessaire_plasma = number_format($definition[$univers]['defenses']['cout']['tour_plasma']['fer'], 0, ',', ' ');
$or_necessaire_plasma = number_format($definition[$univers]['defenses']['cout']['tour_plasma']['or'], 0, ',', ' ');
$ada_necessaire_plasma = number_format($definition[$univers]['defenses']['cout']['tour_plasma']['crystal'], 0, ',', ' ');
$ura_necessaire_plasma = number_format($definition[$univers]['defenses']['cout']['tour_plasma']['naquadah'], 0, ',', ' ');
//naqua
$fer_necessaire_naqua = number_format($definition[$univers]['defenses']['cout']['canon_naquadah']['fer'], 0, ',', ' ');
$or_necessaire_naqua = number_format($definition[$univers]['defenses']['cout']['canon_naquadah']['or'], 0, ',', ' ');
$ada_necessaire_naqua = number_format($definition[$univers]['defenses']['cout']['canon_naquadah']['crystal'], 0, ',', ' ');
$ura_necessaire_naqua = number_format($definition[$univers]['defenses']['cout']['canon_naquadah']['naquadah'], 0, ',', ' ');
//anciens
$fer_necessaire_anciens = number_format($definition[$univers]['defenses']['cout']['satellite_ancien']['fer'], 0, ',', ' ');
$or_necessaire_anciens = number_format($definition[$univers]['defenses']['cout']['satellite_ancien']['or'], 0, ',', ' ');
$ada_necessaire_anciens = number_format($definition[$univers]['defenses']['cout']['satellite_ancien']['crystal'], 0, ',', ' ');
$ura_necessaire_anciens = number_format($definition[$univers]['defenses']['cout']['satellite_ancien']['naquadah'], 0, ',', ' ');
//drone
$fer_necessaire_drone = number_format($definition[$univers]['defenses']['cout']['drone']['fer'], 0, ',', ' ');
$or_necessaire_drone = number_format($definition[$univers]['defenses']['cout']['drone']['or'], 0, ',', ' ');
$ada_necessaire_drone = number_format($definition[$univers]['defenses']['cout']['drone']['crystal'], 0, ',', ' ');
$ura_necessaire_drone = number_format($definition[$univers]['defenses']['cout']['drone']['naquadah'], 0, ',', ' ');
$drone_max=number_format(round((100 * pow( 2, $row[postav_lvl]))), 0, ',', ' ');

//combat
$fer_necessaire2_combat = $definition[$univers]['defenses']['cout']['defcombat']['fer'];
$or_necessaire2_combat = "0";
$ada_necessaire2_combat = "0";
$ura_necessaire2_combat = "0";
//lasersimple
$fer_necessaire2_lasersimple = $definition[$univers]['defenses']['cout']['deflasersimple']['fer'];
$or_necessaire2_lasersimple = $definition[$univers]['defenses']['cout']['deflasersimple']['or'];
$ada_necessaire2_lasersimple = $definition[$univers]['defenses']['cout']['deflasersimple']['crystal'];
$ura_necessaire2_lasersimple = "0";
//laserdouble
$fer_necessaire2_laserdouble = $definition[$univers]['defenses']['cout']['deflaserdouble']['fer'];
$or_necessaire2_laserdouble = $definition[$univers]['defenses']['cout']['deflaserdouble']['or'];
$ada_necessaire2_laserdouble = $definition[$univers]['defenses']['cout']['deflaserdouble']['crystal'];
$ura_necessaire2_laserdouble = "0";
//elec
$fer_necessaire2_elec = $definition[$univers]['defenses']['cout']['defelec']['fer'];
$or_necessaire2_elec = $definition[$univers]['defenses']['cout']['defelec']['or'];
$ada_necessaire2_elec = $definition[$univers]['defenses']['cout']['defelec']['crystal'];
$ura_necessaire2_elec = "0";
//ions
$fer_necessaire2_ions = $definition[$univers]['defenses']['cout']['defions']['fer'];
$or_necessaire2_ions = $definition[$univers]['defenses']['cout']['defions']['or'];
$ada_necessaire2_ions = $definition[$univers]['defenses']['cout']['defions']['crystal'];
$ura_necessaire2_ions = "0";
//plasma
$fer_necessaire2_plasma = $definition[$univers]['defenses']['cout']['tour_plasma']['fer'];
$or_necessaire2_plasma = $definition[$univers]['defenses']['cout']['tour_plasma']['or'];
$ada_necessaire2_plasma = $definition[$univers]['defenses']['cout']['tour_plasma']['crystal'];
$ura_necessaire2_plasma = $definition[$univers]['defenses']['cout']['tour_plasma']['naquadah'];
//naqua
$fer_necessaire2_naqua = $definition[$univers]['defenses']['cout']['canon_naquadah']['fer'];
$or_necessaire2_naqua = $definition[$univers]['defenses']['cout']['canon_naquadah']['or'];
$ada_necessaire2_naqua = $definition[$univers]['defenses']['cout']['canon_naquadah']['crystal'];
$ura_necessaire2_naqua = $definition[$univers]['defenses']['cout']['canon_naquadah']['naquadah'];
//anciens
$fer_necessaire2_anciens = $definition[$univers]['defenses']['cout']['satellite_ancien']['fer'];
$or_necessaire2_anciens = $definition[$univers]['defenses']['cout']['satellite_ancien']['or'];
$ada_necessaire2_anciens = $definition[$univers]['defenses']['cout']['satellite_ancien']['crystal'];
$ura_necessaire2_anciens = $definition[$univers]['defenses']['cout']['satellite_ancien']['naquadah'];
//drone
$fer_necessaire2_drone = $definition[$univers]['defenses']['cout']['drone']['fer'];
$or_necessaire2_drone = $definition[$univers]['defenses']['cout']['drone']['or'];
$ada_necessaire2_drone = $definition[$univers]['defenses']['cout']['drone']['crystal'];
$ura_necessaire2_drone = $definition[$univers]['defenses']['cout']['drone']['naquadah'];
/////////////// TEMPS //////////////
//combat 
$stimecombat = (round(480* $siege_temps_evolution *(bcpow(0.9, $defense_lvl,3))));

$etimecombat = $stimecombat;
$emincombat = $etimecombat / 60;

if ( floor($emincombat) != $emincombat )
  $eseccombat = floor( ($emincombat - floor( $emincombat )) * 60);

  if ( $emincombat > 60 ) {

    $ehourcombat = floor( $emincombat / 60 );
    $emincombat = $emincombat - ( 60 * $ehourcombat );

    if ( $ehourcombat > 24 ) {
      $edaycombat = floor( $ehourcombat / 24);
      $ehourcombat = $ehourcombat - ( 24 * $edaycombat );
    }

  }

$etimecombat ="";

if (!empty($edaycombat) )
  $etimecombat.=$edaycombat."j";

if (!empty($ehourcombat) )
  $etimecombat.=$ehourcombat."h";

if ($emincombat != 0)
  $etimecombat.= floor($emincombat)."min";

if (!empty($eseccombat) ) 
  $etimecombat.=$eseccombat."s";
//lasersimple 
$stimelasersimple = (round(720* $siege_temps_evolution *(bcpow(0.9, $defense_lvl,3))));

$etimelasersimple = $stimelasersimple;
$eminlasersimple = $etimelasersimple / 60;

if ( floor($eminlasersimple) != $eminlasersimple )
  $eseclasersimple = floor( ($eminlasersimple - floor( $eminlasersimple )) * 60);

  if ( $eminlasersimple > 60 ) {

    $ehourlasersimple = floor( $eminlasersimple / 60 );
    $eminlasersimple = $eminlasersimple - ( 60 * $ehourlasersimple );

    if ( $ehourlasersimple > 24 ) {
      $edaylasersimple = floor( $ehourlasersimple / 24);
      $ehourlasersimple = $ehourlasersimple - ( 24 * $edaylasersimple );
    }

  }

$etimelasersimple ="";

if (!empty($edaylasersimple) )
  $etimelasersimple.=$edaylasersimple."j";

if (!empty($ehourlasersimple) )
  $etimelasersimple.=$ehourlasersimple."h";

if ($eminlasersimple != 0)
  $etimelasersimple.= floor($eminlasersimple)."min";

if (!empty($eseclasersimple) ) 
  $etimelasersimple.=$eseclasersimple."s";  
//laserdouble 
$stimelaserdouble = (round(4687* $siege_temps_evolution *(bcpow(0.9, $defense_lvl,3))));

$etimelaserdouble = $stimelaserdouble;
$eminlaserdouble = $etimelaserdouble / 60;

if ( floor($eminlaserdouble) != $eminlaserdouble )
  $eseclaserdouble = floor( ($eminlaserdouble - floor( $eminlaserdouble )) * 60);

  if ( $eminlaserdouble > 60 ) {

    $ehourlaserdouble = floor( $eminlaserdouble / 60 );
    $eminlaserdouble = $eminlaserdouble - ( 60 * $ehourlaserdouble );

    if ( $ehourlaserdouble > 24 ) {
      $edaylaserdouble = floor( $ehourlaserdouble / 24);
      $ehourlaserdouble = $ehourlaserdouble - ( 24 * $edaylaserdouble );
    }

  }

$etimelaserdouble ="";

if (!empty($edaylaserdouble) )
  $etimelaserdouble.=$edaylaserdouble."j";

if (!empty($ehourlaserdouble) )
  $etimelaserdouble.=$ehourlaserdouble."h";

if ($eminlaserdouble != 0)
  $etimelaserdouble.= floor($eminlaserdouble)."min";

if (!empty($eseclaserdouble) ) 
  $etimelaserdouble.=$eseclaserdouble."s";
//elec 
$stimeelec = (round(10750* $siege_temps_evolution *(bcpow(0.9, $defense_lvl,3))));

$etimeelec = $stimeelec;
$eminelec = $etimeelec / 60;

if ( floor($eminelec) != $eminelec )
  $esecelec = floor( ($eminelec - floor( $eminelec )) * 60);

  if ( $eminelec > 60 ) {

    $ehourelec = floor( $eminelec / 60 );
    $eminelec = $eminelec - ( 60 * $ehourelec );

    if ( $ehourelec > 24 ) {
      $edayelec = floor( $ehourelec / 24);
      $ehourelec = $ehourelec - ( 24 * $edayelec );
    }

  }

$etimeelec ="";

if (!empty($edayelec) )
  $etimeelec.=$edayelec."j";

if (!empty($ehourelec) )
  $etimeelec.=$ehourelec."h";

if ($eminelec != 0)
  $etimeelec.= floor($eminelec)."min";

if (!empty($esecelec) ) 
  $etimeelec.=$esecelec."s";
//ions 
$stimeions = (round(32250* $siege_temps_evolution *(bcpow(0.9, $defense_lvl,3))));

$etimeions = $stimeions;
$eminions = $etimeions / 60;

if ( floor($eminions) != $eminions )
  $esecions = floor( ($eminions - floor( $eminions )) * 60);

  if ( $eminions > 60 ) {

    $ehourions = floor( $eminions / 60 );
    $eminions = $eminions - ( 60 * $ehourions );

    if ( $ehourions > 24 ) {
      $edayions = floor( $ehourions / 24);
      $ehourions = $ehourions - ( 24 * $edayions );
    }

  }

$etimeions ="";

if (!empty($edayions) )
  $etimeions.=$edayions."j";

if (!empty($ehourions) )
  $etimeions.=$ehourions."h";

if ($eminions != 0)
  $etimeions.= floor($eminions)."min";

if (!empty($esecions) ) 
  $etimeions.=$esecions."s";
//plasma 
$stimeplasma = (round(48375* $siege_temps_evolution *(bcpow(0.9, $defense_lvl,3))));

$etimeplasma = $stimeplasma;
$eminplasma = $etimeplasma / 60;

if ( floor($eminplasma) != $eminplasma )
  $esecplasma = floor( ($eminplasma - floor( $eminplasma )) * 60);

  if ( $eminplasma > 60 ) {

    $ehourplasma = floor( $eminplasma / 60 );
    $eminplasma = $eminplasma - ( 60 * $ehourplasma );

    if ( $ehourplasma > 24 ) {
      $edayplasma = floor( $ehourplasma / 24);
      $ehourplasma = $ehourplasma - ( 24 * $edayplasma );
    }

  }

$etimeplasma ="";

if (!empty($edayplasma) )
  $etimeplasma.=$edayplasma."j";

if (!empty($ehourplasma) )
  $etimeplasma.=$ehourplasma."h";

if ($eminplasma != 0)
  $etimeplasma.= floor($eminplasma)."min";

if (!empty($esecplasma) ) 
  $etimeplasma.=$esecplasma."s";
//naqua 
$stimenaqua = (round(86000* $siege_temps_evolution *(bcpow(0.9, $defense_lvl,3))));

$etimenaqua = $stimenaqua;
$eminnaqua = $etimenaqua / 60;

if ( floor($eminnaqua) != $eminnaqua )
  $esecnaqua = floor( ($eminnaqua - floor( $eminnaqua )) * 60);

  if ( $eminnaqua > 60 ) {

    $ehournaqua = floor( $eminnaqua / 60 );
    $eminnaqua = $eminnaqua - ( 60 * $ehournaqua );

    if ( $ehournaqua > 24 ) {
      $edaynaqua = floor( $ehournaqua / 24);
      $ehournaqua = $ehournaqua - ( 24 * $edaynaqua );
    }

  }

$etimenaqua ="";

if (!empty($edaynaqua) )
  $etimenaqua.=$edaynaqua."j";

if (!empty($ehournaqua) )
  $etimenaqua.=$ehournaqua."h";

if ($eminnaqua != 0)
  $etimenaqua.= floor($eminnaqua)."min";

if (!empty($esecnaqua) ) 
  $etimenaqua.=$esecnaqua."s";          
//anciens 
$stimeanciens = (round(258000* $siege_temps_evolution *(bcpow(0.9, $defense_lvl,3))));

$etimeanciens = $stimeanciens;
$eminanciens = $etimeanciens / 60;

if ( floor($eminanciens) != $eminanciens )
  $esecanciens = floor( ($eminanciens - floor( $eminanciens )) * 60);

  if ( $eminanciens > 60 ) {

    $ehouranciens = floor( $eminanciens / 60 );
    $eminanciens = $eminanciens - ( 60 * $ehouranciens );

    if ( $ehouranciens > 24 ) {
      $edayanciens = floor( $ehouranciens / 24);
      $ehouranciens = $ehouranciens - ( 24 * $edayanciens );
    }

  }

$etimeanciens ="";

if (!empty($edayanciens) )
  $etimeanciens.=$edayanciens."j";

if (!empty($ehouranciens) )
  $etimeanciens.=$ehouranciens."h";

if ($eminanciens != 0)
  $etimeanciens.= floor($eminanciens)."min";

if (!empty($esecanciens) ) 
  $etimeanciens.=$esecanciens."s";

//drone
$stimedrone = (round(196000* $siege_temps_evolution *(bcpow(1.1, $postav_lvl,3))));
$etimedrone = $stimedrone;
$emindrone = $etimedrone / 60;

if ( floor($emindrone) != $emindrone )
  $esecdrone = floor( ($emindrone - floor( $emindrone )) * 60);

  if ( $emindrone > 60 ) {

    $ehourdrone = floor( $emindrone / 60 );
    $emindrone = $emindrone - ( 60 * $ehourdrone );

    if ( $ehourdrone > 24 ) {
      $edaydrone = floor( $ehourdrone / 24);
      $ehourdrone = $ehourdrone - ( 24 * $edaydrone );
    }

  }

$etimedrone ="";

if (!empty($edaydrone) )
  $etimedrone.=$edaydrone."j";

if (!empty($ehourdrone) )
  $etimedrone.=$ehourdrone."h";

if ($emindrone != 0)
  $etimedrone.= floor($emindrone)."min";

if (!empty($esecdrone) ) 
  $etimedrone.=$esecdrone."s";

//

echo"<script language=\"javascript\">

function chrono(jours,heures,minutes,secondes,champs) {

  if (secondes > 0) {
    secondes--;
  }
  else {
    secondes = 59;

    if (minutes > 0) {
      minutes--;
    }
    else {
      minutes = 59;

      if (heures > 0) {
        heures--;
        jours--;
      }
      else {
        heures = 23;
      }
    }
  }

  if ( minutes == 59 && secondes == 59 && heures == 23 ) {
    window.history.go(0);
     }
  else {
    seconde = secondes;
    minute = minutes;
    text = '';
    if (jours > 0) {
      text +=jours + 'j ';
    }
    if (heures > 0) {
      text +=heures + 'h ';
    }
    if (minutes < 10) {
      minute = '0' + minutes;
    }
    if (seconde < 10) {
      seconde = '0' + secondes;
    }
      text +=minute + 'm ' + seconde + 's';

  document.getElementById('ligne_' + champs).innerHTML = 'Temps restant : <font color=#800000>'+ text +'</font>';
  setTimeout(\"chrono(\" + jours + \",\" + heures + \",\" + minutes + \",\" + secondes + \",'\" + champs + \"')\", 1000);
         }
    }
</script>

<style type=\"text/css\">
<!--
img {
border:0;
}
A {
	COLOR: #9999ff; TEXT-DECORATION: none
}
A:hover {
	COLOR: #ff9900; TEXT-DECORATION: none
}

.objet_name{
	color:#B9C6FF;
	font-size:12px;
	text-align:center;
}
.objet_level{
	color:#FF4F65;
	font-size:12px;
}
.Categorie {
	color: #CCCCCC;
	font-size:14px;
	
}

.Categorie:first-letter /* La première lettre de chaque paragraphe */
{
   font-weight: bold; /* En gras */
   font-size: 15px; /* Ecrit légèrement plus gros que la normale */
   color:#666666; /* En bleu */
}
.objet_construc{
 font-size:14px;
 text-align:center;
}
-->
</style>
<script src=\"Js_module/overlib.js\" type=text/javascript></script>
<style type=text/css>.Style1 {
	COLOR:#FF0000;
}
.Style2 {
	COLOR: #ff0000
}
.Style3 {
	COLOR: #00cc00
}
.Style4 {
	COLOR: #999999
}
.Style5 {
	COLOR: #3399ff
}
.Style6 {
	COLOR: #ffff00
}
A.menulink {
	BORDER-RIGHT: #111111 1px solid; BORDER-TOP: #111111 1px solid; FONT-SIZE: 11px; BORDER-LEFT: #111111 1px solid; WIDTH: 150px; COLOR: #00cc00; BORDER-BOTTOM: #111111 1px solid; FONT-FAMILY: Verdana; TEXT-DECORATION: none
}
A.menulink:hover {
	BORDER-RIGHT: #111111 1px solid; BORDER-TOP: #111111 1px solid; BORDER-LEFT: #111111 1px solid; COLOR: #00cc00; BORDER-BOTTOM: #111111 1px solid; BACKGROUND-COLOR: #111111
}
A.menulink2 {
	BORDER-RIGHT: #111111 1px solid; BORDER-TOP: #111111 1px solid; FONT-SIZE: 11px; BORDER-LEFT: #111111 1px solid; WIDTH: 150px; COLOR: #ff3300; BORDER-BOTTOM: #111111 1px solid; FONT-FAMILY: Verdana; TEXT-DECORATION: none
}
A.menulink2:hover {
	BORDER-RIGHT: #111111 1px solid; BORDER-TOP: #111111 1px solid; BORDER-LEFT: #111111 1px solid; BORDER-BOTTOM: #111111 1px solid; BACKGROUND-COLOR: #111111
}
INPUT {
	BORDER-RIGHT: #7e7e7e 1px solid; height: 20px; BORDER-TOP: #7e7e7e 1px solid; BORDER-LEFT: #7e7e7e 1px solid; COLOR: white; BORDER-BOTTOM: #7e7e7e 1px solid; FONT-FAMILY: 'trebuchet ms',sans-serif; BACKGROUND-COLOR: #222222
}
TEXTAREA {
	BORDER-RIGHT: #7e7e7e 1px solid; BORDER-TOP: #7e7e7e 1px solid; BORDER-LEFT: #7e7e7e 1px solid; COLOR: white; BORDER-BOTTOM: #7e7e7e 1px solid; FONT-FAMILY: 'trebuchet ms',sans-serif; BACKGROUND-COLOR: #000000
}
SELECT {
	COLOR: white; BACKGROUND-COLOR: #000000
}
OPTION {
	COLOR: white; BACKGROUND-COLOR: #000000
}
</style>";
echo"<div align=\"center\"><form name=\"colo\" method=\"post\" action=\"colonie.php\" target=\"_parent\">
<table align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
   <tr>
     <td width=\"100\" rowspan=\"2\" valign=\"middle\">
       <div align=\"center\">
         <input name=\"page\" value=\"" . $PHP_SELF . "\" type=\"hidden\" id=\"page\">
         <select name=\"idcolo\" onchange=submit()>";
include ('colo2.php'); 

$iris_img = "iris";
$combat_img = "combatt";
$lasersimple_img = "lasert";
$laserdouble_img = "double_laser";
$elec_img = "tracteur";
$ions_img = "def_ions";
$plasma_img = "plasmat";
$naqua_img = "def_naquadah";
$anciens_img = "satellites_anciens";
$drone_img = "drone";

$iris_typedef = "iris";
$combat_typedef = "defcombat";
$lasersimple_typedef = "deflasersimple";
$laserdouble_typedef = "deflaserdouble";
$elec_typedef = "defelec";
$ions_typedef = "defions";
$plasma_typedef = "defplasma";
$naqua_typedef = "defnaqua";
$anciens_typedef = "defanciens";
$drone_typedef = "defdrone";

$iris_name = "Iris";
$combat_name = "Tourelles de Combat";
$lasersimple_name = "Tourelle laser simple";
$laserdouble_name = "Double tourelle laser";
$elec_name = "Rayon Tracteur";
$ions_name = "Mini Satellite à ions";
$plasma_name = "Tour à plasma";
$naqua_name = "Canon au Naquadah";
$anciens_name = "Satellite des Anciens";
$drone_name = "Drônes";
//////////////////
//description defense
///iris
$iris_description = addslashes("L'iris protège des attaques venues de la porte des étoiles. Un iris protège d'une seule attaque. <br><br>Coût : allopass : <strong>1 code pour 2 Iris</strong> <br>Temps de construction : Instantanné");
///tour de combat
$combat_description  = addslashes("Les tourelles de combat sont de banals systèmes de défenses. Ce sont les plus courantes, mais aussi les moins puissantes.<br>Puissance : <b>");
$combat_description .= number_format($definition[$univers]['defenses']['puiss_res']['defcombat']['puissance'],0,',',' ');
$combat_description .= addslashes("</b> Résistance : <b>");
$combat_description .= number_format($definition[$univers]['defenses']['puiss_res']['defcombat']['resistance'],0,',',' ');
$combat_description .= addslashes("</b>");
///tour laser simple
$lasersimple_description = addslashes("Les tourelles au laser sont des tours modifiées pour être plus efficaces. <br>Puissance : <b>".$definition[$univers]['defenses']['puiss_res']['deflasersimple']['puissance']."</b> Résistance : <b>".$definition[$univers]['defenses']['puiss_res']['deflasersimple']['resistance']."</b> ");
///tour_laser_double
$laserdouble_description  = addslashes("La tourelle à double laser est constituée de deux canons à laser qui se regroupent ensuite pour n'en former plus qu'un mais d'une puissance 4 fois plus grande à celle d'un laser simple.<br>Puissance : <b>");
$laserdouble_description .= number_format($definition[$univers]['defenses']['puiss_res']['deflaserdouble']['puissance'],0,',',' ');
$laserdouble_description .= addslashes("</b> Résistance : <b>");
$laserdouble_description .= number_format($definition[$univers]['defenses']['puiss_res']['deflaserdouble']['resistance'],0,',',' ');
$laserdouble_description .= addslashes("</b> ");
///rayon tracteur
$elec_description  = addslashes("Le Rayon tracteur est en fait un gros canon électromagnétique qui attire les vaisseaux vers lui et les fait s'écraser.<br>Puissance : <b>");
$elec_description .= number_format($definition[$univers]['defenses']['puiss_res']['defelec']['puissance'],0,',',' ');
$elec_description .= addslashes("</b> Résistance : <b>");
$elec_description .= number_format($definition[$univers]['defenses']['puiss_res']['defelec']['resistance'],0,',',' ');
$elec_description .= addslashes("</b> ");
///satellite à ions
$ions_description  = addslashes("Le satellite à ions est un petit satellite mis en orbite autour de la planète. Sa petite taille le rend difficilement repérable<br>Puissance : <b>");
$ions_description .= number_format($definition[$univers]['defenses']['puiss_res']['defions']['puissance'],0,',',' ');
$ions_description .= addslashes("</b> Résistance : <b>");
$ions_description .= number_format($definition[$univers]['defenses']['puiss_res']['defions']['resistance'],0,',',' ');
$ions_description .= addslashes("</b> ");
///tour de plasma
$plasma_description  = addslashes("Les tours de plasma sont très puissantes et font partie des 3 armes les plus puissantes connues. Leur rayon de plasma est très puissant et capable de détruire en un coup les vaisseaux peu résistants.<br>Puissance : <b>");
$plasma_description .= number_format($definition[$univers]['defenses']['puiss_res']['tour_plasma']['puissance'],0,',',' ');
$plasma_description .= addslashes("</b> Résistance : <b>");
$plasma_description .= number_format($definition[$univers]['defenses']['puiss_res']['tour_plasma']['resistance'],0,',',' ');
$plasma_description .= addslashes("</b> ");
///canon à naquadah
$naqua_description  = addslashes("Sur le même principe que les tourelles à double laser, les Canons au Naquadah permettent de créer un rayon suffisamment puissant pour travers les coques les plus solides.<br>Puissance : <b>");
$naqua_description .= number_format($definition[$univers]['defenses']['puiss_res']['canon_naquadah']['puissance'],0,',',' ');
$naqua_description .= addslashes("</b> Résistance : <b>");
$naqua_description .= number_format($definition[$univers]['defenses']['puiss_res']['canon_naquadah']['resistance'],0,',',' ');
$naqua_description .= addslashes("</b> ");
///satellite des anciens
$anciens_description  = addslashes("Le satellite Ancien est le plus puissant de système de défense, et de loin. Rapide, il peut même défendre une autre planète que celle où il a été construit grâce à ses propulseurs hyperespaces.<br>Puissance : <b>");
$anciens_description .= number_format($definition[$univers]['defenses']['puiss_res']['satellite_ancien']['puissance'],0,',',' ');
$anciens_description .= addslashes("</b> Résistance : <b>");
$anciens_description .= number_format($definition[$univers]['defenses']['puiss_res']['satellite_ancien']['resistance'],0,',',' ');
$anciens_description .= addslashes("</b> ");
///drone
$drone_description  = addslashes("Ce moyens de défense est utilisable qu'une fois, dès qu'il a utilisé toute sa puissance il est détruit mais il a l'avantage de ne pas subir l'attaque ennemi donc il ne pourra être détruit dès la première passe de l'attaquant et donc un drône ne peut être détruit qu'en vidant sa puissance sur un attaquant, d'où son prix élevé.<br>Puissance : <b>");
$drone_description .= number_format($definition[$univers]['defenses']['puiss_res']['drone']['puissance'],0,',',' ');
$drone_description .= addslashes("</b> ");
//
////////////////////

// iris
		$reqxx = "SELECT restant FROM matgraph_iris WHERE idplanete='$planete'";
		$resxx = db_mysql_Query($reqxx) or die('Erreur SQL! <br>'.$reqxx.'<br>'.mysql_error());
		$numxx = mysql_num_rows($resxx);
		if ( $numxx > 0 )
		{	
			$rowxx = mysql_fetch_array($resxx);
		}
		else
		{
			$rowxx[restant] = 0;
		}
		
$iris_nbre = $rowxx[restant];
$combat_nbre = $row[defcombat];
$lasersimple_nbre = $row[deflasersimple];
$laserdouble_nbre = $row[deflaserdouble];
$elec_nbre = $row[defelec];
$ions_nbre = $row[defions];
$plasma_nbre = $row[defplasma];
$naqua_nbre = $row[defnaqua];
$anciens_nbre = $row[defanciens];
$drone_nbre = $row[defdrone];

function premiertd($name,$nbre,$max=0) {

echo"<td width=\"120\" style=\"BACKGROUND-COLOR:#4D4D4D\" class=\"objet_name\"> ".stripslashes($name)." (<span class=\"objet_level\">$nbre</span>)";
if($max!=0){
	echo "(Max:".$max.")";
}
echo "</td>";

}

function deuxiemetd($name,$nbre,$img,$description,$etime,$newwfer_ressource,$newwor_ressource,$newwada_ressource,$newwura_ressource,$Depense2_fer,$Depense2_or,$Depense2_ada,$Depense2_ura,$Depense_fer,$Depense_or,$Depense_ada,$Depense_ura,$nbre=0,$max=0) {

echo"<td style=\"width:120px\"> <a href=\"#\" onMouseOver=\"return overlib('<table border=\'0\' cellspacing=\'0\' cellpadding=\'0\' width=\'332px\'> <tr> <td class=black background=\'imgs/tip/topleft.png\' width=\'6\' height=\'6\'></td> <td class=black background=\'imgs/tip/top.png\' height=\'6\'></td> <td class=black background=\'imgs/tip/topright.png\' width=\'6\' height=\'6\'></td> </tr> <tr> <td class=black background=\'imgs/tip/left.png\' width=\'6\'></td> <td class=black background=\'imgs/tip/middle.png\' heigh=\'500\'> <table background=\'imgs/tip/middle.png\' border=\'0\' style=\'border-collapse:collapse;font-size: 12px;width:320px\'> <tr> <td class=black background=\'imgs/tip/middle.png\' colspan=\'2\'><strong>$name</strong> ($nbre) </td> </tr> <tr> <td class=black background=\'imgs/tip/middle.png\'><img src=\'imgs/".$img."_m.gif\' alt=\'$name\' width=\'80\' height=\'80\'></td> <td class=black background=\'imgs/tip/middle.png\'>$description</td> </tr> <tr style=\'text-align:center;\'> <td class=black background=\'imgs/tip/middle.png\'><span style=\'color:#FF0000\'><strong>$etime</strong></span></td> <td class=black background=\'imgs/tip/middle.png\'><strong>"; if(!empty($Depense2_fer)) {echo" <br> Fer : ";if($newwfer_ressource < ($Depense2_fer)){ echo"<span style=\'color:#FF0000\'>$Depense_fer</span>"; } else { echo"$Depense_fer"; }} if(!empty($Depense2_or)) { echo" <br> Or : "; if($newwor_ressource < ($Depense2_or)){ echo"<span style=\'color:#FF0000\'>$Depense_or</span>"; } else { echo"$Depense_or"; }} if(!empty($Depense2_ada)) { echo" <br> Cristal : "; if($newwada_ressource < ($Depense2_ada)){ echo"<span style=\'color:#FF0000\'>$Depense_ada</span>"; } else { echo"$Depense_ada"; }} if(!empty($Depense2_ura)) { echo" <br> Naquadah : "; if($newwura_ressource < ($Depense2_ura)){ echo"<span style=\'color:#FF0000\'>$Depense_ura</span>"; } else { echo"$Depense_ura"; }} echo"</strong> </td> </tr> </table> </td>	<td class=\'black\' background=\'imgs/tip/right.png\' width=\'6\'></td> </tr> <tr> <td class=black background=\'imgs/tip/bottomleft.png\' width=\'6\' height=\'6\'></td> <td class=black background=\'imgs/tip/bottom.png\' height=\'6\'></td> <td class=black background=\'imgs/tip/bottomright.png\' width=\'6\' height=\'6\'></td>	</tr>	</table>')\" onMouseOut=\"return nd()\"> <img src=\"imgs/"; if ($newwfer_ressource >= ($Depense2_fer) && $newwor_ressource >= ($Depense2_or) && $newwada_ressource >= ($Depense2_ada) && $newwura_ressource >= ($Depense2_ura)) { echo $img; } else { echo $img."_d"; } echo".gif\" alt=\"$name\" width=\"120\" height=\"120\"></a></td>";

}


function troisiemetd($typedef,$newwfer_ressource,$newwor_ressource,$newwada_ressource,$newwura_ressource,$Depense2_fer,$Depense2_or,$Depense2_ada,$Depense2_ura,$timedefense2,$nbre=0,$max=0) {

echo"<form action=\"constructiondef.php\" method=\"post\" target=\"_parent\"><td width=\"120\">"; if ($newwfer_ressource < ($Depense2_fer) || $newwor_ressource < ($Depense2_or) || $newwada_ressource < ($Depense2_ada) || $newwura_ressource < ($Depense2_ura) || $timedefense2 != "-1" || ($nbre==$max && $max!=0) ) { echo"-"; } else { echo" <input style=\"margin:0px;padding:0px\" name=\"nombre_def\" type=\"text\" id=\"nombre_def\" size=\"3\"> <input name=\"typedef\" type=\"hidden\" value=\"$typedef\"> <input type=\"submit\" name=\"Submit\" value=\"Lancer\"> "; } echo"</td></form>";
								

}

//iris
function troisiemetdiris($typedef,$newwfer_ressource,$newwor_ressource,$newwada_ressource,$newwura_ressource,$Depense2_fer,$Depense2_or,$Depense2_ada,$Depense2_ura,$timedefense2) {

echo"<td><a href=\"achat.php\" target=\"_parent\" class=\"objet_construc\">Acheter</a></td>";
								

}


$premierecolonne = 1;
if ($defense_lvl > "0") { $premierecolonne ++; }
if ($defense_lvl > "1" && $techlaser_lvl > "1") {$premierecolonne ++; }
if ($defense_lvl > "2" && $techlaser_lvl > "3") { $premierecolonne ++; }
if ($defense_lvl > "3" && $techBouclier_lvl > "0" && $techenergie_lvl > "4") { $premierecolonne ++; }
echo"<table width=\"596px\" border=\"0\" style=\"border-collapse:collapse;\">

              <tr>
                <td colspan=\"$premierecolonne\" style=\"BACKGROUND-COLOR: #222222\" class=\"Categorie\">Défenses</td>
              </tr>
			  <tr>";
			  premiertd($iris_name,$iris_nbre);
			  if ($defense_lvl > "0") { premiertd($combat_name,$combat_nbre); }
			  if ($defense_lvl > "1" && $techlaser_lvl > "1") { premiertd($lasersimple_name,$lasersimple_nbre); }
			  if ($defense_lvl > "2" && $techlaser_lvl > "3") { premiertd($laserdouble_name,$laserdouble_nbre); }
			  if ($defense_lvl > "3" && $techBouclier_lvl > "0" && $techenergie_lvl > "4") { premiertd($elec_name,$elec_nbre); }
				echo"</tr>
              <tr style=\"text-align:center\">";
			  deuxiemetd($iris_name,$iris_nbre,$iris_img,$iris_description,$etimeiris,$newwfer_ressource,$newwor_ressource,$newwada_ressource,$newwura_ressource,$fer_necessaire2_iris,$or_necessaire2_iris,$ada_necessaire2_iris,$ura_necessaire2_iris,$fer_necessaire_iris,$or_necessaire_iris,$ada_necessaire_iris,$ura_necessaire_iris);
			  if ($defense_lvl > "0") { deuxiemetd($combat_name,$combat_nbre,$combat_img,$combat_description,$etimecombat,$newwfer_ressource,$newwor_ressource,$newwada_ressource,$newwura_ressource,$fer_necessaire2_combat,$or_necessaire2_combat,$ada_necessaire2_combat,$ura_necessaire2_combat,$fer_necessaire_combat,$or_necessaire_combat,$ada_necessaire_combat,$ura_necessaire_combat); }
			  if ($defense_lvl > "1" && $techlaser_lvl > "1") { deuxiemetd($lasersimple_name,$lasersimple_nbre,$lasersimple_img,$lasersimple_description,$etimelasersimple,$newwfer_ressource,$newwor_ressource,$newwada_ressource,$newwura_ressource,$fer_necessaire2_lasersimple,$or_necessaire2_lasersimple,$ada_necessaire2_lasersimple,$ura_necessaire2_lasersimple,$fer_necessaire_lasersimple,$or_necessaire_lasersimple,$ada_necessaire_lasersimple,$ura_necessaire_lasersimple); }
			  if ($defense_lvl > "2" && $techlaser_lvl > "3") { deuxiemetd($laserdouble_name,$laserdouble_nbre,$laserdouble_img,$laserdouble_description,$etimelaserdouble,$newwfer_ressource,$newwor_ressource,$newwada_ressource,$newwura_ressource,$fer_necessaire2_laserdouble,$or_necessaire2_laserdouble,$ada_necessaire2_laserdouble,$ura_necessaire2_laserdouble,$fer_necessaire_laserdouble,$or_necessaire_laserdouble,$ada_necessaire_laserdouble,$ura_necessaire_laserdouble); }
			  if ($defense_lvl > "3" && $techBouclier_lvl > "0" && $techenergie_lvl > "4") { deuxiemetd($elec_name,$elec_nbre,$elec_img,$elec_description,$etimeelec,$newwfer_ressource,$newwor_ressource,$newwada_ressource,$newwura_ressource,$fer_necessaire2_elec,$or_necessaire2_elec,$ada_necessaire2_elec,$ura_necessaire2_elec,$fer_necessaire_elec,$or_necessaire_elec,$ada_necessaire_elec,$ura_necessaire_elec); }
			  echo"</tr>
              <tr style=\"text-align:center;BACKGROUND-COLOR: #222222\">";
			  troisiemetdiris($iris_typedef,$newwfer_ressource,$newwor_ressource,$newwada_ressource,$newwura_ressource,$fer_necessaire2_iris,$or_necessaire2_iris,$ada_necessaire2_iris,$ura_necessaire2_iris,$timedefense2);
			  if ($defense_lvl > "0") { troisiemetd($combat_typedef,$newwfer_ressource,$newwor_ressource,$newwada_ressource,$newwura_ressource,$fer_necessaire2_combat,$or_necessaire2_combat,$ada_necessaire2_combat,$ura_necessaire2_combat,$timedefense2); }
			  if ($defense_lvl > "1" && $techlaser_lvl > "1") { troisiemetd($lasersimple_typedef,$newwfer_ressource,$newwor_ressource,$newwada_ressource,$newwura_ressource,$fer_necessaire2_lasersimple,$or_necessaire2_lasersimple,$ada_necessaire2_lasersimple,$ura_necessaire2_lasersimple,$timedefense2); }
			  if ($defense_lvl > "2" && $techlaser_lvl > "3") { troisiemetd($laserdouble_typedef,$newwfer_ressource,$newwor_ressource,$newwada_ressource,$newwura_ressource,$fer_necessaire2_laserdouble,$or_necessaire2_laserdouble,$ada_necessaire2_laserdouble,$ura_necessaire2_laserdouble,$timedefense2); }
			   if ($defense_lvl > "3" && $techBouclier_lvl > "0" && $techenergie_lvl > "4") { troisiemetd($elec_typedef,$newwfer_ressource,$newwor_ressource,$newwada_ressource,$newwura_ressource,$fer_necessaire2_elec,$or_necessaire2_elec,$ada_necessaire2_elec,$ura_necessaire2_elec,$timedefense2); }
			  echo"
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
			  <tr>";
			  if ($postav_lvl >= "1" && $techArmement_lvl >= "16" && $techenergie_lvl >= "12") { premiertd($drone_name,$drone_nbre,$drone_max); }
			  if ($defense_lvl > "4" && $techions_lvl > "5") { premiertd($ions_name,$ions_nbre); }
			  if ($defense_lvl > "5" && $techplasma_lvl > "6") { premiertd($plasma_name,$plasma_nbre); }
			  if ($defense_lvl > "7" && $technaqua_lvl > "7") { premiertd($naqua_name,$naqua_nbre); }
			  if ($defense_lvl > "9" && $techproAncien_lvl > "9" && $techenergie_lvl > "7" && $techBouclier_lvl > "9") { premiertd($anciens_name,$anciens_nbre); }
			  echo"</tr>
              <tr style=\"text-align:center\">";
			  if ($postav_lvl >= "1" && $techArmement_lvl >= "16" && $techenergie_lvl >= "12") { deuxiemetd($drone_name,$drone_nbre,$drone_img,$drone_description,$etimedrone,$newwfer_ressource,$newwor_ressource,$newwada_ressource,$newwura_ressource,$fer_necessaire2_drone,$or_necessaire2_drone,$ada_necessaire2_drone,$ura_necessaire2_drone,$fer_necessaire_drone,$or_necessaire_drone,$ada_necessaire_drone,$ura_necessaire_drone,$drone_nbre,$drone_max); }
			  if ($defense_lvl > "4" && $techions_lvl > "5") { deuxiemetd($ions_name,$ions_nbre,$ions_img,$ions_description,$etimeions,$newwfer_ressource,$newwor_ressource,$newwada_ressource,$newwura_ressource,$fer_necessaire2_ions,$or_necessaire2_ions,$ada_necessaire2_ions,$ura_necessaire2_ions,$fer_necessaire_ions,$or_necessaire_ions,$ada_necessaire_ions,$ura_necessaire_ions); }
			  if ($defense_lvl > "5" && $techplasma_lvl > "6") { deuxiemetd($plasma_name,$plasma_nbre,$plasma_img,$plasma_description,$etimeplasma,$newwfer_ressource,$newwor_ressource,$newwada_ressource,$newwura_ressource,$fer_necessaire2_plasma,$or_necessaire2_plasma,$ada_necessaire2_plasma,$ura_necessaire2_plasma,$fer_necessaire_plasma,$or_necessaire_plasma,$ada_necessaire_plasma,$ura_necessaire_plasma); }
			  if ($defense_lvl > "7" && $technaqua_lvl > "7") { deuxiemetd($naqua_name,$naqua_nbre,$naqua_img,$naqua_description,$etimenaqua,$newwfer_ressource,$newwor_ressource,$newwada_ressource,$newwura_ressource,$fer_necessaire2_naqua,$or_necessaire2_naqua,$ada_necessaire2_naqua,$ura_necessaire2_naqua,$fer_necessaire_naqua,$or_necessaire_naqua,$ada_necessaire_naqua,$ura_necessaire_naqua); }
			  if ($defense_lvl > "9" && $techproAncien_lvl > "9" && $techenergie_lvl > "7" && $techBouclier_lvl > "9") { deuxiemetd($anciens_name,$anciens_nbre,$anciens_img,$anciens_description,$etimeanciens,$newwfer_ressource,$newwor_ressource,$newwada_ressource,$newwura_ressource,$fer_necessaire2_anciens,$or_necessaire2_anciens,$ada_necessaire2_anciens,$ura_necessaire2_anciens,$fer_necessaire_anciens,$or_necessaire_anciens,$ada_necessaire_anciens,$ura_necessaire_anciens); }
			  echo"</tr>
              <tr style=\"text-align:center;BACKGROUND-COLOR: #222222\">";
			  if ($postav_lvl >= "1" && $techArmement_lvl >= "13" && $techenergie_lvl >= "12") { troisiemetd($drone_typedef,$newwfer_ressource,$newwor_ressource,$newwada_ressource,$newwura_ressource,$fer_necessaire2_drone,$or_necessaire2_drone,$ada_necessaire2_drone,$ura_necessaire2_drone,$timedefense2,$drone_nbre,$drone_max); }
			  if ($defense_lvl > "4" && $techions_lvl > "5") { troisiemetd($ions_typedef,$newwfer_ressource,$newwor_ressource,$newwada_ressource,$newwura_ressource,$fer_necessaire2_ions,$or_necessaire2_ions,$ada_necessaire2_ions,$ura_necessaire2_ions,$timedefense2); }
			  if ($defense_lvl > "5" && $techplasma_lvl > "6") { troisiemetd($plasma_typedef,$newwfer_ressource,$newwor_ressource,$newwada_ressource,$newwura_ressource,$fer_necessaire2_plasma,$or_necessaire2_plasma,$ada_necessaire2_plasma,$ura_necessaire2_plasma,$timedefense2); }
			  if ($defense_lvl > "7" && $technaqua_lvl > "7") { troisiemetd($naqua_typedef,$newwfer_ressource,$newwor_ressource,$newwada_ressource,$newwura_ressource,$fer_necessaire2_naqua,$or_necessaire2_naqua,$ada_necessaire2_naqua,$ura_necessaire2_naqua,$timedefense2); }
			  if ($defense_lvl > "9" && $techproAncien_lvl > "9" && $techenergie_lvl > "7" && $techBouclier_lvl > "9") { troisiemetd($anciens_typedef,$newwfer_ressource,$newwor_ressource,$newwada_ressource,$newwura_ressource,$fer_necessaire2_anciens,$or_necessaire2_anciens,$ada_necessaire2_anciens,$ura_necessaire2_anciens,$timedefense2); }

			  echo"
              </tr>
	</table><br><br>";

$req = "SELECT * FROM matgraph_constructiondef WHERE findeconstruction > ".time()." AND proprietaire='$planete' ";
$res = db_mysql_Query($req) or die('erreur sql<br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ($num >0) {
echo"<br><select name=\"select\" size=\"5\">";
}

$req = "SELECT * FROM matgraph_constructiondef WHERE findeconstruction > ".time()." AND proprietaire='$planete' ORDER BY id asc ";
$res = db_mysql_Query($req) or die('erreur sql<br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ($num >0) {
  While ( $row = mysql_fetch_array($res) ) {
if ($row[typedef] == "defcombat") {
$typedef = "Tourelles de Combat"; }
if ($row[typedef] == "deflasersimple") {
$typedef = "Tourelles laser simple"; }
if ($row[typedef] == "deflaserdouble") {
$typedef = "Tourelle laser à double rayon"; }
if ($row[typedef] == "defelec") {
$typedef = "Tour électromagnétique"; }
if ($row[typedef] == "defions") {
$typedef = "Mini Satellite à ions"; }
if ($row[typedef] == "defplasma") {
$typedef = "Tour à plasma"; }
if ($row[typedef] == "defnaqua") {
$typedef = "Tourelle de Naquadah"; }
if ($row[typedef] == "defanciens") {
$typedef = "Satellite des Anciens"; }
if ($row[typedef] == "defdrone") {
$typedef = "Drônes"; 
}

echo"<option value=\"$typedef\">$typedef</option>";
  	}
}
$req = "SELECT * FROM matgraph_constructiondef WHERE findeconstruction > ".time()." AND proprietaire='$planete' ";
$res = db_mysql_Query($req) or die('erreur sql<br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ($num >0) {
echo"</select>"; }

$req = "SELECT * FROM matgraph_constructiondef WHERE findeconstruction > ".time()." AND proprietaire='$planete' ";
$res = db_mysql_Query($req);
$num = mysql_num_rows($res);
if ($num >0) {


$sql = "SELECT findeconstruction FROM matgraph_constructiondef WHERE proprietaire = '$planete' ORDER BY findeconstruction desc";
$res = db_mysql_Query($sql) or die('Erreur SQL!<br>'.$sql.'<br>'.mysql_error());

$dertemps = mysql_result($res, 0);

$tempsfin =  $dertemps - time();
$etimetechcoque = $tempsfin;
  
echo"<br><br>Temps total restant : <span id=\"temps_def\"></span><input id=\"lanceurCh\" value=\"".$etimetechcoque.":temps_def;\" type=\"hidden\">"; }

mysql_close($connect);

//echo'<br><br><br>';
//include 'zap.php';
?>