<!--
/* \version versionA&S:3.1.1                                      */
/* \date DateA&S:04/12/2007                                    */
var net=false ; //cette variable bool�enne et globale � la page
var c_cible;
var cx,cy;
var x0,y0; // position debut
var vx, vy; // position vision

var numeroID = 0; // conserve le nb de cases avec div unite
var packID = 0; // conserve le nb de cases avec div pack

function fcal(numero) {
top.hof=window.open(url_cal+'&numero='+numero,'calepin','width=410,height=520,menubar=0,toolbar=0,status=0,scrollbars=1,resizable=1');
top.hof.document.close();
top.hof.focus();
}

function visu_clan(clan)
//  0       1       2   3       4       5  6  7      8      9       10      11      12              13      14         15		16
// type, modele, armee, niveau, numero, x, y, v_niv, v_max, f_niv, f_max    action  dans la carte?  prime   desactive  attacher packs
{
    var ligne=0;
document.write('<table class="info" width="100%" cellpadding="0" cellspacing="0">\
<tr><td><b>'+txt[1]+'</b></td><td>&nbsp;</td><td>&nbsp;</td><td><b>'+txt[2]+'</b></td><td><b>'+txt[3]+'</b></td><td><b>'+txt[4]+'</b></td><td><b>'+txt[5]+'</b></td>\n');
for(i=0;i<clan.length-1;i++)
{
    if(ligne%2==0)
        couleur=lignes[0];
    else
        couleur=lignes[1];
    ligne=ligne+1;

    var niveau = ' ';
    var login = ' ';
    var info = '';
    var action ='';
    unite = '<IMG class=\'m\' SRC=\''+ipath+type[clan[i][0]][1]+'_s_'+ext[clan[i][2]]+'.png\'>';
    if( clan[i][0] == 253)  // QG
    {
        login = ' <i>'+clan[i][1]+'</i>';
        clan[i][1] = 0; // on remet le modele a 0
    }
    else if(clan[i][0] == 8)  // campement
    {
        login = clan[i][1];
        niveau = '<IMG class=\'g\' SRC="'+ipath+'n'+clan[i][3]+'.png" TITLE=\''+txt[6]+' '+clan[i][3]+'\'> ';
        clan[i][1] = 0; // on remet le modele a 0
    }
    else
        niveau = '<IMG class=\'g\' SRC="'+ipath+'n'+clan[i][3]+'.png" TITLE=\''+txt[6]+' '+clan[i][3]+'\'> ';

    document.write('</tr><tr bgcolor="'+couleur+'"><td class="'+style[clan[i][2]]+'">');

    info = unite+niveau+'<b>'+type[clan[i][0]][0]+'</b> '+type[clan[i][0]][2][clan[i][1]]+login;

    switch(clan[i][14])
    {
    case 1:  // desactive
     action = '<a class="'+style[clan[i][2]]+'" href="#" OnClick="javascript:activer(\''+lien+'&stock=1&activer='+clan[i][4]+'\')">';
     info = action+info+'</a>';
     position='<td>[d�sact.]</td><td>'+clan[i][11]+'</td><td>';
     break;
    case 2: // en transport
     action = '<a class="'+style[clan[i][2]]+'" href="javascript:l(\'chg='+clan[i][4]+'\')"';
     if(clan[i][12] !== 0)
      action += ' onMouseOver="a('+clan[i][5]+','+clan[i][6]+')" onMouseOut="mc()"';
     action += '>';
     info = action+'<i>'+info+'</i> <IMG class=\'m\' SRC=\''+ipath+'transport_s_'+ext[clan[i][2]]+'.png\'></a>';
     position='<td>['+clan[i][5]+';'+clan[i][6]+']</td><td>'+clan[i][11]+'</td><td>';
     break;
    default:
     action = '<a class="'+style[clan[i][2]]+'" href="javascript:l(\'chg='+clan[i][4]+'\')"';
     if(clan[i][12] !== 0)
      action += ' onMouseOver="a('+clan[i][5]+','+clan[i][6]+')" onMouseOut="mc()"';
     action += '>';
     info = action+info+'</a>';
     position='<td>['+clan[i][5]+';'+clan[i][6]+']</td><td>'+clan[i][11]+'</td><td>';
     break;
    }
    document.write(info);

    l_cad = '&nbsp;';
    if( clan[i][15] == 1)
        l_cad  = '<a class="u" TITLE="'+txt[7]+'" href="javascript:l(\'attacher='+clan[i][4]+'\')"><img border="0" src="'+ipath+'co.gif"></a>';
    else if(clan[i][15] == 2)
        l_cad  = '<a class="u" TITLE="'+txt[8]+'" href="javascript:l(\'detacher='+clan[i][4]+'\')"><img border="0" src="'+ipath+'cf.gif"></a>';

	l_pack = '';
    if( clan[i][16] == 1)
        l_pack  = '&nbsp;<a class="u" TITLE="'+txt[7]+'" href="javascript:l(\'packs='+clan[i][4]+'\')"><img border="0" src="'+ipath+'co.gif"></a>';

    l_hof='&nbsp;';
    if(clan[i][13] > 0)
        l_hof  = '<a class="u" href="javascript:fcal('+clan[i][4]+')"><img border="0" src="'+ipath+'po.gif"></a>&nbsp;';

    if(clan[i][0] != 253 && clan[i][0]!= 9)
        l_hof += '<a class="u" href="javascript:fcal('+clan[i][4]+')"><img border="0" src="'+ipath+'pi.gif"></a>&nbsp;';

    document.write('</td><td align="right">'+l_cad+l_pack+'</td><td align="right">'+l_hof+'</td>');
    document.write(position);
    b_clan(clan[i][7],clan[i][8]);
    document.write('</td><td>');
    f_clan(clan[i][9],clan[i][10]);
    document.write('</td>');
}
document.write('</tr></table>');
}

