//required for correct working of xml2html template
function onTop(htmlObject) {
//set the z-index of this element to top
	  var arrObjects = document.getElementsByTagName('div')
	  for (var i=0; i<arrObjects.length; i++) {
			if (arrObjects[i].className == 'debugInfo' ) {
       	if (htmlObject != arrObjects[i] || htmlObject.style.zIndex == "997") {
	       	arrObjects[i].style.zIndex = "999";
	      	arrObjects[i].style.height = "10px";
	      	arrObjects[i].style.width = "10px";
	      	arrObjects[i].style.background = "red";
	      	arrObjects[i].style.overflow = "hidden";
      	}	else {
      		arrObjects[i].style.zIndex = "997";
      		arrObjects[i].style.height = "500px";
      		arrObjects[i].style.width = "500px";
      		arrObjects[i].style.overflow = "auto";
      		arrObjects[i].style.background = "#EEEECC";
      		
      	}
    	}    
    }
}

function positionDebugInfoDivs() {
  var debugInfoDivs = document.getElementsByName('debugInfo');
  if (debugInfoDivs) {
  for (i = 0; i < debugInfoDivs.length; i++)
    {
      for (k = 0; k < debugInfoDivs.length; k++)
      {
        if (debugInfoDivs[i].offsetLeft == debugInfoDivs[k].offsetLeft && debugInfoDivs[i].offsetTop == debugInfoDivs[k].offsetTop && i!=k)
        {
          var newLeft = debugInfoDivs[k-1].offsetLeft + 20;
          debugInfoDivs[i].style.left = newLeft + 'px';
        }
      }
    }
  }
}

