// Snapsis.DNN utilities

var oPopUpID;
var zIndexTop=2000;
document.oncontextmenu=loadObject;
document.ondblclick=hidePopUp;

function SetFocus(controlId) 
{
	var oControl = null;
	if (document.all == null)
    	oControl = document.getElementById(controlId);
  	else
    	oControl = document.all(controlId);
    if (oControl != null)
    	oControl.focus();
    
    return;
}

function loadObject(ContextMenuId){
		if (ContextMenuId == null)
		    ContextMenuId = "AdminMenu";
		hidePopUp();
   		popUp(ContextMenuId,event.clientX,event.clientY);
		event.returnValue=false;
		event.cancelBubble=true;
	return false;
}
function popUp(oContainerId,leftPos, topPos){
	hidePopUp();
	var oContainer = null;
	if (document.all == null)
	{
    	oContainer = document.getElementById(oContainerId);
    }
	else
	{
    	oContainer = document.all(oContainerId);
	}
    if (oContainer != null )
    {
		oContainer.style.display="none";
		oContainer.style.zIndex=zIndexTop++;
		if (leftPos && topPos)
		{
			oContainer.style.left=leftPos+document.body.scrollLeft;
			oContainer.style.top=topPos+document.body.scrollTop;
		}
		oContainer.style.display="block";
		oPopUpID = oContainer.id;
	}
}
function hidePopUp(){
	if (oPopUpID != null){
		var popup=document.all[oPopUpID];
		if (popup != null){
			popup.style.display="none";
		}
	}
	return;
}

