// JavaScript Document

function getElementPosition(element){
	var x=0,y=0;
	while (element!=null){
		x+=element.offsetLeft-element.scrollLeft;
		y+=element.offsetTop-element.scrollTop;
		element=element.offsetParent;
	}
	return {x:x,y:y};
}
// Browser compatible element getter
function getElement(id){
	if (document.all)
	return document.all[id];
	
	if (document.getElementById(id))
	return document.getElementById(id);

	return null;
}

function displayCross(id,displayAction) {
	
	// Get the element by its id
	element = getElement(id);
	// make sure that the element was found
	if (! element) return;
	// get the object that will contain the x,y coordinates
	position = getElementPosition(element);

	if (displayAction == 1) {
		
		//alert('x: ' + position.x + '\n\ny: ' + position.y);
		
		scrollPos = document.body.scrollTop;
		
		document.getElementById("menuCross").style.left = position.x-5;
		document.getElementById("menuCross").style.top = (scrollPos+position.y)-10;
		document.getElementById("menuCross").style.display = 'block';
		
		
		
	} else if (displayAction == 0) {
		document.getElementById("menuCross").style.display = 'none';
	}

}

/*   FAQ and DIRECTORS LIST */
function togglemenu(obj) {
	var style, im;
	if (document.getElementById('id'+obj).style.display == 'block') {
		style = 'none';
		im = '/imgs/faq/greyright.gif';
	} else {
		style = 'block';
		im = '/imgs/faq/reddown.gif';
	}
	
	document.getElementById('id'+obj).style.display = style;
	document.getElementById('icon'+obj).src = im;
	
}