// American Institute of Physics menu
// Liang Lang 2004

<!--

var colorDef_1;

colorDef_2 = 4;
var colorDef_3 =new Array(4);
colorDef_3[0]="#ae4600";
colorDef_3[1]="#ae4600";
colorDef_3[2]="#ae4600";
colorDef_3[3]="#ae4600";

function gnuFuction_1(colorDef_sub_1) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(colorDef_sub_1)) {
	// W3C DOM
	return document.getElementById(colorDef_sub_1).style;
    } else if (document.all && document.all(colorDef_sub_1)) {
	// MSIE 4 DOM
	return document.all(colorDef_sub_1).style;
    } else if (document.layers && document.layers[colorDef_sub_1]) {
	// NN 4 DOM
	return getObjN4(document, colorDef_sub_1);
    } else {
	return false;
    }
} // gnuFuction_1

function gnuFuction_2(colorDef_sub_1, gnuFuction_param_1) {
    // get a reference to the cross-browser style object and make sure the object exists
    var sheet = gnuFuction_1(colorDef_sub_1);
    if(sheet) {
	sheet.display = gnuFuction_param_1;
	return true;
    } else {
	return false;
    }
} // gnuFuction_2


function gnuFunc_1(gnuFuction_param_2, columnDef_sub_1, colorDef_sub_2) {
    gnuFunc_2();
    var gnuFuction_param_21 = '1';
    var x = 10;		
    var menuTop = 100;
    var menu = gnuFuction_1('myMenu'+gnuFuction_param_2);
    x = getParam1('myLabel'+gnuFuction_param_21);
    menuTop = getParam2('myLabel'+gnuFuction_param_21);
    menu.top=menuTop+19 +'px';
    menu.left=x-3 +'px';
    menu.top=menuTop+19;
    menu.left=x-3;
    var menuId = 'myMenu' + gnuFuction_param_2;
    if(gnuFuction_2(menuId, 'block')) {
	var aipB = gnuFuction_1('myLabel' + gnuFuction_param_2);
	aipB.backgroundColor = colorDef_3[gnuFuction_param_2-1];
	columnDef_sub_1.cancelBubble = true;
	return true;
    } else {
	return false;
    }
}


function gnuFunc_2() {
    for(counter = 1; counter <= colorDef_2; counter++) {
	gnuFuction_2('myMenu' + counter, 'none');
	var aipB = gnuFuction_1('myLabel' + counter);
	aipB.backgroundColor = '';
    }
}

function aipFunc_1() {
 clearTimeout(colorDef_1)
}
function aipFunc_2() {
 if(!document.layers) {
 	colorDef_1 = setTimeout("gnuFunc_2()", 500)
  }
}

function getObjN4(obj,name)
{
	var x = obj.layers;
	var foundLayer;
	for (var i=0;i<x.length;i++)
	{
		if (x[i].id == name)
		 	foundLayer = x[i];
		else if (x[i].layers.length)
			var tmp = getObjN4(x[i],name);
		if (tmp) foundLayer = tmp;
	}
	return foundLayer;
}

function getParam1(Elem) {
	var elem;
	if(document.getElementById) {
		var elem = document.getElementById(Elem);
	} else if (document.all){
		var elem = document.all[Elem];
	}
	xPos = elem.offsetLeft;
	tempEl = elem.offsetParent;
  	while (tempEl != null) {
  		xPos += tempEl.offsetLeft;
  		tempEl = tempEl.offsetParent;
  	}
	return xPos;
}

function getParam2(Elem) {
	if(document.getElementById) {
		var elem = document.getElementById(Elem);
	} else if (document.all) {
		var elem = document.all[Elem];
	}
	yPos = elem.offsetTop;
	tempEl = elem.offsetParent;
	while (tempEl != null) {
  		yPos += tempEl.offsetTop;
  		tempEl = tempEl.offsetParent;
  	}
	return yPos;
}
//-->
