var ns4 = (document.layers)? true:false;
var ie4 = (document.all)? true:false;
var dom = (document.getElementById)? true:false;

function SetDiv(ID,Content) 
{
	
	if (dom) {
		document.getElementById(ID).innerHTML = Content;
		return;
	}
	if (ie4) {
		document.all[ID].innerHTML = Content;
		return;
	}
	if (ns4) {
		with (eval('document.'+ID+'.document')) {
     		open();
      	write(Content);
			close();
		}
		return;
	}
}
function SetDivParent(ID,Content) 
{
	
	if (dom) {
		parent.document.getElementById(ID).innerHTML = Content;
		return;
	}
	if (ie4) {
		parent.all[ID].innerHTML = Content;
		return;
	}
}
function displayDiv(Id)
{
	if (dom) 
	{
		topic = document.getElementById(Id);
	}
	if (ie4) 
	{
		topic = document.all[Id];
	}

	topic.style.display = 'block';
}

function undisplayDiv(Id)
{
	if (dom) 
	{
		topic = document.getElementById(Id);
	}
	if (ie4) 
	{
		topic = document.all[Id];
	}
	
	topic.style.display = 'none';
}

function placeDiv(ID_Anchor,Name_Anchor,ID_Div,offsetX,offsetY)
 {
var DivLeft = 0;
var DivTop = 0;
 if (dom)
	  {
	  pos = document.getElementById(ID_Anchor);
	  DivLeft = getLeft(pos);
	  DivTop = getTop(pos);
	  alert(DivTop);
	  document.getElementById(ID_Div).style.left = DivLeft + offsetX;
	  document.getElementById(ID_Div).style.top = DivTop + offsetY;
	  }
 else if (ie4) 
	  {
	  pos = document.all[ID_Anchor];
	  DivLeft = getLeft(pos);
	  DivTop = getTop(pos);
	  document.all[ID_Div].style.Left = DivLeft + offsetX;
	  document.all[ID_Div].style.Top = DivTop + offsetY;
	  }
 else if (ns4)
	  {
	  pos = document.anchors[Name_Anchor];
	  DivLeft = pos.x;
	  DivTop = pos.y;
	  document.layers[ID_Div].pageX = DivLeft + offsetX;
	  document.layers[ID_Div].pageY = DivTop + offsetY;
	  }
 }

function getLeft(MyObject)
 {
 if (MyObject.offsetParent)
	  return (MyObject.offsetLeft + getLeft(MyObject.offsetParent));
 else 
	  return (MyObject.offsetLeft);
 } 
    
function getTop(MyObject)
 {
 if (MyObject.offsetParent)
	  return (MyObject.offsetTop + getTop(MyObject.offsetParent));
 else
	  return (MyObject.offsetTop);
 }




