function defon(nr, link)
{
    var windowHeight = 0;
    var windowWidth = 0;
    var lnk = getObject(link);
    var lnkLeft = 0;
    var lnkTop = 0;
    var obj = getObject(nr);
    var objHeight = 0;
    var objWidth = 0;
       
    // make def visible
    obj.style.display = 'block'; 
    // position obj relitevly
   	obj.style.position = 'absolute';
   
   objWidth = obj.offsetWidth;
   objHeight = obj.offsetHeight;
   
    // Get Link location 
    if (lnk.offsetParent) 
	{
		lnkLeft = lnk.offsetLeft;
		lnkTop = lnk.offsetTop;

		
		while (lnk = lnk.offsetParent) 
		{
			lnkLeft += lnk.offsetLeft;
			lnkTop += lnk.offsetTop;

	    }
	}
    
     // Set Def left position
	   obj.style.left = lnkLeft + 'px';
    
    
    // Get window height
    if( typeof( window.innerHeight ) == 'number')
    {
        // Non IE
        windowHeight = window.innerHeight;
        windowWidth = window.innerWidth;
    }
    // IE
    else if(document.documentElement && document.documentElement.clientHeight )
    {
         windowHeight = document.documentElement.clientHeight + document.documentElement.scrollTop;;
         windowWidth =document.documentElement.clientWidth + document.documentElement.scrollLeft;
    }
    else if( document.body && document.body.clientHeight )
    {
         windowHeight = document.body.clientHeight + document.documentElement.scrollTop;;
         windowWidth = document.body.clientWidth + document.documentElement.scrollLeft;
    }

    // x position definition
    if((lnkLeft + objWidth) > windowWidth)
    {
        obj.style.left = (lnkLeft - objWidth) + 'px';
    }
    else
    {
         obj.style.left = lnkLeft + 'px';
    }
	
    // y position Definition
    if((lnkTop - objHeight) < 0)
    {
        obj.style.bottom = ((windowHeight - lnkTop) - (objHeight + 20)) + 'px';
        
        
    }
    else
    {
        obj.style.bottom = (windowHeight - lnkTop) + 'px';
    }	
	
}

function defoff(nr)
{
	var obj = getObject(nr);
	
	obj.style.display = 'none';
	obj.style.position = 'inherit';
}

function getObject(nr)
{
    var result;
    
    if (document.layers)
	{
		result = document.layers[nr];
	}
	else if (document.all)
	{
		result =  document.all[nr];
		
	}
	else if (document.getElementById)
	{
		result =  document.getElementById(nr);
	}
	
	return result;
}

function changeDisplay(ele)
{
    var obj = getObject(ele);
    
    if(obj.style.display == 'none')
        obj.style.display = 'block';
    else
        obj.style.display = 'none';
    
    return obj;
}

     // WorkAround for Close Tab on Foxfire
function closeWindow() 
{
window.open('','_parent','');
window.close();