function visu_case(visu)
// Type :
// 0 = unite
// Format tableau :    0      1       2       3       4       5       6     7      8: tableau de 3( 0             1               2  )     9            10
//                     type   numero type, modele, armee, niveau, login     clan                     type action   points action   val     infos       compagnie
// 1 = pack
// Format tableau :    0      1       2       3: tableau de 3( 0             1               2  )
//                     type   numero  type                    type action   points action   val
// 2 = action
{
if( visu.length > 0)
{
var ligne=0;
document.write('<table class="info" width="100%" cellpadding="0" cellspacing="0">');
for(i=0;i<visu.length-1;i++)
{
    if(ligne%2==0)
        couleur=lignes[0];
    else
        couleur=lignes[1];
    ligne=ligne+1;

//    if( isNaN(visu[i][0]))
    if( visu[i][0] == 2)    // action
    {
        document.write('<tr bgcolor="'+couleur+'"><td colspan=\'3\' align=\'right\'>'+visu[i][1]+'</td></tr>');
    }
    else if( visu[i][0] == 1)    // pack
    {
        document.write('<tr bgcolor="'+couleur+'"><td onMouseOver="a(vx,vy)" onMouseOut="mc()"><IMG class=\'m\' SRC=\''+ipath+pack[visu[i][2]][1]+'_s.png\'> <b>'+pack[visu[i][2]][0]+'</b></td>');
        document.write('<td align="right">&nbsp;</td><td align="right">');
        var a=0;
        while(a+2 < visu[i][3].length)
        {
            if(visu[i][3][a+0]>0)
            {
             if(visu[i][3][a+1]>0)
                 visu[i][3][a+1]=visu[i][3][a+1]+txt_pa;
             document.write(' <a class=\'a\' href="'+lien+'&'+act[visu[i][3][a+0]][1]+visu[i][3][a+2]+'"><img SRC="'+ipath+act[visu[i][3][a+0]][2]+'" TITLE="'+act[visu[i][3][a+0]][0]+visu[i][3][a+1]+'" height="12" width="30" BORDER="0" OnMouseOver="javascript:this.src=\''+ipath+'a_'+act[visu[i][3][a+0]][2]+'\'" OnMouseOut="javascript:this.src=\''+ipath+act[visu[i][3][a+0]][2]+'\'"></a>')
            }
            a += 3;
        }

         document.write('</td></tr>');
    }
    else if( visu[i][0] == 0)    // unite
    {
        var niveau = ' ';
        unite = '<tr bgcolor="'+couleur+'"><td class="'+style[visu[i][4]]+'" onMouseOver="a(vx,vy)" onMouseOut="mc()"><a class="'+style[visu[i][4]]+'" href="javascript:fcal('+visu[i][1]+')"><IMG class=\'m\' SRC=\''+ipath+type[visu[i][2]][1]+'_s_'+ext[visu[i][4]]+'.png\' width=\'15\' height=\'15\'>';
        if( visu[i][5] !== '')
            niveau = '<IMG class=\'g\' SRC="'+ipath+'n'+visu[i][5]+'.png" TITLE=\''+txt[6]+' '+visu[i][5]+'\'> ';
        if(visu[i][10] != '')
            compagnie = '[<a class="'+style[visu[i][4]]+'" href="'+url_comp+'&compagnie='+escape(visu[i][10])+'" target="compagnie">'+visu[i][10]+'</a>] ';
        else
            compagnie = '';

        if(visu[i][7] == 1)
            document.write(unite+niveau+'<b><i>'+type[visu[i][2]][0]+' '+type[visu[i][2]][2][visu[i][3]]+'</i></b></a> '+compagnie+visu[i][6]+'</td>');
        else
        {
            if(visu[i][2] == 9) // ballon
                document.write(unite+niveau+'<i>'+type[visu[i][2]][0]+' '+type[visu[i][2]][2][visu[i][3]]+'</i></a></td>');
            else if( visu[i][2] == 8) // campement
                document.write(unite+niveau+'<i>'+type[visu[i][2]][0]+' '+type[visu[i][2]][2][visu[i][3]]+'</i></a> '+compagnie+'</td>');
            else if( visu[i][2] == 253) // QG
                document.write(unite+niveau+'<i>'+type[visu[i][2]][0]+' '+type[visu[i][2]][2][visu[i][3]]+'</i></a> '+armee[visu[i][4]]+'</td>');
            else if( visu[i][6] == '')
                document.write(unite+niveau+'<i>'+type[visu[i][2]][0]+' '+type[visu[i][2]][2][visu[i][3]]+'</i></a> '+deserteur+'</td>');
            else
                document.write(unite+niveau+'<i>'+type[visu[i][2]][0]+' '+type[visu[i][2]][2][visu[i][3]]+'</i></a> '+compagnie+'<a class="'+style[visu[i][4]]+'" href="'+msg+visu[i][6]+'"  target="messages">'+visu[i][6]+'</a></td>');
        }
        var info = '<td align="right">';
        if(visu[i][9]/2 > 1)
            info += '<a class="u" href="javascript:fcal('+visu[i][1]+')"><img border="0" src="'+ipath+'po.gif"></a>&nbsp;';
        if(visu[i][9]%2 == 1)
            info += '<a class="u" href="javascript:fcal('+visu[i][1]+')"><img border="0" src="'+ipath+'pi.gif"></a>';
        document.write(info+'</td>');

        document.write('<td align=\'right\'>');

        var a=0;
        while(a+2 < visu[i][8].length)
        {
            if(visu[i][8][a+0]>0)
            {
             if(visu[i][8][a+1]>0)
                 visu[i][8][a+1]=visu[i][8][a+1]+txt_pa;
             document.write(' <a class=\'a\' href="'+lien+'&'+act[visu[i][8][a+0]][1]+visu[i][8][a+2]+'"><img SRC="'+ipath+act[visu[i][8][a+0]][2]+'" TITLE="'+act[visu[i][8][a+0]][0]+visu[i][8][a+1]+'" height="12" width="30" BORDER="0" OnMouseOver="javascript:this.src=\''+ipath+'a_'+act[visu[i][8][a+0]][2]+'\'" OnMouseOut="javascript:this.src=\''+ipath+act[visu[i][8][a+0]][2]+'\'"></a>')
            }
            a += 3;
        }

         document.write('</td></tr>');
    }
 }
 document.write('</table>');
}
}

var ligne=0;
function visu_autre(t,m,a,n,l,px,py,c, info, comp) // type, modele, armee, niveau, modele, login, x , y, clan, info, compagnie
{
    if(ligne%2==0)
        couleur=lignes[0];
    else
        couleur=lignes[1];
    ligne=ligne+1;
    var niveau = '';
    unite = '<IMG class=\'m\' SRC=\''+ipath+type[t][1]+'_s_'+ext[a]+'.png\'>';
    if(info != '')
        info = '<td align="right">'+info+'</td>';
    if( n>=0)
        niveau = '<IMG class=\'g\' SRC="'+ipath+'n'+n+'.png" TITLE=\''+txt[6]+' '+n+'\'> ';
        if(comp != '')
        comp = '[<a class="'+style[a]+'" href="'+url_comp+'&compagnie='+escape(comp)+'" target="compagnie">'+comp+'</a>] ';
    else
        com = '';
    if(c == 1)
        document.write('<tr onMouseOver="a('+px+','+py+')" onMouseOut="mc()" bgcolor="'+couleur+'"><td class="'+style[a]+'">'+unite+niveau+'<b><i>'+type[t][0]+' '+type[t][2][m]+'</i> '+comp+l+'</b></td><td>['+px+';'+py+']</td>'+info+'</tr>');
    else
    {
      if(t == 9) // Ballon
        document.write('<tr onMouseOver="a('+px+','+py+')" onMouseOut="mc()" bgcolor="'+couleur+'"><td class="'+style[a]+'">'+unite+niveau+'<i>'+type[t][0]+' '+type[t][2][m]+'</i></td><td>['+px+';'+py+']</td>'+info+'</tr>');
      else if( t==8) // campement
        document.write('<tr onMouseOver="a('+px+','+py+')" onMouseOut="mc()" bgcolor="'+couleur+'"><td class="'+style[a]+'">'+unite+niveau+'<i>'+type[t][0]+' '+type[t][2][m]+'</i> '+comp+'</td><td>['+px+';'+py+']</td>'+info+'</tr>');
      else if( t==253) // QG
        document.write('<tr onMouseOver="a('+px+','+py+')" onMouseOut="mc()" bgcolor="'+couleur+'"><td class="'+style[a]+'">'+unite+niveau+'<i>'+type[t][0]+' '+type[t][2][m]+'</i> '+armee[a]+'</td><td>['+px+';'+py+']</td>'+info+'</tr>');
      else if(l == '')
        document.write('<tr onMouseOver="a('+px+','+py+')" onMouseOut="mc()" bgcolor="'+couleur+'"><td class="'+style[a]+'">'+unite+niveau+'<i>'+type[t][0]+' '+type[t][2][m]+'</i> '+deserteur+'</td><td>['+px+';'+py+']</td>'+info+'</tr>');
      else
        document.write('<tr onMouseOver="a('+px+','+py+')" onMouseOut="mc()" bgcolor="'+couleur+'"><td class="'+style[a]+'">'+unite+niveau+'<i>'+type[t][0]+' '+type[t][2][m]+'</i> '+comp+'<a class="'+style[a]+'" href="'+msg+l+'"  target="messages">'+l+'</a></td><td>['+px+';'+py+']</td>'+info+'</tr>');
    }
}


