function DoAll( action )
{
	if( action == "block" )
	{
		link_class	= "active";
	}
	else
	{
		link_class	= "";
	}

	mfr_list			= document.getElementById( "mfrlist" );
	mfr_items			= mfr_list.getElementsByTagName( "LI" );

	item_count	= parseInt( mfr_items.length );

	for( mfr_item = 0; mfr_item < item_count; mfr_item++ )
	{
		mfr_items[mfr_item].className				= link_class;
	}
}

/*
function _ToggleManufacturer( id )
{
	mfr_block		= document.getElementById( "m" + id );
//	mfr_link		= document.getElementById( "l" + id );

	mfr_description	= mfr_block.getElementsByTagName( "P" );
	mfr_description	= mfr_description[0];

	mfr_link		= mfr_block.getElementsByTagName( "A" );
	mfr_link		= mfr_link[0];

	display_value	= mfr_description.style.display;

	if( display_value == "" || display_value == "none" )
	{
		mfr_description.style.display	= "block";
		mfr_link.className				= "active";
//		mfr_link.setAttribute( "className", "active" );
	}
	else
	{
		mfr_description.style.display	= "none";
		mfr_link.className				= "";
	}
}
*/

function testit( e )
{
	var targ
	if (!e)
	{
		var e = window.event;
	}
	if (e.target)
	{
		targ = e.target;
	}
	else if (e.srcElement)
	{
		targ = e.srcElement;
	}
	if (targ.nodeType == 3) // defeat Safari bug
	{
		targ = targ.parentNode
	}
	var tname;
	tname=targ.tagName;

//	alert("You clicked on a " + tname + " element.");

	if( tname == "A" )
	{
		return false;
	}


	while( targ.tagName != "LI" )
	{
		targ	= targ.parentNode;
	}

	ToggleManufacturer( targ );
/*
	if( targ.className == "" )
	{
		targ.className	= "active";
	}
	else
	{
		targ.className	= "";
	}

*/
//	TagID	= targ.getAttribute( "id" );
//	alert( TagID );
//	alert("You clicked on a " + tname + " element.");

}



function ToggleManufacturer( object )
{
	if( object.className == "" )
	{
		object.className	= "active";
	}
	else
	{
		object.className	= "";
	}
}




function ToggleAll()
{
	button	= document.getElementById( 'selectallbutton' );
	
	src	= button.getAttribute( "src" );

	if( src.search( "/site/images/button_selectall.gif" ) > -1 )
	{
		SelectAll();
	}
	else
	{
		ClearAll();
	}

}


function SelectAll()
{
	form		= document.getElementById( "applicationform" );
	button		= document.getElementById( 'selectallbutton' );

	checkboxes	= form.getElementsByTagName( "INPUT" );

	for( var item = 0; item < checkboxes.length; item++ )
	{
		checkboxes[ item ].checked	= true;
	}

	button.setAttribute( "src", "/site/images/button_clearall.gif" );
}

function ClearAll()
{
	form		= document.getElementById( "applicationform" );
	button		= document.getElementById( 'selectallbutton' );

	checkboxes	= form.getElementsByTagName( "INPUT" );

	for( var item = 0; item < checkboxes.length; item++ )
	{
		checkboxes[ item ].checked	= false;
	}

	button.setAttribute( "src", "/site/images/button_selectall.gif" );
}








//---------------------------------------------------------------------------------------------------------
//	Search functions
//---------------------------------------------------------------------------------------------------------
function ChangeTypeFilter( field )
{
//	form	= document.form.types;

//	alert( field.checked );
	type_id	= field.getAttribute( "id" );

	application_form	= document.getElementById( 'applicationform' );

	application_checkboxes	= application_form.getElementsByTagName( 'INPUT' );

	for( field_id = 0; field_id < application_checkboxes.length; field_id++ )
	{
		field_obj	= application_checkboxes[ field_id ];

		field_obj.setAttribute( type_id, field.checked );
	}

	UpdateApplicationsList();
}

function UpdateApplicationsList()
{
	indoor_selected			= ( document.getElementById( "indoor" ).checked == true ) ? 1 : 0;
	outdoor_selected		= ( document.getElementById( "outdoor" ).checked == true ) ? 1 : 0;
	controls_selected		= ( document.getElementById( "controls" ).checked == true ) ? 1 : 0;

	application_form		= document.getElementById( 'applicationform' );
	application_checkboxes	= application_form.getElementsByTagName( 'INPUT' );

	for( field_id = 0; field_id < application_checkboxes.length; field_id++ )
	{
		field_obj	= application_checkboxes[ field_id ];

		attribute_indoor	= field_obj.getAttribute( "indoor" );
		attribute_outdoor	= field_obj.getAttribute( "outdoor" );
		attribute_controls	= field_obj.getAttribute( "controls" );

//		if( attribute_indoor == "true" || attribute_outdoor == "true" || attribute_controls == "true" )
		if( ( attribute_indoor == 1 && indoor_selected == 1 ) || ( attribute_outdoor == 1 && outdoor_selected == 1 ) || ( attribute_controls == 1 && controls_selected == 1 ) )
		{
//			alert( 'test' );
			field_obj.parentNode.style.backgroundColor	= "green";
		}
		else
		{
//			alert( 'notest' );
			field_obj.parentNode.style.backgroundColor	= "white";
		}
	}
}
