
////////////////////
//FUNCTION : movePopup	
//
//  PURPOSE: Moves an element to the left of the source element. 
//
//ARGUMENTS:
//	  srcele	- Refrence to the element in which the 
//				  element should be moved to.
//
//ElementID		- ID of Element to move
//
//VARIABLES:
//		name	- description	
////////////////////////////////////////////////
function movePopup(srcele,ElementID)
{

	//ActiveIndex = index;
	var ActiveElement = getElementStyleByID(ElementID);	
	var tempLeft = findPosX(srcele);	
	ActiveElement.top =findPosY(srcele);		
	//alert(ActiveElement.top)
	//pop right vs left 
	var offset=20;
	if(srcele.width)
	offset = srcele.width;	
	ActiveElement.left = tempLeft+offset//(tempLeft <= 600)?(findPosX(srcele)+20):(ActiveElement.left = tempLeft-175);	
	//alert(ActiveElement.left)
	ActiveElement.visibility="visible";
	//ActiveElement.visibility="show";	

}

////////////////////
//FUNCTION :CloseDiv	
//
//  PURPOSE:Hides the element with the specified ID 
//
//ARGUMENTS:
//		ElementID	- ID of element to Close
//
//////////////////////////////////////////////////C
function CloseDiv(ElementID)
{
	var ActiveElement = getElementStyleByID(ElementID);	
	ActiveElement.visibility="hidden";
}


////////////////////
//FUNCTION :getElementStyleByID	
//
//  PURPOSE:returns a refrence to the style object of the element with teh Specified ID
//
//ARGUMENTS:
//		ID	- ID of element
//
//	
////////////////////////////////////////////////
function getElementStyleByID(ID)
{
	var element;
	if (document.getElementById)	{
		{
		element =document.getElementById(ID)		
		if(element.style)
			{element=element.style}
		}
		
	}
	else
		{
		var DomRef = eval('document.' +ID)
		var DomRef2 = eval(ID +'.style')
		element = (DomRef)?DomRef:DomRef2;		
		}		
		
	return ( element );
}



////////////////////
//FUNCTION :findPosX
//
//  PURPOSE:locates the X position of a given element	
//	
//ARGUMENTS:
//		obj	- element to examine	
////////////////////////////////////////////////
function findPosX(obj)
{
//alert(obj.offsetLeft)
	var curleft = 0;
	if (document.getElementById || document.all)
	{
		if (obj.offsetLeft>=10)//
		{
			curleft += obj.offsetLeft						
		}
	else
		{
			while (obj.offsetParent)
			{
				curleft += obj.offsetLeft
				obj = obj.offsetParent;				
			}		
		}
		
	}
	else if (document.layers)
		curleft += obj.x;

				
	return curleft;
}


////////////////////
//FUNCTION :findPosY
//
//  PURPOSE:locates the Y position of a given element	
//	
//ARGUMENTS:
//		obj	- element to examine	
////////////////////////////////////////////////
function findPosY(obj)
{
	var curtop = 0;
	if (document.getElementById || document.all)
	{
	
		if (obj.offsetTop>10)//
			{
			curtop += obj.offsetTop
			
			}
		else{		
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
			
		}
		
		}
	}
	else if (document.layers)
		curtop += obj.y;
	return curtop;
}	