function test_nav()
{if (navigator.appName=="Netscape" || navigator.appName=="Mozilla")
 {net=true ;
  c_cible = document.getElementById('cible').style;
  offset_x = 5;
  offset_y = 10;
 }else{
  c_cible = document.all['cible'].style ;
  offset_x = 10;
  offset_y = 10;
 }
}
function writeConsole(fichier,titre)
{top.consoleRef=window.open(fichier,titre,
 'width=700,height=400'
 +',menubar=0'
 +',toolbar=0'
 +',status=0'
 +',scrollbars=1'
 +',resizable=1');
 top.consoleRef.document.close();
 top.consoleRef.focus();
}
function disperser(lien)
{top.consoleRef=window.open('disperser.php','Dispersion',
 'width=600,height=100'
 +',menubar=0'
 +',toolbar=0'
 +',status=0'
 +',scrollbars=1'
 +',resizable=1');
 top.consoleRef.lien = lien;
 top.consoleRef.sub = this;
 top.consoleRef.document.close();
 top.consoleRef.focus();
}
function desactiver(lien)
{top.consoleRef=window.open('desactiver.php','D�sactiver',
 'width=600,height=100'
 +',menubar=0'
 +',toolbar=0'
 +',status=0'
 +',scrollbars=1'
 +',resizable=1');
 top.consoleRef.lien = lien;
 top.consoleRef.sub = this;
 top.consoleRef.document.close();
 top.consoleRef.focus();
}
function activer(lien)
{top.consoleRef=window.open('activer.php','Activer',
 'width=600,height=100'
 +',menubar=0'
 +',toolbar=0'
 +',status=0'
 +',scrollbars=1'
 +',resizable=1');
 top.consoleRef.lien = lien;
 top.consoleRef.sub = this;
 top.consoleRef.document.close();
 top.consoleRef.focus();
}
function a(x,y)
{cx = x;
 cy = y;
if(c_cible !== undefined)
{
if( x >= x0 && y >= y0)
{
 x = (x-x0+1)*21 + 1 - offset_x;
 y = (y-y0+1)*21 + 1 - offset_y;
if(net)
 {c_cible.left = x;
  c_cible.top = y;
  c_cible.visibility = 'visible';
 }else
 {c_cible.pixelLeft = x;
  c_cible.pixelTop = y;
  c_cible.visibility = 'visible';
 }}
}
}
function c()
{
x = cx;
y = cy;
window.location = lien+'&visu_x='+x+'&visu_y='+y;
}
function mc()
{ if(c_cible !== undefined)
 {if(net)
  c_cible.visibility = 'hidden';
 else
  c_cible.visibility = 'hidden';
  }
}
deserteur
function action(t,a,l)  // type, action, lien
{
    if(t>0)
    {
     if(a>0)
         a=a+txt_pa;
     switch(t)
     {
     case 6:
     case 7:
         return '<a class=\'a\' href="'+lien+'&'+act[t][1]+l+'">'+act[t][0]+a+' <img src="'+ipath+act[t][2]+'" TITLE="'+act[t][0]+a+'" border="0" height="12" width="30" OnMouseOver="javascript:this.src=\''+ipath+'a_'+act[t][2]+'\'" OnMouseOut="javascript:this.src=\''+ipath+act[t][2]+'\'"></a>'
     default:
         return '<a class=\'a\' href="'+lien+'&'+act[t][1]+l+'"><img src="'+ipath+act[t][2]+'" TITLE="'+act[t][0]+a+'" border="0" height="12" width="30" OnMouseOver="javascript:this.src=\''+ipath+'a_'+act[t][2]+'\'" OnMouseOut="javascript:this.src=\''+ipath+act[t][2]+'\'"></a>'
        break;
     }
    }
    else
     return '&nbsp;'
}

// Fonction recuperant l'image de l'unite et du pack
function images(i_y,i_x)
{
    var obs, dr_pack;
    var char_egal = 0;
    var image = Array();


    fond = carte[i_y][i_x][1];
    char_egal = fond.indexOf("=");
    if(char_egal == -1)
        char_egal = 0;
    else
        char_egal = char_egal+1;
    fond = fond.substr(0,char_egal);
    fond = fond+'00ff';
    fond += carte[i_y][i_x][1].substr(char_egal+4, 8);

    conf = carte[i_y][i_x][1].substr(char_egal+12,2);

    image[0] = parseInt(conf,16);
    image[0] = image[0]&0x9F;   // enleve drapeau unite et pack
    image[0] = image[0].toString(16);
    if(image[0].length  == 1)
        image[0] = "0"+image[0];
    image[0] = fond+image[0]+carte[i_y][i_x][1].substr(char_egal+14);

    // mise de l'image en observation
    obs = parseInt(conf,16);
    if( (obs&0x01) != 0)
        obs = '_o';
    else
        obs = '';

    cunite = parseInt(carte[i_y][i_x][1].substr(char_egal+2,2),16);
    if( cunite != 255)
    {
        couleur = carte[i_y][i_x][1];
        couleur = parseInt(couleur.substr(char_egal+0,2),16);
        txt_couleur='_';
        if((couleur&2)>0)
            txt_couleur += ext[1];
        if((couleur&4)>0)
            txt_couleur += ext[2];
        if((couleur&1)>0)
            txt_couleur += ext[0];

        image[1] = '<img height="20" width="20" border="0" src="'+spath+type[cunite][1]+obs+txt_couleur+'.gif">';
    }
    else
        image[1] = '';

    dr_pack = parseInt(conf,16);
    if( (dr_pack&0x40) != 0)
        image[2] = '<img height="20" width="20" border="0" src="'+spath+pack[0][1]+obs+'.gif">';
    else
        image[2] = '';

    return image;
}

