
var mstrDarkBlue = "darkblue"
var mstrDarkText = "white"
var mstrLightBlue = "#DEE6F1"
var mstrLightText = "black"

function ShowMenu(pobjTable, pobjSRC) {

	// only show the menu if it isnt currently being shown
	if (pobjTable.style.display != "inline") {
		HideMenus()
		
		// set the details for the main text and show the new menu with the correct left position				
		pobjSRC.style.color = "lightsteelblue";	
		pobjTable.style.left = getposOffset(pobjSRC, "left");
		pobjTable.style.display = "inline";
	}
}


function getposOffset(pobj, offsettype){
	// get the correct offset
	var totaloffset=(offsettype=="left")? pobj.offsetLeft : pobj.offsetTop;
	var parentEl=pobj.offsetParent;
	while (parentEl!=null){
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
	return totaloffset;
}

function HideMenus() {		
	// hide all of the menus required
	tblTest.style.display = "none";
	tblInfo.style.display = "none";
	tblTools.style.display = "none";
	tblMembers.style.display = "none";
	
	tdTest.style.color = mstrDarkText;
	tdInfo.style.color = mstrDarkText;
	tdTools.style.color = mstrDarkText;
	tdMembers.style.color = mstrDarkText;		
}

function MenuItemOver(pobjSRC, pobjImg) {
	// show a white background for the current row
	pobjSRC.style.backgroundColor = "white";		
	pobjImg.style.visibility = "visible";		
}

function MenuItemOut(pobjSRC, pobjImg) {
	// reset the background and hide the arrow
	pobjSRC.style.backgroundColor = mstrLightBlue;	
	pobjImg.style.visibility = "hidden";		
}

function Left(str, n){
	// copy of the VB Script Left function
	if (n <= 0)
		return "";
	else if (n > String(str).length)
		return str;
	else
		return String(str).substring(0,n);
}

function OpenRequestAPart() {
	// open the request a part screen
	window.open("http://www.mvda.org.uk/VPRS/outerpost/posttest.asp", null,"scrollbars=yes,resizable=yes,width=500,height=635")
}

function OpenRequestAPart1() {
	// open the request a part screen
	window.open("http://www.mvda.org.uk/VPRS/outerpost/posttest.asp", null,"scrollbars=yes,resizable=yes,width=500,height=635")
}