
		
stdBrowser = (document.getElementById) ? true : false

function toggleMenuOver(currElem,id) {
			
	var mainimage = document.getElementById(id);
			
			var h = mainimage.offsetHeight;
			var w = mainimage.offsetWidth;
			
			var x = getElementLeft(mainimage);
			var y = getElementTop(mainimage);
			
			//alert('x: '+x+' y:'+y);
			
			menuObj = (stdBrowser) ? document.getElementById(currElem).style : eval("document." + currElem)
			menuObj.top = (y + h) + "px";
			menuObj.left = x + "px";
			menuObj.visibility = "visible"
			
			
	}
		
function toggleMenuOut(currElem,topPos,leftPos) {

			menuObj = (stdBrowser) ? document.getElementById(currElem).style : eval("document." + currElem)
			menuObj.top = (stdBrowser) ? topPos + "px" : topPos
			menuObj.left = (stdBrowser) ? leftPos + "px" : leftPos
			menuObj.visibility = "hidden"
}
		
		
function getElementLeft(elm) {
    var x = 0;

    //set x to elm’s offsetLeft
    x = elm.offsetLeft;

    //set elm to its offsetParent
    elm = elm.offsetParent;

    //use while loop to check if elm is null
    // if not then add current elm’s offsetLeft to x
    //offsetTop to y and set elm to its offsetParent

    while(elm != null)
    {
        x = parseInt(x) + parseInt(elm.offsetLeft);
        elm = elm.offsetParent;
    }
    return x;
}

function getElementTop(elm) {
    var y = 0;

    //set x to elm’s offsetLeft
    y = elm.offsetTop;

    //set elm to its offsetParent
    elm = elm.offsetParent;

    //use while loop to check if elm is null
    // if not then add current elm’s offsetLeft to x
    //offsetTop to y and set elm to its offsetParent

    while(elm != null)
    {
        y = parseInt(y) + parseInt(elm.offsetTop);
        elm = elm.offsetParent;
    }

    return y;
}

var win = null;

function newWindow(mypage,myname,w,h,scroll){
	
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=yes';
	win = window.open(mypage,myname,settings);
}


