function sendGenericRefreshRequest(objectID,aContainerClass,bPath,aFunction,siteID,refreshContent)
{
  var xmlID, receiverFunction, aPath, launch;
  
  //launch = getLaunchesByClass(aContainerClass);
  aPath  = "elAdmin/resources/genericBackOffice.php";
  aPath += "?path=" + escape(bPath);
  aPath += "&site=" + siteID;
  //aPath += "&launch=" + launch;
  aPath += "&container=" + escape(objectID);
  
  if (objectID.length == 0)
  {
    aPath += "&action=refresh";
    xmlID = aContainerClass;
    receiverFunction =
    new Function("",'receiveGenericEmptyRequest("'+xmlID+'")');
  }
  else
  {
    aPath += "&action=refresh";
    xmlID = objectID;
    receiverFunction =
    new Function("",'receiveGenericRefreshRequest("'+xmlID+'","'+aFunction+'")');
  }
  
  /*
  else if (refreshContent == false)
  {
    aPath += "&action=refresh";
    xmlID = objectID;
    receiverFunction =
    new Function("",'receiveGenericRefreshRequest("'+xmlID+'","'+aFunction+'")');
  }
  else
  {
    aPath += "&action=reload";
    xmlID = objectID;
    receiverFunction = new Function("",'receiveGenericReloadRequest("'+xmlID+'")');
  }
  */ 
  
  createXmlHttp(xmlID);
  getXmlHttp(xmlID).open("GET",aPath,true);
  getXmlHttp(xmlID).onreadystatechange=receiverFunction;
  getXmlHttp(xmlID).send(null);
}

function receiveGenericReloadRequest(xmlID)
{
  if (getXmlHttp(xmlID).readyState==4)
  {
    var aContainer = xGetElementById(xmlID);
    if (aContainer != null)
    {
	  var aResponse = getXmlHttp(xmlID).responseXML;
	  
	  var aContent = decodeXmlResponse(aResponse,"content");
	  var initJs = decodeXmlResponse(aResponse,"js");
	  
	  if (aContent == "empty")
	  {
	    aContent = "";
	  }
	  
      aContainer.innerHTML = aContent;
      if (initJs != "empty")
      {
        eval(initJs);
      }
    }
    removeXmlHttp(xmlID);
    notifyRefresh();
  }	
}

function receiveGenericEmptyRequest(xmlID)
{
  if (getXmlHttp(xmlID).readyState==4)
  {
    removeXmlHttp(xmlID);
    notifyRefresh();
  }	
}

function receiveGenericRefreshRequest(xmlID,receiverFunction)
{
  if (getXmlHttp(xmlID).readyState==4)
  {
    var aContainer = xGetElementById(xmlID);
    if (aContainer != null)
    {
	  var aResponse = getXmlHttp(xmlID).responseXML;
	  if (receiverFunction == "")
	  {
	    aContent = decodeXmlResponse(aResponse,"content");
	    if (aContent == "empty")
	    {
	      aContent = "";
	    }
        aContainer.innerHTML = aContent;
      }
	  else
	  {
        var launchComponentReceiverFunction =
        new Function("aResponse,aContainer",receiverFunction+"(aResponse,aContainer);");
        launchComponentReceiverFunction(aResponse,aContainer);
      }
    }
    removeXmlHttp(xmlID);
    notifyRefresh();
  }
}

/*
function getLaunchesByClass(aClass)
{
  if (elAdminNetGlobal.launchesByClass[aClass] == null)
  {
  	elAdminNetGlobal.launchesByClass[aClass] = 0;
  }
  elAdminNetGlobal.launchesByClass[aClass]++;
  return elAdminNetGlobal.launchesByClass[aClass];
}
*/

function notifyRefresh()
{
  elAdminNetGlobal.scheduledLoads--;
  
  //if (elAdminNetGlobal.scheduledLoads == 0 &&
  //    elAdminNetGlobal.refreshCanvas == true)
  if (elAdminNetGlobal.scheduledLoads == 0)
  {
  	try
  	{
  		SBMInstance.proceedInit();
  	}
  	catch (e) {}
    //refreshCanvas();
  }
}

function putContentById(content,containerID)
{
	var container = document.getElementById(containerID);
	
	if (container != null)
	{
		if (SBMInstance.initialized  == true)
		{
			var innerdivs = container.getElementsByTagName("div");
			for (var i=0;i<innerdivs.length;i++)
			{
				if (innerdivs[i].className == "inner")
				{
					iTop = innerdivs[i].style.top;
				}
			}
		}
		
		container.innerHTML = content;
		//containerID = container.id;
		
		if (SBMInstance.initialized  == true)
		{
			SBMInstance.addCustomScrolling(containerID,false,iTop);
		}
	}
}

function putContentByClassName(content,containerClassName)
{
	var containerID,containerList,aContainer,iContainers,iContainer,iTop;
	
	//Lookup the outer container.
	containerList = xGetElementsByClassName(containerClassName);
	if (containerList.length > 0)
	{
		aContainer = containerList[0];
		
		if (SBMInstance.initialized  == true)
		{
			var innerdivs = aContainer.getElementsByTagName("div");
			for (var i=0;i<innerdivs.length;i++)
			{
				if (innerdivs[i].className == "inner")
				{
					iTop = innerdivs[i].style.top;
				}
			}
		}
		
		aContainer.innerHTML = content;
		containerID = aContainer.id;
		
		if (SBMInstance.initialized  == true)
		{
			SBMInstance.addCustomScrolling(containerID,false,iTop);
		}
	}
}

function refreshScrollingByClassName(containerClassName)
{
	var iTop, aContainer;
	if (SBMInstance.initialized  == true)
	{
		containerList = xGetElementsByClassName(containerClassName);
		if (containerList.length > 0)
		{
			aContainer = containerList[0];
			
	
			var innerdivs = aContainer.getElementsByTagName("div");
			for (var i=0;i<innerdivs.length;i++)
			{
				if (innerdivs[i].className == "inner")
				{
					iTop = innerdivs[i].style.top;
				}
			}

			SBMInstance.addCustomScrolling(containerID,false,iTop);
		}
}
}