/*
	Author	 K. Ferguson
	Company  Newmedia Studios
	Date	 27 March 2009
*/

//Source: http://www.quirksmode.org/js/findpos.html
function findPos(obj) {
	var curleft = curtop = 0;
//If the browser supports offsetParent we proceed.

	if (obj.offsetParent) {

//Every time we find a new object, we add its offsetLeft and offsetTop to curleft and curtop.

	do {
			curleft += obj.offsetLeft-.1;
			curtop += obj.offsetTop-1.5;

/*The tricky bit: return value of the = operator
Now we get to the tricky bit:*/

		} while (obj = obj.offsetParent);
		/*No, this is not a syntax error. I don't want to use == to compare obj to obj.offsetParent (that doesn't make sense anyhow, since an element is never equal to its offsetParent).
			Instead, I use the = assignment operator to change the value of obj to obj.offsetParent. I explain this trick in more detail in this blog post.
			The simple bits
			The loop continues until the object currently being investigated does not have an offsetParent any more. While the offsetParent is still there, it still adds the offsetLeft of the object to curleft, and the offsetTop to curtop.
			Finally, when the while loop has quit, we return an array with the calculated coordinates to whichever script asked for it.*/
		//alert(curleft+" | "+curtop);	
		return [curleft,curtop];
}

}//end function


function gotToMenu(name, button_id){

	var Pos=findPos(document.getElementById(button_id)).toString().split(",");
	//alert(Pos[0]+" | "+Pos[1]);
	//alert(document.getElementById('DivFrame').style.left+" | "+ document.getElementById('DivFrame').style.top);
	if(name!=''){
		document.getElementById('DivFrame').style.left=Pos[0].toString()+"px";
		Pos[1]=parseInt(Pos[1])+34;
		document.getElementById('DivFrame').style.top=Pos[1].toString()+"px";
		document.getElementById('DivContent').innerHTML=document.getElementById(name).innerHTML;
		document.getElementById('DivFrame').style.display='block';
	}

}

function hideMenu(){
	document.getElementById('DivFrame').style.display='none';
}

function showMenu(){
	document.getElementById('DivFrame').style.display='block';
}


function MouseOver(obj)	{
		obj.style.backgroundColor="#d2c7c7";
		obj.style.cursor="pointer";
	}
	
	function MouseOut(obj)	{
		obj.style.backgroundColor="#e9e9e9";
	}
			
