var ie	= document.all
var ns6	= document.getElementById&&!document.all

var isMenu 	= false ;

var menuSelObj = null ;
var overpopupmenu = false;


// POP UP MENU
function	ItemSelMenu(myControl,myControlToShow)
{
	
    d = getAnchorPosition(myControl);
		
	
    if (document.all)
    {
    divwidth= document.getElementById('menudiv').style.width;
        left = d.x;
        width = document.body.clientWidth;
        if (left + 292 > width) 
        {
        left = width - 292;
        }
        
        document.getElementById(myControlToShow).style.pixelLeft = left; //d.x;
		document.getElementById(myControlToShow).style.pixelTop = d.y + 0;
		//document.getElementById(myControlToShow).style.width = 318;
		
		
//		A = document.body.clientHeight + document.body.scrollTop;
//		B = d.y + 17;
//		C = A - B;
//		height = C - 1;
//		theheight = 400;
//		if (height < theheight) 
//		{   
//		    D = theheight - height;
//		    document.getElementById(myControlToShow).style.pixelTop = d.y - D + 17;
//		    height = theheight;
//		}
	}
	else
    {
        divwidth = document.getElementById(myControlToShow).style.width;
        left = d.x;
        width = document.body.clientWidth;
        if (left + 287 > width) 
        {
        left = width - 287;
        }
        document.getElementById(myControlToShow).style.left = left + "px";
		document.getElementById(myControlToShow).style.top = d.y + 0 + "px";
		//document.getElementById(myControlToShow).style.width = 318;
//        A = document.body.innerHeight + window.pageYOffset;
//        
//        B = d.y + 17;
//		C = A - B;
//		height = C - 1;
//		theheight = 400;
//		if (height < theheight) 
//		{   
//		    DD = theheight - height;
//		    document.getElementById(myControlToShow).style.top = d.y - DD;
//		    height = theheight;
//		}
    }
	document.getElementById(myControlToShow).style.height = 120;
	document.getElementById(myControlToShow).style.display = "";
	return false ;
}

// POP UP MENU
function	ItemSelMenu2(myControl)
{
	
    d = getAnchorPosition(myControl);
		
	if (window.innerWidth)
    {
        document.getElementById('note').style.left = d.x - 20;
		document.getElementById('note').style.top = d.y + 30;
		document.getElementById('note').style.width = 318;
    }
    else if (document.all)
    {
        document.getElementById('note').style.pixelLeft = d.x;
		document.getElementById('note').style.pixelTop = d.y + 30;
		document.getElementById('note').style.width = 318;
	}
	document.getElementById('note').style.height = 100;
	document.getElementById('note').style.display = "";
	return false ;
}
	

// getAnchorPosition(anchorname)
//   This function returns an object having .x and .y properties which are the coordinates
//   of the named anchor, relative to the page.
function getAnchorPosition(anchorname) {
	// This function will return an Object with x and y properties
	var useWindow=false;
	var coordinates=new Object();
	var x=0,y=0;
	// Browser capability sniffing
	var use_gebi=false, use_css=false, use_layers=false;
	if (document.getElementById) { use_gebi=true; }
	else if (document.all) { use_css=true; }
	else if (document.layers) { use_layers=true; }
	// Logic to find position
 	if (use_gebi && document.all) {
		x=AnchorPosition_getPageOffsetLeft(anchorname);
		y=AnchorPosition_getPageOffsetTop(anchorname);
		}
	else if (use_gebi) {
		var o=anchorname;
		x=AnchorPosition_getPageOffsetLeft(o);
		y=AnchorPosition_getPageOffsetTop(o);
		}
 	else if (use_css) {
		x=AnchorPosition_getPageOffsetLeft(anchorname);
		y=AnchorPosition_getPageOffsetTop(anchorname);
		}
	else if (use_layers) {
		x=anchorname.x;
		y=anchorname.y;
		}
	else {
		coordinates.x=0; coordinates.y=0; return coordinates;
		}
	coordinates.x=x;
	coordinates.y=y;
	return coordinates;
	}
	
	


// Functions for IE to get position of an object
function AnchorPosition_getPageOffsetLeft (el) {
	var ol=el.offsetLeft;
	while ((el=el.offsetParent) != null) { ol += el.offsetLeft; }
	return ol;
	}
function AnchorPosition_getWindowOffsetLeft (el) {
	return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;
	}	
function AnchorPosition_getPageOffsetTop (el) {
	var ot=el.offsetTop;
	while((el=el.offsetParent) != null) { ot += el.offsetTop; }
	return ot;
	}
function AnchorPosition_getWindowOffsetTop (el) {
	return AnchorPosition_getPageOffsetTop(el)-document.body.scrollTop;
	}

