function translate(txt) {
  var response = Master.Translate(txt);
  if (response.error) return txt;
  else return response.value;
}

function initMaster() {
  if (typeof AjaxPro != "undefined" && AjaxPro !== null) {
    AjaxPro.timeoutPeriod = 1000 * 10;
    AjaxPro.onTimeout = function(b, res) { ajaxTimeout(b, res); }
    AjaxPro.onLoading = function(b) { showBusy(b); }
    AjaxPro.onError = function(res) { ajaxError(res); }
  }
  try {
    new AjaxTiny("Footer");
    initPage();
    setupTinyControls()
  }
  catch (e) { };
}

function ajaxTimeout(b, res) {
  showBusy(false);
  $('ajaxerr').innerHTML = "Timeout i funktionen " + res.method;
  $S('ajaxerr').display = "block";
  setTimeout("hideAjaxErr()", 3000);
}
function ajaxError(res) {
  showBusy(false);
  $('ajaxerr').innerHTML = res.Message;
  $S('ajaxerr').display = "block";
  setTimeout("hideAjaxErr()", 3000);
}
function showBusy(busy) {
  $S("ajaxbusy").display = (busy ? "block" : "none");
}
function hideAjaxErr() {
  $S('ajaxerr').display = "none";
}

if (window.attachEvent) window.attachEvent("onload", initMaster);
else window.addEventListener("load", initMaster, false);
