// variables
ie = document.all ? 1 : 0;

/* select all messages */
function selectall()
{
	for( var i = 0; i < document.yabbim.elements.length; i++ )
	{
		var e = document.yabbim.elements[i];
		if( ( e.name != 'allbox' ) && ( e.type == 'checkbox' ) )
		{
			e.checked = document.yabbim.allbox.checked;
			if( document.yabbim.allbox.checked )
				select( e );
			else
				unselect( e );
		}
	}
}

/* choose to highlight a message or not */
function highlight( box )
{
	if( box.checked )
		select( box );
	else
		unselect( box );
	var totalbox = 0;
	var totalon = 0;
	for( var i = 0; i < document.yabbim.elements.length; i++ )
	{
		var e = document.yabbim.elements[i];
		if( ( e.name != 'allbox' ) && ( e.type == 'checkbox' ) )
		{
			totalbox++;
			if( e.checked )
				totalon++;
		}
	}
	if( totalbox == totalon )
		document.yabbim.allbox.checked = true;
	else
		document.yabbim.allbox.checked = false;
}

/* highlight this row */
function select( E )
{
	if( ie )
	{
		while( E.tagName != "TR" )
			{E = E.parentElement;}
	}
	else
	{
		while( E.tagName != "TR" )
			{E = E.parentNode;}
	}
	E.className = "highlight";
}

/* unhighlight this row */
function unselect( E )
{
	if( ie )
	{
		while( E.tagName != "TR" )
			{E = E.parentElement;}
	}
	else
	{
		while( E.tagName != "TR" )
			{E = E.parentNode;}
	}
	E.className = "";
}

function Clicked( type )
{
	window.document.yabbim.waction.value = type;
}
