﻿// fixed by Fini, be careful here...
// event handlers for "choose country" dropdown list
// name: {system.contentarea.name} 
// id: {system.page.id} 

function setCountryListHandler()  {

   if(tangoraContentName == null) {
	 var tangoraContentName = "";
   }

var currLang = 'en';

   if(document.location.href.indexOf('/de/') != -1) {
	currLang = 'de';
   }

   if(document.location.href.indexOf('/us/') != -1) {
	currLang = 'us';
   }

   if(document.location.href.indexOf('/es/') != -1) {
	currLang = 'es';
   }


  var elm = document.getElementById('list_filter100');
  if (elm) {

     tsCompat.addEvent(elm, 'onchange', countryListChanged, false); // set onchange

	if(currLang == 'de') {
	   elm.options[0].text="Finden Sie Ihren lokalen Distributor";
	   elm.style.width="200";

     } else if(currLang == 'es') {
	  elm.options[0].text="Encuentre un distribuidor";
	  elm.style.width="200";
     }
   }
}

function countryListChanged() {
  var elm = document.getElementById('list_filter100');
  if (elm.selectedIndex == 0) {
     return;
  }
   // de: document.rediger330.submit();

   var theForm = document.rediger56;

   if(theForm) {
	theForm.submit();
   } else {

	theForm = document.rediger754;

	if(theForm) {
	 theForm.submit();
	} else  {

	   theForm = document.rediger1045;

	   if(theForm) {
		theForm.submit();
	   } else {

	     theForm = document.rediger330;

	     if(theForm) {
		  theForm.submit();
	     }
	    }
	}
   }
}

if (window.addEventListener) {

  window.addEventListener('load', setCountryListHandler, false);
}
else if (window.attachEvent) {

  window.attachEvent('onload', setCountryListHandler);
}

// end of "choose country" event handlers

// event handlers for "choose German city" dropdown list

function setCountryListHandler2()
{
  var elm = document.getElementById('list_filter145');
  if (elm) tsCompat.addEvent(elm, 'onchange', countryListChanged2, false);
}

function countryListChanged2()
{
  var elm = document.getElementById('list_filter145');
  if (elm.selectedIndex == 0) return;
  document.rediger813.submit();
}

if (window.addEventListener)
{
  window.addEventListener('load', setCountryListHandler2, false);
}
else if (window.attachEvent)
{
  window.attachEvent('onload', setCountryListHandler2);
}

// end of "choose German city" event handlers