var nRegion = 0;
function chooseRegion(region)
{
  region = getRegion(region);
  if(region != null)
  {
    nRegion = region.number;
    sem_centre.location = '/public/?qr=&region=' + nRegion;
  }
}

var regionData = null;
var regAjax = new Ajax.Request('/ajax/regions_gest.php', { method: 'get', onComplete: getRegions });

function getRegions(requete)
{
  regionData = requete.responseXML;
 }

var texte_region = '<h2>Cliquez sur votre région pour <br />accéder aux dispositifs</h2>';

function infoRegion(region, show)
{
  var txt = texte_region;

  if((regionData != null) && show)
  {
    region = getRegion(region);
    if(region != null)
    {
      txt = '<h2>' + region.label + '</h2>\n';
      txt += '<p>' + region.produits + (region.produits > 1 ? ' dispositifs d\'aide' : ' dispositif d\'aide');
      if(region.gest != 0) txt += '<br />Région avec gestionnaire';
      txt += '</p>\n';
    }
  }

  $('sem-region-infos').innerHTML = txt;
}

function getRegion(region)
{
  if((regionData != null))
  {
    var regions = regionData.firstChild;
    while((regions.nodeName != 'regions') && (regions.nodeName != null))
    { regions = regions.nextSibling; }

    if(regions != null)
    {
      regions = regions.getElementsByTagName('region');
      for(i = 0; i < regions.length; i++)
      {
        n = regions[i].getElementsByTagName('number');
        if(n[0].firstChild.nodeValue == region)
        {
          return {
            number: region,
            label: regions[i].getElementsByTagName('label').item(0).firstChild.nodeValue,
            gest: regions[i].getElementsByTagName('gest').item(0).firstChild.nodeValue,
            produits: regions[i].getElementsByTagName('produits').item(0).firstChild.nodeValue
          }
        }
      }
    }
  }
  return null;
}

document.writeln('<div align="center">');