function affiche_carte(x_min, x_max, y_min, y_max, carte)
{
var div_menu = '';
var div_image = '';
var fond = '';

var i_y, i_x,cell;
var row = Array();
var res = '<table class="frame" BORDER="0" CELLPADDING="0" CELLSPACING="1">\
<tr height="20" valign="bottom">\
<td width="20" valign="middle"><a href="#" Onclick="javascript:OnOffCarte()"><img border="0" src="'+ipath+'infanterie_s_n.png"></a></td>';

  for( var x = x_min; x <= x_max; x++)
  {
    if( x == x_min)
        res += '<td width="20"><a class="a" href="'+lien+'&xm=1"><img src="'+ipath+'gauche.gif" border=0><br>'+x+'</a></td>';
    else if(x == x_max)
        res += '<td width="20"><a class="a" href="'+lien+'&xp=1"><img src="'+ipath+'droite.gif" border=0><br>'+x+'</a></td>';
    else
        res += '<td width="20">'+x+'</td>';
  }
  res += '</tr>\n';
 for( var y = y_min; y <= y_max; y++)
 {
  i_y = crypt(y, row);
  cell = Array();
  res += '<tr height="20" valign="middle" align="right">';
  if(y == y_min)
    res += '<td><a class="a" href="'+lien+'&ym=1"><img src="'+ipath+'haut.gif" border=0>'+y+'</a></td>';
  else if( y == y_max)
    res += '<td><a class="a" href="'+lien+'&yp=1"><img src="'+ipath+'bas.gif" border=0>'+y+'</a></td>';
  else
    res += '<td>'+y+'</td>';
  for( var x = x_min; x <= x_max; x++)
  {
    i_x = crypt(x,cell);

    if(carte[i_y] != undefined && carte[i_y][i_x] !== undefined)
    {
    var x_pos = ((x-x_min+1)*21+2);
    var y_pos = ((y-y_min+1)*21+2);

     switch(carte[i_y][i_x][0])
     {
    case 0:
      res += '<td class="v2" OnMouseOver="a_menu('+x+','+y+')" OnMouseOut="m_menu('+x+','+y+')"></td>\n';
      div_menu += '<div id="menu'+x+'_'+y+'" style="position:absolute; width:250px; height:20px; z-index:5; visibility: hidden;" OnMouseOver="over_menu('+x+','+y+');" OnMouseOut="m_menu('+x+','+y+')">\n';
      div_menu += faire_menu(menu[i_y][i_x]);
      div_menu += '</div>\n';
      break;

     case 1:
    image = images(i_y, i_x);
    if(image[1] != '')
        div_image += '<DIV id="u'+x+y+'" style="position:absolute;top:'+y_pos+'px;left:'+x_pos+'px;width:20px;height:20px;visibility:visible;z-index:2;">'+image[1]+'</DIV>\n';
    if(image[2] != '')
        div_image += '<DIV id="p'+x+y+'" style="position:absolute;top:'+y_pos+'px;left:'+x_pos+'px;width:20px;height:20px;visibility:visible;z-index:2;">'+image[2]+'</DIV>\n';

      res += '<td TITLE="Relev� en date du '+carte[i_y][i_x][2]+'"><img class="c2"  src="'+rpath+image[0]+'"></td>\n';
      break;

    case 2:
    image = images(i_y, i_x);
    if(image[1] != '')
        div_image += '<DIV id="u'+x+y+'" style="position:absolute;top:'+y_pos+'px;left:'+x_pos+'px;width:20px;height:20px;visibility:visible;z-index:2;">'+image[1]+'</DIV>\n';
    if(image[2] != '')
        div_image += '<DIV id="p'+x+y+'" style="position:absolute;top:'+y_pos+'px;left:'+x_pos+'px;width:20px;height:20px;visibility:visible;z-index:2;">'+image[2]+'</DIV>\n';

      res += '<td TITLE="'+carte[i_y][i_x][2]+'"><img class="c2"  src="'+rpath+image[0]+'"></td>\n';
      break;

    case 3:
    image = images(i_y, i_x);
    if(image[1] != '')
    {
        div_image += '<DIV id="u'+numeroID+'" OnMouseOver="a_menu('+x+','+y+')" OnMouseOut="m_menu('+x+','+y+')" style="position:absolute;top:'+y_pos+'px;left:'+x_pos+'px;width:20px;height:20px;visibility:visible;z-index:2;">'+image[1]+'</DIV>\n';
        action_menu = 'TITLE="'+faire_alt(menu[i_y][i_x])+'"';
        numeroID+=1;
    }
    else
        action_menu = 'OnMouseOver="a_menu('+x+','+y+')" OnMouseOut="m_menu('+x+','+y+')"';
    if(image[2] != '')
    {
        div_image += '<DIV id="p'+packID+'" OnMouseOver="a_menu('+x+','+y+')" OnMouseOut="m_menu('+x+','+y+')" style="position:absolute;top:'+y_pos+'px;left:'+x_pos+'px;width:20px;height:20px;visibility:visible;z-index:2;">'+image[2]+'</DIV>\n';
        packID+=1;
    }
      res += '<td '+action_menu+'><img class="c2" SRC="'+rpath+image[0]+'"></td>\n';
      div_menu += '<div id="menu'+x+'_'+y+'" style="position:absolute; width:250px; height:20px; z-index:5; visibility: hidden;" OnMouseOver="over_menu('+x+','+y+');" OnMouseOut="m_menu('+x+','+y+')">\n';
      div_menu += faire_menu(menu[i_y][i_x]);
      div_menu += '</div>\n';
      break;


     case 4:

    image = images(i_y, i_x);
    if(image[1] != '')
    {
        div_image += '<DIV id="u'+numeroID+'" OnMouseOver="a_menu('+x+','+y+')" OnMouseOut="m_menu('+x+','+y+')" style="position:absolute;top:'+y_pos+'px;left:'+x_pos+'px;width:20px;height:20px;visibility:visible;z-index:2;">'+image[1]+'</DIV>\n';
        action_menu = 'TITLE="'+faire_alt(menu[i_y][i_x])+'"';
        numeroID+=1;
    }
    else
        action_menu = 'OnMouseOver="a_menu('+x+','+y+')" OnMouseOut="m_menu('+x+','+y+')"';

    if(image[2] != '')
    {
        div_image += '<DIV id="p'+packID+'" OnMouseOver="a_menu('+x+','+y+')" OnMouseOut="m_menu('+x+','+y+')" style="position:absolute;top:'+y_pos+'px;left:'+x_pos+'px;width:20px;height:20px;visibility:visible;z-index:2;">'+image[2]+'</DIV>\n';
        packID+=1;
    }

      res += '<td '+action_menu+'><a class="a" href="javascript:l(\'&visu_x='+x+'&visu_y='+y+'\')"><img class="c2" SRC="'+rpath+image[0]+'"></a></td>\n';
      div_menu += '<div id="menu'+x+'_'+y+'" style="position:absolute; width:250px; height:20px; z-index:5; visibility: hidden;" OnMouseOver="over_menu('+x+','+y+');" OnMouseOut="m_menu('+x+','+y+')">\n';
      div_menu += faire_menu(menu[i_y][i_x]);
      div_menu += '</div>\n';
      break;


     case 5:
    image = images(i_y, i_x);
    if(image[1] != '')
    {
        div_image += '<DIV id="u'+numeroID+'" style="position:absolute;top:'+y_pos+'px;left:'+x_pos+'px;width:20px;height:20px;visibility:visible;z-index:2;">'+image[1]+'</DIV>\n';
        numeroID+=1;
    }
    if(image[2] != '')
    {
        div_image += '<DIV id="p'+packID+'" style="position:absolute;top:'+y_pos+'px;left:'+x_pos+'px;width:20px;height:20px;visibility:visible;z-index:2;">'+image[2]+'</DIV>\n';
        packID+=1;
    }

      res += '<td class="c2"  background="'+rpath+image[0]+'">\n';
      break;
     }
    }
    else
    {
        res += '<td class="v2" ></td>\n';
    }
  }
  res += '</tr>\n';
 }
res += '</table>';

/*
if(net)
{
     res += '</table><br><a href="#" Onclick="javascript: document.getElementById(\'carte\').innerHTML = affiche_carte('+x_min+','+x_max+','+y_min+','+y_max+',carte);">T</a>';
}
else
{
    res += '</table><br><a href="#" Onclick="javascript: document.all[\'carte\'].innerHTML = affiche_carte('+x_min+','+x_max+','+y_min+','+y_max+',carte);">T</a>';
}
*/
return div_image + div_menu + res;
}


function OnOffCarte()
{
 if(net)
 {
    for(var i = 0; i < numeroID; i++)
    {
        if(document.getElementById('u'+i).style.visibility == "visible")
            document.getElementById('u'+i).style.visibility = "hidden";
        else
            document.getElementById('u'+i).style.visibility = "visible";

    }
    for(var i = 0; i < packID; i++)
    {
        if(document.getElementById('p'+i).style.visibility == "visible")
            document.getElementById('p'+i).style.visibility = "hidden";
        else
            document.getElementById('p'+i).style.visibility = "visible";

    }
 }
 else
 {
    for(var i = 0; i <numeroID; i++)
    {
        if(document.all['u'+i].style.visibility == "visible")
            document.all['u'+i].style.visibility = "hidden";
        else
            document.all['u'+i].style.visibility = "visible";

    }
    for(var i = 0; i <packID; i++)
    {
        if(document.all['p'+i].style.visibility == "visible")
            document.all['p'+i].style.visibility = "hidden";
        else
            document.all['p'+i].style.visibility = "visible";

    }
 }
}

