/*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) { alert('Timeout'); showWait(false); }
    //AjaxPro.onLoading = function(b) { showBusy(b); }
    AjaxPro.onError = function(res) { alert(res.Message); showWait(false);}
  }

  Master.GetPageIndexes(_pageId, initMaster2);
}

function initMaster2(response) {
  var params = {quality:"high", wmode:"opaque", swfversion:"6.0.65.0"};
  var flashvars = {};
  swfobject.embedSWF("flash/HS_docka_03.swf?badgeMain=" + response.value[0] + "&badgeSub=" + response.value[1], "mainMenu", "134", "600", "9.0.0", "admin/jstools/swfobject/expressInstall.swf", flashvars, params);

  swfobject.embedSWF("flash/banner.swf", "topbanner", "660", "60", "9.0.0", "admin/jstools/swfobject/expressInstall.swf", flashvars, params);

  $("#Contact").ajaxcontrol({ width:330, toolbarLocation:'external' });

  try { initAdmin();}
  catch (e) { nfndebug(e.message); }
  try { initPage();}
  catch (e) { nfndebug(e.message);}
}


function showWait(show) {
  N$S('ajaxWait').display = (show ? "block" : "none");
}

function highlightMenu(mainidx, subidx) {
  if (typeof(thisMovie("mainMenu").goHome) != 'function')
    setTimeout(function(){highlightMenu(mainidx, subidx);}, 1000);
  else
    thisMovie("mainMenu").goHome(String(mainidx), String(subidx));
}

function thisMovie(movieName) {
  if (navigator.appName.indexOf("Microsoft") != -1) return window[movieName]
  else return document[movieName]
}


$(document).ready(function(){
   initMaster();
});
