// JavaScript Document

function show(obj)
{
 	if(typeof(obj) == "undefined")
		return;
 	obj.style.visibility = 'visible';
}

function hide(obj)
{
	if(typeof(obj) == "undefined")
		return;
	obj.style.visibility = 'hidden';
}

function imgover(elementname)
{
document.getElementById(elementname).src = "images/mnu_left_selected.gif";
}
function imgout(elementname)
{
document.getElementById(elementname).src = "images/mnu_left.gif";
}

function navover(elementname)
{
document.getElementById(elementname).src = "images/nav_left_selected.gif";

/*figure out top of the navlink to set top of the popup */
var thisParent = document.getElementById('NavLink');

//now walk up the DOM until the BODY element is reached.
var myLeft = 0;
var myTop = 0;
var trParent = thisParent.offsetParent;
myLeft += trParent.offsetLeft;
myTop += trParent.offsetTop;	


while (trParent.offsetParent.tagName != 'BODY'){
	trParent = trParent.offsetParent;	//get the next parent up the nest
	myLeft += trParent.offsetLeft;
	myTop += trParent.offsetTop;
}

var object=document.getElementById('info_background');
object.style.top=myTop + thisParent.offsetTop + thisParent.offsetHeight + 24 + 'px';
object.style.visibility="visible";
object.style.display="";

 switch (elementname){
 case "aboutus":{
    object.innerText="Jones Brown Motorsports is the premiere provider of insurance to the Motorsports Industry";
	break;}
 case "facilities":{
    object.innerText="Coverage for permanent motorsport facilities and concession go kart operations";
	break;}
 case "events":{
    object.innerText ="Jones Brown Motorsports provides coverage for thousands of events a year";
	break;}
 case "teamsshops":{
    object.innerText="Providing protection for the investment in your racing operation";
	break;}
 case "contactus":{
    object.innerText="Email, Phone and Fax contact information for our Toronto office";
	break;}
	}
}

function navout(elementname)
{
document.getElementById(elementname).src = "images/nav_left.gif";

/* show background help text and position relative to nav height */
var object=document.getElementById('info_background');
object.style.visibility="hidden";
object.style.display="none";
 
}

function PositionAndShowPopUp(objId,parentId)
{

	if(typeof(objId) == "undefined")
		return;

	//first get a reference to the popup menu
	obj = document.getElementById(objId)

	//next get a reference to the <tr>
	var thisParent = document.getElementById(parentId);

	//now walk up the DOM until the BODY element is reached.
	//along the way, add up the Left & Top offsets
	var myLeft = 0;
	var myTop = 0;
	var trParent = thisParent.offsetParent;
	myLeft += trParent.offsetLeft;
	myTop += trParent.offsetTop;	
	
	
	while (trParent.offsetParent.tagName != 'BODY'){
		trParent = trParent.offsetParent;	//get the next parent up the nest
		myLeft += trParent.offsetLeft;
		myTop += trParent.offsetTop;
	}

	obj.style.left = myLeft + thisParent.offsetLeft + thisParent.offsetWidth;
	obj.style.top = myTop + thisParent.offsetTop + thisParent.offsetHeight/2 - 18;
	obj.style.visibility="visible";
	obj.style.display="";
}

function show_resource_menu(menuname,imagetype)
{
var mnuName = menuname +'_left';
var mnuAnchor = menuname +'_row';
var mnuPopupMenu = menuname +'_popup';
var img_obj = document.getElementById(mnuName);

/*first move the arrow in */
switch (imagetype) {
 case "large":{
  	img_obj.src = "images/lrg_mnu_left_selected.gif";
	break;}
 case "normal":{
    img_obj.src = "images/mnu_left_selected.gif";
	break;}
}
/*now show the submenu */
PositionAndShowPopUp(mnuPopupMenu,mnuAnchor);
}


function hide_resource_menu(menuname, imagetype)
{

switch (imagetype){
 case "large":{
	document.getElementById(menuname).src = "images/lrg_mnu_left.gif";
	break;}
 case "normal":{
    document.getElementById(menuname).src = "images/mnu_left.gif";
	break;}
}
}

function lrgimgover(elementname)
{
document.getElementById(elementname).src = "images/lrg_mnu_left_selected.gif";
}

function lrgimgout(elementname)
{
document.getElementById(elementname).src = "images/lrg_mnu_left.gif";
}