function a_menu(x,y)
{
 a(x,y);
 pos_x = (x-x0+1)*21;
 pos_y = (y-y0+2)*21;
 if(net)
 {
  document.getElementById('menu'+x+'_'+y).style.left = pos_x;
  document.getElementById('menu'+x+'_'+y).style.top=pos_y;
  document.getElementById('menu'+x+'_'+y).style.visibility = 'visible';
 }
 else
 {
 document.all['menu'+x+'_'+y].style.pixelLeft = pos_x;
 document.all['menu'+x+'_'+y].style.pixelTop = pos_y;
 document.all['menu'+x+'_'+y].style.visibility = 'visible';
 }
 }

function c_a_menu()
{ a(cx,cy);
 pos_x = (cx-x0+1)*21;
 pos_y = (cy-y0+2)*21;
 if(net)
 {
  document.getElementById('menu'+cx+'_'+cy).style.left = pos_x;
  document.getElementById('menu'+cx+'_'+cy).style.top=pos_y;
  document.getElementById('menu'+cx+'_'+cy).style.visibility = 'visible';
 }
 else
 {
 document.all['menu'+cx+'_'+cy].style.pixelLeft = pos_x;
 document.all['menu'+cx+'_'+cy].style.pixelTop = pos_y;
 document.all['menu'+cx+'_'+cy].style.visibility = 'visible';
 }
 }
function c_m_menu()
{
if(c_cible !== undefined)
    mc();
 if(net)
 document.getElementById('menu'+cx+'_'+cy).style.visibility = 'hidden';
 else
 document.all['menu'+cx+'_'+cy].style.visibility = 'hidden';
}

// Pas propre
function faire_alt(lignes)
{
    var res = '';
  for(i=1;i<lignes.length;)
  {
    switch(lignes[i])
    {
    case 0:
    case 1:
        res += lignes[i+1]+"\n";
        i+=2;
        break;
    case 2:
        i+=11;
        break;
    case 3:
        i+=2;
        break;
    case 4:
        i+=10;
        break;
    case 5:
        i+=8;
        break;
    case 6:
        i+=3;
        break;
    default:
        return 'erreur js';
        break;
    }
  }
  return res;
}