if(flashHasRightVersion) {
  AC_FL_RunContent(
    'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
    'width', '180',
    'height', '215',
    'src', '/flash/france',
    'quality', 'high',
    'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
    'align', 'middle',
    'play', 'true',
    'loop', 'true',
    'scale', 'showall',
    'wmode', 'window',
    'devicefont', 'false',
    'id', 'france',
    'bgcolor', '#FFE5E5',
    'name', 'france',
    'menu', 'true',
    'allowFullScreen', 'false',
    'allowScriptAccess','sameDomain',
    'movie', '/flash/france',
    'salign', ''
    );
}
else
{
  document.writeln('<map name="france">');
  document.writeln('  <area shape="poly" coords="27,108,24,106,22,105,20,104,19,100,16,98,13,100,15,103,13,107,7,103,4,104,5,116,7,119,11,118,13,115,12,110,13,108,15,110,20,110" href="javascript:chooseRegion(1);" alt="Guadeloupe" title="Guadeloupe" onmouseover="infoRegion(1, true);" onmouseout="infoRegion(1, false);" />');
  document.writeln('  <area shape="poly" coords="18,95,21,93,16,81,19,80,18,78,14,79,7,73,3,76,6,79,5,83,9,86,12,86,13,88,11,89,10,88,8,90,10,92,17,92" href="javascript:chooseRegion(2);" alt="Martinique" title="Martinique" onmouseover="infoRegion(2, true);" onmouseout="infoRegion(2, false);" />');
  document.writeln('  <area shape="poly" coords="15,129,11,128,7,131,8,135,10,138,7,143,9,144,11,142,14,144,15,144,17,142,17,140,17,137,19,136,19,133" href="javascript:chooseRegion(3);" alt="Guyane" title="Guyane" onmouseover="infoRegion(3, true);" onmouseout="infoRegion(3, false);" />');
  document.writeln('  <area shape="poly" coords="15,148,9,148,6,149,4,153,7,156,7,158,14,162,16,163,20,161,22,156,17,152,18,151" href="javascript:chooseRegion(4);" alt="La Réunion" title="La Réunion" onmouseover="infoRegion(4, true);" onmouseout="infoRegion(4, false);" />');
  document.writeln('  <area shape="poly" coords="81,48,86,56,90,55,92,59,98,58,100,54,104,54,105,50,104,46,100,40,93,41,90,39,83,39,79,42,81,45" href="javascript:chooseRegion(11);" alt="Île-de-France" title="Île-de-France" onmouseover="infoRegion(11, true);" onmouseout="infoRegion(11, false);" />');
  document.writeln('  <area shape="poly" coords="120,20,117,24,114,24,115,28,111,31,112,35,109,34,106,37,107,40,104,46,105,50,104,54,111,62,118,62,120,59,124,64,126,67,132,67,136,61,132,58,133,56,124,49,122,44,124,41,123,38,124,32,128,30,123,26,121,26" href="javascript:chooseRegion(21);" alt="Champagne-Ardenne" title="Champagne-Ardenne" onmouseover="infoRegion(21, true);" onmouseout="infoRegion(21, false);" />');
  document.writeln('  <area shape="poly" coords="82,17,79,23,84,27,83,39,90,39,93,41,100,40,104,46,107,40,106,37,109,34,112,35,111,31,115,28,114,24,108,22,103,24,94,22,92,19,89,20" href="javascript:chooseRegion(22);" alt="Picardie" title="Picardie" onmouseover="infoRegion(22, true);" onmouseout="infoRegion(22, false);" />');
  document.writeln('  <area shape="poly" coords="63,31,67,34,65,35,67,44,71,49,78,47,79,42,83,38,84,27,79,22,73,26,67,27" href="javascript:chooseRegion(23);" alt="Haute-Normandie" title="Haute-Normandie" onmouseover="infoRegion(23, true);" onmouseout="infoRegion(23, false);" />');
  document.writeln('  <area shape="poly" coords="71,63,66,68,64,68,60,77,65,81,67,81,67,79,69,79,69,82,71,84,71,87,74,89,75,91,82,90,87,90,90,92,91,89,94,86,95,84,99,84,100,78,97,75,97,70,99,68,97,66,101,61,98,58,92,59,90,55,86,56,81,48,81,45,79,42,78,47,71,49,73,52,71,55,71,59" href="javascript:chooseRegion(24);" alt="Centre" title="Centre" onmouseover="infoRegion(24, true);" onmouseout="infoRegion(24, false);" />');
  document.writeln('  <area shape="poly" coords="63,34,59,37,53,35,47,35,46,32,47,29,45,27,43,29,39,28,39,33,42,37,41,48,44,52,45,50,48,51,57,52,58,50,61,54,64,51,71,59,71,55,73,52,71,49,67,44,65,35" href="javascript:chooseRegion(25);" alt="Basse-Normandie" title="Basse-Normandie" onmouseover="infoRegion(25, true);" onmouseout="infoRegion(25, false);" />');
  document.writeln('  <area shape="poly" coords="101,61,97,66,99,68,97,70,97,75,100,78,99,84,105,86,107,84,109,88,112,89,111,94,113,96,117,95,117,93,121,93,123,95,125,89,127,88,129,90,131,89,129,84,131,82,129,82,128,79,131,73,129,70,132,67,126,67,124,64,120,59,118,62,111,62,104,54,100,54,98,58" href="javascript:chooseRegion(26);" alt="Bourgogne" title="Bourgogne" onmouseover="infoRegion(26, true);" onmouseout="infoRegion(26, false);" />');
  document.writeln('  <area shape="poly" coords="93,4,86,5,82,8,82,17,89,20,92,19,94,22,103,24,108,22,114,24,111,17,106,17,106,14,101,14,100,9,96,11,93,8" href="javascript:chooseRegion(31);" alt="Nord-Pas-de-Calais" title="Nord-Pas-de-Calais" onmouseover="infoRegion(31, true);" onmouseout="infoRegion(31, false);" />');
  document.writeln('  <area shape="poly" coords="130,33,133,30,136,33,142,33,145,38,148,37,150,39,154,37,156,40,154,42,149,41,148,43,149,44,151,43,153,44,152,48,150,49,151,54,148,63,138,60,136,61,132,58,133,56,124,49,122,44,124,41,123,38,124,32,128,30" href="javascript:chooseRegion(41);" alt="Lorraine" title="Lorraine" onmouseover="infoRegion(41, true);" onmouseout="infoRegion(41, false);" />');
  document.writeln('  <area shape="poly" coords="162,40,156,40,154,42,149,41,148,43,149,44,151,43,153,44,152,48,150,49,151,54,148,63,151,65,151,69,155,69,158,66,156,63,158,59,156,56,159,46,161,45,163,43" href="javascript:chooseRegion(42);" alt="Alsace" title="Alsace" onmouseover="infoRegion(42, true);" onmouseout="infoRegion(42, false);" />');
  document.writeln('  <area shape="poly" coords="151,72,149,71,151,68,151,65,148,63,138,60,136,61,132,67,129,70,131,73,128,79,129,82,131,82,129,84,131,89,129,90,132,93,134,91,136,93,140,89,139,87,141,85,144,83,143,79,147,78" href="javascript:chooseRegion(43);" alt="Franche-Comté" title="Franche-Comté" onmouseover="infoRegion(43, true);" onmouseout="infoRegion(43, false);" />');
  document.writeln('  <area shape="poly" coords="28,72,31,73,34,71,36,73,33,75,35,76,32,81,36,84,36,87,43,93,46,92,47,91,52,93,53,91,51,89,52,85,48,79,60,77,64,68,66,68,71,63,71,59,64,51,61,54,58,50,57,52,48,51,46,55,48,59,45,64,42,63,40,65,36,65,32,69,29,68" href="javascript:chooseRegion(52);" alt="Pays de la Loire" title="Pays de la Loire" onmouseover="infoRegion(52, true);" onmouseout="infoRegion(52, false);" />');
  document.writeln('  <area shape="poly" coords="27,49,22,42,16,43,16,46,11,45,7,45,2,47,1,50,7,51,6,53,3,53,7,54,6,56,2,56,2,57,6,61,10,60,16,63,29,68,32,69,36,65,40,65,42,63,45,64,48,59,46,55,48,51,45,50,44,52,41,48,40,49,37,46,34,49,33,49,31,47" href="javascript:chooseRegion(53);" alt="Bretagne" title="Bretagne" onmouseover="infoRegion(53, true);" onmouseout="infoRegion(53, false);" />');
  document.writeln('  <area shape="poly" coords="44,95,46,99,44,103,50,111,57,116,63,112,63,109,68,103,72,100,71,94,75,91,74,89,71,87,71,84,69,82,69,79,67,79,67,81,65,81,60,77,48,79,52,85,51,89,53,91,52,93,47,91" href="javascript:chooseRegion(54);" alt="Poitou-Charentes" title="Poitou-Charentes" onmouseover="infoRegion(54, true);" onmouseout="infoRegion(54, false);" />');
  document.writeln('  <area shape="poly" coords="44,106,49,112,50,111,57,116,63,112,63,109,68,103,70,106,73,106,77,110,76,114,78,117,78,120,72,126,73,130,71,129,71,133,67,136,65,135,62,136,59,137,57,136,55,138,55,144,58,147,57,151,53,157,51,158,49,157,39,151,39,149,35,147,39,142,41,131,42,124,46,123,43,120" href="javascript:chooseRegion(72);" alt="Aquitaine" title="Aquitaine" onmouseover="infoRegion(72, true);" onmouseout="infoRegion(72, false);" />');
  document.writeln('  <area shape="poly" coords="53,157,57,160,61,159,65,161,68,157,72,158,77,162,83,163,88,162,88,160,85,161,84,159,86,155,82,151,84,147,86,147,87,148,90,146,94,146,95,143,100,142,101,139,102,140,105,136,104,133,101,132,101,128,99,124,98,120,95,119,92,124,88,124,87,118,82,119,80,116,78,117,78,120,72,126,73,130,71,129,71,133,67,136,65,135,62,136,59,137,57,136,55,138,55,144,58,147,57,151" href="javascript:chooseRegion(73);" alt="Midi-Pyrénées" title="Midi-Pyrénées" onmouseover="infoRegion(73, true);" onmouseout="infoRegion(73, false);" />');
  document.writeln('  <area shape="poly" coords="93,96,93,100,91,102,93,105,92,106,92,110,89,113,87,118,82,119,80,116,78,117,76,114,77,110,73,106,70,106,68,103,72,100,71,94,75,91,82,90,87,90,89,92" href="javascript:chooseRegion(74);" alt="Limousin" title="Limousin" onmouseover="infoRegion(74, true);" onmouseout="infoRegion(74, false);" />');
  document.writeln('  <area shape="poly" coords="150,90,143,90,143,95,139,96,138,95,138,93,140,91,140,89,136,93,134,91,132,93,127,88,125,89,123,95,121,93,117,93,117,95,113,96,111,94,109,95,110,97,108,99,108,102,112,108,111,110,112,112,115,110,119,113,117,118,111,122,115,131,126,129,133,134,136,131,133,129,133,126,135,125,135,123,145,119,145,117,141,115,142,113,144,113,145,115,149,114,154,111,155,108,149,102,153,98,148,94" href="javascript:chooseRegion(82);" alt="Rhône-Alpes" title="Rhône-Alpes" onmouseover="infoRegion(82, true);" onmouseout="infoRegion(82, false);" />');
  document.writeln('  <area shape="poly" coords="108,99,108,102,112,108,111,110,112,112,115,110,119,113,117,118,111,122,108,120,106,121,105,118,100,120,99,124,98,120,95,119,92,124,88,124,87,118,89,113,92,110,92,106,93,105,91,102,93,100,93,96,90,92,91,89,94,86,95,84,99,84,105,86,107,84,109,88,112,89,111,94,109,95,110,97" href="javascript:chooseRegion(83);" alt="Auvergne" title="Auvergne" onmouseover="infoRegion(83, true);" onmouseout="infoRegion(83, false);" />');
  document.writeln('  <area shape="poly" coords="105,136,102,140,101,139,100,142,95,143,94,146,90,146,87,148,86,147,84,147,82,151,86,155,84,159,85,161,88,160,88,162,83,163,87,168,90,166,93,168,100,165,100,156,98,154,114,144,117,148,118,146,120,142,123,141,122,138,124,135,122,130,115,131,111,122,108,120,106,121,105,119,105,118,100,120,99,124,101,128,101,132,104,133" href="javascript:chooseRegion(91);" alt="Languedoc-Roussillon" title="Languedoc-Roussillon" onmouseover="infoRegion(91, true);" onmouseout="infoRegion(91, false);" />');
  document.writeln('  <area shape="poly" coords="151,119,154,121,151,126,155,132,163,132,164,133,161,136,161,139,150,148,150,151,140,153,131,148,118,146,120,142,123,141,122,138,124,135,122,130,126,129,133,134,136,131,133,129,133,126,135,125,135,123,145,119,145,117,141,115,142,113,144,113,145,115,149,114" href="javascript:chooseRegion(93);" alt="Provence-Alpes-Côte d\'Azur" title="Provence-Alpes-Côte d\'Azur" onmouseover="infoRegion(93, true);" onmouseout="infoRegion(93, false);" />');
  document.writeln('  <area shape="poly" coords="171,145,171,152,169,151,165,153,161,159,163,160,161,161,162,164,165,164,162,167,166,168,163,170,166,172,166,174,171,177,173,176,174,170,173,165,174,164,175,163,176,161,176,158,174,154,173,145" href="javascript:chooseRegion(94);" alt="Corse" title="Corse" onmouseover="infoRegion(94, true);" onmouseout="infoRegion(94, false);" />');
  document.writeln('</map>');
  document.writeln('<img src="/images/france.gif" alt="Régions" width="180" height="180" border="0" usemap="#france" />');
}
document.writeln('</div>');
if(!flashHasRightVersion) document.writeln('<div id="sem-region-infos">' + texte_region + '</div>');
