function kitmapClickIcon(sId) {
  $("#id0104 option[value='"+sId+"']").attr("selected","selected");
  $("#form01").submit();
}
var flashvars = {};
var params = {loop:false, menu:false};
var attributes = {};
//taille orig 460 * 500
swfobject.embedSWF('cma12.swf', 'carte', '267', '315', '8.0.0', 'expressInstall.swf', flashvars, params, attributes);
function setCarteXML(xml) {
  $("#id0104 option").slice(1).remove();
  $(xml).find("canton").each(function() {
    $("#id0104").append("<option value='"+$(this).attr("id")+"'>"+$(this).attr("libelle")+"</option>");
  });
  $("#id0104").attr("disabled",false);    
  //IE
  if (window.ActiveXObject) {
    var sXML = xml.xml;
  } else {
    // code for Mozilla, Firefox, Opera, etc.
    var sXML = (new XMLSerializer()).serializeToString(xml);
  }
  var oCarte=document.getElementById("carte");
  if(oCarte) oCarte.setXml(sXML);
}
var oXML=null;
function updateActivite(xml) {
  oXML=xml;
  $("#id0102 option").slice(1).remove();
  $(oXML).find("activite").each(function() {
    $("#id0102").append("<option value='"+$(this).attr("id")+"'>"+$(this).attr("libelle")+"</option>");
  });
}
function updateMetier(xml) {
  $("#id0103 option").slice(1).remove();
  $(xml).find("#"+$("#id0102").val()+" metier").each(function() {
    $("#id0103").append("<option value='"+$(this).attr("id")+"'>"+$(this).attr("libelle")+"</option>");
  });
  $("#id0103").attr("disabled",false);    
}
$(document).ready(function() {
  $.get("activitesXML.xml",{},updateActivite,"xml");
  $("#id0102").change(function() {
    $("#id0103").attr("disabled",true);    
    $("#id0104").attr("disabled",true);    
    if(oXML) {
      updateMetier(oXML);
    } else {
      $.get("activitesXML.xml",{},updateMetier,"xml");
    }
  });
  $("#id0103").change(function() {
    $("#id0104").attr("disabled",true);    
    $.get("cantonsSearch.xml",{'metier':this.options[this.selectedIndex].value},setCarteXML,"xml");
  });
});

//ouverture de l'infobulle
function open_infobulle(){
  var infobulle=document.getElementById("infobulle");
  infobulle.style.display="block";

}

//fermeture de l'infobulle
function close_infobulle(){
  var infobulle=document.getElementById("infobulle");
  infobulle.style.display="none";
 
}