function faire_menu(lignes)
{
var c=0;
contenu = '<table width="100%" height="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000" bgcolor="#FFFFFF">\
<tr><td><table class="info" width="100%" border="0" cellspacing="0" cellpadding="0">'
 for(i=1;i<lignes.length;)
 {
 var niveau = '';
 if(c==0)
 {
bg='#FFFFFF';
c=1;
 }
 else
 {
bg='#F0F0F0';
c=0;
 }
 switch(lignes[i])
 {
 case 0:    // Affichage ligne simple
if( lignes[0] == 1)
  contenu += '<tr bgcolor="#C0C0C0"><td align=\'center\' colspan=\'3\'><b>'+lignes[i+1]+'</b></td></tr>';
else
  contenu += '<tr bgcolor="'+bg+'"><td align=\'center\' colspan=\'3\'><b>'+lignes[i+1]+'</b></td></tr>';
 i+=2;
 break;
 case 1:
 contenu += '<tr bgcolor="'+bg+'"><td colspan="2">'+lignes[i+1]+'</td><td>&nbsp;</td></tr>';
 i+=2;
 break;
 case 2:    // 1        2       3     4     5       6       7     8 tableau de 3 ( 0        1       2)       9      10
            // numero, type, modele, armee, niveau, login, clan,                   action,  lien,   txt      infos   compagnie
unite = '<IMG class=\'m\' SRC=\''+ipath+type[lignes[i+2]][1]+'_s_'+ext[lignes[i+4]]+'.png\'>';
if(type[lignes[i+2]][2][lignes[i+3]] == '')
    nom = type[lignes[i+2]][0];
else
    nom = type[lignes[i+2]][2][lignes[i+3]];
if( lignes[i+5] !== '')
    niveau = '<IMG class=\'g\' SRC="'+ipath+'n'+lignes[i+5]+'.png" TITLE=\''+txt[6]+' '+lignes[i+5]+'\'> ';
if(lignes[i+10] != '')
    compagnie = '[<a class="'+style[lignes[i+4]]+'" href="'+url_comp+'&compagnie='+escape(lignes[i+10])+'" target="compagnie">'+lignes[i+10]+'</a>] ';
else
    compagnie = '';

if(lignes[i+7] == 1)
    contenu += '<tr bgcolor="'+bg+'"><td class="'+style[lignes[i+4]]+'"><a class="'+style[lignes[i+4]]+'" href="javascript:fcal('+lignes[i+1]+')">'+unite+niveau+'<b><i>'+nom+'</i></b></a> '+compagnie+lignes[i+6]+'</td>';
else
{
    if(lignes[i+2] ==9) // ballon
     contenu += '<tr bgcolor="'+bg+'"><td class="'+style[lignes[i+4]]+'"><a class="'+style[lignes[i+4]]+'" href="javascript:fcal('+lignes[i+1]+')">'+unite+niveau+'<i>'+nom+'</i></a></td>';
    else if(lignes[i+2] == 8) // campement
     contenu += '<tr bgcolor="'+bg+'"><td class="'+style[lignes[i+4]]+'"><a class="'+style[lignes[i+4]]+'" href="javascript:fcal('+lignes[i+1]+')">'+unite+niveau+'<i>'+nom+'</i></a> '+compagnie+'</td>';
    else if(lignes[i+2] == 253) // QG
     contenu += '<tr bgcolor="'+bg+'"><td class="'+style[lignes[i+4]]+'"><a class="'+style[lignes[i+4]]+'" href="javascript:fcal('+lignes[i+1]+')">'+unite+niveau+'<i>'+nom+'</i></a> '+armee[lignes[i+4]]+'</td>';
    else if(lignes[i+6] == '')
     contenu += '<tr bgcolor="'+bg+'"><td class="'+style[lignes[i+4]]+'"><a class="'+style[lignes[i+4]]+'" href="javascript:fcal('+lignes[i+1]+')">'+unite+niveau+'<i>'+nom+'</i></a> '+deserteur+'</td>';
    else
     contenu += '<tr bgcolor="'+bg+'"><td class="'+style[lignes[i+4]]+'"><a class="'+style[lignes[i+4]]+'" href="javascript:fcal('+lignes[i+1]+')">'+unite+niveau+'<i>'+nom+'</i></a> '+compagnie+'<a class="'+style[lignes[i+4]]+'" href="'+msg+lignes[i+6]+'"  target="messages">'+lignes[i+6]+'</a></td>';
}
contenu += '<td align="right"> ';
if(lignes[i+9]/2 > 1)
    contenu += '<a class="u" href="javascript:fcal('+lignes[i+1]+')"><img border="0" src="'+ipath+'po.gif"></a>&nbsp;';
if(lignes[i+9]%2 == 1)
    contenu += '<a class="u" href="javascript:fcal('+lignes[i+1]+')"><img border="0" src="'+ipath+'pi.gif"></a>';
contenu += '</td>';

contenu += '<td align=\'right\'>';

var a=0;
while(a+2 < lignes[i+8].length)
{
    contenu += ' '+action(lignes[i+8][a+0],lignes[i+8][a+1],lignes[i+8][a+2]);
    a+=3;
}

contenu += '</td></tr>';
// contenu += '<td align=\'right\'><a class=\'a\' href="'+lien+'&'+lignes[i+8]+'">'+lignes[i+7]+'</a></td>+'</tr>'
 i+=11;
 break;
 case 3:    // Affichage actions uniquements
 var a=0;
contenu += '<tr bgcolor="'+bg+'"><td colspan=\'3\' align=\'right\'>';
while(a+2 < lignes[i+1].length)
{
     contenu += ' '+action(lignes[i+1][a+0],lignes[i+1][a+1],lignes[i+1][a+2]);
    a+=3;
}
contenu += '</td></tr>';
 i+=2;
 break;
 case 4:    // 1        2       3     4      5       6      7    8      9
            // numero, type, modele, armee, niveau, login, clan  infos  compagnie
unite = '<IMG class=\'m\' SRC=\''+ipath+type[lignes[i+2]][1]+'_s_'+ext[lignes[i+4]]+'.png\'>';
if( lignes[i+5] !== '')
    niveau = '<IMG class=\'g\' SRC="'+ipath+'n'+lignes[i+5]+'.png" TITLE=\''+txt[6]+' '+lignes[i+5]+'\'> ';
if(lignes[i+9] != '')
    compagnie = '[<a class="'+style[lignes[i+4]]+'" href="'+url_comp+'&compagnie='+escape(lignes[i+9])+'" target="compagnie">'+lignes[i+9]+'</a>] ';
else
    compagnie = '';
if(type[lignes[i+2]][2][lignes[i+3]] == '')
    nom = type[lignes[i+2]][0];
else
    nom = type[lignes[i+2]][2][lignes[i+3]];
if(lignes[i+7] == 1)
    contenu += '<tr bgcolor="'+bg+'"><td class="'+style[lignes[i+4]]+'"><a class="'+style[lignes[i+4]]+'" href="javascript:fcal('+lignes[i+1]+')">'+unite+niveau+'<b><i>'+nom+'</i></b></a> '+compagnie+lignes[i+6]+'</td>';
else
{
    if(lignes[i+2]==9) // ballon
     contenu += '<tr bgcolor="'+bg+'"><td class="'+style[lignes[i+4]]+'"><a class="'+style[lignes[i+4]]+'" href="javascript:fcal('+lignes[i+1]+')">'+unite+niveau+'<i>'+nom+'</i></a></td>';
    else if(lignes[i+2] == 8) // campement
     contenu += '<tr bgcolor="'+bg+'"><td class="'+style[lignes[i+4]]+'"><a class="'+style[lignes[i+4]]+'" href="javascript:fcal('+lignes[i+1]+')">'+unite+niveau+'<i>'+nom+'</i></a> '+compagnie+'</td>';
    else if(lignes[i+2] == 253) // QG
     contenu += '<tr bgcolor="'+bg+'"><td class="'+style[lignes[i+4]]+'"><a class="'+style[lignes[i+4]]+'" href="javascript:fcal('+lignes[i+1]+')">'+unite+niveau+'<i>'+nom+'</i></a> '+armee[lignes[i+4]]+'</td>';
    else if(lignes[i+6] == '')
     contenu += '<tr bgcolor="'+bg+'"><td class="'+style[lignes[i+4]]+'"><a class="'+style[lignes[i+4]]+'" href="javascript:fcal('+lignes[i+1]+')">'+unite+niveau+'<i>'+nom+'</i></a> '+deserteur+'</td>';
    else
     contenu += '<tr bgcolor="'+bg+'"><td class="'+style[lignes[i+4]]+'"><a class="'+style[lignes[i+4]]+'" href="javascript:fcal('+lignes[i+1]+')">'+unite+niveau+'<i>'+nom+'</i></a> '+compagnie+'<a class="'+style[lignes[i+4]]+'" href="'+msg+lignes[i+6]+'"  target="messages">'+lignes[i+6]+'</a></td>';
}
contenu += '<td align="right">';
if(lignes[i+8]/2 > 1)
    contenu += '<a class="u" href="javascript:fcal('+lignes[i+1]+')"><img border="0" src="'+ipath+'po.gif"></a>&nbsp;';
if(lignes[i+8]%2 == 1)
    contenu += '<a class="u" href="javascript:fcal('+lignes[i+1]+')"><img border="0" src="'+ipath+'pi.gif"></a>';
contenu += '&nbsp;</td>';

 contenu += '<td width="30">&nbsp;</td></tr>'
 i+=10;
 break;
 case 5:    // 1     2       3      4       5      6     7
            // type, modele, armee, niveau, login, clan, compagnie // pour observation
unite = '<IMG class=\'m\' SRC=\''+ipath+type[lignes[i+1]][1]+'_s_'+ext[lignes[i+3]]+'.png\'>';
if( lignes[i+4] !== '')
    niveau = '<IMG class=\'g\' SRC="'+ipath+'n'+lignes[i+4]+'.png" TITLE=\''+txt[6]+' '+lignes[i+4]+'\'> ';
if(lignes[i+7] != '')
    compagnie = '[<a class="'+style[lignes[i+3]]+'" href="'+url_comp+'&compagnie='+escape(lignes[i+7])+'" target="compagnie">'+lignes[i+7]+'</a>] ';
else
    compagnie = '';
if(type[lignes[i+1]][2][lignes[i+2]] == '')
    nom = type[lignes[i+1]][0];
else
    nom = type[lignes[i+1]][2][lignes[i+2]];
if(lignes[i+6] == 1)
    contenu += '<tr bgcolor="'+bg+'"><td class="'+style[lignes[i+3]]+'">'+unite+niveau+'<b><i>'+nom+'</i></b> '+compagnie+lignes[i+5]+'</td>';
else
{
    if(lignes[i+1]==9) // ballon
     contenu += '<tr bgcolor="'+bg+'"><td class="'+style[lignes[i+3]]+'">'+unite+niveau+'<i>'+nom+'</i></td>';
    else if(lignes[i+2] == 8) // campement
     contenu += '<tr bgcolor="'+bg+'"><td class="'+style[lignes[i+3]]+'">'+unite+niveau+'<i>'+nom+'</i></a> '+compagnie+'</td>';
    else if(lignes[i+2] == 253) // QG
     contenu += '<tr bgcolor="'+bg+'"><td class="'+style[lignes[i+3]]+'">'+unite+niveau+'<i>'+nom+'</i></a> '+armee[lignes[i+3]]+'</td>';
    else if(lignes[i+5] == '')
     contenu += '<tr bgcolor="'+bg+'"><td class="'+style[lignes[i+3]]+'">'+unite+niveau+'<i>'+nom+'</i> '+deserteur+'</td>';
    else
     contenu += '<tr bgcolor="'+bg+'"><td class="'+style[lignes[i+3]]+'">'+unite+niveau+'<i>'+nom+'</i> '+compagnie+'<a class="'+style[lignes[i+3]]+'" href="'+msg+lignes[i+5]+'"  target="messages">'+lignes[i+5]+'</a></td>';
}
 contenu += '<td width="30">&nbsp;</td></tr>'
 i+=8;
    break;

 // Affichage pack + action
 case 6:    // 1        2 tableau de 3 ( 0        1       2)
            // type                    action,  lien,   txt
image = '<IMG class=\'m\' SRC=\''+ipath+pack[lignes[i+1]][1]+'_s.png\'>';
nom = pack[lignes[i+1]][0];
contenu += '<tr bgcolor="'+bg+'"><td colspan="2"><i>'+image+' '+nom+'</i></td>';
contenu += '<td align=\'right\'>';
var a=0;
if(lignes[i+2].length == 0)
    contenu += '&nbsp;';
else
{
    while(a+2 < lignes[i+2].length)
    {
        contenu += ' '+action(lignes[i+2][a+0],lignes[i+2][a+1],lignes[i+2][a+2]);
        a+=3;
    }
}
contenu += '</td></tr>';
 i+=3;
 break;

 }
 }

 contenu += '</table></td></tr></table>';
 return contenu;
}

