function createXMLHttpRequest() {
   try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
   try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
   try { return new XMLHttpRequest(); } catch(e) {}
   alert("XMLHttpRequest not supported");
   return null;
 }

var xhReq = createXMLHttpRequest();

function onResponse() {
   if (xhReq.readyState != 4)  { return; }
   var serverResponse = xhReq.responseText;
   var properties = eval('(' + serverResponse + ')');
   for(var i=0;i<properties.length; i++) {
     property = properties[i];
     tag = document.getElementById(property.name);
     if(tag) {
       tag.innerHTML = property.value;
     }
   }
 }

/*
function resolveInternalData() {
  xhReq.open("get", "getInternalDataMapping", true);
  xhReq.onreadystatechange = onResponse;
  xhReq.send(null);
}
*/

function resolveInternalData(language) {
      new Ajax.Request('/getInternalDataMapping?language=' + language, { method:'get',
	           onSuccess: function(transport, properties){  
      for(var i=0;i<properties.length; i++) {
	  var prop = properties[i];
          // keeps to allow compatibility with id selection
	  var tag = $(prop.name);
          if(tag) {
            tag.update(prop.value);
          } 
          // now use class selection
          var elements = document.getElementsByClassName(prop.name);
          elements.each(function(element) {
              element.update(prop.value);
          });

      }
  }});
}