<?php
	require_once ('../common/scripts/templatize.inc.php');
	require_once ('../common/scripts/bdd.inc.php');
	require_once ('../common/scripts/connect.inc.php');
	require_once ('minimap/minimap.php');

/***********************/
/*connexion a la table */
/***********************/

	session_start();
	$login = $_SESSION['login'];
	$id = $_SESSION['id'];

	$tabsSecondOnglet = '';
	//user 1
	$req = 'SELECT char_name, char_id, char_head, char_ears, char_corps, char_tail,char_skincolor FROM characters WHERE user_id ='.$id;
	$nbMimichant= pg_query($dbconn,$req) or die (pg_last_error().'<br/>'.$req);
	
	while ($row = pg_fetch_row($nbMimichant)) {
		$idDefaultMimichant = $row[1];
		$nomDefaultMimichant = $row[0];
		$nomImage = '../mimichants/minit'.$row[2].'o'.$row[3].'c'.$row[4].'q'.$row[5].'c'.$row[6].'.gif';
		$tabsSecondOnglet .= '<div class="Onglet" id="'.$row[0].'" style="cursor:pointer" onmouseover="rollover(\''.$row[0].'\',\'images/fond3.gif\', \''.$row[0].'\')" onclick="info('.$row[1].',\''.$row[0].'\',\'images/fond2.gif\')"
onmousedown="selectCharA('.$row[1].',\''.$row[0].'\')" onmouseout="rollout(\''.$row[0].'\',\'images/fond1.gif\')"><img src="'.$nomImage.'" alt="'.$nomImage.'" /></div>';
	}
	$tabsSecondOnglet .= '</div>';
	
/**************/
/*affichage   */
/**************/
	
	$minimap = createMap(110,110);

	$arrayVars = array(
		'LOGIN' => $login, 
		'TABSECONDONGLET' => $tabsSecondOnglet,
		'ADDITIONNAL_HEADERS' => '
		<link href="carte.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="get/getEverything.js"></script>
		<script type="text/javascript" src="gestionCarte.js"></script>
		<script type="text/javascript" src="minimap/mapGD.js"></script>',
		'ID' => $id,
		'IDMIMI' => $idDefaultMimichant,
		'NOMMIMI' => $nomDefaultMimichant,
		'MINIMAP' => $minimap);
	
	templatizeWithVars('../common/headerMain.tpl','menuLeft.tpl','main.tpl','../common/footerMain.tpl',$arrayVars);
?>
