var geoMap = {
	"US": { "code": "", "noResults": "Sorry, nothing found.", "viewAll": "View all search results", "searchText": "Search" },
	"DE": { "code": "de", "noResults": "Leider nichts gefunden.", "viewAll": "Alle Suchergebnisse", "searchText": "Suche" }
	};
var enhanceSearch = function (P)
{
  var S = function (G)
  {
    var g = document.getElementById(G);
    g.parentNode.removeChild(g);
  };
  document.getElementById("g-search").setAttribute("action", P);
  document.getElementById("g-search").setAttribute("method", "GET");
  S("search-oe");
  S("search-access");
  S("search-site");
  S("search-lr");
};
function loadShortcuts()
{
  decorateGlobalSearchInput();
  if (typeof searchCountry == "undefined")
    {
      searchCountry = "de";
    }
  if (geoMap[searchCountry.toUpperCase()].directory)
    {
      var g = geoMap[searchCountry.toUpperCase()].directory;
    }
  else
    {
      if (searchCountry != "us")
        {
          var g = "/" + searchCountry.replace(/_/, "");
        }
      else
        {
          g = "";
        }
    }
// ?ch=11&q=wer
  // var G = { "global": "http://www.probus.at" + g + "/search/" };
	var G = { "global": "?ch=11" };
  var P = G[searchSection] || "?ch=11";
  enhanceSearch(P);
  var S = navigator.userAgent.match(/WebKit/i) && navigator.userAgent.match(/Mobile/i);
  if (!S && (typeof deactivateSearchShortcuts == "undefined" || !deactivateSearchShortcuts))
    {
      SearchShortcut.load();
    }
}
function shortcutsPageLoader(P)
{
  var S = window.onload;
  if (typeof window.onload != "function")
    {
      window.onload = P;
    }
  else
    {
      window.onload = function ()
      {
        S();
        P();
      };
    }
}
shortcutsPageLoader(loadShortcuts);
var SearchShortcut = { "baseUrl": "./search.php", "minimumCharactersForSearch": 0, "entryDelay": 150, "currentRequest": false, "descriptionCharacters": 90, "isIe": false, "init": function ()
{
  this.fullSearchUrl = document.getElementById("globalsearch").getElementsByTagName("form")[0].getAttribute("action");
  this.noResults = geoMap["US"].noResults;
  this.viewAll = geoMap["US"].viewAll;
  if (typeof searchCountry != "undefined" && searchCountry)
    {
      this.noResults = geoMap[searchCountry.toUpperCase()].noResults || this.noResults;
      this.viewAll = geoMap[searchCountry.toUpperCase()].viewAll || this.viewAll;
    }
  this.html = { "results": document.getElementById("sp-results").getElementsByTagName("div")[0], "input": document.getElementById("sp-searchtext") };
  if (navigator.userAgent.toLowerCase().indexOf("msie 6.") != - 1)
    {
      document.getElementById("sp-results").style.left = "171px";
      this.isIe = true;
    }
  this.pausedControllers = [];
}, "track": function (g, S)
{
  if (typeof s_gi == "undefined" || !s_gi)
    {
      return;
    }
  var G = "global";
  var j = "ussearch";
  var P = null;
  if (typeof searchCountry != "undefined" && searchCountry && searchCountry != "US")
    {
      P = geoMap[searchCountry.toUpperCase()].code;
    }
  if (P)
    {
      G = "" + P + "global";
      j = "" + P + "search";
    }
  if (typeof s_account != "undefined" && s_account.indexOf("ussearch") == - 1)
    {
      s = s_gi(s_account + "," + j);
    }
  else
    {
      s = s_gi(G + "," + j);
    }
  s.prop4 = "";
  s.g_prop4 = "";
  s.prop6 = "";
  s.g_prop6 = "";
  s.pageName = "";
  s.g_pageName = "";
  s.pageURL = "";
  s.g_pageURL = "";
  s.g_channel = "";
  s.linkTrackVars = "eVar2,eVar4,prop7,prop10";
  s.eVar2 = "WWW-sc: " + g.toLowerCase();
  s.prop7 = "WWW-sc: " + g.toLowerCase();
  s.eVar4 = S;
  s.prop10 = S;
  s.tl(this, "o", "Shortcut Search");
}, "go": function (S)
{
  SearchShortcut.track(SearchShortcut.searchText, S);
  document.location = S;
}, "search": function (G)
{
  var S = this.baseUrl + "?q=" + encodeURIComponent(G);
  if (typeof searchSection != "undefined" && searchSection)
    {
      S += "&section=" + searchSection;
    }
  if (typeof searchCountry != "undefined" && searchCountry)
    {
      S += "&geo=" + searchCountry.toLowerCase();
    }
  this.spin();
  S += "&transport=js";
  var P = document.getElementsByTagName("head")[0];
  script = document.createElement("script");
  script.id = "xdShortcutContainer";
  script.type = "text/javascript";
  script.src = S;
  P.appendChild(script);
  SearchShortcut.scriptLoadTest();
}, "scriptLoadTest": function ()
{
  var S = 0;
  var P = window.setInterval(function ()
  {
    S++;
    if (typeof shortcutXml != "undefined")
      {
        window.clearInterval(P);
      }
    else
      {
        if (S > 20)
          {
            window.clearInterval(P);
            document.getElementById("sp-search-spinner").style.display = "none";
          }
      }
  }, 50);
}, "loadXmlToDoc": function (P)
{
  var S;
  if (window.ActiveXObject)
    {
      S = new ActiveXObject("Microsoft.XMLDOM");
      S.async = "false";
      S.loadXML(P);
    }
  else
    {
      var G = new DOMParser();
      S = G.parseFromString(P, "text/xml");
    }
  if (!this.html || !this.html.results)
    {
      this.init();
    }
  document.getElementById("sp-search-spinner").style.display = "none";
  this.term = S.getElementsByTagName("term")[0].firstChild.nodeValue;
  this.xml = S.getElementsByTagName("search_results")[0];
  this.parseResults(this.xml);
  if (this.results)
    {
      this.results.length > 0 ? this.renderResults() : this.renderNoResults();
    }
}, "spin": function ()
{
  document.getElementById("sp-search-spinner").style.display = "block"; /* none */
}, "parseResults": function (g)
{
  var G = g.getElementsByTagName("error");
  if (G.length > 0)
    {
      SearchShortcut.hideResults();
      return;
    }
  else
    {
      var q = g.getElementsByTagName("match");
      this.results = new Array();
      for (var j = 0; j < (q.length); j++)
        {
          var S = q[j];
          var P = { "title": S.getAttribute("title"), "url": S.getAttribute("url"), "desc": S.getAttribute("copy"), "category": S.getAttribute("category"), "priority": S.getAttribute("priority"), "image": S.getAttribute("image") };
          P.url = decodeURIComponent(P.url);
          this.results.push(P);
        }
    }
}, "renderNoResults": function ()
{
  var g = this.noResults;
  this.html.results.innerHTML = "";
  var P = document.createElement("ul");
  P.className = "sp-results";
  listResult = document.createElement("li");
  listResult.className = "firstCat resultCat";
  P.appendChild(listResult);
  listResult = document.createElement("li");
  listResult.id = "sp-result-none";
  listResult.className = "viewall";
  var S = document.createElement("div");
  S.className = "hoverbox";
  var G = document.createElement("a");
  G.href = this.fullSearchUrl + "&q=" + encodeURIComponent(this.term);
  G.innerHTML = g;
  listResult.appendChild(S);
  listResult.appendChild(G);
  listResult.url = this.fullSearchUrl + "&q=" + encodeURIComponent(this.term);
  listResult.num = this.results.length;
  listResult.onclick = function ()
  {
    SearchShortcut.go(this.url);
  };
  listResult.onmouseover = function ()
  {
    SearchShortcut.itemSelected = true;
  };
  listResult.onmouseout = function ()
  {
    SearchShortcut.itemSelected = false;
  };
  P.appendChild(listResult);
  this.html.results.appendChild(P);
  document.getElementById("globalsearch").className = "active";
}, "hideAllQuicktimeMovies": function ()
{
  if (typeof AC != "undefined" && typeof (AC.Quicktime) != "undefined" && typeof (AC.Quicktime.controllers) != "undefined")
    {
      function V(y)
      {
        var i = curtop = 0;
        if (y.offsetParent)
          {
            i = y.offsetLeft;
            curtop = y.offsetTop;
            while (y = y.offsetParent)
              {
                i += y.offsetLeft;
                curtop += y.offsetTop;
              }
          }
        return [i,curtop];
      }
      function z(Y, u, t, N, i, h, X, c)
      {
        var x = Y + t;
        var L = u + N;
        var I = i + X;
        var l = h + c;
        var w = Math.max(Y, i);
        var k = Math.max(u, h);
        var T = Math.min(x, I);
        var y = Math.min(L, l);
        return T > w && y > k;
      }
      var S = AC.Quicktime.controllers;
      var J = $("sp-results");
      var Z = { "width": 328, "height": 448 };
      var v = V(J);
      var j = v[0] - 328;
      var g = v[1];
      var G = E + Z.width;
      var P = q + Z.height;
      for (var H = S.length - 1; H >= 0; H--)
        {
          var d = S[H].movie;
          var n = Element.getDimensions(d);
          var U = V(d);
          var E = U[0];
          var q = U[1];
          if (z(E, q, n.width, n.height, j, g, Z.width, Z.height))
            {
              this.pausedControllers.push(S[H]);
              S[H].Stop();
              S[H].movie.style.visibility = "hidden";
            }
        }
    }
  else
    {
      var f = document.getElementsByTagName("object");
      for (H = 0; H < f.length; H++)
        {
          if (typeof (f[H].Stop) != "undefined")
            {
              f[H].Stop();
            }
          try 
          {
            if (typeof (f[H].getElementsByTagName("embed")[0].Stop) != "undefined")
              {
                f[H].getElementsByTagName("embed")[0].Stop();
              }
          }
          catch (Q)
          {
          }
          f[H].style.visibility = "hidden";
        }
    }
}, "showAllQuicktimeMovies": function ()
{
  if (typeof AC != "undefined" && typeof (AC.Quicktime) != "undefined" && typeof (AC.Quicktime.controllers) != "undefined")
    {
      for (var P = this.pausedControllers.length - 1; P >= 0; P--)
        {
          this.pausedControllers[P].movie.style.visibility = "visible";
          if (navigator.userAgent.match(/Firefox/i))
            {
              setTimeout(this.pausedControllers[P].Play, 100);
            }
          else
            {
              this.pausedControllers[P].Play();
            }
        }
      this.pausedControllers = [];
    }
  else
    {
      var S = document.getElementsByTagName("object");
      for (P = 0; P < S.length; P++)
        {
          S[P].style.visibility = "visible";
          if (typeof (S[P].Play) != "undefined")
            {
              S[P].Play();
            }
          try 
          {
            if (typeof (S[P].getElementsByTagName("embed")[0].Play) != "undefined")
              {
                S[P].getElementsByTagName("embed")[0].Play();
              }
          }
          catch (G)
          {
          }
        }
    }
}, "startFlashFixTimer": function ()
{
  var P = 0;
  var S = setInterval(function ()
  {
    SearchShortcut.flashDomRender();
    P++;
    if (P > 50)
      {
        clearInterval(S);
      }
  }, 10);
}, "border": 5, "flashDomFix": function ()
{
  document.getElementById("sp-results").firstChild.firstChild.style.border = "5px none red";
  document.getElementById("globalsearch").onmousemove = function ()
  {
    SearchShortcut.flashDomRender();
  };
}, "flashDomRender": function ()
{
  SearchShortcut.border % 2 == 0 ? SearchShortcut.border++ : SearchShortcut.border--;
  var S = document.getElementById("sp-results").firstChild.firstChild;
  if (S)
    {
      S.style.border = SearchShortcut.border + "px none red";
    }
}, "itemSelected": false, "renderResults": function ()
{
  this.html.results.innerHTML = "";
  var d = document.createElement("ul");
  d.className = "sp-results";
  var Z = { };
  for (var V = 0; V < this.results.length; V++)
    {
      var z = this.results[V];
      var v = unescape(z.desc);
      var j = "";
      if (v.length > this.descriptionCharacters)
        {
          v = v.substring(0, v.indexOf(" ", this.descriptionCharacters - 11)) + "&hellip; ";
          j = unescape(z.desc);
        }
      var g = unescape(z.title);
      if (g.length > 39)
        {
          g = g.substring(0, g.indexOf(" ", 30)) + "&hellip; ";
        }
      var E = document.createElement("li");
      E.id = "sp-result-" + V;
      E.className = "category-" + unescape(z.category).toLowerCase().replace(/\s+/g, "-");
      var G = document.createElement("div");
      G.className = "hoverbox";
      var q = document.createElement("img");
      q.src = z.image;
      q.title = j;
      var J = document.createElement("span");
      J.className = "text";
      var y = document.createElement("h4");
      var H = document.createElement("a");
      var P = document.createElement("p");
      H.href = decodeURIComponent(z.url);
      H.title = j;
      H.onclick = function ()
      {
        SearchShortcut.go(decodeURIComponent(z.url));
      };
      H.innerHTML = g;
      P.innerHTML = v;
      P.title = j;
      y.appendChild(H);
      J.appendChild(y);
      J.appendChild(P);
      E.appendChild(G);
      E.appendChild(q);
      E.appendChild(J);
      E.url = z.url;
      E.num = V;
      E.onmouseover = function ()
      {
        SearchShortcut.itemSelected = true;
        SearchShortcut.highlight(this);
      };
      E.onmouseup = function ()
      {
        SearchShortcut.itemSelected = true;
        SearchShortcut.go(this.url);
      };
      E.onmouseout = function ()
      {
        SearchShortcut.itemSelected = false;
        SearchShortcut.unhighlight(this);
      };
      E.priority = parseInt(z.priority);
      if (!Z[z.category])
        {
          Z[z.category] = new Array();
        }
      Z[z.category].push(E);
    }
  var f = "firstCat resultCat";
  for (var n in Z)
    {
      if (!Z.hasOwnProperty(n))
        {
          continue;
        }
      E = document.createElement("li");
      E.className = f;
      E.innerHTML = unescape(n);
      f = "resultCat";
      d.appendChild(E);
      for (var S = 0; S < Z[n].length; S++)
        {
          d.appendChild(Z[n][S]);
        }
    }
  E = document.createElement("li");
  E.id = "sp-result-" + this.results.length;
  E.className = "viewall";
  var G = document.createElement("div");
  G.className = "hoverbox";
  var H = document.createElement("a");
  H.href = this.fullSearchUrl + "&q=" + encodeURIComponent(this.term);
  H.innerHTML = this.viewAll;
  E.appendChild(G);
  E.appendChild(H);
  E.url = this.fullSearchUrl + "&q=" + encodeURIComponent(this.term);
  E.num = this.results.length;
  E.onclick = function ()
  {
    SearchShortcut.go(this.url);
  };
  E.onmouseover = function ()
  {
    SearchShortcut.itemSelected = true;
  };
  E.onmouseout = function ()
  {
    SearchShortcut.itemSelected = false;
  };
  document.getElementById("globalsearch").className = "active";
  d.appendChild(E);
  this.html.results.appendChild(d);
  this.hideAllQuicktimeMovies();
  if (typeof flashOnPage != "undefined" && flashOnPage)
    {
      this.flashDomFix();
      this.startFlashFixTimer();
    }
}, "startKeystrokeTimer": function ()
{
  if (this.timeoutId)
    {
      window.clearTimeout(this.timeoutId);
    }
  this.timeoutId = window.setTimeout("SearchShortcut.commitKeystroke()", this.entryDelay);
}, "commitKeystroke": function ()
{
  this.search(this.searchText);
}, "hideResults": function (S, P)
{
  if (!this.html)
    {
      this.init();
    }
  this.selected = null;
  document.getElementById("globalsearch").className = "";
  this.html.results.innerHTML = "";
  this.showAllQuicktimeMovies();
}, "highlight": function (S)
{
  S.className = "hoverli";
}, "keyHighlight": function (S)
{
  if (this.selected)
    {
      this.selected.className = "";
    }
  this.selected = S;
  S.className = "hoverli";
}, "unhighlight": function (S)
{
  S.className = "";
}, "load": function ()
{
  var S = document.createElement("img");
  S.src = "i/search/spinner.gif";
  S.width = "11";
  S.height = "11";
  S.border = "0";
  S.alt = "*";
  S.id = "sp-search-spinner";
  S.style.display = "none";
  document.getElementById("globalsearch").appendChild(S);
  document.getElementById("g-search").onsubmit = function (P)
  {
    return false;
  };
  if (navigator.userAgent.match(/WebKit/i))
    {
      document.getElementById("sp-searchtext").onkeydown = function (P)
      {
        var G = typeof event != "undefined" ? event["keyCode"] : P.keyCode;
        if (!P)
          {
            P = event;
          }
        if (G == 13 && !P.altKey)
          {
            if (P.target.value.length === 0)
              {
                return false;
              }
            if (SearchShortcut.selected)
              {
                SearchShortcut.go(SearchShortcut.selected.url);
              }
            else
              {
                SearchShortcut.hideResults();
                document.getElementById("g-search").submit();
              }
          }
      };
    }
  document.getElementById("sp-searchtext").onkeyup = function (P)
  {
    var g = typeof event != "undefined" ? event["keyCode"] : P.keyCode;
    if (!P)
      {
        P = event;
      }
    if (g == 40 && SearchShortcut.results)
      {
        try 
        {
          P.preventDefault();
          P.stopPropagation();
        }
        catch (j)
        {
        }
        if (SearchShortcut.selected && (SearchShortcut.results.length > SearchShortcut.selected.num + 1))
          {
            SearchShortcut.keyHighlight(document.getElementById("sp-result-" + (SearchShortcut.selected.num + 1)));
          }
        if (!SearchShortcut.selected && SearchShortcut.results.length > 0)
          {
            SearchShortcut.keyHighlight(document.getElementById("sp-result-0"));
          }
        SearchShortcut.flashDomRender();
      }
    else
      {
        if (g == 38 && SearchShortcut.results)
          {
            try 
            {
              P.preventDefault();
              P.stopPropagation();
            }
            catch (j)
            {
            }
            if (SearchShortcut.selected && SearchShortcut.selected.num > 0)
              {
                SearchShortcut.keyHighlight(document.getElementById("sp-result-" + (SearchShortcut.selected.num - 1)));
              }
            SearchShortcut.flashDomRender();
          }
        else
          {
            if (g == 27)
              {
                SearchShortcut.hideResults();
                document.getElementById("sp-searchtext").value = "";
              }
            else
              {
                SearchShortcut.selected = false;
                var G = document.getElementById("sp-searchtext").value;
                G = G.replace(/[%\^\?\!\*\/<>\$]/ig, "");
                G = G.replace(/^\s+/g, "").replace(/\s+$/g, "");
                if (G.length < 1 && SearchShortcut.html)
                  {
                    SearchShortcut.html.results.innerHTML = "";
                    document.getElementById("sp-search-spinner").style.display = "none";
                    SearchShortcut.hideResults();
                  }
                else
                  {
                    if (G.length > SearchShortcut.minimumCharactersForSearch)
                      {
                        SearchShortcut.searchText = G;
                        SearchShortcut.startKeystrokeTimer();
                      }
                  }
              }
          }
      }
  };
} };
function decorateGlobalSearchInput()
{
  var Z = document.getElementById("sp-searchtext");
  var j = null;
  var g = 0;
  var y = "Search";
  if (typeof searchCountry == "undefined")
    {
      searchCountry = "us";
    }
  if (geoMap[searchCountry.toUpperCase()].searchText)
    {
      y = geoMap[searchCountry.toUpperCase()].searchText;
    }
  var V = "";
  if (navigator.userAgent.match(/WebKit/i))
    {
      Z.setAttribute("type", "search");
      if (!Z.getAttribute("results"))
        {
          Z.setAttribute("results", g);
        }
      if (null != y)
        {
          Z.setAttribute("placeholder", y);
          Z.setAttribute("autosave", V);
        }
      Z.onblur = function ()
      {
        if (!SearchShortcut.itemSelected)
          {
            SearchShortcut.hideResults();
          }
      };
    }
  else
    {
      Z.setAttribute("autocomplete", "off");
      j = document.createElement("input");
      Z.parentNode.replaceChild(j, Z);
      var P = document.createElement("span");
      P.className = "left";
      var d = document.createElement("span");
      d.className = "right";
      var E = document.createElement("div");
      E.className = "reset";
      var S = document.createElement("div");
      S.className = "search-wrapper";
      var q = Z.value == y;
      var G = Z.value.length == 0;
      if (q || G)
        {
          Z.value = y;
          S.className += " blurred empty";
        }
      S.appendChild(P);
      S.appendChild(Z);
      S.appendChild(d);
      S.appendChild(E);
      Z.onfocus = function ()
      {
        var n = S.className.indexOf("blurred") > - 1;
        if (Z.value == y && n)
          {
            Z.value = "";
          }
        S.className = S.className.replace("blurred", "");
      };
      Z.onblur = function ()
      {
        if (!SearchShortcut.itemSelected)
          {
            SearchShortcut.hideResults();
          }
        if (Z.value == "")
          {
            S.className += " empty";
            Z.value = y;
          }
        S.className += " blurred";
      };
      Z.onkeydown = function (n)
      {
        var i = typeof event != "undefined" ? event["keyCode"] : n.keyCode;
        if (!n)
          {
            n = event;
          }
        if (i == 13 && !n.altKey)
          {
            var H = null;
            if (n.target)
              {
                H = n.target;
              }
            else
              {
                if (n.srcElement)
                  {
                    H = n.srcElement;
                  }
              }
            if (H.value.length === 0)
              {
                return false;
              }
            if (SearchShortcut.selected)
              {
                SearchShortcut.go(SearchShortcut.selected.url);
              }
            else
              {
                SearchShortcut.hideResults();
                document.getElementById("g-search").submit();
              }
            return;
          }
        if (Z.value.length >= 0)
          {
            S.className = S.className.replace("empty", "");
          }
        f();
      };
      var f = function ()
      {
        return (function (n)
        {
          var H = false;
          if (!n)
            {
              n = window.event;
            }
          if (n.type == "keydown")
            {
              if (n.keyCode != 27)
                {
                  return;
                }
              else
                {
                  H = true;
                }
            }
          Z.blur();
          Z.value = "";
          S.className += " empty";
          Z.focus();
        });
      };
      E.onmousedown = f();
      if (j)
        {
          j.parentNode.replaceChild(S, j);
        }
    }
}