function over_menu()
{if(c_cible !== undefined)
 {if(net)
{
  document.getElementById('menu'+cx+'_'+cy).style.visibility = 'visible';
  c_cible.visibility = 'visible';
}
else
{
document.all['menu'+cx+'_'+cy].style.visibility = 'visible';
c_cible.visibility = 'visible';
}}
}

function m_menu(x,y)
{
  if(c_cible !== undefined)
    mc();
 if(net)
 document.getElementById('menu'+x+'_'+y).style.visibility = 'hidden';
 else
 document.all['menu'+x+'_'+y].style.visibility = 'hidden';
}

function dispertion(adresse)
{if(confirm("Etes vous s�r de vouloir disperser votre unit� ?"))
  window.location=adresse;
}

function l(a)
{
window.location = lien+'&'+a;
}

function v_unite(niv,max)
{
seuil = max/3;
ratio = 100/max;
orange = 0;
verte = 0;
if( niv > seuil)
{
    rouge = Math.floor(seuil*ratio);
    if( niv > (seuil*2))
    {
        orange = Math.floor(seuil*ratio);
        verte = Math.floor((niv - (2*seuil))*ratio);
    }
    else
        orange = Math.floor((niv - seuil)*ratio);
}
else
    rouge = Math.floor(niv*ratio);

if (navigator.appName=="Netscape")
    postop = -1;
else
    postop = 1;
res = '0<span id="v" style="position:relative; width:102px; height:12px; z-index:1" TITLE="'+niv+'/'+max+'">'
+'<img src="'+ipath+'bandeau.gif" width="102" height="12">'
+'<span id="c" style="position:absolute; left:1px; top:'+postop+'px; width:100px; height:10px; z-index:4; background-color: #FFFFFF;">';
res += '<img src="'+ipath+'bandeau_r.gif" width="'+rouge+'" height="10">';
if( orange > 0)
    res += '<img src="'+ipath+'bandeau_o.gif" width="'+orange+'" height="10">';
if( verte > 0)
    res += '<img src="'+ipath+'bandeau_v.gif" width="'+verte+'" height="10">';

res += '</span></span>'+max;
document.write(res);
}

function f_unite(niv,max)
{
ratio = 100/(max+1);
verte = 0;
orange = 0;
rouge = 0;
if (navigator.appName=="Netscape")
    postop = -1;
else
    postop = 1;
var res = '0<span id="f" style="position:relative; width:102px; height:12px; z-index:1" TITLE="'+niv+'/'+max+'">'
+'<img src="'+ipath+'bandeau.gif" width="102" height="12">'
+'<span id="c" style="position:absolute; left:1px; top:'+postop+'px; width:100px; height:10px; z-index:4; background-color: #FFFFFF;">';

if( niv == 0)
    res += '<img src="'+ipath+'bandeau_b.gif" width="1" height="10">';
else
{
if( niv > max/2)
{
 verte = Math.floor((max/2)*ratio);
 if( niv > (max*3/4))
 {
  orange = Math.floor(max/4*ratio);
  rouge = Math.floor((niv - (max*3/4))*ratio);
 }
 else
  orange = Math.floor((niv - max/2)*ratio);
}
else
 verte = Math.floor(niv*ratio);
res += '<img src="'+ipath+'bandeau_v.gif" width="'+verte+'" height="10">';
if( orange > 0)
res += '<img src="'+ipath+'bandeau_o.gif" width="'+orange+'" height="10">';
if( rouge > 0)
res += '<img src="'+ipath+'bandeau_r.gif" width="'+rouge+'" height="10">';
}
res += '</span></span>'+max;

document.write(res);
}

function b_clan(niv,max)
{
seuil = Math.ceil(max/9);
cur = 0;
var image = ipath+'clan_r.gif';
res = '<div id="f" style="position:relative; width:56px; height:7px; z-index:1" TITLE="'+niv+'/'+max+'"><div id="b" style="position:absolute; left:0px; top:0px; width:56px; height:7px; z-index:3; background-color: #FFFFFF; "><img src="'+ipath+'clan.gif" width="56" height="7"></div><div id="e" style="position:absolute; left:1px; top:1px; width:54px; height:5px; z-index:4; background-color: #FFFFFF; ">';
rang = 0;
if( niv == 0)
res += "<img src=\""+ipath+"clan_b.gif\" width=\"6\" height=\"5\">";
else
{while(cur < niv)
{res += "<img src=\""+image+"\" width=\"6\" height=\"5\">";
 cur += seuil;
 rang++;
 if(rang == 3)
  image = ipath+'clan_o.gif';
 else if(rang == 6)
  image = ipath+'clan_v.gif';
}}
res += '</div></div>';
document.write(res);
}

function f_clan(niv,max)
{seuil = Math.ceil(max/9);
cur = 0;
var image = ipath+'clan_v.gif';
res = '<div id="f" style="position:relative; width:56px; height:7px; z-index:1" TITLE="'+niv+'/'+max+'"><div id="b" style="position:absolute; left:0px; top:0px; width:56px; height:7px; z-index:3; background-color: #FFFFFF; "><img src="'+ipath+'clan.gif" width="56" height="7"></div><div id="e" style="position:absolute; left:1px; top:1px; width:54px; height:5px; z-index:4; background-color: #FFFFFF; ">';
rang = 0;
if( niv == 0)
res += "<img src=\""+ipath+"clan_b.gif\" width=\"6\" height=\"5\">";
else
{while(cur < niv)
{res += "<img src=\""+image+"\" width=\"6\" height=\"5\">";
 cur += seuil;
 rang++;
 if(rang == 4)
  image = ipath+'clan_o.gif';
 else if(rang == 7)
  image = ipath+'clan_r.gif';
}}
res += '</div></div>';
document.write(res);
}

img_m = new Array();//  0                   1               2               3               4               5               6               7               8                   9               10                  11
img_m['tissus'] =       ['mt_vert.gif',     'mt_gris.gif',  'mt_marron.gif','mt_bleu.gif',  'mt_noir.gif',  'mt_blanc.gif'];
img_m['bandes'] =       ['mb_sjaune.gif',   'mb_svert.gif', 'mb_srouge.gif','mb_sbleu.gif', 'mb_djaune.gif','mb_dvert.gif', 'mb_drouge.gif','mb_dbleu.gif', 'mb_tjaune.gif',    'mb_tvert.gif', 'mb_trouge.gif',    'mb_tbleu.gif'];
img_m['medailles'] =    ['mm_bronze_r.gif', 'mm_argent_r.gif','mm_or_r.gif','mm_vert_r.gif','mm_bleu_r.gif','mm_rouge_r.gif','mm_vert_c.gif','mm_bleu_c.gif',  'mm_rouge_c.gif'];
img_m['dessin'] =       ['md_3.gif',        'md_2.gif',     'md_1.gif',     'md_unique.gif', 'md_croix.gif'];

