var countries=new Array();var products=new Array();countries = [ "Choisissez un pays","Asia Pacific|http://www.avid.com/ap","Australia|http://www.avid.com/au","China|http://www.avid.com/cn","France|http://www.avid.com/fr","Germany|http://www.avid.com/de","Japan|http://www.avid.com/jp","Korea|http://www.avid.com/ko","Spain|http://www.avid.com/es","United Kingdom|http://www.avid.com/gb","United States|http://www.avid.com"]; products = [ "Produits & Services||False","Audio||True","Interfaces audio & Midi|http://www.m-audio.fr/index.php?do=products.family&ID=recording|False","DJ numérique (Torq)|http://www.m-audio.fr/index.php?do=products.family&ID=DJhardSoft|False","ICON|http://www.digidesign.com/index.cfm?navid=15&langid=2&|False","Pro Tools|http://www.digidesign.com/index.cfm?navid=349&langid=2&itemid=35976|False","Pro Tools Plug-Ins|http://www.digidesign.com/index.cfm?navid=115&langid=100&mkt=all|False","VENUE|http://www.digidesign.com/index.cfm?navid=20&langid=2&|False","Video Satellite|http://www.digidesign.com/index.cfm?itemid=6362&langid=2|False","Instruments virtuels Digidesign|http://www.digidesign.com/index.cfm?navid=108&langid=2|False","Instruments virtuels M-Audio|http://www.m-audio.fr/index.php?do=products.family&ID=virtualins|False","Habillage antenne||True","Deko 1000|http://www.avid.fr/fr/products/deko-1000/index.asp|False","Deko 3000|http://www.avid.fr/fr/products/deko-3000/index.asp|False","Deko 550|http:///www.avid.fr/fr/products/deko-550/index.asp|False","Post Deko|http://www.avid.fr/fr/products/postdeko/index.asp|False","DekoCast|http://www.avid.fr/fr/products/DekoCast/index.asp|False","Thunder|http://www.avid.fr/fr/products/Thunder/index.asp|False","Gestion de contenus multimedia||True","Alienbrain|http://www.avid.com/products/alienbrain/index.asp|False","Interplay|http://www.avid.fr/fr/products/interplay/index.asp|False","Avid Unity ISIS|http://www.avid.fr/fr/products/unityisis/index.asp|False","Avid Unity MediaNetwork|http://www.avid.fr/fr/products/unity-media-network/index.asp|False","Musique et Composition||True","Auralia|http://www.sibelius.com/products/auralia/index.html|False","Groovy Music|http://www.sibelius.com/products/groovy/index.html|False","Musition|http://www.sibelius.com/products/musition/index.html|False","Photoscore|http://www.sibelius.com/products/photoscore/index.html|False","Sibelius|http://www.sibelius.com/home/country_choice.php?page_language=2&url=%2Fproducts%2Fsibelius%2Findex.html&cookiecheck=no|False","Librairie de sons pour Sibelius|http://www.sibelius.com/home/country_choice.php?page_language=2&url=%2Fproducts%2Fsibelius_sounds%2Findex.html&cookiecheck=no|False","Sibelius Student|http://www.sibelius.com/products/sibelius_student/index.html|False","Salles de rédaction||True","Active Content Manager|http://www.avid.fr/fr/products/active-Content-Manager/index.asp|False","AirSpeed|http://www.avid.fr/fr/products/airspeed/index.asp|False","AirSpeed Multi Stream|http://www.avid.fr/fr/products/airspeed/index.asp|False","Capture Manager|http://www.avid.fr/fr/products/capture-Manager/index.asp|False","iNews Command|http://www.avid.fr/fr/products/inews-command/index.asp|False","iNews Instinct|http://www.avid.fr/fr/products/inews-Instinct/index.asp|False","iNews NRCS|http://www.avid.fr/fr/products/inews/index.asp|False","NewsCutter Mojo DX|http://www.avid.fr/fr/products/newscutter-mojo-dx/index.asp|False","NewsCutter Nitris DX|http://www.avid.fr/fr/products/newscutter-nitris-dx/index.asp|False","NewsCutter Software|http://www.avid.fr/fr/products/newscutter-software/index.asp|False","Matériels pour le studio et la scène||True","Surfaces de contrôle & consoles|http://www.digidesign.com/index.cfm?navid=152&langid=2&|False","Pianos numériques|http://www.m-audio.fr/index.php?do=products.family&ID=digitalPianos|False","Enregistreurs mobiles|http://www.m-audio.fr/index.php?do=products.family&ID=handheldRecorders|False","Casques & écouteurs|http://www.m-audio.fr/index.php?do=products.family&ID=Earphones|False","Claviers et contrôleurs Midi|http://www.m-audio.fr/index.php?do=products.family&ID=keyboardcontrollers|False","Microphones|http://www.m-audio.fr/index.php?do=products.family&ID=microphones|False","Enceintes de monitoring|http://www.m-audio.fr/index.php?do=products.family&ID=monitors|False","Transmission et automation||True","Automation Fastbreak NXT|http://www.avid.fr/fr/products/FastBreakNXTAutomation/index.asp|False","Automation Fastbreak NXT Entry Level Edition|http://www.avid.fr/fr/products/FastBreakNXTAutomationELE/index.asp|False","Automation Titan|http://www.avid.fr/fr/products/Titan/index.asp|False","Montage vidéo||True","Avid DS|http://www.avid.fr/fr/products/ds/index.asp|False","Dazzle|http://www.pinnaclesys.com/PublicSite/fr/Products/Consumer+Products/Dazzle/Family.htm|False","Media Composer Mojo DX|http://www.avid.fr/fr/products/Media-Composer-Mojo-DX/index.asp|False","Media Composer Nitris DX|http://www.avid.fr/fr//products/Media-Composer-Nitris-DX/index.asp|False","Media Composer Software|http://www.avid.fr/fr/products/Media-Composer-Software/index.asp|False","MetaFuze|http://www.avid.fr/fr/metafuze/index.asp|False","Mojo SDI|http://www.avid.fr/fr/products/mojo/index.asp|False","Pinnacle Studio|http://www.pinnaclesys.com/PublicSite/fr/Products/Consumer+Products/Home+Video/Studio+Family/|False","Symphony Nitris DX|http://www.avid.fr/fr/products/Symphony-Nitris-DX/index.asp|False","Découvrez d'autres produits:||True","Video|http://www.avid.com/products/index.asp|False","Digidesign|http://www.digidesign.com/index.cfm?navid=2&langid=2&itemid=22700|False","M-Audio|http://www.m-audio.fr/index.php?do=products.family|False","Pinnacle|http://www.pinnaclesys.com/PublicSite/fr/Products/Consumer+Products/Products+List.htm|False","Sibelius|http://www.sibelius.com/products/index.html|False","Tous les produits|http://www.avid.com/fr/products/allproducts.aspx|False"]; 
    function MM_jumpMenu(targ, selObj, restore) 
    { //v3.0
       if ((selObj.options[selObj.selectedIndex].value != "") && (selObj.options[selObj.selectedIndex].value != 'undefined') )
      {
          eval(targ + ".location='" + selObj.options[selObj.selectedIndex].value + "'");
          if (restore) selObj.selectedIndex = 0;
      }
    }

    function populateProducts() {
      productlist.options.length = 0;
      var oGroup;
      for (i = 0; i < products.length; i++)
      {
           if (products[i].split("|")[2] == 'True') //product group
          {
              // if it's the very first group then store the group
              if (oGroup == null)
              {
                  // new group - first group - store the group
                  oGroup = document.createElement('OPTGROUP');
                  oGroup.label = products[i].split("|")[0]; 
              }
              else
              {
                  // if it's a new group then add stored group to select.
                  if (products[i].split("|")[0] != oGroup.label)
                  {
                      // new group
                      // add stored group
                      productlist.appendChild(oGroup);
                      // store new group
                      oGroup = document.createElement('OPTGROUP');
                      oGroup.label = products[i].split("|")[0]; 
                  }
                  else
                  {
                      // same group
                      // do nothing
                  }
              }
          } 
          else
          {
              // product option.
              // add option to stored group.
              var oOption = document.createElement('option');
              oOption.value = products[i].split("|")[1];
              oOption.innerHTML = products[i].split("|")[0];
              // if there is no existing option group just add this option to the select
              if (oGroup == null)
              {
                  productlist.appendChild(oOption);
              }
              else
              {
                  oGroup.appendChild(oOption);
              }
          }
          
          // if it's the last element add stored group to select.
          if (i == (products.length -1))
          {
              productlist.appendChild(oGroup);
          }
              
        }
    }

    function populateCountries() {
        countrieslist.options.length = 0;
        for (i = 0; i < countries.length; i++)
        {
            countrieslist.options[countrieslist.options.length] = new Option(countries[i].split("|")[0], countries[i].split("|")[1]);
        }
    }
    
    function preSelectCountry(index) {
        if (countrieslist.length >= index)
        {
            countrieslist.selectedIndex = index;
        }
    }

    var countrieslist = document.getElementById('countryField');
    var productlist = document.getElementById('productsField');

    populateProducts();
    populateCountries();

  preSelectCountry(4);