function popup(photo, titre, largeur, hauteur) { 
        var posX = (screen.width / 2) - (largeur / 2);
        var posY = (screen.height / 2) - (hauteur / 2);
        var contenu="<html><head><title>"+titre+"</title></head><body topmargin='0' leftmargin='0'><p><a href='javascript:self.close()'><object type='application/x-shockwave-flash' data='"+photo+"' width='550' height='448'><param name='movie' value='"+photo+"' /></object><div id='Layer1' style='position:absolute; z-index:1; margin-left: 400px; margin-top: -20px; background-color:none; padding:5px; font-size: 9px; color: #ccc; font-family:\'Trebuchet MS\';'><a href='javascript:window.close();' style='text-decoration:none!important; color: #ccc; '>&copy;&nbsp;Rhino Jazz 2006</a></div></p></body></html>";

        // var contenu="<html><head><title>"+titre+"</title></head><body topmargin='0' leftmargin='0'><p><a href='javascript:self.close()'><img border='0' src='"+photo+"'></a><div id='Layer1' style='position:absolute; z-index:2; left: 2; top: 2; width: 30px;'><a href='javascript:window.close();'><font size='1' color='#000' face='Arial'>&copy;&nbspCopyright Tournaire</font></a></div></p></body></html>";
        var fenetre=open("","","title="+titre+",resizable=no,scrollbars=no,left = " + posX + ", top = " + posY + ",width="+largeur+", height="+hauteur+"");
        fenetre.document.write(contenu);
} 

function popup2(photo, titre, largeur, hauteur) { 
        var posX = (screen.width / 2) - (largeur / 2);
        var posY = (screen.height / 2) - (hauteur / 2);
        var contenu="<html><head><title>"+titre+"</title></head><body topmargin='0' leftmargin='0'><p><a href='javascript:self.close()'><img border='0' src='"+photo+"'></a></p></body></html>";
        var fenetre=open("","","title="+titre+",resizable=no,scrollbars=no,left = " + posX + ", top = " + posY + ",width="+largeur+", height="+hauteur+"");
        fenetre.document.write(contenu);
}   


function affiche_selecteur()
{
  var url_page = document.location;
   $.get('spip.php?page=selection_magasin',{ url: url_page},function(data){ 
          $("#magasin_absolu").addClass("affiche_magasin_absolu");
          $("#bloc_selection").addClass("style_bloc_selection");
          $("#bloc_selection").html(data);
          
          var NomNav = navigator.appName; // place le nom du navigateur dans la variable NomNav (2)
         var VersNav = navigator.appVersion; // place la version du navigateur dans la variable VersNav (3)
         var NumVers = parseFloat(VersNav);
         
         if (NomNav == "Microsoft Internet Explorer")
         {
            var ieversion = version_navigateur();
            
            if (ieversion < 7)
            {
              resize_conteneur();
            }
            else
            {
              $("#magasin_absolu").height($('body').height() + "px");  
            }
          }
          else
          {
            $("#magasin_absolu").height($('body').height() + "px");  
          }
   });
   
   // on masque l'anim flash en home
   $("#diapo_home").css("display","none");
};

function version_navigateur()
{
  var ieversion = 0;
  if (navigator.appVersion.indexOf("MSIE") != -1)
  {
    t = navigator.appVersion.split("MSIE");
    ieversion = parseFloat(t[1]);
  }
  
  return ieversion;
}

function resize_conteneur()
{
  var body_height = $('#conteneur').height();
  var height_total = (body_height * -1);
  
  $("#magasin_absolu").height($('body').height() + "px");
  $('#magasin_absolu').css("margin-top",height_total + "px");
  $("#bloc_selection").css("margin-top",(height_total - $("#bloc_selection").height()) + "px");
  $("#bloc_selection").css("margin-left",(($("#magasin_absolu").width() / 2) - ($("#bloc_selection").width() / 2)) + "px");
  
}

$(window).resize(function() {
   var NomNav = navigator.appName; // place le nom du navigateur dans la variable NomNav (2)
   var VersNav = navigator.appVersion; // place la version du navigateur dans la variable VersNav (3)
   var NumVers = parseFloat(VersNav);
   
   if (NomNav == "Microsoft Internet Explorer")
    {
      var ieversion = version_navigateur();
      
      if (ieversion < 7)
      {
        resize_conteneur();
      }
      else
      {
        $("#magasin_absolu").height($('body').height() + "px");  
      }
    }
    else
    {
      $("#magasin_absolu").height($('body').height() + "px");  
    }
     
});

function affiche_logo_magasin(code_mag)
{
  $.get('http://www.supercasino.fr/spip.php?page=wslogomagasin',{ id: code_mag},function(data){          
          $("#logo_magasin").html(data);
  });
}

function trouve_dep2(num_dep)
{
  document.getElementById('code_casino').selectedIndex = num_dep;
}

/*
function verification_termine(i)
{
    div1='#verification_ftp'+i;
    div2='#verification_mysql'+i;
    if(($(div1).html().substring(0,20)=='<font color=\"green\">')&&($(div2).html().substring(0,20)=='<font color=\"green\">'))
    {
        div='#bouton'+i;
        $(div).removeAttr('disabled');
        $(div).attr('style','color=#ffffff');
    }
};
*/
//fonctions de mise a jour
function traitement(code,url)
{

    $.get("spip.php?page=enregistre_magasin",
    { code_casino: code},
      function(data) {
        $("#diapo_home").css("display","block");
        document.location.href = url;
      }
    );
    
    // alert(code);

}

function clique_departement(num_dep) {
  
  if (parseInt(num_dep,10) < 10)
  {
    num_dep = "0" + parseInt(num_dep,10);
  }
  
  
  $.get("spip.php?page=liste_magasin_dep",
  { dep: num_dep},
  function(data){
    
    $("#code_casino").empty();
    
    //Bug Safari
    if(/Safari/.test(navigator.appVersion))
    {
        resultat_contenu=document.getElementById("code_casino");
        resultat_contenu.innerHTML=resultat_contenu.innerHTML+data;
    }
    else
    {
      
      $("#code_casino").html(data);
    }
  }
);
}

function autre_mag()
{
  if (confirm("Cette op\u00E9ration va effacer votre menu pr\u00E9c\u00E9dent : "))
  {
    document.location.href = "spip.php?page=panier_add&menu_sup=1";
  }
}

