function country_detection() {
  var _domain;
  var _default_country;

  this.setDomain = function(domain) {
    _domain = domain;
  };

  this.setDefaultCountry = function(default_country) {
    _default_country = default_country;
  };

  this.setCountryCodeCookie = function(value) {
    // 100 Tage speichern
    var oExpires = new Date();
    oExpires = new Date(oExpires.getTime() + 1000*60*60*24*100);
    setCookie('country_code', value, oExpires, "/");
  };

  this.setCountryCheckCookie = function() {
    // 1 Tag speichern
    var oExpires = new Date();
    oExpires = new Date(oExpires.getTime() + 1000*60*60*24*1);
    setCookie('country_checked', "1", oExpires, "/");
  };

  this.doAction = function() {
    var country_code = '';

    if(!getCookie('country_checked')) {
      if(!getCookie('country_code')) {
        //Land per JS ermitteln
        if (google.loader.ClientLocation != null) {
          country_code = google.loader.ClientLocation.address.country_code;
          country_code = country_code.toLowerCase();
        }

        if(country_code == '') {
          country_code = _default_country;
        }

        if((country_code != '')) {
          this.setCountryCodeCookie(country_code.toLowerCase());
        } else {
          this.setCountryCodeCookie('de');
        }
      }

      this.setCountryCheckCookie();
      if((getCookie('country_code') == 'ch') && (document.location.href.indexOf("international/index_ch.php") == -1)) {
        document.location.href="http://" + _domain + "/international/index_ch.php";
      }
    }
  };
}