function updateComboBox(catID)
{
  var theForm = document.forms["searchOptions"];
  theForm.mainproductcategory.value = catID;
}
function MM_swapImgRestore() 
{ 
  //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) 
{ 
  //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) 
  {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
  }
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_swapImage() 
{ 
  //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; 
  document.MM_sr=new Array; 
  for(i=0;i<(a.length-2);i+=3)
  {
    if ((x=MM_findObj(a[i]))!=null)
    {
      document.MM_sr[j++]=x; 
      if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];
    }
  }
}
function unHide_StepByCat(id)
{
  var theForm = document.forms["searchOptions"];
  if (id == 1 || id == 2)
  {
    theForm.dealerType[0].checked = false;
    theForm.dealerType[1].checked = false;
    document.getElementById('step2').style.display = "block";
    document.getElementById('step3').style.display = "none";
    document.getElementById('step4').style.display = "none";
    document.getElementById('step5').style.display = "none";
  }
  if (id == 3)
  {
    theForm.dealerType[0].checked = true;
    document.getElementById('step2').style.display = "none";
    document.getElementById('step3').style.display = "block";
    document.getElementById('step4').style.display = "block";
    document.getElementById('step5').style.display = "block";
  }
  if (id == 4 || id == 5 || id == 6)
  {
    theForm.dealerType[0].checked = true;
    document.getElementById('step2').style.display = "none";
    document.getElementById('step3').style.display = "none";
    document.getElementById('step4').style.display = "none";
    document.getElementById('step5').style.display = "block";
  }
}
function dealer_Type(id)
{
  var theForm = document.forms["searchOptions"];
  if (id == 1)
  {
    document.getElementById('step3').style.display = "block";
    document.getElementById('step4').style.display = "block";
    document.getElementById('step5').style.display = "block";
  }
  else if (id == 2)
  {
    document.getElementById('step3').style.display = "none";
    document.getElementById('step4').style.display = "none";
    document.getElementById('step5').style.display = "block";
  }
}
function unHide_Step(id)
{
  if (id == 2)
  {
    document.getElementById('step2').style.display = "block";
  }
  if (id == 3)
  {
    document.getElementById('step3').style.display = "block";
    document.getElementById('step4').style.display = "block";
    document.getElementById('step5').style.display = "block";
  }
  if (id == 5)
  {
    document.getElementById('step5').style.display = "block";
  }
}

function sendParameters(n) 
{
  var countSel = 0;
  var theForm = document.forms["searchOptions"];
  theForm.postalcode.value = "";
  theForm.city.value = "";
  theForm.Search_Param.value = "LU";
  theForm.state.value = n;
  theForm.action = "/serviceandsupport_dealer-locator_results";
  theForm.target = "_self";
  theForm.submit();
}
function verifyCats()
{
  var countSel = 0;
  var theForm = document.forms["searchOptions"];
  if ((theForm.mainCategories.value == 1) || (theForm.mainCategories.value == 2) || (theForm.mainCategories.value == 3))
  {
    if ((theForm.mainCategories.value == 3) && (theForm.dealerType[1].checked))
    {
      alert("I'm sorry but there are currently no on-line Installed Sound Contractors.\nPlease choose a different product category.");
      return false;
    }
    else if (theForm.dealerType[1].checked)
    {
      if (theForm.mainCategories.value == 1)
      {
        theForm.action = "/serviceandsupport_authorized-dealers_online-dealers_headphones-and-headsets";
      }
      else if (theForm.mainCategories.value == 2)
      {
        theForm.action = "/serviceandsupport_authorized-dealers_online-dealers_microphones-and-professional-audio";
      }
      else
      {
        theForm.action = "/serviceandsupport_dealer-locator";
      }
      theForm.mainCategories.selectedIndex = 0;
      theForm.dealerType[0].checked = false;
      theForm.dealerType[1].checked = false;
      theForm.target = "_top";
      return true;
    }
    else
    { 
      if ((theForm.postalcode.value == "") && (theForm.city.value == "" || theForm.state.selectedIndex == 0))
      {
        alert("Please enter either a zip code, or a city/state to search.\n");
        return false;
      }
      else
      {
        if (theForm.mainCategories.options[0].selected)
        {
          alert("Please select at least one category.");
          return false;
        }
        else
        {
          theForm.mainproductcategory.value = theForm.mainCategories.value;
          theForm.mainCategories.selectedIndex = 0;
          theForm.dealerType[0].checked = false;
          theForm.dealerType[1].checked = false;
          theForm.action = "http://sennheiserusa.findlocation.com/results.aspx"
          theForm.target = "_self";
          return true;
        }
      }
    }
  }
  else
  {
    if (theForm.mainCategories.options[0].selected)
    {
      alert("Please select at least one category.");
      return false;
    }
    else
    {
      if (theForm.mainCategories.value == 4)
      { 
        theForm.action = "/serviceandsupport_authorized-dealers_call-center";
      }
      else if (theForm.mainCategories.value == 5)
      {
        theForm.action = "/serviceandsupport_authorized-dealers_aviation";
      }
      else if (theForm.mainCategories.value == 6)
      {
        theForm.action = "/serviceandsupport_authorized-dealers_audiology";
      }
      else if (theForm.mainCategories.value == 7)
      {
        theForm.action = "/serviceandsupport_authorized-dealers_neumann";
      }
      else
      {
        theForm.action = "/serviceandsupport_dealer-locator";
      }
      theForm.mainCategories.selectedIndex = 0;
      theForm.dealerType[0].checked = false;
      theForm.dealerType[1].checked = false;
      theForm.target = "_top";
      return true;
    }
  }
}
function popupToURL(destination,width,height) 
{
  var positionX = (screen.width-800)/2;
  var positionY = (screen.height-500)/2;
  theWindow = window.open(destination,'theWindow','width=' + width + ',height=' + height + ',scrollbars=1,location=yes,resizable=yes,left=' + positionX + ',top=' + positionY + ',toolbar=yes');
  theWindow.focus();
}
function UpdateSearchParam()
{
  var theForm = document.forms["searchOptions"];
  theForm.Search_Param.value = theForm.SPShow.value;
}
function picswapbyid(Bildid,Bildobjekt) 
{
  var query = window.location.href;
  window.document.getElementById(Bildid).src = Bildobjekt.src;
}
function clearCityState()
{
  var theForm = document.forms["searchOptions"];
  theForm.city.value = "";
  theForm.state.selectedIndex = 0;
}
function clearZipCode()
{
  var theForm = document.forms["searchOptions"];
  theForm.postalcode.value = "";
}
function submitToPopup()
{
}
function submitToIFrame()
{
  var theForm = document.IFrameParams;
  theForm.action = "http://sennheiserusa.findlocation.com/results.aspx"
  theForm.target = "resultsWindow";
  theForm.submit();
}
