var cur_indx = 0;

function Toggle(item, ltitle, do_image)
{
	obj1=document.getElementById(item);
	visible=(obj1.style.display!="none")
	key=document.getElementById("x" + item);
	if (visible)
	{
		obj1.style.display="none";
		if(do_image)	key.innerHTML="<img src=image/book_closed.gif border=0>" + " " + ltitle;
		else			key.innerHTML=ltitle;
	}
	else
	{
		obj1.style.display="block";
		if(do_image)	key.innerHTML="<img src=image/book_open.gif border=0>" + " " + ltitle;
		else			key.innerHTML=ltitle;
	}
}

function is_visible(obj1, level)
{
	if(obj1.style && obj1.style.display == "none")
		return 0;
	else if(obj1.parentNode != obj1.ownerDocument)
		return is_visible(obj1.parentNode, level+1);
	else return 1;
}

function keydown(indx, evt)
{
	var which = 0;
	if(document.all)
	{
		which = evt.keyCode;
	}
	else
	{
		which = evt.which;
	}
	switch (which)
	{
		case 9 : // tab key
		case 38 : // up key
			if(document.all)
			{
				evt.cancelBubble = true;
				evt.returnValue = false;
			}
			str = "tp" + (indx);
			obj1=document.getElementById(str);
			str = "tp" + (indx-1);
			nxt=document.getElementById(str);
			if(nxt && is_visible(nxt.parentNode, 0))
			{
				obj1.style.background = "#ffffff";
				nxt.style.background = "#F9EDED";
				top.frames["RightFrm"].location = nxt.href;
				nxt.focus();
				cur_indx = indx-1;
				window.top.defaultStatus = nxt.alt;
			}
		break;
		case 40 : // down key
			if(document.all)
			{
				evt.cancelBubble = true;
				evt.returnValue = false;
			}
			str = "tp" + (indx);
			obj1=document.getElementById(str);
			str = "tp" + (indx+1);
			nxt=document.getElementById(str);
			if(nxt && is_visible(nxt.parentNode, 0))
			{
				obj1.style.background = "#ffffff";
				nxt.style.background = "#F9EDED";
				top.frames["RightFrm"].location = nxt.href;
				nxt.focus();
				cur_indx = indx+1;
//				alert(nxt.alt);
				window.top.defaultStatus = nxt.alt;
			}
		break;
	}
}

function DoLink(indx)
{
	if(cur_indx > 0)
	{
		str = "tp" + (cur_indx);
		obj1=document.getElementById(str);
		obj1.style.background = "#ffffff";
	}
	cur_indx = indx;
	str = "tp" + (cur_indx);
	obj1=document.getElementById(str);
	obj1.style.background = "#F9EDED";
}

function do_make_visible(obj1)
{
	if(obj1.style && obj1.style.display == "none")
		obj1.style.display = "block";
	if(obj1.parentNode != obj1.ownerDocument)
		do_make_visible(obj1.parentNode);
}

function MakeVisible(prefix1, prefix2, indx, openit)
{
	str = prefix1 + (indx);
	obj1=document.getElementById(str);
	do_make_visible(obj1.parentNode);
	obj1.focus();

	if(openit)
	{
		str2 = prefix2 + (indx);
		obj2=document.getElementById(str2);
		if(obj2.style && obj2.style.display == "none")
			obj2.style.display = "block";
	}
}

function nothing()
{
	window.event.cancelBubble = true;
	window.event.returnValue = false;
}