type_m = new Array();
// premiere valeur = genre de la medaille
type_m[1]  = [1,[0,0 ,2,3]];
type_m[2]  = [3,[1,1 ,0,0],[1,1 ,1,1],[1,1 ,2,2]];
type_m[3]  = [3,[2,2 ,0,0],[2,2 ,1,1],[2,2 ,2,2]];
type_m[4]  = [3,[3,3 ,0,0],[3,3 ,1,1],[3,3 ,2,2]];
type_m[5]  = [3,[4,4 ,0,0],[4,4 ,1,1],[4,4 ,2,2]];
type_m[6]  = [3,[5,5 ,0,0],[5,5 ,1,1],[5,5 ,2,2]];
type_m[7]  = [3,[0,6 ,0,0],[0,6 ,1,1],[0,6 ,2,2]];
type_m[8]  = [3,[1,7 ,0,0],[1,7 ,1,1],[1,7 ,2,2]];
type_m[9]  = [3,[2,8 ,0,0],[2,8 ,1,1],[2,8 ,2,2]];
type_m[10] = [3,[3,9 ,0,0],[3,9 ,1,1],[3,9 ,2,2]];
type_m[11] = [3,[4,10,0,0],[4,10,1,1],[4,10,2,2]];
type_m[12] = [3,[5,11,0,0],[5,11,1,1],[5,11,2,2]];
type_m[13] = [3,[0,1 ,0,0],[0,1 ,1,1],[0,1 ,2,2]];
type_m[14] = [3,[1,2 ,0,0],[1,2 ,1,1],[1,2 ,2,2]];
type_m[15] = [3,[2,3 ,0,0],[2,3 ,1,1],[2,3 ,2,2]];
type_m[16] = [3,[3,4 ,0,0],[3,4 ,1,1],[3,4 ,2,2]];
type_m[17] = [3,[4,5 ,0,0],[4,5 ,1,1],[4,5 ,2,2]];
type_m[18] = [3,[5,6 ,0,0],[5,6 ,1,1],[5,6 ,2,2]];
type_m[19] = [3,[0,7 ,0,0],[0,7 ,1,1],[0,7 ,2,2]];
type_m[20] = [4,[1,8 ,6,0],[1,8 ,7,1],[1,8 ,8,2]];
type_m[21] = [3,[2,9 ,0,0],[2,9 ,1,1],[2,9 ,2,2]];
type_m[22] = [3,[3,10,0,0],[3,10,1,1],[3,10,2,2]];
type_m[23] = [1,[4,11,2,3]];
type_m[24] = [2,[5,0,3,4]];
type_m[25] = [1,[0,2 ,2,3]];
type_m[26] = [3,[1,3 ,0,0],[1,3 ,1,1],[1,3 ,2,2]];
type_m[27] = [3,[2,4 ,0,0],[2,4 ,1,1],[2,4 ,2,2]];
type_m[28] = [3,[3,5 ,0,0],[3,5 ,1,1],[3,5 ,2,2]];
type_m[29] = [3,[4,6 ,0,0],[4,6 ,1,1],[4,6 ,2,2]];
type_m[30] = [3,[5,7 ,0,0],[5,7 ,1,1],[5,7 ,2,2]];
type_m[31] = [3,[0,8 ,0,0],[0,8 ,1,1],[0,8 ,2,2]];
type_m[32] = [3,[1,9 ,0,0],[1,9 ,1,1],[1,9 ,2,2]];
type_m[33] = [3,[2,10,0,0],[2,10,1,1],[2,10,2,2]];
type_m[34] = [3,[3,11,0,0],[3,11,1,1],[3,11,2,2]];
type_m[35] = [1,[4,0,2,3]];
type_m[36] = [1,[5,1,2,3]];
type_m[37] = [4,[0,3 ,6,0],[0,3 ,7,1],[0,3 ,8,2]];
type_m[38] = [4,[1,4 ,6,0],[1,4 ,7,1],[1,4 ,8,2]];
type_m[39] = [4,[2,5 ,6,0],[2,5 ,7,1],[2,5 ,8,2]];
type_m[40] = [4,[3,6 ,6,0],[3,6 ,7,1],[3,6 ,8,2]];
type_m[41] = [4,[4,7 ,6,0],[4,7 ,7,1],[4,7 ,8,2]];
type_m[42] = [4,[5,8 ,6,0],[5,8 ,7,1],[5,8 ,8,2]];
type_m[43] = [4,[0,9 ,6,0],[0,9 ,7,1],[0,9 ,8,2]];
type_m[44] = [4,[1,10,6,0],[1,10,7,1],[1,10,8,2]];
type_m[45] = [4,[2,11,6,0],[2,11,7,1],[2,11,8,2]];
type_m[46] = [3,[3,0 ,0,0],[3,0 ,1,1],[3,0 ,2,2]];
type_m[47] = [3,[4,1 ,0,0],[4,1 ,1,1],[4,1 ,2,2]];

type_m[48] = [3,[5,2 ,0,0],[5,2 ,1,1],[5,2 ,2,2]];
type_m[49] = [3,[0,4 ,0,0],[0,4 ,1,1],[0,4 ,2,2]];
type_m[50] = [3,[1,5 ,0,0],[1,5 ,1,1],[1,5 ,2,2]];
type_m[51] = [3,[2,6 ,0,0],[2,6 ,1,1],[2,6 ,2,2]];
type_m[52] = [3,[3,7 ,0,0],[3,7 ,1,1],[3,7 ,2,2]];
type_m[53] = [3,[4,8 ,0,0],[4,8 ,1,1],[4,8 ,2,2]];
type_m[54] = [3,[5,9 ,0,0],[5,9 ,1,1],[5,9 ,2,2]];;
type_m[55] = [3,[0,10 ,0,0],[0,10 ,1,1],[0,10 ,2,2]];;
type_m[56] = [3,[1,11 ,0,0],[1,11 ,1,1],[1,11 ,2,2]];;
type_m[57] = [3,[2,1 ,0,0],[2,1 ,1,1],[2,1 ,2,2]];;


//type_m[47] = [,[0,0,0,0],[0,0,1,1],[0,0,2,2]];






function medaille(tab,ligne)
{
// Affichage des images superposee
	if( tab.length-1 == 0)
		document.write('&nbsp;');
	else
	{
		var l =0;
		prem = 0;
		pos = 0;
		num = 0;
		max_h = Math.ceil((tab.length-1)/ligne);
		max_w = Math.min(ligne,tab.length-1);
		res = '<div  style="position:relative; width:'+(max_w*13)+'px; height:'+(24*max_h)+'px; z-index:1;">';
		for(i=0;i<tab.length-1;i+=1)
		{
			if( tab[i].constructor == Array )
			{
				x_pos = 13*l+pos;
				y_pos = 22*num;
				res += '<div style="position:absolute;top:'+y_pos+'px;left:'+x_pos+'px;z-index:'+(max_h-num)+';" class="dm"><img src="'+ipath+img_m['tissus'][type_m[tab[i][0]][tab[i][1]][0]]+'" class="fm"></div>';
				res += '<div style="position:absolute;top:'+y_pos+'px;left:'+x_pos+'px;z-index:'+(max_h-num)+';" class="dm"><img src="'+ipath+img_m['bandes'][type_m[tab[i][0]][tab[i][1]][1]]+'" class="fm"></div>';
				res += '<div style="position:absolute;top:'+y_pos+'px;left:'+x_pos+'px;z-index:'+(max_h-num)+';" class="dm"><img src="'+ipath+img_m['medailles'][type_m[tab[i][0]][tab[i][1]][2]]+'" class="fm"></div>';
				res += '<div style="position:absolute;top:'+y_pos+'px;left:'+x_pos+'px;z-index:'+(max_h-num)+';" class="dm"><img TITLE="'+titre_m[type_m[tab[i][0]][0]][tab[i][1]-1]+' '+nom_m[tab[i][0]]+'" src="'+ipath+img_m['dessin'][type_m[tab[i][0]][tab[i][1]][3]]+'" class="fm"></div>';
				res += "\n";
				l+=1;
			}
			else
				l += 1;

			if(l == ligne)
			{
				l = 0;
				num += 1;
				if(pos == 0)
					pos = 6;
				else
					pos = 0;
			}
		}
		res += '</div>';
		document.write(res);
	}
}

//-->

