// Scripts to update the status bar of the shopbot

// These scripts enable to dynamically replace the content of the status bar elements.
// The use of document.getElementById to get the elements is supported since NS6 and IE5.

// update the status bar of the shopbot
// used with empty parameter to hide the status bar when no result
function kk_updateStatusBar() {
   if (eval(document.getElementById)) {
      var d = document.getElementById('statusBar');
      // Make sure the element exists
      if (d) {
         d.innerHTML = arguments[0];
      }
   }
}

// update the status of the search
// the parameter is the text of the status (eg "completed", "in progress", ...)
function kk_updateStatus() {
   if (eval(document.getElementById)) {
      var d = document.getElementById('currentStatus');
      // Make sure the element exists
      if (d) {
         d.innerHTML = arguments[0];
      }
   }
}

// update the counter of the status bar
// the parameter is the text giving the number of results (eg "10 results (of total 118) from 30 shops")
function kk_updateCounter() {
   if (eval(document.getElementById)) {
      var d = document.getElementById('counter');
      // Make sure the element exists
      if (d) {
         d.innerHTML = arguments[0];
      }
   }
}

function kk_updatePage(currentPage, totalPage) {
   if (eval(document.getElementById)) {
      for (i = currentPage + 1; i <= totalPage; i++) {
         var id = 'page' + i;
         var pageDiv = document.getElementById(id);
         if (pageDiv) {
            pageDiv.style.display = "inline";
         }
      }
      if (totalPage>currentPage)
      {
         var pageDiv = document.getElementById("nextpage");
         if (pageDiv) {
            pageDiv.style.display = "inline";
         }
      }
   }
}

//script to update the label Infos site in Infos 'merchant_name'
function kk_showMerchantName(m){
        document.getElementById("newName_" + m).innerHTML=document.getElementById("layer_m_" + m).innerHTML;
}

function kk_hideMerchantName(m,v){
	setTimeout("kk_realHideMerchantName(\""+ m +"\",\""+ v +"\")",2000);
}
function kk_realHideMerchantName(m,v){
        document.getElementById("newName_" + m).innerHTML=v;
}

