// JavaScript Document
// Scripts for iPath

var last_id = null;
var last_elm, curr_elm;
function nav_hover (id)
{	
	// whast it normally is...
	if (last_elm = document.getElementById(last_id))
	{
		last_elm.style.background = "#cccccc";
		last_elm.style.color = "#000000";
	}

	// what it will hover as...
	if (curr_elm = document.getElementById(id))
	{
		curr_elm.style.background = "#416691";
		curr_elm.style.color = "#FFFFFF";
	}

	last_id = id;
}

var lastid = 0;
var thetimeout;
delay = 200;

function showspan (id)
{
	hidelast();
	
	clearTimeout(thetimeout);
	
	if (lastid != id)
		hidelast();

	var span = document.getElementById(id) ;
    var image = document.getElementById('image' + id) ;
	var br = document.getElementById('br' + id) ;
    
	if (image)
		image.src = "http://www.archbishopcurley.org/" + image.name + "_hover.jpg";
	
	if (span)	
		span.style.display = "";
	
	if (br)
		br.style.display = "";
			
	document.body.style.cursor = "pointer";

   	lastid = id;
}

function hidelast()
{
	var span = document.getElementById(lastid) ;
    var image = document.getElementById('image' + lastid) ;
	var br = document.getElementById('br' + lastid) ;
	
	if (image)
		image.src = "http://www.archbishopcurley.org/" + image.name + ".jpg";

	if (span)
		span.style.display = "none";
		
	if (br)
        br.style.display = "none";

	document.body.style.cursor = "";    
}

function hidelasttimed()
{
	thetimeout = setTimeout("hidelast()",delay);
}

menu_item_forecolor 		= "#000000";
menu_item_backcolor			= "#ffffff";
menu_item_forecolor_hover	= "#000000";
menu_item_backcolor_hover	= "#eeeeee";

function rowcolor(id, show)
{
	var row = document.getElementById(id);

	if (show)
	{
		row.style.color = menu_item_forecolor_hover;
		row.style.background = menu_item_backcolor_hover;
		//row.style.paddingLeft = "15px";
		row.style.borderLeft = "6px solid #475b6d";
	}

	if (!show)
	{
		row.style.color = menu_item_forecolor;
		row.style.background = menu_item_backcolor;
		//row.style.paddingLeft = "12px";
		row.style.borderLeft = "6px solid #dddddd";
	}
	
	row.style.cursor = 'pointer';
}

function redirect (url, is_absolute)
{
	if (is_absolute)
		document.location.href = "/" + url;	
	else
		document.location.href = url;	
}

function titleswap (obj, is_hovered)
{
	if (is_hovered)
		document.getElementById(obj.id).src = "images/" + obj.id + "_hover.jpg";	
	else
		document.getElementById(obj.id).src = "images/" + obj.id + ".jpg";	
}

function titleswappng (obj, is_hovered)
{
	if (is_hovered)
		document.getElementById(obj.id).src = "images/" + obj.id + "_hover.png";	
	else
		document.getElementById(obj.id).src = "images/" + obj.id + ".png";	
}
